@algorisys/tinyfly 0.65.0 → 0.66.1
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 +55 -25
- package/lib/browser/tinyfly.iife.js +21 -2
- package/lib/browser/tinyfly.js +1313 -1118
- package/lib/browser/tinyfly.umd.js +21 -2
- package/lib/embed/tinyfly-embed.iife.js +2 -2
- package/lib/embed/tinyfly-embed.js +19 -18
- package/lib/types/browser/index.d.ts +10 -0
- package/lib/types/embed/auto-mount.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,6 +135,13 @@ npm install @algorisys/tinyfly
|
|
|
135
135
|
|
|
136
136
|
Or use it with no build step from the [GitHub CDN](#use-from-a-script-tag-no-build-step).
|
|
137
137
|
|
|
138
|
+
It also installs a `tinyfly` command for teaching figures in build pipelines:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npx tinyfly validate figure.json --markup figure.svg # fails the build on broken figures
|
|
142
|
+
npx tinyfly render figure.json figure.svg --at end > end.svg # a static frame for RSS, email, print
|
|
143
|
+
```
|
|
144
|
+
|
|
138
145
|
The package ships these entry points. Each is tree-shakeable, so you pay only
|
|
139
146
|
for what you import:
|
|
140
147
|
|
|
@@ -169,6 +176,7 @@ live.to('.box', { x: 200, duration: 1, ease: 'power2.out' })
|
|
|
169
176
|
|
|
170
177
|
```jsx
|
|
171
178
|
// React: everything the setup creates is reverted when the component unmounts
|
|
179
|
+
import { useRef } from 'react'
|
|
172
180
|
import { useTinyfly } from '@algorisys/tinyfly/react'
|
|
173
181
|
|
|
174
182
|
function Hero() {
|
|
@@ -189,11 +197,13 @@ Every release publishes browser bundles to the `cdn/` folder of
|
|
|
189
197
|
its version, and [jsDelivr](https://www.jsdelivr.com/) serves them straight from
|
|
190
198
|
GitHub. No npm required.
|
|
191
199
|
|
|
192
|
-
`tinyfly.iife.js` (~
|
|
193
|
-
GSAP-shaped functions at the top level:
|
|
200
|
+
`tinyfly.iife.js` (~53 KB gzipped) puts everything on one `tinyfly` global, with
|
|
201
|
+
GSAP-shaped functions at the top level. Teaching embeds are included: add
|
|
202
|
+
`data-tinyfly-auto` to the script tag and every `[data-tinyfly-embed]` figure mounts
|
|
203
|
+
itself.
|
|
194
204
|
|
|
195
205
|
```html
|
|
196
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
206
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.66.1/cdn/tinyfly.iife.js"></script>
|
|
197
207
|
<script>
|
|
198
208
|
tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
|
|
199
209
|
|
|
@@ -209,14 +219,30 @@ GSAP-shaped functions at the top level:
|
|
|
209
219
|
|
|
210
220
|
| File | What |
|
|
211
221
|
|---|---|
|
|
212
|
-
| `cdn/tinyfly.iife.js` | Everything, on a `tinyfly` global |
|
|
222
|
+
| `cdn/tinyfly.iife.js` | Everything, on a `tinyfly` global, including teaching embeds |
|
|
213
223
|
| `cdn/tinyfly.umd.js` | The same, as UMD |
|
|
214
224
|
| `cdn/tinyfly.esm.js` | The same, as an ES module: `import { live } from '…/cdn/tinyfly.esm.js'` |
|
|
215
|
-
| `cdn/tinyfly-player.iife.js` | Player only (~
|
|
225
|
+
| `cdn/tinyfly-player.iife.js` | Player only (~17 KB gzipped), for playing editor exports |
|
|
226
|
+
| `cdn/tinyfly-embed.iife.js` | Only teaching figures (~19 KB gzipped): player, step controls, auto-mount |
|
|
227
|
+
|
|
228
|
+
Replace `@v0.66.1` with the version you want. **Pin a version in production**:
|
|
229
|
+
a tag's files never change, and each release's `cdn/README.md` lists an SRI hash
|
|
230
|
+
for `integrity=`. `@main` follows the latest release, which jsDelivr caches for up
|
|
231
|
+
to a day. Loading more than one bundle is safe: they add to the same `tinyfly`
|
|
232
|
+
global.
|
|
216
233
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
234
|
+
A teaching figure needs no code at all:
|
|
235
|
+
|
|
236
|
+
```html
|
|
237
|
+
<figure data-tinyfly-embed data-options='{"stepMode": true}'>
|
|
238
|
+
<svg viewBox="0 0 720 200">…<rect data-tinyfly="cell-3" …/>…</svg>
|
|
239
|
+
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
|
|
240
|
+
<figcaption>Appending to a full slice</figcaption>
|
|
241
|
+
</figure>
|
|
242
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.66.1/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
See [Teaching Animations](docs/teaching.md).
|
|
220
246
|
|
|
221
247
|
Every card on the [Examples page](docs/editor-guide.md#examples) has **Copy code**, which gives you a
|
|
222
248
|
complete HTML page already using these URLs.
|
|
@@ -231,7 +257,9 @@ This produces:
|
|
|
231
257
|
|
|
232
258
|
- `lib/engine/tinyfly-engine.js` (ESM) and `.umd.cjs` — the engine
|
|
233
259
|
- `lib/player/tinyfly-player.{es,umd,iife}.js` — the standalone DOM player
|
|
234
|
-
- `lib/addons/{adapters,export,gsap-compat,drivers,interaction}.js` — the optional entry points
|
|
260
|
+
- `lib/addons/{adapters,export,gsap-compat,drivers,interaction,teach}.js` — the optional entry points
|
|
261
|
+
- `lib/frameworks/{react,vue,svelte,solid}.js` — the framework hooks
|
|
262
|
+
- `lib/embed/tinyfly-embed.{iife.js,js}` — teaching embeds; `lib/cli/tools.js` — the `tinyfly` command
|
|
235
263
|
- `lib/browser/tinyfly.{iife,umd}.js` and `tinyfly.js` — the all-in-one bundle
|
|
236
264
|
- `lib/types/**` — TypeScript declarations
|
|
237
265
|
|
|
@@ -291,26 +319,28 @@ animate();
|
|
|
291
319
|
|
|
292
320
|
### Embedding Animations
|
|
293
321
|
|
|
322
|
+
With a bundler (Vite, webpack, Next.js…):
|
|
323
|
+
|
|
324
|
+
```js
|
|
325
|
+
import { play } from '@algorisys/tinyfly/player'
|
|
326
|
+
|
|
327
|
+
// Load from a JSON file (e.g. exported from the studio)
|
|
328
|
+
play('#animation', './animation.json', { loop: -1 })
|
|
329
|
+
|
|
330
|
+
// Or pass the JSON directly
|
|
331
|
+
play('#animation', { id: 'my-animation', config: { duration: 1000 }, tracks: [/* … */] })
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Without a build step, the player bundle puts the same functions on a `tinyfly` global:
|
|
335
|
+
|
|
294
336
|
```html
|
|
295
337
|
<div id="animation">
|
|
296
338
|
<div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
|
|
297
339
|
</div>
|
|
298
340
|
|
|
299
|
-
<script
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
// Load from JSON file
|
|
303
|
-
play('#animation', './animation.json', {
|
|
304
|
-
loop: -1,
|
|
305
|
-
autoplay: true
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// Or use inline JSON
|
|
309
|
-
play('#animation', {
|
|
310
|
-
id: 'my-animation',
|
|
311
|
-
config: { duration: 1000 },
|
|
312
|
-
tracks: [...]
|
|
313
|
-
});
|
|
341
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.66.1/cdn/tinyfly-player.iife.js"></script>
|
|
342
|
+
<script>
|
|
343
|
+
tinyfly.play('#animation', './animation.json', { loop: -1 })
|
|
314
344
|
</script>
|
|
315
345
|
```
|
|
316
346
|
|
|
@@ -417,7 +447,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
|
|
|
417
447
|
<svg viewBox="0 0 720 200">…</svg>
|
|
418
448
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
419
449
|
</figure>
|
|
420
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
450
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.66.1/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
421
451
|
```
|
|
422
452
|
|
|
423
453
|
### Audio / Video Sync
|