Skip to content

Releases: manzt/anywidget

[email protected]

12 Nov 17:06
738a3a7

Choose a tag to compare

Patch Changes

  • Use rsbuild inline sourcemaps for JupyterLab extension (#909)

    JupyterLab was refusing to load external source map files because they were
    being served with the wrong MIME type ('application/octet-stream' instead of
    the expected source map MIME type). This caused the extension to fail loading
    in version 0.9.20.

    Switching to inline source maps embeds the source map directly in the
    JavaScript bundle, avoiding the MIME type issue while still providing source
    map support for debugging.

[email protected]

11 Nov 20:01
2566887

Choose a tag to compare

Patch Changes

  • Override repr to avoid expensive trait serialization #906 (#906)

    Previously, AnyWidget inherited ipywidgets.Widget.__repr__ which serialized all trait values. This is costly because the repr might not even be shown to users, yet it forces a full serialization of potentially large data. AnyWidget now overrides __repr__ to use object.__repr__(self), which produces a simple <module.ClassName object at 0x...> format.

    To restore the previous behavior showing all trait values, users can define:

    class MyWidget(anywidget.AnyWidget):
        def __repr__(self):
            return traitlets.HasTraits.__repr__(self)

[email protected]

10 Nov 20:58
e3bb27a

Choose a tag to compare

Patch Changes

  • Exclude docs/ and paper/ from sdist/wheel (#902)

@anywidget/[email protected]

01 Sep 18:23
a49a872

Choose a tag to compare

Patch Changes

  • Normalize possible AFM inputs to an AFM object when using Vite HMR. (#881)

[email protected]

10 Jul 16:09
2545497

Choose a tag to compare

Patch Changes

  • Upgrade @clack/prompts to avoid using placeholder values (#868)

@anywidget/[email protected]

10 Jul 16:09
2545497

Choose a tag to compare

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.

  • Migrate to Svelte 5 signals API (#869)

    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.

@anywidget/[email protected]

21 May 15:21
58180a8

Choose a tag to compare

Minor Changes

  • Initial release (1c5f07a)

    Thanks to @aryan02420, we now support Vue with an official framework bridge—similar to our React and Svelte bindings.

    Unlike @anywidget/react, the useModelState hook returns a Vue ShallowRef that you can update directly (e.g. value++), aligning with Vue’s reactivity model.

    // src/index.js
    import { createRender } from "@anywidget/vue";
    import CounterWidget from "./CounterWidget.vue";
    
    const render = createRender(CounterWidget);
    export default { render };
    <!-- src/CounterWidget.vue -->
    <script setup>
    import { useModelState } from "@anywidget/vue";
    const value = useModelState("value");
    </script>
    
    <template>
      <button :onClick="() => value++">count is {{ value }}</button>
    </template>

    See the README for build tool configuration.

[email protected]

25 Mar 14:31
ad031b9

Choose a tag to compare

Patch Changes

  • Pin @anywidget/react ~v0.2 (#837)

@anywidget/[email protected]

25 Mar 14:23
29e30d7

Choose a tag to compare

Minor Changes

  • Use React.useSyncExternalStore for useModelState hook implementation (34f01a3)

    The React.useSyncExternalStore hook was introduced in React 18 and is designed for external sources of truth, like the anywidget model. It ensures a shared source within the component tree, and consistent behavior during concurrent rendering, avoiding subtle bugs present in useEffect-based patterns.

    This is marked as a breaking change to signal the internal shift in behavior, though in practice it should be considered an improvement. Most users should not notice any difference, aside from more consistent updates.

  • Mirror React.useState API in useModelState hook (34f01a3)

    Aligns the useModelState hook more closely with the React.useState API by allowing a callback function in the state setter.

Patch Changes

  • Add generic type parameter to useModel hook (34f01a3)

[email protected]

23 Mar 20:01
0462f77

Choose a tag to compare

Patch Changes

  • experimental Fix descriptor API to send initial state on comm creation (#832)