There is a newer version of the record available.

Published July 10, 2025 | Version @anywidget/svelte@0.1.0

anywidget

Authors/Creators

  • 1. Harvard Medical School

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/svelte in your package.json file or be using a version range syntax that only accepts patch upgrades such as ~0.0.1.

    The @anywidget/svelte now uses Svelte 5's new runes reactivity system (aka signals). The context-based implementation has been replaced with reactive model bindings using createSubscriber.

    Update your Svelte dependency to version 5:

    npm install svelte@^5.0.0
    

    Ensure 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 stores proxy:

    <script>
      import { stores } from "@anywidget/svelte";
      let { count } = stores;
    </script>
    
    <button on:click={() => $count += 1}>Count is {$count}</button>
    

    With Svelte 5, @anywidget/svelte now 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

Software