@glissade/scene 0.7.0 → 0.8.0-pre.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/dist/index.d.ts CHANGED
@@ -225,6 +225,70 @@ interface CacheColdResult {
225
225
  */
226
226
  declare function auditCacheCold(createScene: () => Scene, doc: Timeline, t: number): CacheColdResult;
227
227
  //#endregion
228
+ //#region src/assets.d.ts
229
+ /**
230
+ * Asset contracts (DESIGN.md §3.8): evaluate() never awaits — callers warm
231
+ * sources first (§2.5 readiness precondition), then emission is pure. The
232
+ * VideoFrameSource seam isolates decoder differences (WebCodecs vs FFmpeg);
233
+ * backends resolve asset ids to their own bitmap types.
234
+ */
235
+ interface VideoFrameSource {
236
+ /** Source duration in seconds. */
237
+ readonly duration: number;
238
+ /** Frames per second of the source grid (mediaT quantization). */
239
+ readonly fps: number;
240
+ /**
241
+ * Ensure getFrameSync can serve [fromT, toT] (seconds, media time).
242
+ * O(GOP) for backward/random seeks; a readiness latency, never state.
243
+ */
244
+ warm(fromT: number, toT: number): Promise<void>;
245
+ /**
246
+ * The decoded frame for the source-grid frame containing mediaT.
247
+ * Precondition: warmed. The return is backend-consumable (VideoFrame,
248
+ * ImageBitmap, HTMLCanvasElement, or a node Image) — opaque here.
249
+ */
250
+ getFrameSync(mediaT: number): unknown;
251
+ close(): void;
252
+ }
253
+ /** A decoded still image — opaque to scene/core, consumed by backends. */
254
+ type ImageHandle = unknown;
255
+ declare class ColdAssetError extends Error {
256
+ readonly assetId: string;
257
+ readonly detail: string;
258
+ /** Media time that was requested cold, when known — drives demand warming. */
259
+ readonly mediaT: number | undefined;
260
+ constructor(assetId: string, detail: string, mediaT?: number);
261
+ }
262
+ //#endregion
263
+ //#region src/renderBackend.d.ts
264
+ /** A filter kind the document layer can emit (mirrors `FilterSpec['kind']`). */
265
+ type FilterKind = FilterSpec['kind'];
266
+ /** Every filter kind the shared Raster2D interpreter rasterizes (§3.4). */
267
+ declare const ALL_FILTER_KINDS: ReadonlySet<FilterKind>;
268
+ /** What a backend can do — queried, never assumed (§3.4 capability negotiation). */
269
+ interface BackendCaps {
270
+ /** Filter kinds this backend rasterizes. */
271
+ readonly filters: ReadonlySet<FilterKind>;
272
+ /** Can it run a ShaderEffect pass (WebGPU)? Headless Skia: false. */
273
+ readonly shaders: boolean;
274
+ /** Largest texture/canvas dimension it will allocate. */
275
+ readonly maxTextureSize: number;
276
+ }
277
+ interface RenderBackend extends TextMeasurer {
278
+ readonly caps: BackendCaps;
279
+ render(list: DisplayList): void;
280
+ readPixels(): Promise<Uint8ClampedArray>;
281
+ /**
282
+ * Browser zero-copy encode path (§3.4): a decoded frame for VideoEncoder.
283
+ * Absent on headless backends. Typed `unknown` because `VideoFrame` is a DOM
284
+ * type and `@glissade/scene` carries no DOM lib — browser backends cast.
285
+ */
286
+ toVideoFrame?(timestampUs: number): unknown;
287
+ setImageAsset(assetId: string, image: unknown): void;
288
+ setVideoAsset(assetId: string, source: VideoFrameSource): void;
289
+ dispose(): void;
290
+ }
291
+ //#endregion
228
292
  //#region src/motionPath.d.ts
229
293
  /** An arc-length-parameterized sampler over a path. */
230
294
  interface PathSampler {
@@ -332,41 +396,6 @@ declare class TokenHighlight extends Node {
332
396
  */
333
397
  declare function tokenHighlight(text: Text, props: Omit<TokenHighlightProps, 'text'>): TokenHighlight;
334
398
  //#endregion
335
- //#region src/assets.d.ts
336
- /**
337
- * Asset contracts (DESIGN.md §3.8): evaluate() never awaits — callers warm
338
- * sources first (§2.5 readiness precondition), then emission is pure. The
339
- * VideoFrameSource seam isolates decoder differences (WebCodecs vs FFmpeg);
340
- * backends resolve asset ids to their own bitmap types.
341
- */
342
- interface VideoFrameSource {
343
- /** Source duration in seconds. */
344
- readonly duration: number;
345
- /** Frames per second of the source grid (mediaT quantization). */
346
- readonly fps: number;
347
- /**
348
- * Ensure getFrameSync can serve [fromT, toT] (seconds, media time).
349
- * O(GOP) for backward/random seeks; a readiness latency, never state.
350
- */
351
- warm(fromT: number, toT: number): Promise<void>;
352
- /**
353
- * The decoded frame for the source-grid frame containing mediaT.
354
- * Precondition: warmed. The return is backend-consumable (VideoFrame,
355
- * ImageBitmap, HTMLCanvasElement, or a node Image) — opaque here.
356
- */
357
- getFrameSync(mediaT: number): unknown;
358
- close(): void;
359
- }
360
- /** A decoded still image — opaque to scene/core, consumed by backends. */
361
- type ImageHandle = unknown;
362
- declare class ColdAssetError extends Error {
363
- readonly assetId: string;
364
- readonly detail: string;
365
- /** Media time that was requested cold, when known — drives demand warming. */
366
- readonly mediaT: number | undefined;
367
- constructor(assetId: string, detail: string, mediaT?: number);
368
- }
369
- //#endregion
370
399
  //#region src/shaderEffect.d.ts
371
400
  interface ShaderEffectProps extends NodeProps {
372
401
  children?: Node[];
@@ -474,4 +503,4 @@ declare class Raster2D<TCanvas extends CanvasLike, TPath extends PathLike, TDraw
474
503
  render(target: TCanvas, list: DisplayList): void;
475
504
  }
476
505
  //#endregion
477
- export { type AnchorSpec, type BindablePropTarget, type BlendMode, type CacheColdResult, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, DeterminismViolationError, type DisplayList, type DisplayListBuilder, type DrawCommand, type DrawOnEachOptions, type DrawOnOptions, DuplicateNodeIdError, type EditMark, type EvalContext, type FilterSpec, FilterValidationError, FollowPath, type FollowPathProps, type FontSpec, Group, type GuardMode, type HachureSpec, 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 Polyline, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type ResolvedSketch, type Resource, type ResourceId, type RevealMark, type Scene, type SceneInit, type SceneModule, type ShaderCaps, ShaderEffect, type ShaderEffectProps, type ShaderRef, type ShapeProps, type SketchStyle, SketchValidationError, 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, arcLength, auditCacheCold, bindScene, breakLines, createDisplayListBuilder, createScene, drawOn, drawOnEach, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, followPath, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, matEquals, matchTokenRun, motionPath, multiply, pathFromSegs, pathLength, pointAtLength, quantize, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, tokenHighlight, typewriter, validateFilters, validateHachure, validateSketch, withDeterminismGuards };
506
+ export { ALL_FILTER_KINDS, type AnchorSpec, type BackendCaps, type BindablePropTarget, type BlendMode, type CacheColdResult, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, DeterminismViolationError, type DisplayList, type DisplayListBuilder, type DrawCommand, type DrawOnEachOptions, type DrawOnOptions, DuplicateNodeIdError, type EditMark, type EvalContext, type FilterKind, type FilterSpec, FilterValidationError, FollowPath, type FollowPathProps, type FontSpec, Group, type GuardMode, type HachureSpec, 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 Polyline, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type RenderBackend, type ResolvedSketch, type Resource, type ResourceId, type RevealMark, type Scene, type SceneInit, type SceneModule, type ShaderCaps, ShaderEffect, type ShaderEffectProps, type ShaderRef, type ShapeProps, type SketchStyle, SketchValidationError, 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, arcLength, auditCacheCold, bindScene, breakLines, createDisplayListBuilder, createScene, drawOn, drawOnEach, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, followPath, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, matEquals, matchTokenRun, motionPath, multiply, pathFromSegs, pathLength, pointAtLength, quantize, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, tokenHighlight, typewriter, validateFilters, validateHachure, validateSketch, withDeterminismGuards };
package/dist/index.js CHANGED
@@ -482,6 +482,16 @@ function auditCacheCold(createScene, doc, t) {
482
482
  };
483
483
  }
484
484
  //#endregion
485
+ //#region src/renderBackend.ts
486
+ /** Every filter kind the shared Raster2D interpreter rasterizes (§3.4). */
487
+ const ALL_FILTER_KINDS = new Set([
488
+ "blur",
489
+ "drop-shadow",
490
+ "brightness",
491
+ "contrast",
492
+ "saturate"
493
+ ]);
494
+ //#endregion
485
495
  //#region src/motionPath.ts
486
496
  /**
487
497
  * Motion along a path: sample a point (and tangent) at an arc-length position on
@@ -1244,4 +1254,4 @@ var Raster2D = class {
1244
1254
  }
1245
1255
  };
1246
1256
  //#endregion
1247
- export { Circle, ColdAssetError, DeterminismViolationError, DuplicateNodeIdError, FilterValidationError, FollowPath, Group, Highlight, IDENTITY, ImageNode, LayoutEngineMissingError, Node, Path, Raster2D, Rect, ShaderEffect, SketchValidationError, Text, TextCursor, TokenHighlight, TokenMatchError, Video, applyToPoint, arcLength, auditCacheCold, bindScene, breakLines, createDisplayListBuilder, createScene, drawOn, drawOnEach, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, followPath, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, matEquals, matchTokenRun, motionPath, multiply, pathFromSegs, pathLength, pointAtLength, quantize, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, tokenHighlight, typewriter, validateFilters, validateHachure, validateSketch, withDeterminismGuards };
1257
+ export { ALL_FILTER_KINDS, Circle, ColdAssetError, DeterminismViolationError, DuplicateNodeIdError, FilterValidationError, FollowPath, Group, Highlight, IDENTITY, ImageNode, LayoutEngineMissingError, Node, Path, Raster2D, Rect, ShaderEffect, SketchValidationError, Text, TextCursor, TokenHighlight, TokenMatchError, Video, applyToPoint, arcLength, auditCacheCold, bindScene, breakLines, createDisplayListBuilder, createScene, drawOn, drawOnEach, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, followPath, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, matEquals, matchTokenRun, motionPath, multiply, pathFromSegs, pathLength, pointAtLength, quantize, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, tokenHighlight, typewriter, validateFilters, validateHachure, validateSketch, withDeterminismGuards };
@@ -113,6 +113,8 @@ interface ShaderRef {
113
113
  wgsl: string;
114
114
  /** Scalar uniforms, packed as f32 in SORTED KEY ORDER into the Uniforms struct. */
115
115
  uniforms: Record<string, number>;
116
+ /** Named texture inputs: binding name → image/video asset id (the source canvas is binding 0). Reserved for multi-input passes. */
117
+ textures?: Record<string, string>;
116
118
  }
117
119
  type DrawCommand = {
118
120
  op: 'save';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/scene",
3
- "version": "0.7.0",
3
+ "version": "0.8.0-pre.0",
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.7.0"
23
+ "@glissade/core": "0.8.0-pre.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",