anywidget
Description
Minor Changes
Migrate to Svelte 5 signals API (#869)
This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of
@anywidget/sveltein yourpackage.jsonfile or be using a version range syntax that only accepts patch upgrades such as~0.0.1.The
@anywidget/sveltenow uses Svelte 5's new runes reactivity system (aka signals). The context-based implementation has been replaced with reactive model bindings usingcreateSubscriber.Update your Svelte dependency to version 5:
npm install svelte@^5.0.0Ensure Svelte 5 runes are enabled in your bundler configuration:
// rolldown.config.js or rollup.config.js svelte({ compilerOptions: { runes: true, }, });The previous API used Svelte 4 and exposed model values via the
storesproxy:<script> import { stores } from "@anywidget/svelte"; let { count } = stores; </script> <button on:click={() => $count += 1}>Count is {$count}</button>With Svelte 5,
@anywidget/sveltenow uses direct reactive bindings and the$props()rune:<script> /** @type {{ bindings: { count: number } }} */ let { bindings } = $props(); </script> <button on:click={() => bindings.count++}>Count is {bindings.count}</button>This is a breaking change. The old stores API and getContext-based access are no longer supported. You must update your components to use the new bindings prop via
$props().See manzt/ipyfoo-svelte for a complete example.
Files
manzt/anywidget-@anywidget/svelte@0.1.0.zip
Files
(9.8 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:1b54b85425371c6e460cffa5dcadadba
|
9.8 MB | Preview Download |
Additional details
Related works
- Is supplement to
- Software: https://github.com/manzt/anywidget/tree/@anywidget/svelte@0.1.0 (URL)
Software
- Repository URL
- https://github.com/manzt/anywidget