storyink 0.3.2 → 0.3.4
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 +41 -0
- package/README.md +2 -1
- package/dist/chunks/{index-5qmjsg8w.js → index-8fj4y3qd.js} +10 -5
- package/dist/chunks/{index-n3gf4fyb.js → index-a1ae1dgw.js} +208 -56
- package/dist/cli.js +216 -59
- package/dist/core/index.js +19 -1
- package/dist/index.js +20 -2
- package/dist/node/index.js +2 -2
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/layout/index.d.ts +1 -1
- package/dist/types/core/layout/paths.d.ts +7 -0
- package/dist/types/core/render/Story.d.ts +13 -1
- package/dist/types/core/story/state.d.ts +45 -0
- package/dist/types/generated/meta.d.ts +1 -1
- package/dist/types/generated/viewer.d.ts +1 -1
- package/docs/spec.md +41 -5
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -10,12 +10,17 @@ import {
|
|
|
10
10
|
MESSAGE_KINDS,
|
|
11
11
|
PARTICIPANT_KINDS,
|
|
12
12
|
STEP_BEAT,
|
|
13
|
+
STEP_MOVE,
|
|
13
14
|
STORY_MOTIONS,
|
|
14
15
|
StoryinkError,
|
|
15
16
|
VERSION,
|
|
16
17
|
animatedHeaderHeight,
|
|
17
18
|
animatedSvg,
|
|
18
19
|
autoStory,
|
|
20
|
+
beatChapters,
|
|
21
|
+
beatGroups,
|
|
22
|
+
beatStops,
|
|
23
|
+
beatTicks,
|
|
19
24
|
beatTimes,
|
|
20
25
|
cameraAt,
|
|
21
26
|
cameraAtEnd,
|
|
@@ -30,6 +35,7 @@ import {
|
|
|
30
35
|
exports_tokens,
|
|
31
36
|
fitCamera,
|
|
32
37
|
fitIsReadable,
|
|
38
|
+
flattenPath,
|
|
33
39
|
followStep,
|
|
34
40
|
fontCss,
|
|
35
41
|
formatDiagnostic,
|
|
@@ -50,7 +56,10 @@ import {
|
|
|
50
56
|
simplify,
|
|
51
57
|
simplifyError,
|
|
52
58
|
stepAt,
|
|
59
|
+
stepBoundary,
|
|
53
60
|
stepFocus,
|
|
61
|
+
stepMoveSpeed,
|
|
62
|
+
stepMoveTarget,
|
|
54
63
|
steppedIndex,
|
|
55
64
|
steppedSchedule,
|
|
56
65
|
steppedStop,
|
|
@@ -62,7 +71,7 @@ import {
|
|
|
62
71
|
validate,
|
|
63
72
|
wirePath,
|
|
64
73
|
wrap
|
|
65
|
-
} from "../chunks/index-
|
|
74
|
+
} from "../chunks/index-a1ae1dgw.js";
|
|
66
75
|
export {
|
|
67
76
|
ARROWS,
|
|
68
77
|
CAMERA,
|
|
@@ -74,12 +83,17 @@ export {
|
|
|
74
83
|
MESSAGE_KINDS,
|
|
75
84
|
PARTICIPANT_KINDS,
|
|
76
85
|
STEP_BEAT,
|
|
86
|
+
STEP_MOVE,
|
|
77
87
|
STORY_MOTIONS,
|
|
78
88
|
StoryinkError,
|
|
79
89
|
VERSION,
|
|
80
90
|
animatedHeaderHeight,
|
|
81
91
|
animatedSvg,
|
|
82
92
|
autoStory,
|
|
93
|
+
beatChapters,
|
|
94
|
+
beatGroups,
|
|
95
|
+
beatStops,
|
|
96
|
+
beatTicks,
|
|
83
97
|
beatTimes,
|
|
84
98
|
cameraAt,
|
|
85
99
|
cameraAtEnd,
|
|
@@ -93,6 +107,7 @@ export {
|
|
|
93
107
|
elbowPathV,
|
|
94
108
|
fitCamera,
|
|
95
109
|
fitIsReadable,
|
|
110
|
+
flattenPath,
|
|
96
111
|
followStep,
|
|
97
112
|
fontCss,
|
|
98
113
|
formatDiagnostic,
|
|
@@ -113,7 +128,10 @@ export {
|
|
|
113
128
|
simplify,
|
|
114
129
|
simplifyError,
|
|
115
130
|
stepAt,
|
|
131
|
+
stepBoundary,
|
|
116
132
|
stepFocus,
|
|
133
|
+
stepMoveSpeed,
|
|
134
|
+
stepMoveTarget,
|
|
117
135
|
steppedIndex,
|
|
118
136
|
steppedSchedule,
|
|
119
137
|
steppedStop,
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
snapshot,
|
|
9
9
|
writeAnimatedSvg,
|
|
10
10
|
writeDiagram
|
|
11
|
-
} from "./chunks/index-
|
|
11
|
+
} from "./chunks/index-8fj4y3qd.js";
|
|
12
12
|
import {
|
|
13
13
|
ARROWS,
|
|
14
14
|
CAMERA,
|
|
@@ -20,12 +20,17 @@ import {
|
|
|
20
20
|
MESSAGE_KINDS,
|
|
21
21
|
PARTICIPANT_KINDS,
|
|
22
22
|
STEP_BEAT,
|
|
23
|
+
STEP_MOVE,
|
|
23
24
|
STORY_MOTIONS,
|
|
24
25
|
StoryinkError,
|
|
25
26
|
VERSION,
|
|
26
27
|
animatedHeaderHeight,
|
|
27
28
|
animatedSvg,
|
|
28
29
|
autoStory,
|
|
30
|
+
beatChapters,
|
|
31
|
+
beatGroups,
|
|
32
|
+
beatStops,
|
|
33
|
+
beatTicks,
|
|
29
34
|
beatTimes,
|
|
30
35
|
cameraAt,
|
|
31
36
|
cameraAtEnd,
|
|
@@ -40,6 +45,7 @@ import {
|
|
|
40
45
|
exports_tokens,
|
|
41
46
|
fitCamera,
|
|
42
47
|
fitIsReadable,
|
|
48
|
+
flattenPath,
|
|
43
49
|
followStep,
|
|
44
50
|
fontCss,
|
|
45
51
|
formatDiagnostic,
|
|
@@ -60,7 +66,10 @@ import {
|
|
|
60
66
|
simplify,
|
|
61
67
|
simplifyError,
|
|
62
68
|
stepAt,
|
|
69
|
+
stepBoundary,
|
|
63
70
|
stepFocus,
|
|
71
|
+
stepMoveSpeed,
|
|
72
|
+
stepMoveTarget,
|
|
64
73
|
steppedIndex,
|
|
65
74
|
steppedSchedule,
|
|
66
75
|
steppedStop,
|
|
@@ -72,7 +81,7 @@ import {
|
|
|
72
81
|
validate,
|
|
73
82
|
wirePath,
|
|
74
83
|
wrap
|
|
75
|
-
} from "./chunks/index-
|
|
84
|
+
} from "./chunks/index-a1ae1dgw.js";
|
|
76
85
|
// src/plugin.ts
|
|
77
86
|
import fs2 from "node:fs";
|
|
78
87
|
import path2 from "node:path";
|
|
@@ -373,12 +382,17 @@ export {
|
|
|
373
382
|
PARTICIPANT_KINDS,
|
|
374
383
|
PLUGIN_ID,
|
|
375
384
|
STEP_BEAT,
|
|
385
|
+
STEP_MOVE,
|
|
376
386
|
STORY_MOTIONS,
|
|
377
387
|
StoryinkError,
|
|
378
388
|
VERSION,
|
|
379
389
|
animatedHeaderHeight,
|
|
380
390
|
animatedSvg,
|
|
381
391
|
autoStory,
|
|
392
|
+
beatChapters,
|
|
393
|
+
beatGroups,
|
|
394
|
+
beatStops,
|
|
395
|
+
beatTicks,
|
|
382
396
|
beatTimes,
|
|
383
397
|
cameraAt,
|
|
384
398
|
cameraAtEnd,
|
|
@@ -394,6 +408,7 @@ export {
|
|
|
394
408
|
findBrowser,
|
|
395
409
|
fitCamera,
|
|
396
410
|
fitIsReadable,
|
|
411
|
+
flattenPath,
|
|
397
412
|
followStep,
|
|
398
413
|
fontCss,
|
|
399
414
|
formatDiagnostic,
|
|
@@ -417,7 +432,10 @@ export {
|
|
|
417
432
|
simplifyError,
|
|
418
433
|
snapshot,
|
|
419
434
|
stepAt,
|
|
435
|
+
stepBoundary,
|
|
420
436
|
stepFocus,
|
|
437
|
+
stepMoveSpeed,
|
|
438
|
+
stepMoveTarget,
|
|
421
439
|
steppedIndex,
|
|
422
440
|
steppedSchedule,
|
|
423
441
|
steppedStop,
|
package/dist/node/index.js
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
snapshot,
|
|
11
11
|
writeAnimatedSvg,
|
|
12
12
|
writeDiagram
|
|
13
|
-
} from "../chunks/index-
|
|
14
|
-
import"../chunks/index-
|
|
13
|
+
} from "../chunks/index-8fj4y3qd.js";
|
|
14
|
+
import"../chunks/index-a1ae1dgw.js";
|
|
15
15
|
export {
|
|
16
16
|
browserVersion,
|
|
17
17
|
findBrowser,
|
|
@@ -5,12 +5,12 @@ export * from "./spec.js";
|
|
|
5
5
|
export type * from "./scene.js";
|
|
6
6
|
export { validate, formatDiagnostic, type Diagnostic, type Severity, type ValidationResult } from "./validate.js";
|
|
7
7
|
export { fromMermaid, detectMermaid, type MermaidResult, type MermaidFamily } from "./mermaid/index.js";
|
|
8
|
-
export { layout, elbowPath, elbowPathV, roundedPolyline, wirePath, textWidth, wrap } from "./layout/index.js";
|
|
8
|
+
export { layout, elbowPath, elbowPathV, flattenPath, roundedPolyline, wirePath, textWidth, wrap } from "./layout/index.js";
|
|
9
9
|
export { renderSvg, renderHtml, toScene, fontCss, StoryinkError, type SvgOptions, type HtmlOptions } from "./render/index.js";
|
|
10
10
|
export { parseHash, type HashParams } from "./render/App.js";
|
|
11
11
|
export * as tokens from "../theme/tokens.js";
|
|
12
12
|
export { VERSION } from "../generated/meta.js";
|
|
13
|
-
export { storyState, restFrame, beatTimes, counterValue, steppedSchedule, steppedIndex, steppedStop, steppedTime, STEP_BEAT, type StateOptions, type SteppedStop } from "./story/state.js";
|
|
13
|
+
export { storyState, restFrame, beatTimes, counterValue, steppedSchedule, steppedIndex, steppedStop, steppedTime, STEP_BEAT, STEP_MOVE, stepBoundary, stepMoveTarget, stepMoveSpeed, beatGroups, beatStops, beatChapters, beatTicks, type StateOptions, type SteppedStop } from "./story/state.js";
|
|
14
14
|
export { CAMERA, cameraAt, cameraAtEnd, centreOn, clampCamera, deadZoneRect, fitCamera, fitIsReadable, followStep, inView, readableScale, stepAt, stepFocus, toScreen, type Camera, type Viewport } from "./story/camera.js";
|
|
15
15
|
export { compileStory, resolveEdge, readTime, type CompileResult } from "./story/compile.js";
|
|
16
16
|
export { autoStory } from "./story/auto.js";
|
|
@@ -5,5 +5,5 @@ import { layoutSequence } from "./sequence.js";
|
|
|
5
5
|
/** Pure, deterministic layout of a validated spec into absolute geometry. */
|
|
6
6
|
export declare function layout(spec: Spec): Scene;
|
|
7
7
|
export { layoutGraph, layoutSequence };
|
|
8
|
-
export { elbowPath, elbowPathV, roundedPolyline, wirePath } from "./paths.js";
|
|
8
|
+
export { elbowPath, elbowPathV, flattenPath, roundedPolyline, wirePath } from "./paths.js";
|
|
9
9
|
export { textWidth, wrap } from "./measure.js";
|
|
@@ -19,3 +19,10 @@ export declare function dedupe(points: Pt[]): Pt[];
|
|
|
19
19
|
* (radius 18); everything else the rounded polyline (radius 12).
|
|
20
20
|
*/
|
|
21
21
|
export declare function wirePath(points: Pt[], elbowRadius: number, cornerRadius: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Flatten a wire path (absolute `M L H V Q`, as the builders above emit) into a dense polyline
|
|
24
|
+
* that follows the drawn curve: each quadratic corner is sampled so the chord error stays well
|
|
25
|
+
* under 0.1 px. Pulse routes, trails and draw-on lengths use this, so everything animated along a
|
|
26
|
+
* wire lies on the same rounded geometry as the wire itself.
|
|
27
|
+
*/
|
|
28
|
+
export declare function flattenPath(d: string): Pt[];
|
|
@@ -15,7 +15,19 @@ export interface StoryControls {
|
|
|
15
15
|
toggle: () => void;
|
|
16
16
|
seek: (t: number) => void;
|
|
17
17
|
replay: () => void;
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* → / ←: full motion plays forward (1×) or backward (2×) to the next / previous step (or chapter)
|
|
20
|
+
* boundary and pauses; resolves when the move ends or is interrupted. Reduced motion jumps.
|
|
21
|
+
*/
|
|
22
|
+
step: (dir: 1 | -1, chapters?: boolean) => Promise<void>;
|
|
23
|
+
/** The clock and mode now (the rendered `t` / `mode` can lag by a frame). */
|
|
24
|
+
now: () => number;
|
|
25
|
+
modeNow: () => Mode;
|
|
26
|
+
/** The running step move, if any. */
|
|
27
|
+
moving: () => {
|
|
28
|
+
dir: 1 | -1;
|
|
29
|
+
target: number;
|
|
30
|
+
} | null;
|
|
19
31
|
ungate: () => void;
|
|
20
32
|
/** Render synchronously at another time (for exporting a specific frame). */
|
|
21
33
|
frameAt: (t: number) => Frame;
|
|
@@ -20,6 +20,15 @@ export declare function counterValue(c: Timeline["counters"][string], t: number,
|
|
|
20
20
|
* for scrubbing, snapshots and beat sheets.
|
|
21
21
|
*/
|
|
22
22
|
export declare function storyState(scene: Scene, tl: Timeline | undefined, t: number, opts?: StateOptions): Frame;
|
|
23
|
+
/**
|
|
24
|
+
* The story's **beats**: consecutive step indices that read as one change. A step joins the next
|
|
25
|
+
* when the next starts with it (same `t0`), or is chained straight on ("+0", within 50 ms of this
|
|
26
|
+
* step's end) and either adds no chapter `stop` or caption of its own, or (without a `stop`)
|
|
27
|
+
* reveals the box this step's pulse arrives at. So a pulse and the reveal of its
|
|
28
|
+
* target are always one beat. One definition for step moves (→ / ←), stepped (reduced) playback,
|
|
29
|
+
* scrubber ticks and beat tiles (tiles may merge further to fit `MAX_BEATS`).
|
|
30
|
+
*/
|
|
31
|
+
export declare function beatGroups(tl: Timeline): number[][];
|
|
23
32
|
/** Time of a beat tile: after the step lands, before the next one moves. */
|
|
24
33
|
export interface Beat {
|
|
25
34
|
id: string;
|
|
@@ -66,3 +75,39 @@ export declare function steppedStop(tl: Timeline, t: number): number;
|
|
|
66
75
|
* Before the first step: 0. At or after the end: the duration (final frame).
|
|
67
76
|
*/
|
|
68
77
|
export declare function steppedTime(tl: Timeline, t: number): number;
|
|
78
|
+
/** Animated step moves (→ / ←): backward speed (story seconds per second) and the reverse ease (s). */
|
|
79
|
+
export declare const STEP_MOVE: {
|
|
80
|
+
readonly back: 2;
|
|
81
|
+
readonly ease: 0.12;
|
|
82
|
+
readonly minSpeed: 0.3;
|
|
83
|
+
};
|
|
84
|
+
/** The next boundary strictly past `from` in direction `dir` (0 and `duration` are the ends). */
|
|
85
|
+
export declare function stepBoundary(list: number[], from: number, dir: 1 | -1, duration: number): number;
|
|
86
|
+
/**
|
|
87
|
+
* Target of an animated step move. A press in the direction of a running move extends it to the
|
|
88
|
+
* following boundary; otherwise (no move, or the opposite direction) it heads to the boundary
|
|
89
|
+
* adjacent to `now`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function stepMoveTarget(list: number[], now: number, dir: 1 | -1, duration: number, current?: {
|
|
92
|
+
dir: 1 | -1;
|
|
93
|
+
target: number;
|
|
94
|
+
}): number;
|
|
95
|
+
/**
|
|
96
|
+
* Speed of a move at a moment: forward plays at 1×; backward at `STEP_MOVE.back`× with a short
|
|
97
|
+
* bounce-free ease in and out (never below `minSpeed` of full so it always arrives).
|
|
98
|
+
*/
|
|
99
|
+
export declare function stepMoveSpeed(dir: 1 | -1, elapsed: number, remaining: number): number;
|
|
100
|
+
/**
|
|
101
|
+
* Step-move boundaries: every beat's settled stop time, then the end. → / ← land on these, so a
|
|
102
|
+
* move includes a pulse and the reveal, highlight, counter and caption it causes.
|
|
103
|
+
*/
|
|
104
|
+
export declare function beatStops(tl: Timeline): number[];
|
|
105
|
+
/** Chapter boundaries (Shift+→ / ←): the settled stop of each beat holding a `stop`, and the end. */
|
|
106
|
+
export declare function beatChapters(tl: Timeline): number[];
|
|
107
|
+
/** Scrubber ticks: one per beat at its first step's start, labelled with its chapter stop if any. */
|
|
108
|
+
export declare function beatTicks(tl: Timeline): {
|
|
109
|
+
id: string;
|
|
110
|
+
t: number;
|
|
111
|
+
label: string;
|
|
112
|
+
stop?: string;
|
|
113
|
+
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.3.
|
|
1
|
+
export declare const VERSION = "0.3.4";
|