@glissade/scene 0.1.0 → 0.2.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
@@ -1,4 +1,4 @@
1
- import { A as DisplayList, B as StrokeStyle, C as PropInit, D as estimatingMeasurer, E as breakLines, F as Paint, G as fromTRS, H as IDENTITY, I as PathSeg, K as matEquals, L as Rect$1, M as DrawCommand, N as FilterSpec, O as quantize, P as FontSpec, R as Resource, S as NodeProps, T as TextMetricsLite, U as Mat2x3, V as createDisplayListBuilder, W as applyToPoint, _ as Video, a as LayoutEngineMissingError, b as EvalContext, c as setLayoutEngine, d as ImageNode, f as ImageProps, g as TextProps, h as Text, i as LayoutEngine, j as DisplayListBuilder, k as BlendMode, l as Circle, m as ShapeProps, n as LayoutChildSpec, o as getLayoutEngine, p as Rect, q as multiply, r as LayoutContainerSpec, s as requireLayoutEngine, t as LayoutBox, u as Group, v as VideoProps, w as TextMeasurer, x as Node, y as BindablePropTarget, z as ResourceId } from "./layoutEngine.js";
1
+ import { A as BlendMode, B as ResourceId, C as NodeProps, D as breakLines, E as TextMetricsLite, F as FontSpec, G as applyToPoint, H as createDisplayListBuilder, I as Paint, J as matEquals, K as fromTRS, L as PathSeg, M as DisplayListBuilder, N as DrawCommand, O as estimatingMeasurer, P as FilterSpec, R as Rect$1, S as Node, T as TextMeasurer, U as IDENTITY, V as StrokeStyle, W as Mat2x3, Y as multiply, _ as Video, a as LayoutEngineMissingError, b as EvalContext, c as setLayoutEngine, d as ImageNode, f as ImageProps, g as TextProps, h as Text, i as LayoutEngine, j as DisplayList, k as quantize, l as Circle, m as ShapeProps, n as LayoutChildSpec, o as getLayoutEngine, p as Rect, q as invert, r as LayoutContainerSpec, s as requireLayoutEngine, t as LayoutBox, u as Group, v as VideoProps, w as PropInit, x as HitArea, y as BindablePropTarget, z as Resource } from "./layoutEngine.js";
2
2
  import { BoundTimeline, CompiledTimeline, Playhead, Timeline } from "@glissade/core";
3
3
 
4
4
  //#region src/assets.d.ts
@@ -86,4 +86,4 @@ declare function bindScene(scene: Scene, doc: Timeline): BindingCacheEntry;
86
86
  */
87
87
  declare function evaluate(scene: Scene, doc: Timeline, t: number): DisplayList;
88
88
  //#endregion
89
- export { type BindablePropTarget, type BlendMode, Circle, ColdAssetError, type DisplayList, type DisplayListBuilder, type DrawCommand, DuplicateNodeIdError, type EvalContext, type FilterSpec, type FontSpec, Group, IDENTITY, type ImageHandle, ImageNode, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type Mat2x3, Node, type NodeProps, type Paint, type PathSeg, type PropInit, Rect, type Rect$1 as RectShape, type Resource, type ResourceId, type Scene, type SceneInit, type SceneModule, type ShapeProps, type StrokeStyle, Text, type TextMeasurer, type TextMetricsLite, type TextProps, Video, type VideoFrameSource, type VideoProps, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, fromTRS, getLayoutEngine, matEquals, multiply, quantize, requireLayoutEngine, setLayoutEngine };
89
+ export { type BindablePropTarget, type BlendMode, Circle, ColdAssetError, type DisplayList, type DisplayListBuilder, type DrawCommand, DuplicateNodeIdError, type EvalContext, type FilterSpec, type FontSpec, Group, type HitArea, IDENTITY, type ImageHandle, ImageNode, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type Mat2x3, Node, type NodeProps, type Paint, type PathSeg, type PropInit, Rect, type Rect$1 as RectShape, type Resource, type ResourceId, type Scene, type SceneInit, type SceneModule, type ShapeProps, type StrokeStyle, Text, type TextMeasurer, type TextMetricsLite, type TextProps, Video, type VideoFrameSource, type VideoProps, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, fromTRS, getLayoutEngine, invert, matEquals, multiply, quantize, requireLayoutEngine, setLayoutEngine };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as applyToPoint, a as Circle, b as multiply, c as Rect, d as Node, f as breakLines, g as IDENTITY, h as createDisplayListBuilder, i as setLayoutEngine, l as Text, m as quantize, n as getLayoutEngine, o as Group, p as estimatingMeasurer, r as requireLayoutEngine, s as ImageNode, t as LayoutEngineMissingError, u as Video, v as fromTRS, y as matEquals } from "./layoutEngine.js";
1
+ import { _ as applyToPoint, a as Circle, b as matEquals, c as Rect, d as Node, f as breakLines, g as IDENTITY, h as createDisplayListBuilder, i as setLayoutEngine, l as Text, m as quantize, n as getLayoutEngine, o as Group, p as estimatingMeasurer, r as requireLayoutEngine, s as ImageNode, t as LayoutEngineMissingError, u as Video, v as fromTRS, x as multiply, y as invert } from "./layoutEngine.js";
2
2
  import { bindTimeline, compileTimeline, createPlayhead, evaluateAt } from "@glissade/core";
3
3
  //#region src/assets.ts
4
4
  var ColdAssetError = class extends Error {
@@ -99,4 +99,4 @@ function evaluate(scene, doc, t) {
99
99
  });
100
100
  }
101
101
  //#endregion
102
- export { Circle, ColdAssetError, DuplicateNodeIdError, Group, IDENTITY, ImageNode, LayoutEngineMissingError, Node, Rect, Text, Video, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, fromTRS, getLayoutEngine, matEquals, multiply, quantize, requireLayoutEngine, setLayoutEngine };
102
+ export { Circle, ColdAssetError, DuplicateNodeIdError, Group, IDENTITY, ImageNode, LayoutEngineMissingError, Node, Rect, Text, Video, applyToPoint, bindScene, breakLines, createDisplayListBuilder, createScene, estimatingMeasurer, evaluate, fromTRS, getLayoutEngine, invert, matEquals, multiply, quantize, requireLayoutEngine, setLayoutEngine };
package/dist/layout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as PropInit, S as NodeProps, a as LayoutEngineMissingError, b as EvalContext, c as setLayoutEngine, i as LayoutEngine, j as DisplayListBuilder, n as LayoutChildSpec, o as getLayoutEngine, r as LayoutContainerSpec, t as LayoutBox, u as Group, x as Node } from "./layoutEngine.js";
1
+ import { C as NodeProps, M as DisplayListBuilder, S as Node, a as LayoutEngineMissingError, b as EvalContext, c as setLayoutEngine, i as LayoutEngine, n as LayoutChildSpec, o as getLayoutEngine, r as LayoutContainerSpec, t as LayoutBox, u as Group, w as PropInit } from "./layoutEngine.js";
2
2
  import { BindableSignal } from "@glissade/core";
3
3
 
4
4
  //#region src/layout.d.ts
@@ -7,6 +7,8 @@ declare const IDENTITY: Mat2x3;
7
7
  declare function multiply(m1: Mat2x3, m2: Mat2x3): Mat2x3;
8
8
  /** Compose translate × rotate × scale (rotation in degrees). */
9
9
  declare function fromTRS(position: Vec2, rotationDeg: number, scale: Vec2): Mat2x3;
10
+ /** Inverse affine: [A | t]⁻¹ = [A⁻¹ | −A⁻¹t]; null when degenerate (det 0). */
11
+ declare function invert(m: Mat2x3): Mat2x3 | null;
10
12
  declare function applyToPoint(m: Mat2x3, p: Vec2): Vec2;
11
13
  declare function matEquals(a: Mat2x3, b: Mat2x3): boolean;
12
14
  //#endregion
@@ -172,6 +174,19 @@ interface BindablePropTarget {
172
174
  bindSource(fn: () => unknown): void;
173
175
  unbindSource(): void;
174
176
  }
177
+ /** Node-local hit-shape override (v2 §C.3) — fat targets for thin strokes. */
178
+ type HitArea = {
179
+ kind: 'rect';
180
+ x: number;
181
+ y: number;
182
+ w: number;
183
+ h: number;
184
+ } | {
185
+ kind: 'circle';
186
+ x: number;
187
+ y: number;
188
+ r: number;
189
+ };
175
190
  declare abstract class Node {
176
191
  readonly id: string | undefined;
177
192
  readonly position: Vec2Signal;
@@ -182,6 +197,12 @@ declare abstract class Node {
182
197
  readonly zIndex: BindableSignal<number>;
183
198
  readonly filters: BindableSignal<FilterSpec[]>;
184
199
  parent: Node | null;
200
+ /** v2 §C.3: participates in hit testing; set implicitly by attaching a listener. */
201
+ interactive: boolean;
202
+ /** v2 §C.3: false prunes this subtree from hit testing (PixiJS's flag). */
203
+ interactiveChildren: boolean;
204
+ /** v2 §C.3: explicit hit-shape override in node-local coordinates. */
205
+ hitArea: HitArea | undefined;
185
206
  readonly localMatrix: ReadonlySignal<Mat2x3>;
186
207
  readonly worldMatrix: ReadonlySignal<Mat2x3>;
187
208
  /** Track-target paths → bindable signals; subclasses register their own props. */
@@ -392,4 +413,4 @@ declare function setLayoutEngine(e: LayoutEngine): void;
392
413
  declare function getLayoutEngine(): LayoutEngine | null;
393
414
  declare function requireLayoutEngine(): LayoutEngine;
394
415
  //#endregion
395
- export { DisplayList as A, StrokeStyle as B, PropInit as C, estimatingMeasurer as D, breakLines as E, Paint as F, fromTRS as G, IDENTITY as H, PathSeg as I, matEquals as K, Rect$1 as L, DrawCommand as M, FilterSpec as N, quantize as O, FontSpec as P, Resource as R, NodeProps as S, TextMetricsLite as T, Mat2x3 as U, createDisplayListBuilder as V, applyToPoint as W, Video as _, LayoutEngineMissingError as a, EvalContext as b, setLayoutEngine as c, ImageNode as d, ImageProps as f, TextProps as g, Text as h, LayoutEngine as i, DisplayListBuilder as j, BlendMode as k, Circle as l, ShapeProps as m, LayoutChildSpec as n, getLayoutEngine as o, Rect as p, multiply as q, LayoutContainerSpec as r, requireLayoutEngine as s, LayoutBox as t, Group as u, VideoProps as v, TextMeasurer as w, Node as x, BindablePropTarget as y, ResourceId as z };
416
+ export { BlendMode as A, ResourceId as B, NodeProps as C, breakLines as D, TextMetricsLite as E, FontSpec as F, applyToPoint as G, createDisplayListBuilder as H, Paint as I, matEquals as J, fromTRS as K, PathSeg as L, DisplayListBuilder as M, DrawCommand as N, estimatingMeasurer as O, FilterSpec as P, Rect$1 as R, Node as S, TextMeasurer as T, IDENTITY as U, StrokeStyle as V, Mat2x3 as W, multiply as Y, Video as _, LayoutEngineMissingError as a, EvalContext as b, setLayoutEngine as c, ImageNode as d, ImageProps as f, TextProps as g, Text as h, LayoutEngine as i, DisplayList as j, quantize as k, Circle as l, ShapeProps as m, LayoutChildSpec as n, getLayoutEngine as o, Rect as p, invert as q, LayoutContainerSpec as r, requireLayoutEngine as s, LayoutBox as t, Group as u, VideoProps as v, PropInit as w, HitArea as x, BindablePropTarget as y, Resource as z };
@@ -36,6 +36,24 @@ function fromTRS(position, rotationDeg, scale) {
36
36
  z(position[1])
37
37
  ];
38
38
  }
39
+ /** Inverse affine: [A | t]⁻¹ = [A⁻¹ | −A⁻¹t]; null when degenerate (det 0). */
40
+ function invert(m) {
41
+ const [a, b, c, d, e, f] = m;
42
+ const det = a * d - b * c;
43
+ if (det === 0) return null;
44
+ const ia = d / det;
45
+ const ib = -b / det;
46
+ const ic = -c / det;
47
+ const id = a / det;
48
+ return [
49
+ z(ia),
50
+ z(ib),
51
+ z(ic),
52
+ z(id),
53
+ z(-(ia * e + ic * f)),
54
+ z(-(ib * e + id * f))
55
+ ];
56
+ }
39
57
  function applyToPoint(m, p) {
40
58
  return [m[0] * p[0] + m[2] * p[1] + m[4], m[1] * p[0] + m[3] * p[1] + m[5]];
41
59
  }
@@ -149,6 +167,12 @@ var Node = class {
149
167
  zIndex;
150
168
  filters;
151
169
  parent = null;
170
+ /** v2 §C.3: participates in hit testing; set implicitly by attaching a listener. */
171
+ interactive = false;
172
+ /** v2 §C.3: false prunes this subtree from hit testing (PixiJS's flag). */
173
+ interactiveChildren = true;
174
+ /** v2 §C.3: explicit hit-shape override in node-local coordinates. */
175
+ hitArea;
152
176
  localMatrix;
153
177
  worldMatrix;
154
178
  /** Track-target paths → bindable signals; subclasses register their own props. */
@@ -652,4 +676,4 @@ function requireLayoutEngine() {
652
676
  return engine;
653
677
  }
654
678
  //#endregion
655
- export { applyToPoint as _, Circle as a, multiply as b, Rect as c, Node as d, breakLines as f, IDENTITY as g, createDisplayListBuilder as h, setLayoutEngine as i, Text as l, quantize as m, getLayoutEngine as n, Group as o, estimatingMeasurer as p, requireLayoutEngine as r, ImageNode as s, LayoutEngineMissingError as t, Video as u, fromTRS as v, matEquals as y };
679
+ export { applyToPoint as _, Circle as a, matEquals as b, Rect as c, Node as d, breakLines as f, IDENTITY as g, createDisplayListBuilder as h, setLayoutEngine as i, Text as l, quantize as m, getLayoutEngine as n, Group as o, estimatingMeasurer as p, requireLayoutEngine as r, ImageNode as s, LayoutEngineMissingError as t, Video as u, fromTRS as v, multiply as x, invert as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/scene",
3
- "version": "0.1.0",
3
+ "version": "0.2.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.1.0"
23
+ "@glissade/core": "0.2.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",