@glissade/scene 0.5.0-pre.4 → 0.5.0-pre.5

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/dist/index.d.ts CHANGED
@@ -80,11 +80,25 @@ interface EditMark {
80
80
  /** the full visible string AFTER this keystroke */
81
81
  value: string;
82
82
  }
83
+ /** One edit step's phrase boundary — for driving sibling UI (a counter chip, a
84
+ * progress dot) off the same source instead of recomputing wall-clock spans. */
85
+ interface StepMark {
86
+ /** index of the step in the edit script */
87
+ index: number;
88
+ /** time this step began (before its first keystroke) */
89
+ start: number;
90
+ /** time this step completed (after its last keystroke and its hold) */
91
+ end: number;
92
+ /** the full visible string after this step */
93
+ value: string;
94
+ }
83
95
  interface TypewriterResult {
84
96
  /** hold-key string track for the Text node's `<id>/text` target */
85
97
  track: Track<string>;
86
98
  /** every keystroke (insert + delete), for keystroke SFX */
87
99
  marks: EditMark[];
100
+ /** one entry per edit step, with its start/end times — phrase boundaries */
101
+ steps: StepMark[];
88
102
  /** time of the last keystroke or hold — the performance's end */
89
103
  duration: number;
90
104
  }
@@ -401,4 +415,4 @@ declare function bindScene(scene: Scene, doc: Timeline): BindingCacheEntry;
401
415
  */
402
416
  declare function evaluate(scene: Scene, doc: Timeline, t: number): DisplayList;
403
417
  //#endregion
404
- export { type AnchorSpec, type BindablePropTarget, type BlendMode, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, type DisplayList, type DisplayListBuilder, type DrawCommand, DuplicateNodeIdError, type EditMark, type EvalContext, type FilterSpec, FilterValidationError, FollowPath, type FollowPathProps, type FontSpec, Group, Highlight, type HighlightProps, type HitArea, IDENTITY, type ImageHandle, ImageNode, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type LineBox, type Mat2x3, Node, type NodeProps, type Paint, Path, type PathLike, type PathProps, type PathSampler, type PathSeg, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type Resource, type ResourceId, type RevealMark, type Scene, type SceneInit, type SceneModule, type ShaderCaps, ShaderEffect, type ShaderEffectProps, type ShaderRef, type ShapeProps, type StrokeStyle, Text, TextCursor, type TextCursorProps, type TextMeasurer, type TextMetricsLite, type TextProps, TokenHighlight, type TokenHighlightProps, TokenMatchError, type TokenRange, type TypeEdit, type TypewriterResult, Video, type VideoFrameSource, type VideoProps, type WordBox, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, filtersToCanvasFilter, followPath, fontString, fromTRS, getLayoutEngine, glow, highlight, invert, matEquals, matchTokenRun, motionPath, multiply, pathLength, pointAtLength, quantize, requireLayoutEngine, resolveAnchor, revealSchedule, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, textCursor, tokenHighlight, typewriter, validateFilters };
418
+ export { type AnchorSpec, type BindablePropTarget, type BlendMode, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, type DisplayList, type DisplayListBuilder, type DrawCommand, DuplicateNodeIdError, type EditMark, type EvalContext, type FilterSpec, FilterValidationError, FollowPath, type FollowPathProps, type FontSpec, Group, Highlight, type HighlightProps, type HitArea, IDENTITY, type ImageHandle, ImageNode, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type LineBox, type Mat2x3, Node, type NodeProps, type Paint, Path, type PathLike, type PathProps, type PathSampler, type PathSeg, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type Resource, type ResourceId, type RevealMark, type Scene, type SceneInit, type SceneModule, type ShaderCaps, ShaderEffect, type ShaderEffectProps, type ShaderRef, type ShapeProps, type StepMark, type StrokeStyle, Text, TextCursor, type TextCursorProps, type TextMeasurer, type TextMetricsLite, type TextProps, TokenHighlight, type TokenHighlightProps, TokenMatchError, type TokenRange, type TypeEdit, type TypewriterResult, Video, type VideoFrameSource, type VideoProps, type WordBox, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, filtersToCanvasFilter, followPath, fontString, fromTRS, getLayoutEngine, glow, highlight, invert, matEquals, matchTokenRun, motionPath, multiply, pathLength, pointAtLength, quantize, requireLayoutEngine, resolveAnchor, revealSchedule, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, textCursor, tokenHighlight, typewriter, validateFilters };
package/dist/index.js CHANGED
@@ -185,7 +185,10 @@ function typewriter(target, edits, opts = {}) {
185
185
  const shown = [];
186
186
  const keys = [key(start, "", { interp: "hold" })];
187
187
  const marks = [];
188
- for (const edit of edits) {
188
+ const steps = [];
189
+ for (let ei = 0; ei < edits.length; ei++) {
190
+ const edit = edits[ei];
191
+ const stepStart = t;
189
192
  const per = edit.perChar ?? globalPer;
190
193
  if (edit.type !== void 0) for (const g of segmentGraphemes(edit.type)) {
191
194
  t += per;
@@ -212,10 +215,17 @@ function typewriter(target, edits, opts = {}) {
212
215
  });
213
216
  }
214
217
  if (edit.hold !== void 0) t += edit.hold;
218
+ steps.push({
219
+ index: ei,
220
+ start: stepStart,
221
+ end: t,
222
+ value: shown.join("")
223
+ });
215
224
  }
216
225
  return {
217
226
  track: track(target, "string", keys),
218
227
  marks,
228
+ steps,
219
229
  duration: t
220
230
  };
221
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/scene",
3
- "version": "0.5.0-pre.4",
3
+ "version": "0.5.0-pre.5",
4
4
  "description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "yoga-layout": "^3.2.1",
23
- "@glissade/core": "0.5.0-pre.4"
23
+ "@glissade/core": "0.5.0-pre.5"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",