Skip to content

Commit

Permalink
Add notes on Svelte 5 compatibility to documentation. Lint fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kitschpatrol committed Oct 22, 2024
1 parent 26c9be5 commit af91a3f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ src/examples/components/
docs/src/content/docs/docs/components/
docs/src/content/acknowledgments/
docs/src/examples/

# svelte-5 test project
svelte-5/src
14 changes: 11 additions & 3 deletions docs/src/content/docs/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The library makes it easy to quickly and declaratively add knobs and dials to yo

The components should be useful for integrating controls and value monitoring in parametrically driven artworks or simulations. For some use cases, it could also present a viable alternative to traditional component libraries altogether.

It's open-source, MIT-licensed, extensively documented, and is compatible with Svelte 4 and Tweakpane 4. It should work anywhere Svelte works, including [SvelteKit](https://kit.svelte.dev/) and "island" frameworks like [Astro](https://astro.build/). _Svelte Tweakpane UI_ is distributed as an [NPM package](http://npmjs.com/package/svelte-tweakpane-ui), and the source code is available on [GitHub](https://github.com/kitschpatrol/svelte-tweakpane-ui).
It's open-source, MIT-licensed, extensively documented, and is compatible with Svelte 4 and Svelte 5. It should work anywhere Svelte works, including [SvelteKit](https://kit.svelte.dev/) and "island" frameworks like [Astro](https://astro.build/). _Svelte Tweakpane UI_ is distributed as an [NPM package](http://npmjs.com/package/svelte-tweakpane-ui), and the source code is available on [GitHub](https://github.com/kitschpatrol/svelte-tweakpane-ui).

---

Expand Down Expand Up @@ -250,7 +250,7 @@ The vanilla tweakpane API is highly dynamic, and the availability of various opt

Svelte's component API is comparatively static, and the availability of props is typically fixed at compile time... but several _Svelte Tweakpane UI_ components feature dynamic properties that are added / removed from the component depending on the presence or type of other props.

Dynamic props are used in cases where the clarity of a component's purpose isn't compromised by a bit of dynamism (e.g. `<Pane>`), or where the alternative would be to create a large number of very similar components (e.g. `<Monitor>`.
Dynamic props are used in cases where the clarity of a component's purpose isn't compromised by a bit of dynamism (e.g. `<Pane>`), or where the alternative would be to create a large number of very similar components (e.g. `<Monitor>`).

Svelte's approach to supporting dynamic props is still evolving, and the right balance between flexibility and predictability is subject to reconsideration in subsequent versions of Svelte Tweakpane UI.

Expand Down Expand Up @@ -305,4 +305,12 @@ _Svelte Tweakpane UI_ drew some inspiration from these projects, but was develop

## Svelte 5 compatibility

At the moment, _Svelte Tweakpane UI_ is compatible with Svelte 4 only, but Svelte 5 support is on the roadmap. Some components work with recent preview releases of Svelte 5, but there are some bugs and incompatibilities that will need to be resolved.
**As of version 1.4, _Svelte Tweakpane UI_ is fully compatible with Svelte 5.**

The library itself is (currently) written in the Svelte 4 style, which is now considered "Legacy" mode (vs. the new "Runes" mode) in Svelte 5, but the components will compile and work fine in Svelte 5 projects.

Svelte libraries are distributed as source, not as compiled components, so the version of Svelte actually used to build and run your Svelte Tweakpane UI components is determined by the Svelte version of the containing project — not by the library itself.

Due to some subtle differences in how Svelte 5 compiles Svelte 4 "legacy" code, there are some rare edge cases where you might see slightly different behavior in components compiled with Svelte 5 vs. Svelte 4. If you encounter an intractable case, please [open an issue](https://github.com/kitschpatrol/svelte-tweakpane-ui/issues).

Longer-term, I'd like to rewrite the library in the Svelte 5 "Runes" style; there's complexity in the current implementation around fine-grained reactivity that I'd love to simplify — but at this point I'd rather not maintain separate versions of Svelte Tweakpane UI for Svelte 4 and Svelte 5.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@
"build:11-examples-to-docs": "tsx ./scripts/generate-example-components.ts",
"build:12-acknowledgments-data": "mkdir -p ./docs/src/content/acknowledgments && pnpm licenses list --json > ./docs/src/content/acknowledgments/acknowledgments-lib.json",
"build:13-build-docs": "pnpm run docs-build",
"build:14-build-svelte-5": "pnpm run svelte-5-build",
"build:14-build-kit": "pnpm run kit-build",
"build:15-build-svelte-5": "pnpm run svelte-5-build",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check-watch": "svelte-kit sync && svelte-check --ignore ./scratch --tsconfig ./tsconfig.json --watch",
"clean": "rm pnpm-lock.yaml ; git clean -fdX",
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ The library makes it easy to quickly and declaratively add knobs and dials to yo

[The components](https://kitschpatrol.com/svelte-tweakpane-ui/docs#components) should be useful for integrating controls and value monitoring in parametrically driven artworks, data visualizations, creative tools, simulations, etc.

The library is compatible with both Svelte 4 and Svelte 5.

## Demo

![Svelte Tweakpane UI quick demo](./docs/public/quick-demo.gif)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/extra/AutoValue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Plugin component behavior is not available in `<AutoValue>`.
import { AutoValue } from 'svelte-tweakpane-ui';
let number = 0;
let color = '#ff00ff';
let color = { r: 255, g: 0, b: 255 };
let point = { x: 0, y: 0 };
let text = 'Cosmic manifold';
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/extra/Element.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ case the `<Element>` will be implicitly wrapped in `<Pane position="inline">`.
gradientAngle = 45;
textAngle = 0;
}}
disabled={gradientAngle == 45 && textAngle == 0}
disabled={gradientAngle === 45 && textAngle === 0}
title="Reset"
/>
</Pane>
Expand Down

0 comments on commit af91a3f

Please sign in to comment.