storyink 0.3.2 → 0.3.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.
@@ -10,6 +10,7 @@ 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,
@@ -50,7 +51,10 @@ import {
50
51
  simplify,
51
52
  simplifyError,
52
53
  stepAt,
54
+ stepBoundary,
53
55
  stepFocus,
56
+ stepMoveSpeed,
57
+ stepMoveTarget,
54
58
  steppedIndex,
55
59
  steppedSchedule,
56
60
  steppedStop,
@@ -62,7 +66,7 @@ import {
62
66
  validate,
63
67
  wirePath,
64
68
  wrap
65
- } from "../chunks/index-n3gf4fyb.js";
69
+ } from "../chunks/index-xmj21twd.js";
66
70
  export {
67
71
  ARROWS,
68
72
  CAMERA,
@@ -74,6 +78,7 @@ export {
74
78
  MESSAGE_KINDS,
75
79
  PARTICIPANT_KINDS,
76
80
  STEP_BEAT,
81
+ STEP_MOVE,
77
82
  STORY_MOTIONS,
78
83
  StoryinkError,
79
84
  VERSION,
@@ -113,7 +118,10 @@ export {
113
118
  simplify,
114
119
  simplifyError,
115
120
  stepAt,
121
+ stepBoundary,
116
122
  stepFocus,
123
+ stepMoveSpeed,
124
+ stepMoveTarget,
117
125
  steppedIndex,
118
126
  steppedSchedule,
119
127
  steppedStop,
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  snapshot,
9
9
  writeAnimatedSvg,
10
10
  writeDiagram
11
- } from "./chunks/index-5qmjsg8w.js";
11
+ } from "./chunks/index-wpcz893s.js";
12
12
  import {
13
13
  ARROWS,
14
14
  CAMERA,
@@ -20,6 +20,7 @@ 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,
@@ -60,7 +61,10 @@ import {
60
61
  simplify,
61
62
  simplifyError,
62
63
  stepAt,
64
+ stepBoundary,
63
65
  stepFocus,
66
+ stepMoveSpeed,
67
+ stepMoveTarget,
64
68
  steppedIndex,
65
69
  steppedSchedule,
66
70
  steppedStop,
@@ -72,7 +76,7 @@ import {
72
76
  validate,
73
77
  wirePath,
74
78
  wrap
75
- } from "./chunks/index-n3gf4fyb.js";
79
+ } from "./chunks/index-xmj21twd.js";
76
80
  // src/plugin.ts
77
81
  import fs2 from "node:fs";
78
82
  import path2 from "node:path";
@@ -373,6 +377,7 @@ export {
373
377
  PARTICIPANT_KINDS,
374
378
  PLUGIN_ID,
375
379
  STEP_BEAT,
380
+ STEP_MOVE,
376
381
  STORY_MOTIONS,
377
382
  StoryinkError,
378
383
  VERSION,
@@ -417,7 +422,10 @@ export {
417
422
  simplifyError,
418
423
  snapshot,
419
424
  stepAt,
425
+ stepBoundary,
420
426
  stepFocus,
427
+ stepMoveSpeed,
428
+ stepMoveTarget,
421
429
  steppedIndex,
422
430
  steppedSchedule,
423
431
  steppedStop,
@@ -10,8 +10,8 @@ import {
10
10
  snapshot,
11
11
  writeAnimatedSvg,
12
12
  writeDiagram
13
- } from "../chunks/index-5qmjsg8w.js";
14
- import"../chunks/index-n3gf4fyb.js";
13
+ } from "../chunks/index-wpcz893s.js";
14
+ import"../chunks/index-xmj21twd.js";
15
15
  export {
16
16
  browserVersion,
17
17
  findBrowser,
@@ -10,7 +10,7 @@ export { renderSvg, renderHtml, toScene, fontCss, StoryinkError, type SvgOptions
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, 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";
@@ -15,7 +15,19 @@ export interface StoryControls {
15
15
  toggle: () => void;
16
16
  seek: (t: number) => void;
17
17
  replay: () => void;
18
- step: (dir: 1 | -1, chapters?: boolean) => void;
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;
@@ -66,3 +66,25 @@ export declare function steppedStop(tl: Timeline, t: number): number;
66
66
  * Before the first step: 0. At or after the end: the duration (final frame).
67
67
  */
68
68
  export declare function steppedTime(tl: Timeline, t: number): number;
69
+ /** Animated step moves (→ / ←): backward speed (story seconds per second) and the reverse ease (s). */
70
+ export declare const STEP_MOVE: {
71
+ readonly back: 2;
72
+ readonly ease: 0.12;
73
+ readonly minSpeed: 0.3;
74
+ };
75
+ /** The next boundary strictly past `from` in direction `dir` (0 and `duration` are the ends). */
76
+ export declare function stepBoundary(list: number[], from: number, dir: 1 | -1, duration: number): number;
77
+ /**
78
+ * Target of an animated step move. A press in the direction of a running move extends it to the
79
+ * following boundary; otherwise (no move, or the opposite direction) it heads to the boundary
80
+ * adjacent to `now`.
81
+ */
82
+ export declare function stepMoveTarget(list: number[], now: number, dir: 1 | -1, duration: number, current?: {
83
+ dir: 1 | -1;
84
+ target: number;
85
+ }): number;
86
+ /**
87
+ * Speed of a move at a moment: forward plays at 1×; backward at `STEP_MOVE.back`× with a short
88
+ * bounce-free ease in and out (never below `minSpeed` of full so it always arrives).
89
+ */
90
+ export declare function stepMoveSpeed(dir: 1 | -1, elapsed: number, remaining: number): number;
@@ -1 +1 @@
1
- export declare const VERSION = "0.3.2";
1
+ export declare const VERSION = "0.3.3";