@glissade/scene 0.20.0 → 0.20.1
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/describe.js +4 -5
- package/dist/diagnostics.js +1 -1
- package/dist/grid.d.ts +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/layoutCtors.d.ts +1 -1
- package/dist/layoutCtors.js +3 -2
- package/dist/motion.d.ts +1 -1
- package/dist/nodes.d.ts +28 -1
- package/dist/nodes.js +172 -8
- package/dist/scene.d.ts +1 -1
- package/dist/scene.js +1 -2
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.js +1 -1
- package/dist/type.d.ts +1 -1
- package/dist/type.js +6 -1
- package/package.json +2 -2
- package/dist/constructionProps.js +0 -82
package/dist/describe.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as Path, c as Video, i as ImageNode, o as Rect, r as Group, s as Text, t as Circle } from "./nodes.js";
|
|
2
|
-
import { n as NODE_CONSTRUCTION_PROP_NAMES, t as BASE_CONSTRUCTION_PROP_NAMES } from "./constructionProps.js";
|
|
1
|
+
import { _ as NODE_CONSTRUCTION_PROP_NAMES, a as Path, c as Video, g as BASE_CONSTRUCTION_PROP_NAMES, i as ImageNode, o as Rect, r as Group, s as Text, t as Circle } from "./nodes.js";
|
|
3
2
|
import { easings, listValueTypes } from "@glissade/core";
|
|
4
3
|
//#region src/describe.ts
|
|
5
4
|
/**
|
|
@@ -23,7 +22,7 @@ import { easings, listValueTypes } from "@glissade/core";
|
|
|
23
22
|
* never pulled onto the base embed path — a scene that never calls `describe()`
|
|
24
23
|
* pays zero bytes for it.
|
|
25
24
|
*/
|
|
26
|
-
const RAW_VERSION = "0.20.
|
|
25
|
+
const RAW_VERSION = "0.20.1";
|
|
27
26
|
const PACKAGE_VERSION = RAW_VERSION.includes("GLISSADE_".concat("VERSION")) ? "0.0.0-dev" : RAW_VERSION;
|
|
28
27
|
/** Arity of a value type's numeric repr: vec2/vec2-arc → 2, number → 1; others (color/paint/path/string/boolean) carry no scalar arity. */
|
|
29
28
|
function arityOf(type) {
|
|
@@ -328,9 +327,9 @@ const HELPERS = [
|
|
|
328
327
|
},
|
|
329
328
|
{
|
|
330
329
|
name: "splitText",
|
|
331
|
-
summary: "Split a Text node into per-word / per-
|
|
330
|
+
summary: "Split a Text node into per-word / per-line / per-grapheme parts you can animate individually (kinetic typography). Pass { measurer } (or call setTextMeasurer first) so part geometry uses the real backend, not the estimating fallback. Tree-shaken off the base scene index.",
|
|
332
331
|
import: "@glissade/scene/type",
|
|
333
|
-
usage: "splitText(text: Text, opts?: { by?: 'word'|'
|
|
332
|
+
usage: "splitText(text: Text | TextProps, opts?: { by?: 'word'|'line'|'grapheme', id?: string, measurer?: TextMeasurer }): { node: Group, children: Text[], parts: SplitPart[], targets(prop): string[] }"
|
|
334
333
|
},
|
|
335
334
|
{
|
|
336
335
|
name: "Grid",
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as collapseReplacer, V as createDisplayListBuilder, r as Group } from "./nodes.js";
|
|
2
2
|
import { a as evaluate } from "./scene.js";
|
|
3
3
|
//#region src/displayDiff.ts
|
|
4
4
|
/** A flat, stable JSON value for one command with its resource ids INLINED to content. */
|
package/dist/grid.d.ts
CHANGED
package/dist/identity.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as Mat2x3, D as matEquals, E as invert, O as multiply, S as IDENTITY, T as fromTRS, _ as StrokeStyle, a as FilterSpec, b as glow, c as MeshInterpolation, d as Paint, f as PathSeg, g as ShaderRef, h as ResourceId, i as DrawCommand, l as MeshPaint, m as Resource, n as DisplayList, o as FilterValidationError, p as Rect$1, r as DisplayListBuilder, s as FontSpec, t as BlendMode, u as MeshPoint, v as createDisplayListBuilder, w as applyToPoint, x as validateFilters, y as filtersToCanvasFilter } from "./displayList.js";
|
|
2
2
|
import { t as collapseReplacer } from "./collapseReplacer.js";
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as segmentWords, A as resolveSketch, B as NodeConstructionError, C as Polyline, D as arcLength, E as SketchValidationError, F as AnchorSpec, G as TextMeasurer, H as PropInit, I as BindablePropTarget, J as breakLines, K as TextMetricsLite, L as EvalContext, M as sketchStrokes, N as validateHachure, O as flatten, P as validateSketch, Q as segmentGraphemes, R as HitArea, S as HachureSpec, T as SketchStyle, U as resolveAnchor, V as NodeProps, W as MEASURE_QUANTUM_PX, X as isEstimatingMeasurer, Y as estimatingMeasurer, Z as quantize, _ as WordBox, a as ImageNode, b as revealSchedule, c as Path, d as RevealMark, et as setDefaultMeasurer, f as ShapeProps, g as VideoProps, h as Video, i as Group, j as roughen, k as hachureLines, l as PathProps, m as TextProps, n as Custom, o as ImageProps, p as Text, q as __resetEstimateWarnings, r as GraphemeBox, s as LineBox, t as Circle, u as Rect, v as coercePathData, w as ResolvedSketch, x as roundedRectSegs, y as pathFromSegs, z as Node } from "./nodes.js";
|
|
4
4
|
import { a as SceneModule, c as evaluate, i as SceneInit, n as ReservedNodeIdError, o as bindScene, r as Scene, s as createScene, t as DuplicateNodeIdError } from "./scene.js";
|
|
5
5
|
import { a as LayoutEngineMissingError, c as requireLayoutEngine, i as LayoutEngine, l as setLayoutEngine, n as LayoutChildSpec, r as LayoutContainerSpec, s as getLayoutEngine, t as LayoutBox } from "./layoutEngine.js";
|
|
6
6
|
import { BindableSignal, CoverageReport, EaseSpec, FontMode, FontUsage, MeshPaint as MeshPaint$1, Rng, Timeline, Track } from "@glissade/core";
|
|
@@ -619,4 +619,4 @@ declare function meshRasterSize(bw: number, bh: number): {
|
|
|
619
619
|
h: number;
|
|
620
620
|
};
|
|
621
621
|
//#endregion
|
|
622
|
-
export { ALL_FILTER_KINDS, type AnchorSpec, type BackendCaps, type BindablePropTarget, type BlendMode, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, Custom, DeterminismViolationError, type DisplayList, type DisplayListBuilder, type DrawCommand, type DrawOnEachOptions, type DrawOnOptions, DuplicateNodeIdError, type EachBox, type EachContext, type EachDistribute, EachError, type EachLayout, type EachMotion, type EachOpts, type EachResult, type EditMark, type EvalContext, type FilterKind, type FilterSpec, FilterValidationError, type FontByteLoader, type FontSpec, type GraphemeBox, Group, type GuardMode, type HachureSpec, Highlight, type HighlightProps, type HitArea, IDENTITY, ImageNode as Image, ImageNode, type ImageDataLike, type ImageHandle, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type LineBox, MEASURE_QUANTUM_PX, MESH_DOWNSCALE, MESH_SHEPARD_POWER, MESH_SIGMA, type Mat2x3, type MeshInterpolation, type MeshPaint, type MeshPoint, NODE_TAXONOMY, Node, type NodeProps, type NodeTypeName, type Paint, Path, type PathLike, type PathProps, type PathSeg, type Place, type Polyline, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type RenderBackend, ReservedNodeIdError, 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, type TypeEdit, type TypewriterResult, type ValidateSceneFontsOptions, Video, type VideoFrameSource, type VideoProps, type WordBox, __resetEstimateWarnings, applyToPoint, arcLength, bindScene, breakLines, coercePathData, collapseReplacer, collectLocalizedTextUsages, collectTextUsages, createDisplayListBuilder, createScene, drawOn, drawOnEach, each, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, isEstimatingMeasurer, matEquals, meshRasterSize, multiply, pathFromSegs, quantize, rasterizeMesh, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, typewriter, validateFilters, validateHachure, validateSceneFonts, validateSketch, withDeterminismGuards };
|
|
622
|
+
export { ALL_FILTER_KINDS, type AnchorSpec, type BackendCaps, type BindablePropTarget, type BlendMode, type CanvasLike, Circle, ColdAssetError, type Ctx2DLike, Custom, DeterminismViolationError, type DisplayList, type DisplayListBuilder, type DrawCommand, type DrawOnEachOptions, type DrawOnOptions, DuplicateNodeIdError, type EachBox, type EachContext, type EachDistribute, EachError, type EachLayout, type EachMotion, type EachOpts, type EachResult, type EditMark, type EvalContext, type FilterKind, type FilterSpec, FilterValidationError, type FontByteLoader, type FontSpec, type GraphemeBox, Group, type GuardMode, type HachureSpec, Highlight, type HighlightProps, type HitArea, IDENTITY, ImageNode as Image, ImageNode, type ImageDataLike, type ImageHandle, type ImageProps, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, type LineBox, MEASURE_QUANTUM_PX, MESH_DOWNSCALE, MESH_SHEPARD_POWER, MESH_SIGMA, type Mat2x3, type MeshInterpolation, type MeshPaint, type MeshPoint, NODE_TAXONOMY, Node, NodeConstructionError, type NodeProps, type NodeTypeName, type Paint, Path, type PathLike, type PathProps, type PathSeg, type Place, type Polyline, type PropInit, Raster2D, type Raster2DHost, Rect, type Rect$1 as RectShape, type RenderBackend, ReservedNodeIdError, 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, type TypeEdit, type TypewriterResult, type ValidateSceneFontsOptions, Video, type VideoFrameSource, type VideoProps, type WordBox, __resetEstimateWarnings, applyToPoint, arcLength, bindScene, breakLines, coercePathData, collapseReplacer, collectLocalizedTextUsages, collectTextUsages, createDisplayListBuilder, createScene, drawOn, drawOnEach, each, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, isEstimatingMeasurer, matEquals, meshRasterSize, multiply, pathFromSegs, quantize, rasterizeMesh, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, typewriter, validateFilters, validateHachure, validateSceneFonts, validateSketch, withDeterminismGuards };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as SketchValidationError, B as FilterValidationError, D as segmentWords, E as segmentGraphemes, F as resolveSketch, G as collapseReplacer, H as filtersToCanvasFilter, I as roughen, J as fromTRS, K as IDENTITY, L as sketchStrokes, M as flatten, N as hachureLines, O as setDefaultMeasurer, P as hashStr, R as validateHachure, S as estimatingMeasurer, T as quantize, U as glow, V as createDisplayListBuilder, W as validateFilters, X as matEquals, Y as invert, Z as multiply, a as Path, b as __resetEstimateWarnings, c as Video, d as revealSchedule, f as roundedRectSegs, h as resolveAnchor, i as ImageNode, j as arcLength, l as coercePathData, m as NodeConstructionError, n as Custom, o as Rect, p as Node, q as applyToPoint, r as Group, s as Text, t as Circle, u as pathFromSegs, w as isEstimatingMeasurer, x as breakLines, y as MEASURE_QUANTUM_PX, z as validateSketch } from "./nodes.js";
|
|
2
2
|
import { a as evaluate, i as createScene, n as ReservedNodeIdError, r as bindScene, t as DuplicateNodeIdError } from "./scene.js";
|
|
3
3
|
import { i as setLayoutEngine, n as getLayoutEngine, r as requireLayoutEngine, t as LayoutEngineMissingError } from "./layoutEngine.js";
|
|
4
4
|
import { buildFontRegistry, emitDevWarning, key, lerpColor, oklabToRgba, parseCmap, parseColor, random, rgbaToOklab, signal, stagger, track, validateFonts } from "@glissade/core";
|
|
@@ -1353,4 +1353,4 @@ var Raster2D = class {
|
|
|
1353
1353
|
}
|
|
1354
1354
|
};
|
|
1355
1355
|
//#endregion
|
|
1356
|
-
export { ALL_FILTER_KINDS, Circle, ColdAssetError, Custom, DeterminismViolationError, DuplicateNodeIdError, EachError, FilterValidationError, Group, Highlight, IDENTITY, ImageNode as Image, ImageNode, LayoutEngineMissingError, MEASURE_QUANTUM_PX, MESH_DOWNSCALE, MESH_SHEPARD_POWER, MESH_SIGMA, NODE_TAXONOMY, Node, Path, Raster2D, Rect, ReservedNodeIdError, ShaderEffect, SketchValidationError, Text, TextCursor, Video, __resetEstimateWarnings, applyToPoint, arcLength, bindScene, breakLines, coercePathData, collapseReplacer, collectLocalizedTextUsages, collectTextUsages, createDisplayListBuilder, createScene, drawOn, drawOnEach, each, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, isEstimatingMeasurer, matEquals, meshRasterSize, multiply, pathFromSegs, quantize, rasterizeMesh, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, typewriter, validateFilters, validateHachure, validateSceneFonts, validateSketch, withDeterminismGuards };
|
|
1356
|
+
export { ALL_FILTER_KINDS, Circle, ColdAssetError, Custom, DeterminismViolationError, DuplicateNodeIdError, EachError, FilterValidationError, Group, Highlight, IDENTITY, ImageNode as Image, ImageNode, LayoutEngineMissingError, MEASURE_QUANTUM_PX, MESH_DOWNSCALE, MESH_SHEPARD_POWER, MESH_SIGMA, NODE_TAXONOMY, Node, NodeConstructionError, Path, Raster2D, Rect, ReservedNodeIdError, ShaderEffect, SketchValidationError, Text, TextCursor, Video, __resetEstimateWarnings, applyToPoint, arcLength, bindScene, breakLines, coercePathData, collapseReplacer, collectLocalizedTextUsages, collectTextUsages, createDisplayListBuilder, createScene, drawOn, drawOnEach, each, estimatingMeasurer, evaluate, filtersToCanvasFilter, flatten, fontString, fromTRS, getLayoutEngine, glow, hachureLines, highlight, invert, isEstimatingMeasurer, matEquals, meshRasterSize, multiply, pathFromSegs, quantize, rasterizeMesh, requireLayoutEngine, resolveAnchor, resolveSketch, revealSchedule, roughen, roundedRectSegs, segmentGraphemes, segmentWords, setDefaultMeasurer, setLayoutEngine, sketchStrokes, textCursor, typewriter, validateFilters, validateHachure, validateSceneFonts, validateSketch, withDeterminismGuards };
|
package/dist/layoutCtors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as DisplayListBuilder } from "./displayList.js";
|
|
2
|
-
import {
|
|
2
|
+
import { G as TextMeasurer, H as PropInit, L as EvalContext, V as NodeProps, i as Group, z as Node } from "./nodes.js";
|
|
3
3
|
import { r as LayoutContainerSpec } from "./layoutEngine.js";
|
|
4
4
|
import { BindableSignal } from "@glissade/core";
|
|
5
5
|
|
package/dist/layoutCtors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as fallbackMeasurer, r as Group } from "./nodes.js";
|
|
2
2
|
import { r as requireLayoutEngine } from "./layoutEngine.js";
|
|
3
3
|
import { computed, signal } from "@glissade/core";
|
|
4
4
|
//#region src/layoutCtors.ts
|
|
@@ -30,7 +30,7 @@ import { computed, signal } from "@glissade/core";
|
|
|
30
30
|
* BEFORE the flow — their dominant use is backgrounds. Flowed paint order is
|
|
31
31
|
* zIndex-sorted; flow order is array order.
|
|
32
32
|
*/
|
|
33
|
-
var Layout = class extends Group {
|
|
33
|
+
var Layout = class Layout extends Group {
|
|
34
34
|
/** CLI/host detection marker — avoids importing this entry just to instanceof. */
|
|
35
35
|
static isLayoutNode = true;
|
|
36
36
|
/**
|
|
@@ -77,6 +77,7 @@ var Layout = class extends Group {
|
|
|
77
77
|
this.registerTarget("height", this.height, "number");
|
|
78
78
|
this.registerTarget("gap", this.gap, "number");
|
|
79
79
|
this.registerTarget("padding", this.padding, "number");
|
|
80
|
+
if (new.target === Layout) this.checkProps(props);
|
|
80
81
|
}
|
|
81
82
|
intrinsicSize(measurer) {
|
|
82
83
|
if (!this.autoWidth && !this.autoHeight) return {
|
package/dist/motion.d.ts
CHANGED
package/dist/nodes.d.ts
CHANGED
|
@@ -150,6 +150,15 @@ type HitArea = {
|
|
|
150
150
|
y: number;
|
|
151
151
|
r: number;
|
|
152
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* Thrown by a node constructor when it's passed an unknown prop key (the
|
|
155
|
+
* construction-time sibling of the timeline builder's `TimelineValidationError`).
|
|
156
|
+
* Names the offending key(s), the node type, and the valid props. See
|
|
157
|
+
* {@link Node.checkProps}.
|
|
158
|
+
*/
|
|
159
|
+
declare class NodeConstructionError extends Error {
|
|
160
|
+
constructor(message: string);
|
|
161
|
+
}
|
|
153
162
|
declare abstract class Node {
|
|
154
163
|
#private;
|
|
155
164
|
readonly id: string | undefined;
|
|
@@ -221,6 +230,24 @@ declare abstract class Node {
|
|
|
221
230
|
path: string;
|
|
222
231
|
expects: ValueTypeId | readonly ValueTypeId[] | undefined;
|
|
223
232
|
}[];
|
|
233
|
+
/**
|
|
234
|
+
* Fail-loud guard against UNKNOWN construction props — the sibling of the
|
|
235
|
+
* timeline builder's unknown-option guard (`to(…, { eaze })` throws). Without
|
|
236
|
+
* it a node silently drops a misnamed prop: `new Rect({ size:[80,80] })` keeps
|
|
237
|
+
* width/height at 0 → an invisible node, no warning (a real footgun the docs
|
|
238
|
+
* even shipped). Each BUILT-IN node calls this at the END of its constructor,
|
|
239
|
+
* guarded by `new.target === <ThisClass>` so it runs ONLY for the exact leaf
|
|
240
|
+
* type (an intermediate base like `Group` skips it when a `Layout` is being
|
|
241
|
+
* constructed — `Layout` validates itself with its own fuller target set; and
|
|
242
|
+
* user `Custom`/external subclasses, whose `new.target` matches no built-in,
|
|
243
|
+
* are never validated, keeping that extension seam lenient).
|
|
244
|
+
*
|
|
245
|
+
* The allow-list is {@link acceptedConstructionKeys} — built from the live
|
|
246
|
+
* `registerTarget` set + the construction-prop name sets, so it can't drift
|
|
247
|
+
* from what the constructors actually honor. Must be called after the leaf has
|
|
248
|
+
* registered all its targets (i.e. last), so the animatable keys are present.
|
|
249
|
+
*/
|
|
250
|
+
protected checkProps(props: object): void;
|
|
224
251
|
/** Subclass drawing: emit own commands (and children for containers). */
|
|
225
252
|
protected abstract draw(out: DisplayListBuilder, ctx: EvalContext): void;
|
|
226
253
|
/**
|
|
@@ -795,4 +822,4 @@ interface RevealMark {
|
|
|
795
822
|
*/
|
|
796
823
|
declare function revealSchedule(text: Text, reveal: Track<number>, measurer?: TextMeasurer): RevealMark[];
|
|
797
824
|
//#endregion
|
|
798
|
-
export {
|
|
825
|
+
export { segmentWords as $, resolveSketch as A, NodeConstructionError as B, Polyline as C, arcLength as D, SketchValidationError as E, AnchorSpec as F, TextMeasurer as G, PropInit as H, BindablePropTarget as I, breakLines as J, TextMetricsLite as K, EvalContext as L, sketchStrokes as M, validateHachure as N, flatten as O, validateSketch as P, segmentGraphemes as Q, HitArea as R, HachureSpec as S, SketchStyle as T, resolveAnchor as U, NodeProps as V, MEASURE_QUANTUM_PX as W, isEstimatingMeasurer as X, estimatingMeasurer as Y, quantize as Z, WordBox as _, ImageNode as a, revealSchedule as b, Path as c, RevealMark as d, setDefaultMeasurer as et, ShapeProps as f, VideoProps as g, Video as h, Group as i, roughen as j, hachureLines as k, PathProps as l, TextProps as m, Custom as n, ImageProps as o, Text as p, __resetEstimateWarnings as q, GraphemeBox as r, LineBox as s, Circle as t, Rect as u, coercePathData as v, ResolvedSketch as w, roundedRectSegs as x, pathFromSegs as y, Node as z };
|
package/dist/nodes.js
CHANGED
|
@@ -669,6 +669,125 @@ function breakLines(text, font, maxWidth, measurer) {
|
|
|
669
669
|
return lines;
|
|
670
670
|
}
|
|
671
671
|
//#endregion
|
|
672
|
+
//#region src/constructionProps.ts
|
|
673
|
+
/**
|
|
674
|
+
* The SLIM construction-prop NAME set (0.20) — the embed-path-safe half of the
|
|
675
|
+
* describe() schema. A construction prop (`animatable: false`) is passed to a
|
|
676
|
+
* node's constructor and is NEVER a track target; binding one is rejected.
|
|
677
|
+
*
|
|
678
|
+
* This module carries ONLY the per-node-type set of construction-prop NAMES
|
|
679
|
+
* (plus the shared base set), nothing else — no value types, no `required`
|
|
680
|
+
* flags, no manifest scaffolding. That keeps it tiny: it rides on the
|
|
681
|
+
* embed/bind path (the bind guard imports it to turn a generic UnboundTarget
|
|
682
|
+
* into a friendlier "that's a construction prop" message), so it must stay
|
|
683
|
+
* byte-cheap. `describe.ts` imports the SAME sets and layers its richer
|
|
684
|
+
* per-prop metadata (type/required) on top, so the manifest and this lookup
|
|
685
|
+
* can't drift.
|
|
686
|
+
*/
|
|
687
|
+
/**
|
|
688
|
+
* Base `NodeProps` construction-prop names shared by EVERY node — set once at
|
|
689
|
+
* `new Node({...})`, never animatable (none is a registered target).
|
|
690
|
+
*/
|
|
691
|
+
const BASE_CONSTRUCTION_PROP_NAMES = [
|
|
692
|
+
"id",
|
|
693
|
+
"blend",
|
|
694
|
+
"filters",
|
|
695
|
+
"anchor",
|
|
696
|
+
"cache"
|
|
697
|
+
];
|
|
698
|
+
/**
|
|
699
|
+
* Each built-in node's OWN construction-prop names (the base set is merged in
|
|
700
|
+
* separately, via {@link isConstructionProp}). Keyed by the describe TYPE NAME
|
|
701
|
+
* (e.g. `Image`, not the `ImageNode` class name).
|
|
702
|
+
*/
|
|
703
|
+
const SKETCH = [
|
|
704
|
+
"sketch",
|
|
705
|
+
"sketchFill",
|
|
706
|
+
"sketchSeed"
|
|
707
|
+
];
|
|
708
|
+
const LAYOUT = [
|
|
709
|
+
"direction",
|
|
710
|
+
"justify",
|
|
711
|
+
"align",
|
|
712
|
+
"children"
|
|
713
|
+
];
|
|
714
|
+
const NODE_CONSTRUCTION_PROP_NAMES = {
|
|
715
|
+
Group: ["children"],
|
|
716
|
+
Rect: SKETCH,
|
|
717
|
+
Circle: SKETCH,
|
|
718
|
+
Path: SKETCH,
|
|
719
|
+
Text: [
|
|
720
|
+
"fontFamily",
|
|
721
|
+
"fontWeight",
|
|
722
|
+
"fontStyle",
|
|
723
|
+
"align",
|
|
724
|
+
"lineHeight",
|
|
725
|
+
"fontVariationSettings"
|
|
726
|
+
],
|
|
727
|
+
Image: ["assetId"],
|
|
728
|
+
Video: [
|
|
729
|
+
"assetId",
|
|
730
|
+
"at",
|
|
731
|
+
"trimStart",
|
|
732
|
+
"playbackRate",
|
|
733
|
+
"clipDuration",
|
|
734
|
+
"sourceFps"
|
|
735
|
+
],
|
|
736
|
+
Layout: LAYOUT,
|
|
737
|
+
Stack: LAYOUT,
|
|
738
|
+
Row: LAYOUT,
|
|
739
|
+
Column: LAYOUT
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* Is `prop` a KNOWN construction-only prop for a node of describe-type
|
|
743
|
+
* `typeName`? True for the shared base set or that type's own set. Used by the
|
|
744
|
+
* bind guard to special-case the unbound-target error: a construction prop gets
|
|
745
|
+
* a "set it at construction" message instead of the generic one.
|
|
746
|
+
*/
|
|
747
|
+
function isConstructionProp(typeName, prop) {
|
|
748
|
+
if (BASE_CONSTRUCTION_PROP_NAMES.includes(prop)) return true;
|
|
749
|
+
const own = NODE_CONSTRUCTION_PROP_NAMES[typeName];
|
|
750
|
+
return own !== void 0 && own.includes(prop);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Construction keys that are NEITHER a construction-prop name NOR the same-named
|
|
754
|
+
* animatable target — so the `acceptedConstructionKeys` union below would miss
|
|
755
|
+
* them and the constructor guard would false-positive. Today this is ONLY
|
|
756
|
+
* `Path`: you construct it with `{ data }`, but its animatable target is
|
|
757
|
+
* registered as `d` (so `d` is in the target set, `data` is in neither). Without
|
|
758
|
+
* this alias `new Path({ data })` would wrongly throw.
|
|
759
|
+
*/
|
|
760
|
+
const CONSTRUCTION_KEY_ALIASES = { Path: ["data"] };
|
|
761
|
+
/**
|
|
762
|
+
* The FULL set of prop keys a node of describe-type `typeName` accepts at
|
|
763
|
+
* CONSTRUCTION — the allow-list the node constructor guard ({@link Node.checkProps})
|
|
764
|
+
* validates incoming `props` against, so an unknown key throws instead of being
|
|
765
|
+
* silently dropped (the `new Rect({ size:[…] })` → invisible-box footgun).
|
|
766
|
+
*
|
|
767
|
+
* It's the union of three drift-free sources, so it can never disagree with what
|
|
768
|
+
* the constructors actually honor:
|
|
769
|
+
* - the shared base construction props + this type's own construction props
|
|
770
|
+
* (the SAME name sets `describe()` and the bind guard read);
|
|
771
|
+
* - the **un-dotted** names of this node's registered animatable targets
|
|
772
|
+
* (`targetPaths` — the live `registerTarget` set; animatable props are settable
|
|
773
|
+
* at construction too). A dotted sub-path like `position.x` collapses to its
|
|
774
|
+
* head `position`: the dotted form is a TWEEN target (`to('id/position.x', …)`),
|
|
775
|
+
* never a constructor key, so it is correctly NOT accepted at construction;
|
|
776
|
+
* - the per-type construction-key aliases above (Path's `data`).
|
|
777
|
+
*/
|
|
778
|
+
function acceptedConstructionKeys(typeName, targetPaths) {
|
|
779
|
+
const keys = new Set(BASE_CONSTRUCTION_PROP_NAMES);
|
|
780
|
+
const own = NODE_CONSTRUCTION_PROP_NAMES[typeName];
|
|
781
|
+
if (own !== void 0) for (const k of own) keys.add(k);
|
|
782
|
+
const alias = CONSTRUCTION_KEY_ALIASES[typeName];
|
|
783
|
+
if (alias !== void 0) for (const k of alias) keys.add(k);
|
|
784
|
+
for (const path of targetPaths) {
|
|
785
|
+
const dot = path.indexOf(".");
|
|
786
|
+
keys.add(dot === -1 ? path : path.slice(0, dot));
|
|
787
|
+
}
|
|
788
|
+
return keys;
|
|
789
|
+
}
|
|
790
|
+
//#endregion
|
|
672
791
|
//#region src/node.ts
|
|
673
792
|
/**
|
|
674
793
|
* Scene-graph node base (DESIGN.md §3.1): every animatable property is a
|
|
@@ -704,6 +823,18 @@ function initVec2(sig, init) {
|
|
|
704
823
|
else if (init !== void 0) sig.set(init);
|
|
705
824
|
return sig;
|
|
706
825
|
}
|
|
826
|
+
/**
|
|
827
|
+
* Thrown by a node constructor when it's passed an unknown prop key (the
|
|
828
|
+
* construction-time sibling of the timeline builder's `TimelineValidationError`).
|
|
829
|
+
* Names the offending key(s), the node type, and the valid props. See
|
|
830
|
+
* {@link Node.checkProps}.
|
|
831
|
+
*/
|
|
832
|
+
var NodeConstructionError = class extends Error {
|
|
833
|
+
constructor(message) {
|
|
834
|
+
super(message);
|
|
835
|
+
this.name = "NodeConstructionError";
|
|
836
|
+
}
|
|
837
|
+
};
|
|
707
838
|
var Node = class {
|
|
708
839
|
id;
|
|
709
840
|
position;
|
|
@@ -817,6 +948,32 @@ var Node = class {
|
|
|
817
948
|
}));
|
|
818
949
|
}
|
|
819
950
|
/**
|
|
951
|
+
* Fail-loud guard against UNKNOWN construction props — the sibling of the
|
|
952
|
+
* timeline builder's unknown-option guard (`to(…, { eaze })` throws). Without
|
|
953
|
+
* it a node silently drops a misnamed prop: `new Rect({ size:[80,80] })` keeps
|
|
954
|
+
* width/height at 0 → an invisible node, no warning (a real footgun the docs
|
|
955
|
+
* even shipped). Each BUILT-IN node calls this at the END of its constructor,
|
|
956
|
+
* guarded by `new.target === <ThisClass>` so it runs ONLY for the exact leaf
|
|
957
|
+
* type (an intermediate base like `Group` skips it when a `Layout` is being
|
|
958
|
+
* constructed — `Layout` validates itself with its own fuller target set; and
|
|
959
|
+
* user `Custom`/external subclasses, whose `new.target` matches no built-in,
|
|
960
|
+
* are never validated, keeping that extension seam lenient).
|
|
961
|
+
*
|
|
962
|
+
* The allow-list is {@link acceptedConstructionKeys} — built from the live
|
|
963
|
+
* `registerTarget` set + the construction-prop name sets, so it can't drift
|
|
964
|
+
* from what the constructors actually honor. Must be called after the leaf has
|
|
965
|
+
* registered all its targets (i.e. last), so the animatable keys are present.
|
|
966
|
+
*/
|
|
967
|
+
checkProps(props) {
|
|
968
|
+
const accepted = acceptedConstructionKeys(this.describeType, this.targets.keys());
|
|
969
|
+
let unknown;
|
|
970
|
+
for (const k of Object.keys(props)) if (!accepted.has(k)) (unknown ??= []).push(k);
|
|
971
|
+
if (unknown !== void 0) {
|
|
972
|
+
const valid = [...accepted].sort().join(", ");
|
|
973
|
+
throw new NodeConstructionError(`new ${this.describeType}({ … }): unknown construction ${unknown.length > 1 ? "props" : "prop"} ${unknown.map((k) => `'${k}'`).join(", ")}. Valid ${this.describeType} props: ${valid}. (Animatable sub-paths like 'position.x' are timeline targets — to('<id>/position.x', …) — not construction keys; set the whole 'position' at construction.)`);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
820
977
|
* Natural size for flex flow (§3.2); null = not flowable (a Layout parent
|
|
821
978
|
* emits such children absolutely, untouched).
|
|
822
979
|
*/
|
|
@@ -1034,7 +1191,7 @@ function roundedRectSegs(x, y, w, h, r) {
|
|
|
1034
1191
|
["Z"]
|
|
1035
1192
|
];
|
|
1036
1193
|
}
|
|
1037
|
-
var Group = class extends Node {
|
|
1194
|
+
var Group = class Group extends Node {
|
|
1038
1195
|
/**
|
|
1039
1196
|
* Taxonomy name pinned as a STRING LITERAL (not the inherited
|
|
1040
1197
|
* `constructor.name`): the minified `@glissade/browser` IIFE mangles class
|
|
@@ -1057,6 +1214,7 @@ var Group = class extends Node {
|
|
|
1057
1214
|
super(props);
|
|
1058
1215
|
this.children = props.children ?? [];
|
|
1059
1216
|
for (const child of this.children) child.parent = this;
|
|
1217
|
+
if (new.target === Group) this.checkProps(props);
|
|
1060
1218
|
}
|
|
1061
1219
|
/** Record the structural version as a dependency — call inside a computed
|
|
1062
1220
|
* that walks `children` so add()/remove() invalidate it. */
|
|
@@ -1368,7 +1526,7 @@ function pathFromSegs(segs) {
|
|
|
1368
1526
|
}
|
|
1369
1527
|
return contours;
|
|
1370
1528
|
}
|
|
1371
|
-
var Rect = class extends Shape {
|
|
1529
|
+
var Rect = class Rect extends Shape {
|
|
1372
1530
|
/** Taxonomy name pinned literally (survives IIFE minification — see {@link Group}). */
|
|
1373
1531
|
get describeType() {
|
|
1374
1532
|
return "Rect";
|
|
@@ -1385,6 +1543,7 @@ var Rect = class extends Shape {
|
|
|
1385
1543
|
this.registerTarget("width", this.width, "number");
|
|
1386
1544
|
this.registerTarget("height", this.height, "number");
|
|
1387
1545
|
this.registerTarget("cornerRadius", this.cornerRadius, "number");
|
|
1546
|
+
if (new.target === Rect) this.checkProps(props);
|
|
1388
1547
|
}
|
|
1389
1548
|
intrinsicSize() {
|
|
1390
1549
|
return {
|
|
@@ -1399,7 +1558,7 @@ var Rect = class extends Shape {
|
|
|
1399
1558
|
return roundedRectSegs(-w / 2, -h / 2, w, h, r);
|
|
1400
1559
|
}
|
|
1401
1560
|
};
|
|
1402
|
-
var Circle = class extends Shape {
|
|
1561
|
+
var Circle = class Circle extends Shape {
|
|
1403
1562
|
/** Taxonomy name pinned literally (survives IIFE minification — see {@link Group}). */
|
|
1404
1563
|
get describeType() {
|
|
1405
1564
|
return "Circle";
|
|
@@ -1409,6 +1568,7 @@ var Circle = class extends Shape {
|
|
|
1409
1568
|
super(props);
|
|
1410
1569
|
this.radius = initProp(signal(0), props.radius);
|
|
1411
1570
|
this.registerTarget("radius", this.radius, "number");
|
|
1571
|
+
if (new.target === Circle) this.checkProps(props);
|
|
1412
1572
|
}
|
|
1413
1573
|
intrinsicSize() {
|
|
1414
1574
|
const d = this.radius() * 2;
|
|
@@ -1436,7 +1596,7 @@ var Circle = class extends Shape {
|
|
|
1436
1596
|
* of native path morphs. Coordinates are node-local (the node origin is
|
|
1437
1597
|
* wherever the author put 0,0); flow placement uses the control-point bounds.
|
|
1438
1598
|
*/
|
|
1439
|
-
var Path = class extends Shape {
|
|
1599
|
+
var Path = class Path extends Shape {
|
|
1440
1600
|
/** Taxonomy name pinned literally (survives IIFE minification — see {@link Group}). */
|
|
1441
1601
|
get describeType() {
|
|
1442
1602
|
return "Path";
|
|
@@ -1448,6 +1608,7 @@ var Path = class extends Shape {
|
|
|
1448
1608
|
const coerced = typeof init === "function" ? () => coercePathData(init()) : init !== void 0 ? coercePathData(init) : void 0;
|
|
1449
1609
|
this.data = initProp(signal([]), coerced);
|
|
1450
1610
|
this.registerTarget("d", this.data, "path");
|
|
1611
|
+
if (new.target === Path) this.checkProps(props);
|
|
1451
1612
|
}
|
|
1452
1613
|
/** Control-point bounding box (conservative: contains the true curve). */
|
|
1453
1614
|
bounds() {
|
|
@@ -1533,7 +1694,7 @@ var Path = class extends Shape {
|
|
|
1533
1694
|
return segs;
|
|
1534
1695
|
}
|
|
1535
1696
|
};
|
|
1536
|
-
var ImageNode = class extends Node {
|
|
1697
|
+
var ImageNode = class ImageNode extends Node {
|
|
1537
1698
|
/** Marks this node as referencing a kind 'image' timeline asset (§2.3). */
|
|
1538
1699
|
static assetKind = "image";
|
|
1539
1700
|
/** Public taxonomy name is `Image` (the class is `ImageNode`). */
|
|
@@ -1550,6 +1711,7 @@ var ImageNode = class extends Node {
|
|
|
1550
1711
|
this.height = initProp(signal(0), props.height);
|
|
1551
1712
|
this.registerTarget("width", this.width, "number");
|
|
1552
1713
|
this.registerTarget("height", this.height, "number");
|
|
1714
|
+
if (new.target === ImageNode) this.checkProps(props);
|
|
1553
1715
|
}
|
|
1554
1716
|
intrinsicSize() {
|
|
1555
1717
|
return {
|
|
@@ -1582,7 +1744,7 @@ var ImageNode = class extends Node {
|
|
|
1582
1744
|
* frame-indexed media-time arithmetic — mediaT = trimStart + (t - at) * rate —
|
|
1583
1745
|
* and references the exact source-grid frame; backends resolve it.
|
|
1584
1746
|
*/
|
|
1585
|
-
var Video = class extends Node {
|
|
1747
|
+
var Video = class Video extends Node {
|
|
1586
1748
|
/** Marks this node as referencing a kind 'video' timeline asset (§3.8). */
|
|
1587
1749
|
static assetKind = "video";
|
|
1588
1750
|
/** Taxonomy name pinned literally (survives IIFE minification — see {@link Group}). */
|
|
@@ -1609,6 +1771,7 @@ var Video = class extends Node {
|
|
|
1609
1771
|
this.height = initProp(signal(0), props.height);
|
|
1610
1772
|
this.registerTarget("width", this.width, "number");
|
|
1611
1773
|
this.registerTarget("height", this.height, "number");
|
|
1774
|
+
if (new.target === Video) this.checkProps(props);
|
|
1612
1775
|
}
|
|
1613
1776
|
/** Frame-indexed media time for timeline time t; null when outside the clip. */
|
|
1614
1777
|
mediaTime(t) {
|
|
@@ -1642,7 +1805,7 @@ var Video = class extends Node {
|
|
|
1642
1805
|
});
|
|
1643
1806
|
}
|
|
1644
1807
|
};
|
|
1645
|
-
var Text = class extends Node {
|
|
1808
|
+
var Text = class Text extends Node {
|
|
1646
1809
|
/** Taxonomy name pinned literally (survives IIFE minification — see {@link Group}). */
|
|
1647
1810
|
get describeType() {
|
|
1648
1811
|
return "Text";
|
|
@@ -1685,6 +1848,7 @@ var Text = class extends Node {
|
|
|
1685
1848
|
this.registerTarget("fontSize", this.fontSize, "number");
|
|
1686
1849
|
this.registerTarget("reveal", this.reveal, "number");
|
|
1687
1850
|
this.registerTarget("revealFraction", this.revealFraction, "number");
|
|
1851
|
+
if (new.target === Text) this.checkProps(props);
|
|
1688
1852
|
}
|
|
1689
1853
|
/**
|
|
1690
1854
|
* The per-draw {@link FontSpec} — the single construction point every measure
|
|
@@ -2067,4 +2231,4 @@ function revealSchedule(text, reveal, measurer) {
|
|
|
2067
2231
|
return marks;
|
|
2068
2232
|
}
|
|
2069
2233
|
//#endregion
|
|
2070
|
-
export {
|
|
2234
|
+
export { SketchValidationError as A, FilterValidationError as B, fallbackMeasurer as C, segmentWords as D, segmentGraphemes as E, resolveSketch as F, collapseReplacer as G, filtersToCanvasFilter as H, roughen as I, fromTRS as J, IDENTITY as K, sketchStrokes as L, flatten as M, hachureLines as N, setDefaultMeasurer as O, hashStr as P, validateHachure as R, estimatingMeasurer as S, quantize as T, glow as U, createDisplayListBuilder as V, validateFilters as W, matEquals as X, invert as Y, multiply as Z, NODE_CONSTRUCTION_PROP_NAMES as _, Path as a, __resetEstimateWarnings as b, Video as c, revealSchedule as d, roundedRectSegs as f, BASE_CONSTRUCTION_PROP_NAMES as g, resolveAnchor as h, ImageNode as i, arcLength as j, warnIfEstimating as k, coercePathData as l, NodeConstructionError as m, Custom as n, Rect as o, Node as p, applyToPoint as q, Group as r, Text as s, Circle as t, pathFromSegs as u, isConstructionProp as v, isEstimatingMeasurer as w, breakLines as x, MEASURE_QUANTUM_PX as y, validateSketch as z };
|
package/dist/scene.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as DisplayList } from "./displayList.js";
|
|
2
|
-
import {
|
|
2
|
+
import { G as TextMeasurer, I as BindablePropTarget, i as Group, z as Node } from "./nodes.js";
|
|
3
3
|
import { BoundTimeline, CompiledTimeline, Playhead, Timeline } from "@glissade/core";
|
|
4
4
|
|
|
5
5
|
//#region src/scene.d.ts
|
package/dist/scene.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as isConstructionProp } from "./constructionProps.js";
|
|
1
|
+
import { C as fallbackMeasurer, V as createDisplayListBuilder, r as Group, v as isConstructionProp } from "./nodes.js";
|
|
3
2
|
import { bindTimeline, compileTimeline, createPlayhead, evaluateAt, signal } from "@glissade/core";
|
|
4
3
|
//#region src/scene.ts
|
|
5
4
|
/**
|
package/dist/tokens.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as DisplayListBuilder } from "./displayList.js";
|
|
2
|
-
import {
|
|
2
|
+
import { H as PropInit, L as EvalContext, V as NodeProps, _ as WordBox, p as Text, z as Node } from "./nodes.js";
|
|
3
3
|
import { Vec2 } from "@glissade/core";
|
|
4
4
|
|
|
5
5
|
//#region src/tokenHighlight.d.ts
|
package/dist/tokens.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as IDENTITY, X as matEquals, f as roundedRectSegs, p as Node } from "./nodes.js";
|
|
2
2
|
import { signal, vec2Signal } from "@glissade/core";
|
|
3
3
|
//#region src/tokenHighlight.ts
|
|
4
4
|
/**
|
package/dist/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as TextMeasurer, _ as WordBox, i as Group, m as TextProps, p as Text, r as GraphemeBox, s as LineBox } from "./nodes.js";
|
|
2
2
|
|
|
3
3
|
//#region src/type.d.ts
|
|
4
4
|
|
package/dist/type.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as fallbackMeasurer, T as quantize, k as warnIfEstimating, r as Group, s as Text } from "./nodes.js";
|
|
2
2
|
//#region src/type.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@glissade/scene/type` — `splitText()`: build-time split-text sub-targets
|
|
@@ -46,6 +46,11 @@ function splitText(source, opts = {}) {
|
|
|
46
46
|
const id = opts.id ?? text.id;
|
|
47
47
|
if (id === void 0) throw new SplitTextError("splitText() needs a stable id — pass { id } or give the source Text an id (the parts bind tracks against ${id}/${i})");
|
|
48
48
|
const by = opts.by ?? "word";
|
|
49
|
+
if (![
|
|
50
|
+
"word",
|
|
51
|
+
"line",
|
|
52
|
+
"grapheme"
|
|
53
|
+
].includes(by)) throw new SplitTextError(`splitText() got an unknown { by: ${JSON.stringify(by)} } — valid values are 'word', 'line', 'grapheme'.`);
|
|
49
54
|
const m = opts.measurer ?? text.measurerSource?.() ?? fallbackMeasurer();
|
|
50
55
|
warnIfEstimating(m, "splitText");
|
|
51
56
|
const font = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/scene",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"yoga-layout": "^3.2.1",
|
|
62
|
-
"@glissade/core": "0.20.
|
|
62
|
+
"@glissade/core": "0.20.1"
|
|
63
63
|
},
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
//#region src/constructionProps.ts
|
|
2
|
-
/**
|
|
3
|
-
* The SLIM construction-prop NAME set (0.20) — the embed-path-safe half of the
|
|
4
|
-
* describe() schema. A construction prop (`animatable: false`) is passed to a
|
|
5
|
-
* node's constructor and is NEVER a track target; binding one is rejected.
|
|
6
|
-
*
|
|
7
|
-
* This module carries ONLY the per-node-type set of construction-prop NAMES
|
|
8
|
-
* (plus the shared base set), nothing else — no value types, no `required`
|
|
9
|
-
* flags, no manifest scaffolding. That keeps it tiny: it rides on the
|
|
10
|
-
* embed/bind path (the bind guard imports it to turn a generic UnboundTarget
|
|
11
|
-
* into a friendlier "that's a construction prop" message), so it must stay
|
|
12
|
-
* byte-cheap. `describe.ts` imports the SAME sets and layers its richer
|
|
13
|
-
* per-prop metadata (type/required) on top, so the manifest and this lookup
|
|
14
|
-
* can't drift.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Base `NodeProps` construction-prop names shared by EVERY node — set once at
|
|
18
|
-
* `new Node({...})`, never animatable (none is a registered target).
|
|
19
|
-
*/
|
|
20
|
-
const BASE_CONSTRUCTION_PROP_NAMES = [
|
|
21
|
-
"id",
|
|
22
|
-
"blend",
|
|
23
|
-
"filters",
|
|
24
|
-
"anchor",
|
|
25
|
-
"cache"
|
|
26
|
-
];
|
|
27
|
-
/**
|
|
28
|
-
* Each built-in node's OWN construction-prop names (the base set is merged in
|
|
29
|
-
* separately, via {@link isConstructionProp}). Keyed by the describe TYPE NAME
|
|
30
|
-
* (e.g. `Image`, not the `ImageNode` class name).
|
|
31
|
-
*/
|
|
32
|
-
const SKETCH = [
|
|
33
|
-
"sketch",
|
|
34
|
-
"sketchFill",
|
|
35
|
-
"sketchSeed"
|
|
36
|
-
];
|
|
37
|
-
const LAYOUT = [
|
|
38
|
-
"direction",
|
|
39
|
-
"justify",
|
|
40
|
-
"align",
|
|
41
|
-
"children"
|
|
42
|
-
];
|
|
43
|
-
const NODE_CONSTRUCTION_PROP_NAMES = {
|
|
44
|
-
Group: ["children"],
|
|
45
|
-
Rect: SKETCH,
|
|
46
|
-
Circle: SKETCH,
|
|
47
|
-
Path: SKETCH,
|
|
48
|
-
Text: [
|
|
49
|
-
"fontFamily",
|
|
50
|
-
"fontWeight",
|
|
51
|
-
"fontStyle",
|
|
52
|
-
"align",
|
|
53
|
-
"lineHeight",
|
|
54
|
-
"fontVariationSettings"
|
|
55
|
-
],
|
|
56
|
-
Image: ["assetId"],
|
|
57
|
-
Video: [
|
|
58
|
-
"assetId",
|
|
59
|
-
"at",
|
|
60
|
-
"trimStart",
|
|
61
|
-
"playbackRate",
|
|
62
|
-
"clipDuration",
|
|
63
|
-
"sourceFps"
|
|
64
|
-
],
|
|
65
|
-
Layout: LAYOUT,
|
|
66
|
-
Stack: LAYOUT,
|
|
67
|
-
Row: LAYOUT,
|
|
68
|
-
Column: LAYOUT
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Is `prop` a KNOWN construction-only prop for a node of describe-type
|
|
72
|
-
* `typeName`? True for the shared base set or that type's own set. Used by the
|
|
73
|
-
* bind guard to special-case the unbound-target error: a construction prop gets
|
|
74
|
-
* a "set it at construction" message instead of the generic one.
|
|
75
|
-
*/
|
|
76
|
-
function isConstructionProp(typeName, prop) {
|
|
77
|
-
if (BASE_CONSTRUCTION_PROP_NAMES.includes(prop)) return true;
|
|
78
|
-
const own = NODE_CONSTRUCTION_PROP_NAMES[typeName];
|
|
79
|
-
return own !== void 0 && own.includes(prop);
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
export { NODE_CONSTRUCTION_PROP_NAMES as n, isConstructionProp as r, BASE_CONSTRUCTION_PROP_NAMES as t };
|