@algorisys/tinyfly 0.68.1 → 0.70.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 +17 -15
- package/bin/tinyfly.mjs +20 -6
- package/lib/browser/tinyfly.iife.js +35 -3
- package/lib/browser/tinyfly.js +2376 -2094
- package/lib/browser/tinyfly.umd.js +35 -3
- package/lib/cli/tools.js +34 -1
- package/lib/embed/tinyfly-embed.iife.js +35 -3
- package/lib/embed/tinyfly-embed.js +1176 -866
- package/lib/player/tinyfly-player.es.js +200 -128
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/browser/index.d.ts +2 -1
- package/lib/types/embed/choices.d.ts +3 -0
- package/lib/types/embed/controls.d.ts +27 -3
- package/lib/types/embed/index.d.ts +4 -3
- package/lib/types/embed/mount.d.ts +9 -0
- package/lib/types/embed/tools.d.ts +10 -0
- package/lib/types/player/index.d.ts +1 -1
- package/lib/types/player/player.d.ts +50 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,8 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
|
|
|
39
39
|
- **Markers and captions in the JSON** - Named steps (`pause`, `question` for predict-then-reveal) and captions per language, kept out of the tracks so translation never touches timing
|
|
40
40
|
- **A player that teaches** - Shows a real frame on load, steps between markers (`next` / `prev` / `stepMode`), respects `prefers-reduced-motion`, and pauses off screen
|
|
41
41
|
- **One-script embeds** - `tinyfly-embed.iife.js` with `data-tinyfly-auto` mounts every `[data-tinyfly-embed]` figure with step controls, announced captions and an accessible SVG, with no per-post JavaScript
|
|
42
|
+
- **Full screen** - `data-fullscreen="true"` adds a button that fills the screen with the figure, through the Fullscreen API or, on iPhone, an overlay; the drawing scales to the screen whatever the page's figure CSS says
|
|
43
|
+
- **Scenarios** - Several timelines on one figure, and the reader chooses which plays: a group of options, a stepped slider, or clickable parts of the SVG (`data-tinyfly-choose`). Switching undoes the previous scenario's drawing and keeps the reader at the same step
|
|
42
44
|
- **Authoring kit** - `lesson()` step builder and diagram primitives (array cells, pointer, stack, queue / channel, table, pipeline) in `@algorisys/tinyfly/teach`
|
|
43
45
|
- **Build tools** - `npx @algorisys/tinyfly validate` catches broken figures in CI; `render` writes a frame to static SVG for RSS, email and print
|
|
44
46
|
|
|
@@ -118,7 +120,7 @@ A lightweight, API-driven animation engine and visual editor for creating high-p
|
|
|
118
120
|
- [Examples](docs/examples.md) — Code examples for common animation patterns
|
|
119
121
|
- [Scroll Animation](docs/scroll-animation.md) — Scroll-driven and visibility-triggered playback via drivers
|
|
120
122
|
- [GSAP Compatibility](docs/gsap-compat.md) — The GSAP-flavoured API, the mapping table, and what we deliberately don't do
|
|
121
|
-
- [Teaching Animations](docs/teaching.md) — Step-through figures: markers, captions, the stepping player, controls, declarative embeds, `tinyfly/teach`, validate and render
|
|
123
|
+
- [Teaching Animations](docs/teaching.md) — Step-through figures: markers, captions, the stepping player, controls, declarative embeds, scenarios the reader chooses, `tinyfly/teach`, validate and render
|
|
122
124
|
- [Extending tinyfly](docs/extending.md) — Writing adapters, custom eases and stagger offsets, adding a track kind, contributing examples
|
|
123
125
|
- [Deployment](docs/DEPLOYMENT.md) — Hosting, Docker, and CDN configuration
|
|
124
126
|
- [2D Animation Roadmap](docs/2d-animation-roadmap.md) — Adobe Animate gap analysis and phased plan (symbols/library, camera, onion skinning, …)
|
|
@@ -154,7 +156,7 @@ for what you import:
|
|
|
154
156
|
| `@algorisys/tinyfly/gsap-compat` | GSAP-style `live.to()` / `timeline()`, plus the compiling `tf` facade | Browser (`tf` anywhere) |
|
|
155
157
|
| `@algorisys/tinyfly/drivers` | `ScrollDriver`, `VisibilityDriver` | Browser |
|
|
156
158
|
| `@algorisys/tinyfly/interaction` | `Observer`, `Draggable` | Browser |
|
|
157
|
-
| `@algorisys/tinyfly/embed` | Teaching embeds: the player with step controls, captions and one-script `[data-tinyfly-embed]` mounting; `validateEmbed`, `renderFrame` | Browser (tools anywhere) |
|
|
159
|
+
| `@algorisys/tinyfly/embed` | Teaching embeds: the player with step controls, captions, scenarios and one-script `[data-tinyfly-embed]` mounting; `validateEmbed`, `validateScenarios`, `renderFrame` | Browser (tools anywhere) |
|
|
158
160
|
| `@algorisys/tinyfly/teach` | `lesson()` step builder and diagram primitives (cells, pointer, stack, queue, table, pipeline) | Anywhere |
|
|
159
161
|
| `@algorisys/tinyfly/react`, `@algorisys/tinyfly/vue`, `@algorisys/tinyfly/svelte`, `@algorisys/tinyfly/solid` | `useTinyfly` hooks, a Svelte action and a Solid primitive: `live` animations scoped to a component and reverted on unmount | Browser (frameworks are optional peer dependencies) |
|
|
160
162
|
| `@algorisys/tinyfly/browser` | Everything above in one bundle | Browser |
|
|
@@ -203,7 +205,7 @@ GSAP-shaped functions at the top level. Teaching embeds are included: add
|
|
|
203
205
|
itself.
|
|
204
206
|
|
|
205
207
|
```html
|
|
206
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
208
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.70.1/cdn/tinyfly.iife.js"></script>
|
|
207
209
|
<script>
|
|
208
210
|
tinyfly.to('.box', { x: 200, rotate: 90, duration: 1, ease: 'power2.out' })
|
|
209
211
|
|
|
@@ -225,7 +227,7 @@ itself.
|
|
|
225
227
|
| `cdn/tinyfly-player.iife.js` | Player only (~17 KB gzipped), for playing editor exports |
|
|
226
228
|
| `cdn/tinyfly-embed.iife.js` | Only teaching figures (~19 KB gzipped): player, step controls, auto-mount |
|
|
227
229
|
|
|
228
|
-
Replace `@v0.
|
|
230
|
+
Replace `@v0.70.1` with the version you want. **Pin a version in production**:
|
|
229
231
|
a tag's files never change, and each release's `cdn/README.md` lists an SRI hash
|
|
230
232
|
for `integrity=`. `@main` follows the latest release, which jsDelivr caches for up
|
|
231
233
|
to a day. Loading more than one bundle is safe: they add to the same `tinyfly`
|
|
@@ -239,7 +241,7 @@ A teaching figure needs no code at all:
|
|
|
239
241
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON with markers… }</script>
|
|
240
242
|
<figcaption>Appending to a full slice</figcaption>
|
|
241
243
|
</figure>
|
|
242
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
244
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.70.1/cdn/tinyfly.iife.js" data-tinyfly-auto></script>
|
|
243
245
|
```
|
|
244
246
|
|
|
245
247
|
See [Teaching Animations](docs/teaching.md).
|
|
@@ -338,7 +340,7 @@ Without a build step, the player bundle puts the same functions on a `tinyfly` g
|
|
|
338
340
|
<div data-tinyfly="box" style="width: 60px; height: 60px; background: #4a9eff;"></div>
|
|
339
341
|
</div>
|
|
340
342
|
|
|
341
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
343
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.70.1/cdn/tinyfly-player.iife.js"></script>
|
|
342
344
|
<script>
|
|
343
345
|
tinyfly.play('#animation', './animation.json', { loop: -1 })
|
|
344
346
|
</script>
|
|
@@ -447,7 +449,7 @@ Or skip the code entirely with declarative embeds (see [Teaching Animations](doc
|
|
|
447
449
|
<svg viewBox="0 0 720 200">…</svg>
|
|
448
450
|
<script type="application/json" data-tinyfly-timeline>{ …timeline JSON… }</script>
|
|
449
451
|
</figure>
|
|
450
|
-
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.
|
|
452
|
+
<script src="https://cdn.jsdelivr.net/gh/algorisys-oss/tinyfly@v0.70.1/cdn/tinyfly-embed.iife.js" data-tinyfly-auto></script>
|
|
451
453
|
```
|
|
452
454
|
|
|
453
455
|
### Audio / Video Sync
|
|
@@ -719,20 +721,20 @@ load.
|
|
|
719
721
|
|
|
720
722
|
### Test Coverage
|
|
721
723
|
|
|
722
|
-
`npm test` runs
|
|
724
|
+
`npm test` runs 2,197 unit tests in 127 files, all passing:
|
|
723
725
|
|
|
724
726
|
| Area | Tests |
|
|
725
727
|
|---|---|
|
|
726
728
|
| Engine (`src/engine`: timeline, easing, paths, text, exports, serialization) | 521 |
|
|
727
|
-
| Editor (`src/editor`: stores, utils, presets, AI, samples) |
|
|
728
|
-
| GSAP-style API (`src/compat/gsap`) |
|
|
729
|
-
| Examples page, GSAP-style demos and showcases (`src/examples`) |
|
|
729
|
+
| Editor (`src/editor`: stores, utils, presets, AI, samples) | 409 |
|
|
730
|
+
| GSAP-style API (`src/compat/gsap`) | 332 |
|
|
731
|
+
| Examples page, GSAP-style demos and showcases (`src/examples`) | 302 |
|
|
730
732
|
| Render adapters (`src/adapters`) | 134 |
|
|
731
|
-
| Interactive course (`src/learn`) |
|
|
733
|
+
| Interactive course (`src/learn`) | 211 |
|
|
732
734
|
| Drivers and interaction (`src/drivers`, `src/interaction`) | 136 |
|
|
733
|
-
| Player, media sync, sequencer and
|
|
734
|
-
| Docs viewer and `llms.txt` (`src/docs`) |
|
|
735
|
-
| Embeds, teaching kit, framework hooks, landing (`src/embed`, `src/teach`, `src/frameworks`, `src/landing`) |
|
|
735
|
+
| Player, media sync, sequencer, teaching and scenarios (`src/player`) | 103 |
|
|
736
|
+
| Docs viewer and `llms.txt` (`src/docs`) | 16 |
|
|
737
|
+
| Embeds, teaching kit, framework hooks, landing (`src/embed`, `src/teach`, `src/frameworks`, `src/landing`) | 33 |
|
|
736
738
|
|
|
737
739
|
## Contributing
|
|
738
740
|
|
package/bin/tinyfly.mjs
CHANGED
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* tinyfly command line.
|
|
4
4
|
*
|
|
5
|
-
* tinyfly validate <timeline.json> [--markup <figure.svg|.html>]
|
|
5
|
+
* tinyfly validate <timeline.json> [<timeline.json> …] [--markup <figure.svg|.html>]
|
|
6
6
|
* Exit 1 when the timeline has errors: tracks aimed at elements the markup
|
|
7
7
|
* lacks, markers out of order or outside the animation, keyframes past an
|
|
8
8
|
* explicit duration, captions for unknown markers. Warnings are printed.
|
|
9
|
+
* Several timelines are a figure's scenarios, each named by its "id": they
|
|
10
|
+
* are checked together, including repeated ids and data-tinyfly-choose
|
|
11
|
+
* hotspots that name no scenario.
|
|
9
12
|
*
|
|
10
13
|
* tinyfly render <timeline.json> <figure.svg|.html> [--at start|end|<ms>|<marker id>]
|
|
11
14
|
* Print the markup with that frame written in, for places that run no
|
|
12
15
|
* JavaScript (RSS, email, print, previews).
|
|
13
16
|
*/
|
|
14
17
|
import { readFileSync } from 'node:fs'
|
|
15
|
-
import { validateEmbed, renderFrame } from '../lib/cli/tools.js'
|
|
18
|
+
import { validateEmbed, validateScenarios, renderFrame } from '../lib/cli/tools.js'
|
|
16
19
|
|
|
17
20
|
const [command, ...rest] = process.argv.slice(2)
|
|
18
21
|
const flag = (name) => {
|
|
@@ -23,7 +26,7 @@ const flag = (name) => {
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
const usage = () => {
|
|
26
|
-
console.error('Usage:\n tinyfly validate <timeline.json> [--markup <file>]\n tinyfly render <timeline.json> <markup file> [--at start|end|<ms>|<marker id>]')
|
|
29
|
+
console.error('Usage:\n tinyfly validate <timeline.json> [<timeline.json> …] [--markup <file>]\n tinyfly render <timeline.json> <markup file> [--at start|end|<ms>|<marker id>]')
|
|
27
30
|
process.exit(2)
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -38,9 +41,20 @@ const readJson = (file) => {
|
|
|
38
41
|
|
|
39
42
|
if (command === 'validate') {
|
|
40
43
|
const markupFile = flag('--markup')
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
+
const timelineFiles = rest
|
|
45
|
+
if (timelineFiles.length === 0) usage()
|
|
46
|
+
const markup = markupFile ? readFileSync(markupFile, 'utf8') : undefined
|
|
47
|
+
const timelineFile = timelineFiles.join(', ')
|
|
48
|
+
const problems =
|
|
49
|
+
timelineFiles.length === 1
|
|
50
|
+
? validateEmbed(readJson(timelineFiles[0]), { markup })
|
|
51
|
+
: validateScenarios(
|
|
52
|
+
timelineFiles.map((file) => {
|
|
53
|
+
const timeline = readJson(file)
|
|
54
|
+
return { id: timeline.id ?? file, timeline }
|
|
55
|
+
}),
|
|
56
|
+
{ markup }
|
|
57
|
+
)
|
|
44
58
|
for (const problem of problems) console.error(`${problem.level}: ${problem.message}`)
|
|
45
59
|
const errors = problems.filter((problem) => problem.level === 'error').length
|
|
46
60
|
if (errors > 0) {
|