@glissade/scene 0.10.0-pre.0 → 0.10.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.js +4 -4
- package/dist/layout.js +1 -0
- package/dist/layoutEngine.d.ts +15 -0
- package/dist/layoutEngine.js +20 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -371,8 +371,8 @@ function createScene(init) {
|
|
|
371
371
|
});
|
|
372
372
|
const nodes = /* @__PURE__ */ new Map();
|
|
373
373
|
const playhead = createPlayhead();
|
|
374
|
-
|
|
375
|
-
indexNodes(root, nodes, () => measurer ?? fallbackMeasurer());
|
|
374
|
+
const measurer = signal(null);
|
|
375
|
+
indexNodes(root, nodes, () => measurer() ?? fallbackMeasurer());
|
|
376
376
|
return {
|
|
377
377
|
root,
|
|
378
378
|
nodes,
|
|
@@ -384,10 +384,10 @@ function createScene(init) {
|
|
|
384
384
|
return nodes.get(target.slice(0, slash))?.resolveTarget(target.slice(slash + 1));
|
|
385
385
|
},
|
|
386
386
|
setTextMeasurer: (m) => {
|
|
387
|
-
measurer
|
|
387
|
+
measurer.set(m);
|
|
388
388
|
},
|
|
389
389
|
get textMeasurer() {
|
|
390
|
-
return measurer ?? fallbackMeasurer();
|
|
390
|
+
return measurer.peek() ?? fallbackMeasurer();
|
|
391
391
|
}
|
|
392
392
|
};
|
|
393
393
|
}
|
package/dist/layout.js
CHANGED
package/dist/layoutEngine.d.ts
CHANGED
|
@@ -287,6 +287,15 @@ interface NodeProps {
|
|
|
287
287
|
* (the cache key folds in the inherited device transform, so a stale CTM can
|
|
288
288
|
* never blit). OFF by default: a scene that never sets it emits ZERO extra
|
|
289
289
|
* groups and is byte-identical to before. Best for expensive STATIC subtrees.
|
|
290
|
+
*
|
|
291
|
+
* CAVEAT (when it does NOT help): the key folds in the inherited device
|
|
292
|
+
* transform, so a subtree that itself DRIFTS — e.g. animated on sub-pixel
|
|
293
|
+
* float positions — misses the cache every frame; cache a static subtree
|
|
294
|
+
* under a *moving parent*, not a subtree that moves itself. And a `filter`
|
|
295
|
+
* is a LIVE composite parameter applied on the blit, never baked into the
|
|
296
|
+
* cached bitmap, so `cache:true` on a filter-declaring (e.g. blurred) group
|
|
297
|
+
* does not cache the filter cost. For per-frame-cheap drift, prefer
|
|
298
|
+
* eliminating the work (a cheaper Paint/effect) over caching it.
|
|
290
299
|
*/
|
|
291
300
|
cache?: boolean;
|
|
292
301
|
}
|
|
@@ -476,11 +485,17 @@ declare function sketchStrokes(segs: readonly PathSeg[], style: SketchStyle, see
|
|
|
476
485
|
/** Rounded-rect path segments — Rect's outline, shared with Highlight. */
|
|
477
486
|
declare function roundedRectSegs(x: number, y: number, w: number, h: number, r: number): PathSeg[];
|
|
478
487
|
declare class Group extends Node {
|
|
488
|
+
#private;
|
|
479
489
|
readonly children: Node[];
|
|
480
490
|
constructor(props?: NodeProps & {
|
|
481
491
|
children?: Node[];
|
|
482
492
|
});
|
|
493
|
+
/** Record the structural version as a dependency — call inside a computed
|
|
494
|
+
* that walks `children` so add()/remove() invalidate it. */
|
|
495
|
+
protected trackStructure(): void;
|
|
483
496
|
add(child: Node): this;
|
|
497
|
+
/** Remove a child (the reactive counterpart to add()); no-op if absent. */
|
|
498
|
+
remove(child: Node): this;
|
|
484
499
|
protected draw(out: DisplayListBuilder, ctx: EvalContext): void;
|
|
485
500
|
}
|
|
486
501
|
interface ShapeProps extends NodeProps {
|
package/dist/layoutEngine.js
CHANGED
|
@@ -910,14 +910,34 @@ function roundedRectSegs(x, y, w, h, r) {
|
|
|
910
910
|
}
|
|
911
911
|
var Group = class extends Node {
|
|
912
912
|
children;
|
|
913
|
+
/** Version bumped on structural child mutation, so a dependency-tracked memo
|
|
914
|
+
* (e.g. Layout's computed) re-runs when the child SET changes — not only when
|
|
915
|
+
* a participating prop signal does. */
|
|
916
|
+
#structure = signal(0);
|
|
913
917
|
constructor(props = {}) {
|
|
914
918
|
super(props);
|
|
915
919
|
this.children = props.children ?? [];
|
|
916
920
|
for (const child of this.children) child.parent = this;
|
|
917
921
|
}
|
|
922
|
+
/** Record the structural version as a dependency — call inside a computed
|
|
923
|
+
* that walks `children` so add()/remove() invalidate it. */
|
|
924
|
+
trackStructure() {
|
|
925
|
+
this.#structure();
|
|
926
|
+
}
|
|
918
927
|
add(child) {
|
|
919
928
|
child.parent = this;
|
|
920
929
|
this.children.push(child);
|
|
930
|
+
this.#structure.set(this.#structure.peek() + 1);
|
|
931
|
+
return this;
|
|
932
|
+
}
|
|
933
|
+
/** Remove a child (the reactive counterpart to add()); no-op if absent. */
|
|
934
|
+
remove(child) {
|
|
935
|
+
const i = this.children.indexOf(child);
|
|
936
|
+
if (i >= 0) {
|
|
937
|
+
this.children.splice(i, 1);
|
|
938
|
+
if (child.parent === this) child.parent = null;
|
|
939
|
+
this.#structure.set(this.#structure.peek() + 1);
|
|
940
|
+
}
|
|
921
941
|
return this;
|
|
922
942
|
}
|
|
923
943
|
draw(out, ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/scene",
|
|
3
|
-
"version": "0.10.0
|
|
3
|
+
"version": "0.10.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.10.0
|
|
23
|
+
"@glissade/core": "0.10.0"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|