@motionscript/patterns 0.1.0-alpha.7 → 0.1.0-alpha.9

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +49 -48
  4. package/README.md +83 -83
  5. package/dist/browser/chunks/{chunk-REWLNFZ2.js → chunk-FXDYEY4R.js} +1 -1
  6. package/dist/browser/chunks/chunk-FXDYEY4R.js.map +7 -0
  7. package/dist/browser/index.js +1 -1
  8. package/dist/browser/index.js.map +1 -1
  9. package/dist/browser/kit.js +1 -1
  10. package/dist/browser/manifest.json +1 -1
  11. package/dist/dot-grid-pattern/dot-grid-pattern.js.map +1 -1
  12. package/dist/dot-grid-pattern/index.js.map +1 -1
  13. package/dist/engine.d.ts +1 -1
  14. package/dist/engine.js +1 -1
  15. package/dist/engine.js.map +1 -1
  16. package/dist/grid-pattern/grid-pattern.js.map +1 -1
  17. package/dist/grid-pattern/index.js.map +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/kit/grid-lines.js.map +1 -1
  20. package/dist/kit/index.js.map +1 -1
  21. package/dist/kit/viewport-pattern.d.ts.map +1 -1
  22. package/dist/kit/viewport-pattern.js.map +1 -1
  23. package/dist/line-grid-pattern/index.js.map +1 -1
  24. package/dist/line-grid-pattern/line-grid-pattern.js.map +1 -1
  25. package/dist/nodes.js.map +1 -1
  26. package/package.json +5 -4
  27. package/registry.json +26 -26
  28. package/src/dot-grid-pattern/dot-grid-pattern.ts +155 -155
  29. package/src/dot-grid-pattern/index.ts +1 -1
  30. package/src/engine.ts +11 -11
  31. package/src/grid-pattern/grid-pattern.ts +176 -176
  32. package/src/grid-pattern/index.ts +1 -1
  33. package/src/index.ts +5 -5
  34. package/src/kit/grid-lines.ts +223 -223
  35. package/src/kit/index.ts +2 -2
  36. package/src/kit/viewport-pattern.ts +109 -109
  37. package/src/line-grid-pattern/index.ts +1 -1
  38. package/src/line-grid-pattern/line-grid-pattern.ts +117 -117
  39. package/src/nodes.ts +27 -27
  40. package/dist/browser/chunks/chunk-REWLNFZ2.js.map +0 -7
@@ -1,109 +1,109 @@
1
- import {
2
- Camera,
3
- Flow,
4
- Graphics2D,
5
- Paint,
6
- type BoxBounds,
7
- type ChildView,
8
- type Measurer,
9
- type Placement2D,
10
- type RenderContext,
11
- type Size2D,
12
- type Values,
13
- // Named so the emitted declaration reaches these through the sdk, not core.
14
- type Alignment as _Alignment,
15
- type Fill as _Fill,
16
- type FillResolved as _FillResolved,
17
- type FlowMode as _FlowMode,
18
- type FlowResolved as _FlowResolved,
19
- type GapSize as _GapSize,
20
- type Shadow as _Shadow,
21
- type ShadowResolved as _ShadowResolved,
22
- type Stroke as _Stroke,
23
- type StrokeResolved as _StrokeResolved,
24
- type Vector2 as _Vector2,
25
- } from "@motionscript/sdk";
26
-
27
- /**
28
- * What a background that fills whatever region is currently visible shares,
29
- * rather than a fixed rect: `GridPattern` is built from it, and so is a pattern
30
- * of your own. Spread `state` and `commands` in, pass `measure` and `layout`, and
31
- * draw with {@link draw}.
32
- *
33
- * Placed inside a `Camera`, the pattern is handed the world region the camera
34
- * can currently see (from its `zoom`/`lookAt`/`heading`), so it only ever
35
- * generates geometry for what's on screen, with no oversized node sized for the
36
- * worst-case pan and zoom. With no `Camera` above it, it fills its own box, so the
37
- * same pattern doubles as an ordinary full-bleed background.
38
- *
39
- * The pattern is itself a camera child, laid out at the camera's centre, so its
40
- * local draw space shares the world origin its siblings use. The visible region
41
- * is therefore expressed directly in that space: centred on the camera's
42
- * `lookAt`, sized to the inverse of the camera transform.
43
- */
44
-
45
- /** A pattern is a shape: paints, and children laid out like a rect's. */
46
- export const state = { ...Paint.state, ...Flow.state };
47
-
48
- export const commands = { ...Paint.commands };
49
-
50
- type ShapeState = Flow.FlowState & Values<typeof Paint.state>;
51
-
52
- export function measure(measurer: Measurer, s: ShapeState, children: readonly ChildView[]): Size2D {
53
- return Flow.measure(measurer, s, children, Paint.inset(s));
54
- }
55
-
56
- export function layout(box: BoxBounds, s: ShapeState, children: readonly ChildView[]): readonly Placement2D[] {
57
- return Flow.layout(box, s, children, Paint.inset(s));
58
- }
59
-
60
- /**
61
- * The region the pattern covers, in its own draw space: the world rect the
62
- * nearest `Camera` above it sees, or its own box when there is none.
63
- */
64
- export function visibleBounds(ctx: RenderContext): BoxBounds {
65
- const camera = ctx.ancestor(Camera);
66
- if (!camera) return { x: 0, y: 0, width: ctx.size.width, height: ctx.size.height };
67
-
68
- const { width: vw, height: vh } = camera.size;
69
- const zoom = camera.state.zoom || 1;
70
- const heading = camera.state.heading;
71
-
72
- // Inverse of the camera scale: a viewport `vw×vh` shows `vw/zoom × vh/zoom` of the world.
73
- const hw = vw / 2 / zoom;
74
- const hh = vh / 2 / zoom;
75
-
76
- // With a heading the visible world rect is rotated; take its axis-aligned
77
- // bounding box so the pattern covers the rotated viewport's full extent.
78
- let bw = hw;
79
- let bh = hh;
80
- if (heading !== 0) {
81
- const rad = (heading * Math.PI) / 180;
82
- const cos = Math.abs(Math.cos(rad));
83
- const sin = Math.abs(Math.sin(rad));
84
- bw = hw * cos + hh * sin;
85
- bh = hw * sin + hh * cos;
86
- }
87
-
88
- // Centred on the camera's `lookAt`, in y-up world space (the descriptor
89
- // convention; the renderer applies the single y-up→canvas flip when the
90
- // pattern's shapes are drawn).
91
- const lookAt = camera.state.lookAt;
92
- return { x: lookAt.x, y: lookAt.y, width: bw * 2, height: bh * 2 };
93
- }
94
-
95
- /**
96
- * Paint `pattern` over the visible region, once per render, then the children.
97
- *
98
- * The pattern is clipped to the region, so geometry overscanned past the edge
99
- * (so thick lines slide out instead of popping) trims cleanly. Inside a camera
100
- * the viewport already clips, but this keeps edge strokes clean and bounds the
101
- * work with no camera too. A `centerBounds` for a path drawn here is
102
- * `[bounds.x - w/2, bounds.y - h/2, bounds.x + w/2, bounds.y + h/2]`.
103
- */
104
- export function draw(ctx: RenderContext, pattern: (bounds: BoxBounds) => void): void {
105
- const bounds = visibleBounds(ctx);
106
- const region = new Graphics2D().rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });
107
- ctx.inFront(() => ctx.clip(region, () => pattern(bounds)));
108
- ctx.children();
109
- }
1
+ import {
2
+ Camera,
3
+ Flow,
4
+ Graphics2D,
5
+ Paint,
6
+ type BoxBounds,
7
+ type ChildView,
8
+ type Measurer,
9
+ type Placement2D,
10
+ type RenderContext,
11
+ type Size2D,
12
+ type Values,
13
+ // Named so the emitted declaration reaches these through the sdk, not core.
14
+ type Alignment as _Alignment,
15
+ type Fill as _Fill,
16
+ type FillResolved as _FillResolved,
17
+ type FlowMode as _FlowMode,
18
+ type FlowResolved as _FlowResolved,
19
+ type GapSize as _GapSize,
20
+ type Shadow as _Shadow,
21
+ type ShadowResolved as _ShadowResolved,
22
+ type Stroke as _Stroke,
23
+ type StrokeResolved as _StrokeResolved,
24
+ type Vector2 as _Vector2,
25
+ } from "@motionscript/sdk";
26
+
27
+ /**
28
+ * What a background that fills whatever region is currently visible shares,
29
+ * rather than a fixed rect: `GridPattern` is built from it, and so is a pattern
30
+ * of your own. Spread `state` and `commands` in, pass `measure` and `layout`, and
31
+ * draw with {@link draw}.
32
+ *
33
+ * Placed inside a `Camera`, the pattern is handed the world region the camera
34
+ * can currently see (from its `zoom`/`lookAt`/`heading`), so it only ever
35
+ * generates geometry for what's on screen, with no oversized node sized for the
36
+ * worst-case pan and zoom. With no `Camera` above it, it fills its own box, so the
37
+ * same pattern doubles as an ordinary full-bleed background.
38
+ *
39
+ * The pattern is itself a camera child, laid out at the camera's centre, so its
40
+ * local draw space shares the world origin its siblings use. The visible region
41
+ * is therefore expressed directly in that space: centred on the camera's
42
+ * `lookAt`, sized to the inverse of the camera transform.
43
+ */
44
+
45
+ /** A pattern is a shape: paints, and children laid out like a rect's. */
46
+ export const state = { ...Paint.state, ...Flow.state };
47
+
48
+ export const commands = { ...Paint.commands };
49
+
50
+ type ShapeState = Flow.FlowState & Values<typeof Paint.state>;
51
+
52
+ export function measure(measurer: Measurer, s: ShapeState, children: readonly ChildView[]): Size2D {
53
+ return Flow.measure(measurer, s, children, Paint.inset(s));
54
+ }
55
+
56
+ export function layout(box: BoxBounds, s: ShapeState, children: readonly ChildView[]): readonly Placement2D[] {
57
+ return Flow.layout(box, s, children, Paint.inset(s));
58
+ }
59
+
60
+ /**
61
+ * The region the pattern covers, in its own draw space: the world rect the
62
+ * nearest `Camera` above it sees, or its own box when there is none.
63
+ */
64
+ export function visibleBounds(ctx: RenderContext): BoxBounds {
65
+ const camera = ctx.ancestor(Camera);
66
+ if (!camera) return { x: 0, y: 0, width: ctx.size.width, height: ctx.size.height };
67
+
68
+ const { width: vw, height: vh } = camera.size;
69
+ const zoom = camera.state.zoom || 1;
70
+ const heading = camera.state.heading;
71
+
72
+ // Inverse of the camera scale: a viewport `vw×vh` shows `vw/zoom × vh/zoom` of the world.
73
+ const hw = vw / 2 / zoom;
74
+ const hh = vh / 2 / zoom;
75
+
76
+ // With a heading the visible world rect is rotated; take its axis-aligned
77
+ // bounding box so the pattern covers the rotated viewport's full extent.
78
+ let bw = hw;
79
+ let bh = hh;
80
+ if (heading !== 0) {
81
+ const rad = (heading * Math.PI) / 180;
82
+ const cos = Math.abs(Math.cos(rad));
83
+ const sin = Math.abs(Math.sin(rad));
84
+ bw = hw * cos + hh * sin;
85
+ bh = hw * sin + hh * cos;
86
+ }
87
+
88
+ // Centred on the camera's `lookAt`, in y-up world space (the descriptor
89
+ // convention; the renderer applies the single y-up→canvas flip when the
90
+ // pattern's shapes are drawn).
91
+ const lookAt = camera.state.lookAt;
92
+ return { x: lookAt.x, y: lookAt.y, width: bw * 2, height: bh * 2 };
93
+ }
94
+
95
+ /**
96
+ * Paint `pattern` over the visible region, once per render, then the children.
97
+ *
98
+ * The pattern is clipped to the region, so geometry overscanned past the edge
99
+ * (so thick lines slide out instead of popping) trims cleanly. Inside a camera
100
+ * the viewport already clips, but this keeps edge strokes clean and bounds the
101
+ * work with no camera too. A `centerBounds` for a path drawn here is
102
+ * `[bounds.x - w/2, bounds.y - h/2, bounds.x + w/2, bounds.y + h/2]`.
103
+ */
104
+ export function draw(ctx: RenderContext, pattern: (bounds: BoxBounds) => void): void {
105
+ const bounds = visibleBounds(ctx);
106
+ const region = new Graphics2D().rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });
107
+ ctx.inFront(() => ctx.clip(region, () => pattern(bounds)));
108
+ ctx.children();
109
+ }
@@ -1 +1 @@
1
- export * from "./line-grid-pattern"
1
+ export * from "./line-grid-pattern"
@@ -1,117 +1,117 @@
1
- import {
2
- Flow,
3
- Graphics2D,
4
- Paint,
5
- Types,
6
- component2d,
7
- lerpVector2,
8
- type NodeOf,
9
- type PathBounds,
10
- type PathCommand,
11
- type Vector2,
12
- // Named so the emitted declaration reaches these through the sdk, not core.
13
- type Alignment as _Alignment,
14
- type Fill as _Fill,
15
- type FillResolved as _FillResolved,
16
- type FlowMode as _FlowMode,
17
- type FlowResolved as _FlowResolved,
18
- type GapSize as _GapSize,
19
- type Node2D as _Node2D,
20
- type Node2DProps as _Node2DProps,
21
- type Shadow as _Shadow,
22
- type ShadowResolved as _ShadowResolved,
23
- type Stroke as _Stroke,
24
- type StrokeResolved as _StrokeResolved,
25
- } from "@motionscript/sdk";
26
-
27
- import { centered, defaultSubStroke, gridLinePaths, maxWeight } from "../kit";
28
-
29
- /**
30
- * A rectangular grid of lines filling the node's layout rect.
31
- *
32
- * `stroke` paints the major lines and `subStroke` the minor ones, each as a
33
- * single union path. `fill` and `shadow` cover the whole rect, behind the lines.
34
- */
35
- export const LineGridPattern = component2d({
36
- key: "lineGridPattern",
37
- state: {
38
- ...Paint.state,
39
- ...Flow.state,
40
- /** Cells along each axis: `divisions` of 4 draws 5 major lines per axis. */
41
- divisions: 4,
42
- /** Finer cells each division is split into. 1 draws no minor lines; 2 adds one per division. */
43
- subdivisions: 1,
44
- /** Stroke for the minor lines. Unset, the major `stroke` at half opacity when `subdivisions > 1`. */
45
- subStroke: Types.stroke,
46
- /** Pans the grid. Lines wrap and tile, so the rect stays full while `offset` scrolls it. */
47
- offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),
48
- },
49
- defaults: { subStroke: (_state, given) => defaultSubStroke(given) },
50
- commands: { ...Paint.commands },
51
- measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),
52
- layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),
53
- render: (ctx, state) => {
54
- const { width, height } = ctx.size;
55
- const box = new Graphics2D().rect({ width, height });
56
- ctx.inFront(() => {
57
- ctx.draw(new Graphics2D()
58
- .rect({ width, height, start: state.start, end: state.end })
59
- .shadow(state.shadow)
60
- .fill(state.fill));
61
-
62
- const divisions = Math.max(1, Math.floor(state.divisions));
63
- const subdivisions = Math.max(1, Math.floor(state.subdivisions));
64
-
65
- // Lines overscan the rect by half the thickest stroke and are clipped to it, so a
66
- // thick line slides out under the clip instead of popping at the boundary.
67
- const major = centered(state.stroke);
68
- const minorStroke = centered(state.subStroke);
69
- const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;
70
- const lines = gridPaths(width, height, divisions, subdivisions, overscan, state.offset);
71
- const centerBounds: PathBounds = [-width / 2, -height / 2, width / 2, height / 2];
72
-
73
- ctx.clip(box, () => {
74
- // Minor lines first so the major lines sit on top.
75
- if (subdivisions > 1 && minorStroke.length > 0 && lines.minor.length > 0) {
76
- ctx.draw(new Graphics2D().path({ data: lines.minor, centerBounds }).stroke(minorStroke));
77
- }
78
- if (lines.major.length > 0) {
79
- ctx.draw(new Graphics2D().path({ data: lines.major, centerBounds }).stroke(major));
80
- }
81
- });
82
- });
83
- // The rect is what `clip` confines the children to and what picking tests; it paints nothing more.
84
- Paint.draw(ctx, state, null, { clipShape: box });
85
- },
86
- });
87
-
88
- export type LineGridPattern = NodeOf<typeof LineGridPattern>;
89
- /** What a call or a document row may set. */
90
- export type LineGridPatternProps = NonNullable<Parameters<typeof LineGridPattern>[0]>;
91
-
92
- // One multi-subpath path per group, so each stroke paints its lines as a union with no
93
- // destructive boolean op (which would erase open lines).
94
- function gridPaths(
95
- width: number,
96
- height: number,
97
- divisions: number,
98
- subdivisions: number,
99
- overscan: number,
100
- offset: Vector2,
101
- ): { major: PathCommand[]; minor: PathCommand[] } {
102
- // Inset by `overscan` so the outermost lines sit fully inside the rect and are not
103
- // trimmed to half weight by the clip.
104
- const cols = divisions * subdivisions;
105
- const innerW = Math.max(0, width - 2 * overscan);
106
- const innerH = Math.max(0, height - 2 * overscan);
107
- const insetX = width / 2 - overscan;
108
- const insetY = height / 2 - overscan;
109
-
110
- // Anchored at the near edge, so a line sits on each edge of the box for any count of cells.
111
- return gridLinePaths(
112
- { min: -insetX, max: insetX, step: innerW / cols, offset: offset.x, anchor: -insetX },
113
- { min: -insetY, max: insetY, step: innerH / cols, offset: offset.y, anchor: -insetY },
114
- subdivisions,
115
- overscan,
116
- );
117
- }
1
+ import {
2
+ Flow,
3
+ Graphics2D,
4
+ Paint,
5
+ Types,
6
+ component2d,
7
+ lerpVector2,
8
+ type NodeOf,
9
+ type PathBounds,
10
+ type PathCommand,
11
+ type Vector2,
12
+ // Named so the emitted declaration reaches these through the sdk, not core.
13
+ type Alignment as _Alignment,
14
+ type Fill as _Fill,
15
+ type FillResolved as _FillResolved,
16
+ type FlowMode as _FlowMode,
17
+ type FlowResolved as _FlowResolved,
18
+ type GapSize as _GapSize,
19
+ type Node2D as _Node2D,
20
+ type Node2DProps as _Node2DProps,
21
+ type Shadow as _Shadow,
22
+ type ShadowResolved as _ShadowResolved,
23
+ type Stroke as _Stroke,
24
+ type StrokeResolved as _StrokeResolved,
25
+ } from "@motionscript/sdk";
26
+
27
+ import { centered, defaultSubStroke, gridLinePaths, maxWeight } from "../kit";
28
+
29
+ /**
30
+ * A rectangular grid of lines filling the node's layout rect.
31
+ *
32
+ * `stroke` paints the major lines and `subStroke` the minor ones, each as a
33
+ * single union path. `fill` and `shadow` cover the whole rect, behind the lines.
34
+ */
35
+ export const LineGridPattern = component2d({
36
+ key: "lineGridPattern",
37
+ state: {
38
+ ...Paint.state,
39
+ ...Flow.state,
40
+ /** Cells along each axis: `divisions` of 4 draws 5 major lines per axis. */
41
+ divisions: 4,
42
+ /** Finer cells each division is split into. 1 draws no minor lines; 2 adds one per division. */
43
+ subdivisions: 1,
44
+ /** Stroke for the minor lines. Unset, the major `stroke` at half opacity when `subdivisions > 1`. */
45
+ subStroke: Types.stroke,
46
+ /** Pans the grid. Lines wrap and tile, so the rect stays full while `offset` scrolls it. */
47
+ offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),
48
+ },
49
+ defaults: { subStroke: (_state, given) => defaultSubStroke(given) },
50
+ commands: { ...Paint.commands },
51
+ measure: (measurer, state, children) => Flow.measure(measurer, state, children, Paint.inset(state)),
52
+ layout: (box, state, children) => Flow.layout(box, state, children, Paint.inset(state)),
53
+ render: (ctx, state) => {
54
+ const { width, height } = ctx.size;
55
+ const box = new Graphics2D().rect({ width, height });
56
+ ctx.inFront(() => {
57
+ ctx.draw(new Graphics2D()
58
+ .rect({ width, height, start: state.start, end: state.end })
59
+ .shadow(state.shadow)
60
+ .fill(state.fill));
61
+
62
+ const divisions = Math.max(1, Math.floor(state.divisions));
63
+ const subdivisions = Math.max(1, Math.floor(state.subdivisions));
64
+
65
+ // Lines overscan the rect by half the thickest stroke and are clipped to it, so a
66
+ // thick line slides out under the clip instead of popping at the boundary.
67
+ const major = centered(state.stroke);
68
+ const minorStroke = centered(state.subStroke);
69
+ const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;
70
+ const lines = gridPaths(width, height, divisions, subdivisions, overscan, state.offset);
71
+ const centerBounds: PathBounds = [-width / 2, -height / 2, width / 2, height / 2];
72
+
73
+ ctx.clip(box, () => {
74
+ // Minor lines first so the major lines sit on top.
75
+ if (subdivisions > 1 && minorStroke.length > 0 && lines.minor.length > 0) {
76
+ ctx.draw(new Graphics2D().path({ data: lines.minor, centerBounds }).stroke(minorStroke));
77
+ }
78
+ if (lines.major.length > 0) {
79
+ ctx.draw(new Graphics2D().path({ data: lines.major, centerBounds }).stroke(major));
80
+ }
81
+ });
82
+ });
83
+ // The rect is what `clip` confines the children to and what picking tests; it paints nothing more.
84
+ Paint.draw(ctx, state, null, { clipShape: box });
85
+ },
86
+ });
87
+
88
+ export type LineGridPattern = NodeOf<typeof LineGridPattern>;
89
+ /** What a call or a document row may set. */
90
+ export type LineGridPatternProps = NonNullable<Parameters<typeof LineGridPattern>[0]>;
91
+
92
+ // One multi-subpath path per group, so each stroke paints its lines as a union with no
93
+ // destructive boolean op (which would erase open lines).
94
+ function gridPaths(
95
+ width: number,
96
+ height: number,
97
+ divisions: number,
98
+ subdivisions: number,
99
+ overscan: number,
100
+ offset: Vector2,
101
+ ): { major: PathCommand[]; minor: PathCommand[] } {
102
+ // Inset by `overscan` so the outermost lines sit fully inside the rect and are not
103
+ // trimmed to half weight by the clip.
104
+ const cols = divisions * subdivisions;
105
+ const innerW = Math.max(0, width - 2 * overscan);
106
+ const innerH = Math.max(0, height - 2 * overscan);
107
+ const insetX = width / 2 - overscan;
108
+ const insetY = height / 2 - overscan;
109
+
110
+ // Anchored at the near edge, so a line sits on each edge of the box for any count of cells.
111
+ return gridLinePaths(
112
+ { min: -insetX, max: insetX, step: innerW / cols, offset: offset.x, anchor: -insetX },
113
+ { min: -insetY, max: insetY, step: innerH / cols, offset: offset.y, anchor: -insetY },
114
+ subdivisions,
115
+ overscan,
116
+ );
117
+ }
package/src/nodes.ts CHANGED
@@ -1,27 +1,27 @@
1
- import { DotGridPattern } from "./dot-grid-pattern"
2
- import { GridPattern } from "./grid-pattern"
3
- import { LineGridPattern } from "./line-grid-pattern"
4
-
5
- /**
6
- * Every node type this package publishes.
7
- *
8
- * A host registers these by handing the array to an engine —
9
- * `new Engine(platform, { nodes: NODES })` — which reads each component's key.
10
- * Defining a component only *declares* that key: nothing is registered by
11
- * importing a module, so a registry holds exactly what its owner asked for.
12
- *
13
- * Listing the component **values** is also what survives bundling: this package
14
- * declares `sideEffects: false`, and a document names a node type by string, so
15
- * an import kept only for its side effect is exactly what gets shaken out.
16
- */
17
- // Typed by name, so the declaration names each component rather than spelling out its type through core.
18
- type KitNode =
19
- | typeof LineGridPattern
20
- | typeof DotGridPattern
21
- | typeof GridPattern
22
-
23
- export const NODES: KitNode[] = [
24
- LineGridPattern,
25
- DotGridPattern,
26
- GridPattern,
27
- ]
1
+ import { DotGridPattern } from "./dot-grid-pattern"
2
+ import { GridPattern } from "./grid-pattern"
3
+ import { LineGridPattern } from "./line-grid-pattern"
4
+
5
+ /**
6
+ * Every node type this package publishes.
7
+ *
8
+ * A host registers these by handing the array to an engine —
9
+ * `new Engine(platform, { nodes: NODES })` — which reads each component's key.
10
+ * Defining a component only *declares* that key: nothing is registered by
11
+ * importing a module, so a registry holds exactly what its owner asked for.
12
+ *
13
+ * Listing the component **values** is also what survives bundling: this package
14
+ * declares `sideEffects: false`, and a document names a node type by string, so
15
+ * an import kept only for its side effect is exactly what gets shaken out.
16
+ */
17
+ // Typed by name, so the declaration names each component rather than spelling out its type through core.
18
+ type KitNode =
19
+ | typeof LineGridPattern
20
+ | typeof DotGridPattern
21
+ | typeof GridPattern
22
+
23
+ export const NODES: KitNode[] = [
24
+ LineGridPattern,
25
+ DotGridPattern,
26
+ GridPattern,
27
+ ]
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/kit/grid-lines.ts", "../../../src/kit/viewport-pattern.ts"],
4
- "sourcesContent": ["import { strokeOps, type PathCommand, type Stroke, type StrokeProp, type StrokeResolved } from \"@motionscript/sdk\";\r\n\r\n/**\r\n * Shared geometry for line grids. Both {@link LineGridPattern} (a fixed grid filling\r\n * its layout rect) and {@link GridPattern} (an infinite grid tiled across the\r\n * camera's visible region) build the same multi-subpath line paths from these\r\n * helpers — they differ only in how the extent and step are chosen.\r\n *\r\n * Lines are tiled by the minor step and panned by an origin offset: every\r\n * position within the extent (grown by `overscan` so thick lines clip out\r\n * smoothly) is emitted regardless of the offset, so the area always stays full\r\n * and animating the offset scrolls the grid. The lattice starts at the axis's\r\n * `anchor` (the world origin unless it says otherwise). A tile whose index\r\n * aligns to the division grid is major; the rest are minor. Each is built as a\r\n * single multi-subpath path so the trailing stroke paints every line as one\r\n * union with no destructive boolean op (which would erase the open lines).\r\n */\r\n\r\n/** A grid extent on one axis: lines tile within `[min, max]`, on a lattice that starts at `anchor`. */\r\nexport interface GridAxis {\r\n /** Minimum coordinate (typically negative). */\r\n min: number;\r\n /** Maximum coordinate. */\r\n max: number;\r\n /** Spacing between adjacent (minor) lines. */\r\n step: number;\r\n /** Pan offset in pixels along this axis. */\r\n offset: number;\r\n /**\r\n * Where the lattice starts: a line sits at `anchor + n * step`, and the tile\r\n * index `n` that decides which lines are major counts from there. Omitted it is 0, the\r\n * world origin, which is what a grid that follows a camera keeps. A grid with a box of its\r\n * own sets it to `min`, so the box's edges are lines whatever the count of cells.\r\n */\r\n anchor?: number;\r\n}\r\n\r\n/** The resolved grid: where each line sits and how far it runs. Vertical lines\r\n * sit at x = `verticalX[i]` and run from `top` to `bottom`; horizontal lines sit\r\n * at y = `horizontalY[i]` and run from `left` to `right`. Positions are split\r\n * into major (division) and minor (subdivision) lines. */\r\nexport interface GridLines {\r\n /** y-extent every vertical line spans. */\r\n top: number;\r\n bottom: number;\r\n /** x-extent every horizontal line spans. */\r\n left: number;\r\n right: number;\r\n verticalMajor: number[];\r\n verticalMinor: number[];\r\n horizontalMajor: number[];\r\n horizontalMinor: number[];\r\n}\r\n\r\n/**\r\n * Resolve the grid for the given per-axis extents: the cross-axis span and the\r\n * major/minor line positions on each axis. Vertical lines span the full y\r\n * extent; horizontal lines span the full x extent. Both spans are grown by\r\n * `overscan` so a thick line slides out under the clip instead of popping, and\r\n * snapped outward to the grid so the endpoints sit on stable world positions\r\n * (a line's start stays fixed as the camera pans, so a dashed stroke anchored to\r\n * it doesn't crawl).\r\n *\r\n * `cycle` (the dash period, when dashed) snaps the cross-axis span to a whole\r\n * number of dash cycles too, so each parallel line is the same dash-aligned\r\n * length and the renderer's per-path dash-fit becomes a no-op (no per-frame\r\n * resizing of the dashes as lines enter and leave view).\r\n */\r\nexport function gridLines(\r\n x: GridAxis,\r\n y: GridAxis,\r\n subdivisions: number,\r\n overscan: number,\r\n cycle = 0,\r\n): GridLines {\r\n const verticalMajor: number[] = [];\r\n const verticalMinor: number[] = [];\r\n const horizontalMajor: number[] = [];\r\n const horizontalMinor: number[] = [];\r\n\r\n // Span each line across the cross axis, snapped outward to the grid (and to\r\n // the dash cycle when dashed) so the endpoints sit on stable world positions.\r\n const top = snapSpan(y.min - overscan, y.step, y.offset, cycle, Math.floor);\r\n const bottom = snapSpan(y.max + overscan, y.step, y.offset, cycle, Math.ceil);\r\n const left = snapSpan(x.min - overscan, x.step, x.offset, cycle, Math.floor);\r\n const right = snapSpan(x.max + overscan, x.step, x.offset, cycle, Math.ceil);\r\n\r\n addTiledLines(x.min, x.max, x.step, x.offset, subdivisions, overscan, (px, isMajor) => {\r\n (isMajor ? verticalMajor : verticalMinor).push(px);\r\n }, x.anchor);\r\n addTiledLines(y.min, y.max, y.step, y.offset, subdivisions, overscan, (py, isMajor) => {\r\n (isMajor ? horizontalMajor : horizontalMinor).push(py);\r\n }, y.anchor);\r\n\r\n return { top, bottom, left, right, verticalMajor, verticalMinor, horizontalMajor, horizontalMinor };\r\n}\r\n\r\n/**\r\n * Build the grid lines as multi-subpath path commands, split into the major\r\n * (division) lines and the minor (subdivision) lines, for the given per-axis\r\n * extents. Every line in a group shares one stroke (drawn as one union path), so\r\n * this is the path for solid strokes; dashed strokes that must stay world-locked\r\n * draw per line from {@link gridLines} instead.\r\n */\r\nexport function gridLinePaths(\r\n x: GridAxis,\r\n y: GridAxis,\r\n subdivisions: number,\r\n overscan: number,\r\n): { major: PathCommand[]; minor: PathCommand[] } {\r\n const g = gridLines(x, y, subdivisions, overscan);\r\n const major: PathCommand[] = [];\r\n const minor: PathCommand[] = [];\r\n for (const px of g.verticalMajor) major.push({ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom });\r\n for (const px of g.verticalMinor) minor.push({ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom });\r\n for (const py of g.horizontalMajor) major.push({ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py });\r\n for (const py of g.horizontalMinor) minor.push({ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py });\r\n return { major, minor };\r\n}\r\n\r\n// Snap `pos` outward to a stable world position so a dashed line's start stays\r\n// fixed as the viewport moves (the renderer anchors dash phase to the subpath\r\n// start). Snap to the grid line lattice (`n*step + offset`); when a dash `cycle`\r\n// is given, snap to the dash lattice instead (`n*cycle`, anchored to world 0) so\r\n// every parallel line is the same whole number of cycles long and the renderer's\r\n// per-path dash-fit stays a no-op. `round` is `Math.floor` to snap below, `ceil`\r\n// to snap above. The lattice is the one about 0 whatever an axis's `anchor`: a span\r\n// only has to reach past the edge, and a line's ends stay where they always were.\r\nfunction snapSpan(pos: number, step: number, offset: number, cycle: number, round: (n: number) => number): number {\r\n if (cycle > 0) return round(pos / cycle) * cycle;\r\n if (step <= 0) return pos;\r\n return round((pos - offset) / step) * step + offset;\r\n}\r\n\r\n/**\r\n * Emit every grid line position in `[min, max]` (grown by `overscan` on each\r\n * end) for a grid of spacing `step`, panned by `offset` px. Without panning the\r\n * lattice starts at `anchor` (0 unless given) and its tile indices count outward\r\n * from there; the line at tile index `n` is major when `n` is a multiple of\r\n * `subdivisions`. The pan shifts each position by `offset` while keeping the\r\n * area full, so `n` is taken relative to the un-panned lattice (offset folded\r\n * out) to keep classification stable as it scrolls.\r\n *\r\n * A fixed grid anchors at `min`, so its first line is on the box's edge and the\r\n * last is too whenever the extent is a whole number of steps. An infinite grid\r\n * keeps the default, so its lines stay on the world's lattice.\r\n */\r\nexport function addTiledLines(\r\n min: number,\r\n max: number,\r\n step: number,\r\n offset: number,\r\n subdivisions: number,\r\n overscan: number,\r\n emit: (pos: number, isMajor: boolean) => void,\r\n anchor = 0,\r\n): void {\r\n if (step <= 0) return;\r\n // First/last tile index whose panned position is within the overscanned\r\n // [min, max]. Positions are `anchor + n*step + offset` (n=0 sits on the\r\n // anchor). A small epsilon keeps a line that lands exactly on an edge (an\r\n // anchor at `min`, or a world lattice that reaches it) from being dropped by FP error.\r\n const eps = step * 1e-6;\r\n const startN = Math.ceil((min - overscan - offset - anchor - eps) / step);\r\n const endN = Math.floor((max + overscan - offset - anchor + eps) / step);\r\n for (let n = startN; n <= endN; n++) {\r\n const pos = anchor + n * step + offset;\r\n // mod that stays non-negative for negative n.\r\n const isMajor = ((n % subdivisions) + subdivisions) % subdivisions === 0;\r\n emit(pos, isMajor);\r\n }\r\n}\r\n\r\n/** Largest stroke weight across the layers of a resolved stroke array. Used to\r\n * overscan the tiling so a thick line stays drawn until fully off the area. */\r\nexport function maxWeight(strokes: StrokeResolved[]): number {\r\n let max = 0;\r\n for (const s of strokes) if (s.weight > max) max = s.weight;\r\n return max;\r\n}\r\n\r\n/** Force every layer of a resolved stroke array to centered alignment. Grid\r\n * lines are open paths, not a closed region, so inside/outside alignment is\r\n * meaningless — they always straddle their position. (Open paths are already\r\n * stroked centered by the renderer; this makes the intent explicit and ignores\r\n * any author `align`.) */\r\nexport function centered(strokes: StrokeResolved[]): StrokeResolved[] {\r\n return strokes.map(s => (s.align === 0 ? s : { ...s, align: 0 }));\r\n}\r\n\r\n/** Copy a resolved stroke array with every fill layer's opacity scaled by\r\n * `factor`. Used to derive the default minor-line stroke from the major one.\r\n * Every resolved fill carries an `opacity` field, so this is type-uniform. */\r\nexport function dimStroke(strokes: StrokeResolved[], factor: number): StrokeResolved[] {\r\n return strokeOps.resolve(strokes.map(s => ({\r\n ...s,\r\n fill: s.fill.map(f => ({ ...f, opacity: (f.opacity ?? 1) * factor })),\r\n })) as unknown as StrokeProp[]);\r\n}\r\n\r\nconst SUB_STROKES = new WeakMap<object, StrokeResolved[]>();\r\n\r\n/**\r\n * The minor-line stroke of a pattern built with a `stroke` and no `subStroke`:\r\n * the major one at half opacity, when it was built with minor lines. Read off\r\n * what the pattern was built with (`given`), so it is not kept in step with a\r\n * stroke written later.\r\n */\r\nexport function defaultSubStroke(given: Readonly<Record<string, unknown>>): StrokeResolved[] {\r\n let sub = SUB_STROKES.get(given);\r\n if (!sub) {\r\n const stroke = valueOf(given.stroke) as Stroke | undefined;\r\n const subdivisions = (valueOf(given.subdivisions) as number | undefined) ?? 1;\r\n sub = stroke !== undefined && subdivisions > 1 ? dimStroke(strokeOps.resolve(stroke), 0.5) : [];\r\n SUB_STROKES.set(given, sub);\r\n }\r\n return sub;\r\n}\r\n\r\n/** A prop as it stood when given: a binding read once. */\r\nfunction valueOf(prop: unknown): unknown {\r\n return typeof prop === \"function\" ? (prop as () => unknown)() : prop;\r\n}\r\n", "import {\r\n Camera,\r\n Flow,\r\n Graphics2D,\r\n Paint,\r\n type BoxBounds,\r\n type ChildView,\r\n type Measurer,\r\n type Placement2D,\r\n type RenderContext,\r\n type Size2D,\r\n type Values,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Alignment as _Alignment,\r\n type Fill as _Fill,\r\n type FillResolved as _FillResolved,\r\n type FlowMode as _FlowMode,\r\n type FlowResolved as _FlowResolved,\r\n type GapSize as _GapSize,\r\n type Shadow as _Shadow,\r\n type ShadowResolved as _ShadowResolved,\r\n type Stroke as _Stroke,\r\n type StrokeResolved as _StrokeResolved,\r\n type Vector2 as _Vector2,\r\n} from \"@motionscript/sdk\";\r\n\r\n/**\r\n * What a background that fills whatever region is currently visible shares,\r\n * rather than a fixed rect: `GridPattern` is built from it, and so is a pattern\r\n * of your own. Spread `state` and `commands` in, pass `measure` and `layout`, and\r\n * draw with {@link draw}.\r\n *\r\n * Placed inside a `Camera`, the pattern is handed the world region the camera\r\n * can currently see (from its `zoom`/`lookAt`/`heading`), so it only ever\r\n * generates geometry for what's on screen, with no oversized node sized for the\r\n * worst-case pan and zoom. With no `Camera` above it, it fills its own box, so the\r\n * same pattern doubles as an ordinary full-bleed background.\r\n *\r\n * The pattern is itself a camera child, laid out at the camera's centre, so its\r\n * local draw space shares the world origin its siblings use. The visible region\r\n * is therefore expressed directly in that space: centred on the camera's\r\n * `lookAt`, sized to the inverse of the camera transform.\r\n */\r\n\r\n/** A pattern is a shape: paints, and children laid out like a rect's. */\r\nexport const state = { ...Paint.state, ...Flow.state };\r\n\r\nexport const commands = { ...Paint.commands };\r\n\r\ntype ShapeState = Flow.FlowState & Values<typeof Paint.state>;\r\n\r\nexport function measure(measurer: Measurer, s: ShapeState, children: readonly ChildView[]): Size2D {\r\n return Flow.measure(measurer, s, children, Paint.inset(s));\r\n}\r\n\r\nexport function layout(box: BoxBounds, s: ShapeState, children: readonly ChildView[]): readonly Placement2D[] {\r\n return Flow.layout(box, s, children, Paint.inset(s));\r\n}\r\n\r\n/**\r\n * The region the pattern covers, in its own draw space: the world rect the\r\n * nearest `Camera` above it sees, or its own box when there is none.\r\n */\r\nexport function visibleBounds(ctx: RenderContext): BoxBounds {\r\n const camera = ctx.ancestor(Camera);\r\n if (!camera) return { x: 0, y: 0, width: ctx.size.width, height: ctx.size.height };\r\n\r\n const { width: vw, height: vh } = camera.size;\r\n const zoom = camera.state.zoom || 1;\r\n const heading = camera.state.heading;\r\n\r\n // Inverse of the camera scale: a viewport `vw×vh` shows `vw/zoom × vh/zoom` of the world.\r\n const hw = vw / 2 / zoom;\r\n const hh = vh / 2 / zoom;\r\n\r\n // With a heading the visible world rect is rotated; take its axis-aligned\r\n // bounding box so the pattern covers the rotated viewport's full extent.\r\n let bw = hw;\r\n let bh = hh;\r\n if (heading !== 0) {\r\n const rad = (heading * Math.PI) / 180;\r\n const cos = Math.abs(Math.cos(rad));\r\n const sin = Math.abs(Math.sin(rad));\r\n bw = hw * cos + hh * sin;\r\n bh = hw * sin + hh * cos;\r\n }\r\n\r\n // Centred on the camera's `lookAt`, in y-up world space (the descriptor\r\n // convention; the renderer applies the single y-up→canvas flip when the\r\n // pattern's shapes are drawn).\r\n const lookAt = camera.state.lookAt;\r\n return { x: lookAt.x, y: lookAt.y, width: bw * 2, height: bh * 2 };\r\n}\r\n\r\n/**\r\n * Paint `pattern` over the visible region, once per render, then the children.\r\n *\r\n * The pattern is clipped to the region, so geometry overscanned past the edge\r\n * (so thick lines slide out instead of popping) trims cleanly. Inside a camera\r\n * the viewport already clips, but this keeps edge strokes clean and bounds the\r\n * work with no camera too. A `centerBounds` for a path drawn here is\r\n * `[bounds.x - w/2, bounds.y - h/2, bounds.x + w/2, bounds.y + h/2]`.\r\n */\r\nexport function draw(ctx: RenderContext, pattern: (bounds: BoxBounds) => void): void {\r\n const bounds = visibleBounds(ctx);\r\n const region = new Graphics2D().rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });\r\n ctx.inFront(() => ctx.clip(region, () => pattern(bounds)));\r\n ctx.children();\r\n}\r\n"],
5
- "mappings": "0FAAA,OAAS,aAAAA,MAAsF,oBAoEzF,SAAUC,EACZC,EACAC,EACAC,EACAC,EACAC,EAAQ,EAAC,CAET,IAAMC,EAA0B,CAAA,EAC1BC,EAA0B,CAAA,EAC1BC,EAA4B,CAAA,EAC5BC,EAA4B,CAAA,EAI5BC,EAAMC,EAAST,EAAE,IAAME,EAAUF,EAAE,KAAMA,EAAE,OAAQG,EAAO,KAAK,KAAK,EACpEO,EAASD,EAAST,EAAE,IAAME,EAAUF,EAAE,KAAMA,EAAE,OAAQG,EAAO,KAAK,IAAI,EACtEQ,EAAOF,EAASV,EAAE,IAAMG,EAAUH,EAAE,KAAMA,EAAE,OAAQI,EAAO,KAAK,KAAK,EACrES,EAAQH,EAASV,EAAE,IAAMG,EAAUH,EAAE,KAAMA,EAAE,OAAQI,EAAO,KAAK,IAAI,EAE3E,OAAAU,EAAcd,EAAE,IAAKA,EAAE,IAAKA,EAAE,KAAMA,EAAE,OAAQE,EAAcC,EAA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GAAIF,IAAY,EAAG,CACf,IAAMK,EAAOL,EAAU,KAAK,GAAM,IAC5BM,EAAM,KAAK,IAAI,KAAK,IAAID,CAAG,CAAC,EAC5BE,EAAM,KAAK,IAAI,KAAK,IAAIF,CAAG,CAAC,EAClCF,EAAKF,EAAKK,EAAMJ,EAAKK,EACrBH,EAAKH,EAAKM,EAAML,EAAKI,CACzB,CAKA,IAAME,EAASZ,EAAO,MAAM,OAC5B,MAAO,CAAE,EAAGY,EAAO,EAAG,EAAGA,EAAO,EAAG,MAAOL,EAAK,EAAG,OAAQC,EAAK,CAAC,CACpE,CAWM,SAAUtB,EAAKa,EAAoBc,EAAoC,CACzE,IAAMC,EAASxB,EAAcS,CAAG,EAC1BgB,EAAS,IAAItB,EAAU,EAAG,KAAK,CAAE,EAAGqB,EAAO,EAAG,EAAGA,EAAO,EAAG,MAAOA,EAAO,MAAO,OAAQA,EAAO,MAAM,CAAE,EAC7Gf,EAAI,QAAQ,IAAMA,EAAI,KAAKgB,EAAQ,IAAMF,EAAQC,CAAM,CAAC,CAAC,EACzDf,EAAI,SAAQ,CAChB",
6
- "names": ["strokeOps", "gridLines", "x", "y", "subdivisions", "overscan", "cycle", "verticalMajor", "verticalMinor", "horizontalMajor", "horizontalMinor", "top", "snapSpan", "bottom", "left", "right", "addTiledLines", "px", "isMajor", "py", "gridLinePaths", "g", "major", "minor", "pos", "step", "offset", "round", "min", "max", "emit", "anchor", "eps", "startN", "endN", "n", "maxWeight", "strokes", "s", "centered", "dimStroke", "factor", "f", "SUB_STROKES", "defaultSubStroke", "given", "sub", "stroke", "valueOf", "prop", "viewport_pattern_exports", "__export", "commands", "draw", "layout", "measure", "state", "visibleBounds", "Camera", "Flow", "Graphics2D", "Paint", "measurer", "s", "children", "box", "ctx", "camera", "vw", "vh", "zoom", "heading", "hw", "hh", "bw", "bh", "rad", "cos", "sin", "lookAt", "pattern", "bounds", "region"]
7
- }