animot-presenter 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -23
- package/dist/cdn/animot-presenter.esm.js +2210 -2155
- package/dist/cdn/animot-presenter.min.js +9 -8
- package/dist/element.svelte.d.ts +33 -4
- package/dist/element.svelte.js +71 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,37 +95,26 @@ npm install animot-presenter
|
|
|
95
95
|
|
|
96
96
|
```svelte
|
|
97
97
|
<script>
|
|
98
|
+
import { browser } from '$app/environment';
|
|
98
99
|
import { AnimotPresenter } from 'animot-presenter';
|
|
99
|
-
|
|
100
|
-
let animationData = $state(null);
|
|
101
|
-
|
|
102
|
-
async function load() {
|
|
103
|
-
const res = await fetch('/animations/hero.json');
|
|
104
|
-
animationData = await res.json();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
load();
|
|
108
100
|
</script>
|
|
109
101
|
|
|
110
|
-
<!--
|
|
102
|
+
<!-- Wrap with {#if browser} in SvelteKit to skip SSR -->
|
|
111
103
|
<div style="width: 100%; height: 500px;">
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
<!-- Option B: Pass data directly -->
|
|
122
|
-
<div style="width: 800px; height: 450px;">
|
|
123
|
-
{#if animationData}
|
|
124
|
-
<AnimotPresenter data={animationData} controls arrows />
|
|
104
|
+
{#if browser}
|
|
105
|
+
<AnimotPresenter
|
|
106
|
+
src="/animations/hero.json"
|
|
107
|
+
autoplay
|
|
108
|
+
loop
|
|
109
|
+
controls
|
|
110
|
+
onslidechange={(index, total) => console.log(`${index + 1}/${total}`)}
|
|
111
|
+
/>
|
|
125
112
|
{/if}
|
|
126
113
|
</div>
|
|
127
114
|
```
|
|
128
115
|
|
|
116
|
+
> **SvelteKit SSR:** The component uses browser APIs (canvas, ResizeObserver) and cannot be server-rendered. Always wrap with `{#if browser}` in SvelteKit, or use `ssr: false` in your `+page.ts`.
|
|
117
|
+
|
|
129
118
|
### React
|
|
130
119
|
|
|
131
120
|
```bash
|