Skip to content

feat(runes): rewrite SliceSimulator and test component to runes#44

Open
ivenuss wants to merge 2 commits into
prismicio:masterfrom
ivenuss:venus/rewrite-to-runes
Open

feat(runes): rewrite SliceSimulator and test component to runes#44
ivenuss wants to merge 2 commits into
prismicio:masterfrom
ivenuss:venus/rewrite-to-runes

Conversation

@ivenuss
Copy link
Copy Markdown

@ivenuss ivenuss commented Apr 21, 2026

Changes

Rewrites SliceSimulator & PrismicLinkTestWrapper to Svelte 5 runes.

Fixes

Fixes #40 which introduced Svelte 4 syntax which shoudnl't occur in the new codebase as #32 has been already merged.

⚠️ Breaking change

Since <slot /> has been deprecated and it is recommended to use snippets instead.

So this will no longer work:

<SliceSimulator let:slices>
	...
</SliceSimulator>

And you should do:

<SliceSimulator>
	{#snippet children({ slices })}
		...
	{/snippet}
</SliceSimulator>

View in Codesmith
Codesmith can help with this PR — just tag @codesmith or enable autofix.

  • Autofix CI and bot reviews

Note

Medium Risk
Introduces a breaking API change in SliceSimulator (slot → required snippet) that can break consumers at compile-time; runtime logic changes are otherwise localized to UI/event wiring.

Overview
Updates SliceSimulator and PrismicLinkTestWrapper to Svelte 5 runes by switching to $props()/$state() and modern event bindings (onclick/onsubmit/onkeypress) and class handling.

SliceSimulator now renders content via a required children snippet ({@render ...}) instead of <slot {slices} />, changing the public usage from let:slices slot props to snippet-based rendering.

Reviewed by Cursor Bugbot for commit e71dd15. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/SliceSimulator.svelte Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e71dd15. Configure here.

Comment thread src/SliceSimulator.svelte
</article>
{:else if slices.length}
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y_no_static_element_interactions, event_directive_deprecated -->
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary event_directive_deprecated svelte-ignore for new syntax

Low Severity

The event_directive_deprecated svelte-ignore directive was newly added in this PR, but it's unnecessary. This warning only fires when using the old on:click syntax — the code already uses the new onclick/onsubmit/onkeypress attributes (lines 72–74), so the warning will never trigger. The stale ignore directive is misleading and suggests the old syntax is still in use.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e71dd15. Configure here.

@ivenuss
Copy link
Copy Markdown
Author

ivenuss commented Apr 21, 2026

And the reason why I noticed this is that we cannot use runes: true in svelte.config, since this legacy Svelte 4 syntax blocks us

error during build:
Build failed with 1 error:
[plugin vite-plugin-svelte:compile] /node_modules/@prismicio/svelte/dist/SliceSimulator.svelte:45:26
RolldownError: /node_modules/@prismicio/svelte/dist/SliceSimulator.svelte:45:26 Cannot use `$$props` in runes mode
https://svelte.dev/e/legacy_props_invalid
 43 |  
 44 |  <div
 45 |    class="{simulatorClass} {$$props.class}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant