storyink 0.2.0 → 0.3.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0
4
+
5
+ - **Animated SVG (SMIL):** the story plays inside a plain `<img>`, so in GitHub READMEs and PR
6
+ comments (camo), docs and chat previews, where no script runs.
7
+ - `renderAnimatedSvg(spec, { theme, once, font, hold, reset, fps })` / `animatedSvg()` in
8
+ `storyink/core`; `writeAnimatedSvg()` and `pictureSnippet()` in `storyink/node`.
9
+ - CLI: `storyink render x.json --animated-svg x.svg [--theme light|dark|both] [--once] [--font system|embed]`;
10
+ `both` writes `.light.svg` + `.dark.svg` and prints the `<picture>` snippet. Specs without a
11
+ story use the auto story (with a warning).
12
+ - Plugin: `storyink_render` takes `animatedSvg: true | "both"`, `animatedSvgPath`, `once`, `font`.
13
+ - Built by sampling `storyState(t)` (the viewer's frame function) and compressing each track
14
+ to SMIL keyframes; one shared cycle (story, 3 s hold, 0.4 s reset) or `once` (freeze).
15
+ Base values are the final frame. Theme-pinned, no custom properties, deterministic.
16
+ - `bun run gallery:animated`, `bun run verify:smil` (frame parity PSNR, `<img>` playback, font).
17
+ - `Frame` pulse trail segments carry `k`, `s0`, `s1`; captions carry their index `i`.
18
+ - `screenshotPage()` in `storyink/node`: screenshot any local page.
19
+
20
+ ## 0.2.1
21
+
22
+ - **Fix:** `storyink_snapshot` no longer inlines the full-resolution contact sheet. Tall beat
23
+ sheets (1440 px wide, thousands of px tall) could stall the next model request and bloat
24
+ session context. It now returns **one compact JPEG preview**, with its longest side at most
25
+ 1024 px and a 300 KB budget. Beat sheets are reflowed into 3–8 columns so they fit in one
26
+ image.
27
+ - New tool options: `image: "overview" | "full" | "none"` (default `overview`; `full` returns
28
+ at most 3 parts) and `maxImageSize` (default 1024).
29
+ - Full-resolution PNGs stay on disk and are listed in the text result.
30
+ - CLI: `storyink snapshot … --preview out.jpg [--preview-size 1024]` writes the same preview.
31
+ - Snapshot receipts include `previews` (path, size, bytes, what the image shows).
32
+ - The beat-sheet page accepts `#cols=N`, `#range=a-b` and `#zoom=z`.
33
+ - SKILL.md: guidance on keeping image reads few and on using `at` frames for detail.
34
+
35
+ ## 0.2.0
36
+
37
+ - Storyboard mode: `story` steps and `"story": "auto"`, the pure `storyState(t)`, the viewer
38
+ transport and counters. Snapshot gets `--at`, `--sheet beats` and the static gates.
39
+ - Fixes: captions belong to their own step, humanised beat titles, warm light-theme glow,
40
+ beat sheets sized to their content.
41
+
42
+ ## 0.1.0
43
+
44
+ - First release: spec, validation, Mermaid import, layout, SSR/viewer, CLI, OpenCode plugin.
package/README.md CHANGED
@@ -6,6 +6,19 @@ Mermaid) into **one offline HTML file** (a React + Motion viewer over server-ren
6
6
 
7
7
  One package, four ways to use it: library, CLI, OpenCode plugin, and a skill for other agents.
8
8
 
9
+ <picture>
10
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/grenaad/storyink/main/docs/gallery/checkout.architecture.animated.dark.svg">
11
+ <img alt="Checkout platform, animated story" src="https://raw.githubusercontent.com/grenaad/storyink/main/docs/gallery/checkout.architecture.animated.light.svg">
12
+ </picture>
13
+
14
+ <picture>
15
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/gh/grenaad/storyink@main/docs/gallery/oauth.sequence.animated.dark.svg">
16
+ <img alt="OAuth sequence, animated story" src="https://cdn.jsdelivr.net/gh/grenaad/storyink@main/docs/gallery/oauth.sequence.animated.light.svg">
17
+ </picture>
18
+
19
+ *Animated SVGs (SMIL, no script): they play inside a plain `<img>`, so in a README or a PR
20
+ comment too. See [Animated SVG](#animated-svg-readmes-and-prs).*
21
+
9
22
  ```sh
10
23
  npx storyink render examples/checkout.architecture.json -o checkout.html --svg checkout.svg
11
24
  ```
@@ -35,9 +48,11 @@ both and has the OpenCode plugin as its default export. Runs on Node ≥ 20 and
35
48
 
36
49
  ```
37
50
  storyink render <in.json|in.mmd|-> [-o out.html] [--svg out.svg] [--theme light|dark] [--story auto]
51
+ [--animated-svg out.svg [--theme light|dark|both] [--once] [--font system|embed]]
38
52
  storyink mermaid <in.mmd> [-o out.json]
39
53
  storyink validate <in> [--json]
40
54
  storyink snapshot <out.html> [--theme light,dark] [--width N] [--sheet [themes|beats]|--no-sheet] [--at 0.5,1.2,end] [--scale 2] [-o dir] [--json]
55
+ [--preview out.jpg [--preview-size 1024]]
41
56
  storyink skill
42
57
  ```
43
58
 
@@ -74,8 +89,14 @@ read `package.json` `main`, which is why the repo ships a root `server.js` that
74
89
  Rebuild after changes, then restart the server (or touch the config) to reload.
75
90
 
76
91
  This adds the tools `storyink_render`, `storyink_from_mermaid`, `storyink_validate` and
77
- `storyink_snapshot`. `storyink_snapshot` returns the contact sheet as an image, so the model can
78
- see its own render. The plugin also adds the `storyink` skill (`skill/SKILL.md`), which covers
92
+ `storyink_snapshot`. `storyink_snapshot` returns **one compact preview image** so the model can see its
93
+ own render: a JPEG no larger than `maxImageSize` (1024 px by default) on its longest side, and
94
+ usually well under 300 KB.
95
+ - Beat sheets are reflowed into more columns so they fit in that single image.
96
+ - Set `image: "full"` to get the normal sheet layout instead, split into at most 3 parts, or
97
+ `image: "none"` to get paths only.
98
+ - Full-resolution PNGs are never inlined; they stay on disk and their paths are listed. The CLI
99
+ equivalent is `--preview out.jpg`. The plugin also adds the `storyink` skill (`skill/SKILL.md`), which covers
79
100
  choosing a diagram type, writing the spec, and the render → look → fix loop. If you already have
80
101
  a skill with the id `storyink`, yours is kept. Relative paths resolve against the project
81
102
  directory.
@@ -111,10 +132,41 @@ receipt gates check that the end frame and the reduced-motion page match the sta
111
132
 
112
133
  ![Checkout beats](docs/gallery/checkout.architecture.beats.light.png)
113
134
 
135
+ ## Animated SVG (READMEs and PRs)
136
+
137
+ GitHub shows images in READMEs and PR comments as a plain `<img>` through its camo proxy, so no
138
+ script runs and nothing outside the file loads. `--animated-svg` compiles the story into **SMIL**
139
+ inside one self-contained SVG that plays there:
140
+
141
+ ```sh
142
+ storyink render examples/checkout.architecture.json --animated-svg docs/checkout.svg --theme both
143
+ # wrote docs/checkout.light.svg, docs/checkout.dark.svg and prints:
144
+ ```
145
+
146
+ ```html
147
+ <picture>
148
+ <source media="(prefers-color-scheme: dark)" srcset="docs/checkout.dark.svg">
149
+ <img alt="Checkout platform" src="docs/checkout.light.svg">
150
+ </picture>
151
+ ```
152
+
153
+ - An SVG image doesn't follow the page theme, so each file is **pinned** to one theme; the
154
+ `<picture>` picks one. `--theme light|dark` writes a single file.
155
+ - It loops: story, a 3 s hold on the final frame, a 0.4 s reset. `--once` plays once and freezes.
156
+ - The attributes' base values are the final frame, so viewers without SMIL show the static diagram.
157
+ - Fonts: `--font system` (default) uses the system mono stack; `--font embed` embeds Commit Mono
158
+ (+~127 KB) for the exact look. See the size table in [docs/spec.md](docs/spec.md#animated-svg).
159
+ - No story in the spec? The auto story is used (with a warning).
160
+ - Library: `renderAnimatedSvg(spec, { theme, once, font })` from `storyink/core`; plugin:
161
+ `storyink_render` with `animatedSvg: true | "both"`, `once`, `font`.
162
+ - GitHub's image proxy caches by URL: when a diagram changes, give it a new file name (or URL).
163
+
114
164
  ## Gallery
115
165
 
116
166
  `bun run gallery` renders every example and Mermaid sample and writes one light and one dark PNG per
117
- example to `docs/gallery/`.
167
+ example to `docs/gallery/`. `bun run gallery:animated` writes the animated SVGs of the story
168
+ examples (`*.animated.light.svg` / `*.animated.dark.svg`); `bun run verify:smil` checks them in
169
+ headless Chrome (frame parity with the viewer's frames, `<img>` playback, embedded font).
118
170
 
119
171
  | | |
120
172
  | --- | --- |
@@ -48,3 +48,10 @@ site are included. Serif headings use system fonts ("Iowan Old Style", Charter,
48
48
 
49
49
  storyink parses a subset of Mermaid syntax with its own hand-written parsers; no Mermaid
50
50
  or merman code is included.
51
+
52
+ ## PR Lens (patterns only)
53
+
54
+ The animated SVG export follows the constraints and SMIL patterns of PR Lens's GitHub-safe SVG
55
+ renderer (<https://github.com/coldteadotai/pr-lens>, MIT License, Copyright (c) 2026 Coldtea AI):
56
+ self-contained files, no script or custom properties, animation as SMIL so it plays inside an
57
+ `<img>` behind GitHub's image proxy. No PR Lens code is included.