Skip to content

Commit

Permalink
feat: refactoring the main library exports
Browse files Browse the repository at this point in the history
  • Loading branch information
edodusi committed Jan 14, 2025
1 parent c7f36dc commit ba86bb5
Show file tree
Hide file tree
Showing 17 changed files with 646 additions and 123 deletions.
6 changes: 3 additions & 3 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'cypress';
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { svelte } from '@sveltejs/vite-plugin-svelte';

export default defineConfig({
e2e: {
Expand All @@ -12,8 +12,8 @@ export default defineConfig({
bundler: 'vite',
viteConfig: () => {
return {
plugins: [svelte()]
}
plugins: [svelte()],
};
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion cypress/component/page.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
Cypress is not working well with Svelte 5, so for now no StoryblokComponent tests are available.
@todo Fix Cypress to work with Svelte 5
*/
*/
describe('Basic Test', () => {
it('can find an element', () => {
// Create a basic element
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"cypress": "^13.17.0",
"eslint": "^9.18.0",
"eslint-plugin-svelte": "^2.36.0",
"jsdom": "^26.0.0",
"publint": "^0.2.0",
"simple-git-hooks": "^2.11.1",
"start-server-and-test": "^2.0.10",
Expand All @@ -88,7 +89,11 @@
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [2, "always", 200]
"body-max-line-length": [
2,
"always",
200
]
}
},
"release": {
Expand Down
24 changes: 15 additions & 9 deletions playground/sveltekit/src/lib/Page.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<script lang="ts">
import { storyblokEditable, StoryblokComponent } from '@storyblok/svelte';
<script>
import {
storyblokEditable,
StoryblokComponent,
renderRichText,
} from "@storyblok/svelte";
let { blok } = $props();
let resolvedRichText = $derived(renderRichText(blok.richText));
</script>

<div use:storyblokEditable={blok} class="container">
{#each blok.body as item}
<div>
<StoryblokComponent blok={item} />
</div>
{/each}
</div>
{#key blok}
<div use:storyblokEditable={blok} class="px-6">
{#each blok.body as bodyBlok}
<StoryblokComponent blok={bodyBlok} />
{/each}
<div class="prose">{@html resolvedRichText}</div>
</div>
{/key}
5 changes: 2 additions & 3 deletions playground/sveltekit/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script lang="ts">
import type { LayoutData } from './$types';
import type { Snippet } from 'svelte';
let { data, children }: { data: LayoutData, children: Snippet } = $props();
let { children }: { children: Snippet } = $props();
</script>

{@render children()}
{@render children?.()}
4 changes: 2 additions & 2 deletions playground/sveltekit/src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LayoutLoad } from './$types';
import { storyblokInit, apiPlugin, useStoryblokApi } from "@storyblok/svelte";
import { storyblokInit, apiPlugin, getStoryblokApi } from "@storyblok/svelte";
import Teaser from '$lib/Teaser.svelte';
import Page from '$lib/Page.svelte';
import Feature from '$lib/Feature.svelte';
Expand All @@ -26,6 +26,6 @@ export const load: LayoutLoad = () => {
});

return {
storyblokApi: useStoryblokApi()
storyblokApi: getStoryblokApi(),
};
};
2 changes: 1 addition & 1 deletion playground/sveltekit/src/routes/[...slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { PageData } from './$types';
import { onMount } from 'svelte';
let { data }: { data: PageData } = $props();
let { data = $bindable() }: { data: PageData } = $props();
let story = $state(data.story);
let loaded = $state(false);
Expand Down
Loading

0 comments on commit ba86bb5

Please sign in to comment.