@motionscript/patterns 0.0.0-stage → 0.1.0-alpha.5

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 (73) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +48 -0
  4. package/README.md +79 -3
  5. package/dist/browser/chunks/chunk-EZEE76AY.js +2 -0
  6. package/dist/browser/chunks/chunk-EZEE76AY.js.map +7 -0
  7. package/dist/browser/index.js +2 -0
  8. package/dist/browser/index.js.map +7 -0
  9. package/dist/browser/kit.js +2 -0
  10. package/dist/browser/kit.js.map +7 -0
  11. package/dist/browser/manifest.json +13 -0
  12. package/dist/dot-grid-pattern/dot-grid-pattern.d.ts +41 -0
  13. package/dist/dot-grid-pattern/dot-grid-pattern.d.ts.map +1 -0
  14. package/dist/dot-grid-pattern/dot-grid-pattern.js +93 -0
  15. package/dist/dot-grid-pattern/dot-grid-pattern.js.map +1 -0
  16. package/dist/dot-grid-pattern/index.d.ts +2 -0
  17. package/dist/dot-grid-pattern/index.d.ts.map +1 -0
  18. package/dist/dot-grid-pattern/index.js +2 -0
  19. package/dist/dot-grid-pattern/index.js.map +1 -0
  20. package/dist/engine.d.ts +12 -0
  21. package/dist/engine.d.ts.map +1 -0
  22. package/dist/engine.js +12 -0
  23. package/dist/engine.js.map +1 -0
  24. package/dist/grid-pattern/grid-pattern.d.ts +31 -0
  25. package/dist/grid-pattern/grid-pattern.d.ts.map +1 -0
  26. package/dist/grid-pattern/grid-pattern.js +138 -0
  27. package/dist/grid-pattern/grid-pattern.js.map +1 -0
  28. package/dist/grid-pattern/index.d.ts +2 -0
  29. package/dist/grid-pattern/index.d.ts.map +1 -0
  30. package/dist/grid-pattern/index.js +2 -0
  31. package/dist/grid-pattern/index.js.map +1 -0
  32. package/dist/index.d.ts +6 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +6 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/kit/grid-lines.d.ts +104 -0
  37. package/dist/kit/grid-lines.d.ts.map +1 -0
  38. package/dist/kit/grid-lines.js +127 -0
  39. package/dist/kit/grid-lines.js.map +1 -0
  40. package/dist/kit/index.d.ts +3 -0
  41. package/dist/kit/index.d.ts.map +1 -0
  42. package/dist/kit/index.js +3 -0
  43. package/dist/kit/index.js.map +1 -0
  44. package/dist/kit/viewport-pattern.d.ts +36 -0
  45. package/dist/kit/viewport-pattern.d.ts.map +1 -0
  46. package/dist/kit/viewport-pattern.js +77 -0
  47. package/dist/kit/viewport-pattern.js.map +1 -0
  48. package/dist/line-grid-pattern/index.d.ts +2 -0
  49. package/dist/line-grid-pattern/index.d.ts.map +1 -0
  50. package/dist/line-grid-pattern/index.js +2 -0
  51. package/dist/line-grid-pattern/index.js.map +1 -0
  52. package/dist/line-grid-pattern/line-grid-pattern.d.ts +30 -0
  53. package/dist/line-grid-pattern/line-grid-pattern.d.ts.map +1 -0
  54. package/dist/line-grid-pattern/line-grid-pattern.js +96 -0
  55. package/dist/line-grid-pattern/line-grid-pattern.js.map +1 -0
  56. package/dist/nodes.d.ts +14 -0
  57. package/dist/nodes.d.ts.map +1 -0
  58. package/dist/nodes.js +14 -0
  59. package/dist/nodes.js.map +1 -0
  60. package/package.json +72 -3
  61. package/registry.json +26 -0
  62. package/src/dot-grid-pattern/dot-grid-pattern.ts +132 -0
  63. package/src/dot-grid-pattern/index.ts +1 -0
  64. package/src/engine.ts +11 -0
  65. package/src/grid-pattern/grid-pattern.ts +170 -0
  66. package/src/grid-pattern/index.ts +1 -0
  67. package/src/index.ts +5 -0
  68. package/src/kit/grid-lines.ts +199 -0
  69. package/src/kit/index.ts +2 -0
  70. package/src/kit/viewport-pattern.ts +98 -0
  71. package/src/line-grid-pattern/index.ts +1 -0
  72. package/src/line-grid-pattern/line-grid-pattern.ts +125 -0
  73. package/src/nodes.ts +14 -0
@@ -0,0 +1,93 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Clip, Graphics2D, ShapeNode, lerpVector2, node, property, } from "@motionscript/sdk";
8
+ import { addTiledLines } from "../kit/index.js";
9
+ // Calls the tiling `LineGridPattern` uses, so dots stay on its intersections at every offset.
10
+ function gridPositions(min, max, step, offset, subdivisions, overscan) {
11
+ const out = [];
12
+ // Anchored at the near edge, so a column or row sits on each edge of the box for any count of cells.
13
+ addTiledLines(min, max, step, offset, subdivisions, overscan, (pos, isMajor) => {
14
+ out.push({ pos, isMajor });
15
+ }, min);
16
+ return out;
17
+ }
18
+ /**
19
+ * A field of dots on the same `divisions` / `subdivisions` / `offset` as
20
+ * {@link LineGridPattern}, so laid over one the dots sit on its intersections.
21
+ *
22
+ * The silhouette is the dots (see {@link DotGridPattern.shapeGraphics}), so
23
+ * `ShapeNode` paints `shadow`, `fill`, `overlay` and `stroke` with no render code
24
+ * here. A dot grid has no "paper": a rectangle behind it is how it gets a
25
+ * background.
26
+ *
27
+ * `clipSelf` is the node's box rather than the silhouette, which clips outer dots
28
+ * as they pan out and keeps the node selectable between dots. `start` / `end` act
29
+ * on nothing: trimming a disc leaves a crescent, not a partial grid.
30
+ */
31
+ let DotGridPattern = class DotGridPattern extends ShapeNode {
32
+ /** Every dot in the field as one un-painted union: the paint stacks belong to the grid, not to a dot. */
33
+ shapeGraphics() {
34
+ const bounds = this.layoutBounds;
35
+ const width = bounds?.width ?? 0;
36
+ const height = bounds?.height ?? 0;
37
+ if (width <= 0 || height <= 0)
38
+ return null;
39
+ const divisions = Math.max(1, Math.floor(this.divisions));
40
+ const subdivisions = Math.max(1, Math.floor(this.subdivisions));
41
+ const major = Math.max(0, this.radius);
42
+ const minor = major * Math.max(0, this.subScale);
43
+ if (major <= 0 && minor <= 0)
44
+ return null;
45
+ // Inset by a dot's radius so an edge dot sits inside the box rather than being halved by the clip.
46
+ const cols = divisions * subdivisions;
47
+ const insetX = Math.max(0, width / 2 - major);
48
+ const insetY = Math.max(0, height / 2 - major);
49
+ const xs = gridPositions(-insetX, insetX, (insetX * 2) / cols, this.offset.x, subdivisions, major);
50
+ const ys = gridPositions(-insetY, insetY, (insetY * 2) / cols, this.offset.y, subdivisions, major);
51
+ const dots = new Graphics2D();
52
+ let drew = false;
53
+ for (const column of xs) {
54
+ for (const row of ys) {
55
+ // A dot is major only where *both* axes are — an intersection of two
56
+ // major rules, which is exactly the point a line grid draws heaviest.
57
+ const size = column.isMajor && row.isMajor ? major : minor;
58
+ if (size <= 0)
59
+ continue;
60
+ dots.ellipse({ x: column.pos, y: row.pos, width: size * 2, height: size * 2 });
61
+ drew = true;
62
+ }
63
+ }
64
+ return drew ? dots : null;
65
+ }
66
+ clipSelf() {
67
+ const bounds = this.layoutBounds;
68
+ return new Clip().rect({
69
+ width: bounds?.width ?? 0,
70
+ height: bounds?.height ?? 0,
71
+ });
72
+ }
73
+ };
74
+ __decorate([
75
+ property({ default: 4 })
76
+ ], DotGridPattern.prototype, "divisions", void 0);
77
+ __decorate([
78
+ property({ default: 1 })
79
+ ], DotGridPattern.prototype, "subdivisions", void 0);
80
+ __decorate([
81
+ property({ default: 3 })
82
+ ], DotGridPattern.prototype, "radius", void 0);
83
+ __decorate([
84
+ property({ default: 0.5 })
85
+ ], DotGridPattern.prototype, "subScale", void 0);
86
+ __decorate([
87
+ property({ default: { x: 0, y: 0 }, tween: lerpVector2 })
88
+ ], DotGridPattern.prototype, "offset", void 0);
89
+ DotGridPattern = __decorate([
90
+ node({ key: "dotGridPattern", parentKey: "shape", forkable: true })
91
+ ], DotGridPattern);
92
+ export { DotGridPattern };
93
+ //# sourceMappingURL=dot-grid-pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-grid-pattern.js","sourceRoot":"","sources":["../../src/dot-grid-pattern/dot-grid-pattern.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,WAAW,EACX,IAAI,EACJ,QAAQ,GAGT,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAQtC,8FAA8F;AAC9F,SAAS,aAAa,CACpB,GAAW,EACX,GAAW,EACX,IAAY,EACZ,MAAc,EACd,YAAoB,EACpB,QAAgB;IAEhB,MAAM,GAAG,GAAmB,EAAE,CAAA;IAC9B,qGAAqG;IACrG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QAC7E,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5B,CAAC,EAAE,GAAG,CAAC,CAAA;IACP,OAAO,GAAG,CAAA;AACZ,CAAC;AAmBD;;;;;;;;;;;;GAYG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,SAA8B;IAQhE,yGAAyG;IACtF,aAAa;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAA;QAChC,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC,CAAA;QAChC,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,CAAC,CAAA;QAClC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAE1C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;QACzD,MAAM,YA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E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;GACvD,cAAc,CAgE1B","sourcesContent":["import {\r\n Clip,\r\n Graphics2D,\r\n ShapeNode,\r\n lerpVector2,\r\n node,\r\n property,\r\n type ShapeProps,\r\n type Vector2,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport { addTiledLines } from \"../kit\"\r\n\r\n/** One mark's place on an axis, and whether it lands on the coarse grid. */\r\ninterface GridPosition {\r\n pos: number\r\n isMajor: boolean\r\n}\r\n\r\n// Calls the tiling `LineGridPattern` uses, so dots stay on its intersections at every offset.\r\nfunction gridPositions(\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): GridPosition[] {\r\n const out: GridPosition[] = []\r\n // Anchored at the near edge, so a column or row sits on each edge of the box for any count of cells.\r\n addTiledLines(min, max, step, offset, subdivisions, overscan, (pos, isMajor) => {\r\n out.push({ pos, isMajor })\r\n }, min)\r\n return out\r\n}\r\n\r\nexport interface DotGridPatternProps extends ShapeProps {\r\n /** Cells along each axis, as in `LineGridPattern.divisions`: 4 puts 5 major dots on each axis. */\r\n divisions: number\r\n /** Splits each division again. `1` draws only the major dots; `2` puts one minor dot between each pair. */\r\n subdivisions: number\r\n /** Radius of a major dot. */\r\n radius: number\r\n /**\r\n * A minor dot's radius as a fraction of a major one's. A fraction rather than a\r\n * second paint stack, so the whole field stays one fill and a gradient crosses\r\n * every dot in it.\r\n */\r\n subScale: number\r\n /** Pans the field, as `LineGridPattern.offset` does, so the two stay aligned while both scroll. */\r\n offset: Vector2\r\n}\r\n\r\n/**\r\n * A field of dots on the same `divisions` / `subdivisions` / `offset` as\r\n * {@link LineGridPattern}, so laid over one the dots sit on its intersections.\r\n *\r\n * The silhouette is the dots (see {@link DotGridPattern.shapeGraphics}), so\r\n * `ShapeNode` paints `shadow`, `fill`, `overlay` and `stroke` with no render code\r\n * here. A dot grid has no \"paper\": a rectangle behind it is how it gets a\r\n * background.\r\n *\r\n * `clipSelf` is the node's box rather than the silhouette, which clips outer dots\r\n * as they pan out and keeps the node selectable between dots. `start` / `end` act\r\n * on nothing: trimming a disc leaves a crescent, not a partial grid.\r\n */\r\n@node({ key: \"dotGridPattern\", parentKey: \"shape\", forkable: true })\r\nexport class DotGridPattern extends ShapeNode<DotGridPatternProps> {\r\n @property({ default: 4 }) declare readonly divisions: number\r\n @property({ default: 1 }) declare readonly subdivisions: number\r\n @property({ default: 3 }) declare readonly radius: number\r\n @property({ default: 0.5 }) declare readonly subScale: number\r\n @property({ default: { x: 0, y: 0 }, tween: lerpVector2 })\r\n declare readonly offset: Vector2\r\n\r\n /** Every dot in the field as one un-painted union: the paint stacks belong to the grid, not to a dot. */\r\n protected override shapeGraphics(): Graphics2D | null {\r\n const bounds = this.layoutBounds\r\n const width = bounds?.width ?? 0\r\n const height = bounds?.height ?? 0\r\n if (width <= 0 || height <= 0) return null\r\n\r\n const divisions = Math.max(1, Math.floor(this.divisions))\r\n const subdivisions = Math.max(1, Math.floor(this.subdivisions))\r\n const major = Math.max(0, this.radius)\r\n const minor = major * Math.max(0, this.subScale)\r\n if (major <= 0 && minor <= 0) return null\r\n\r\n // Inset by a dot's radius so an edge dot sits inside the box rather than being halved by the clip.\r\n const cols = divisions * subdivisions\r\n const insetX = Math.max(0, width / 2 - major)\r\n const insetY = Math.max(0, height / 2 - major)\r\n const xs = gridPositions(\r\n -insetX,\r\n insetX,\r\n (insetX * 2) / cols,\r\n this.offset.x,\r\n subdivisions,\r\n major\r\n )\r\n const ys = gridPositions(\r\n -insetY,\r\n insetY,\r\n (insetY * 2) / cols,\r\n this.offset.y,\r\n subdivisions,\r\n major\r\n )\r\n\r\n const dots = new Graphics2D()\r\n let drew = false\r\n for (const column of xs) {\r\n for (const row of ys) {\r\n // A dot is major only where *both* axes are — an intersection of two\r\n // major rules, which is exactly the point a line grid draws heaviest.\r\n const size = column.isMajor && row.isMajor ? major : minor\r\n if (size <= 0) continue\r\n dots.ellipse({ x: column.pos, y: row.pos, width: size * 2, height: size * 2 })\r\n drew = true\r\n }\r\n }\r\n return drew ? dots : null\r\n }\r\n\r\n protected override clipSelf(): Clip {\r\n const bounds = this.layoutBounds\r\n return new Clip().rect({\r\n width: bounds?.width ?? 0,\r\n height: bounds?.height ?? 0,\r\n })\r\n }\r\n}\r\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./dot-grid-pattern.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dot-grid-pattern/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./dot-grid-pattern.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dot-grid-pattern/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA","sourcesContent":["export * from \"./dot-grid-pattern\"\r\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The patterns **kit**: what the three patterns share, and what a copied one does
3
+ * not copy.
4
+ *
5
+ * `ms add` writes a pattern's own files into your project and rewrites its reach
6
+ * for these to `@motionscript/patterns/kit`. The engine keys prop machinery to
7
+ * class identity, so a second copy of `ViewportPattern` would be a second base
8
+ * class answering to one name; `grid-lines` is the tiling every pattern shares,
9
+ * which is what keeps a dot grid on a line grid's intersections.
10
+ */
11
+ export * from "./kit/index.js";
12
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,OAAO,CAAA"}
package/dist/engine.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The patterns **kit**: what the three patterns share, and what a copied one does
3
+ * not copy.
4
+ *
5
+ * `ms add` writes a pattern's own files into your project and rewrites its reach
6
+ * for these to `@motionscript/patterns/kit`. The engine keys prop machinery to
7
+ * class identity, so a second copy of `ViewportPattern` would be a second base
8
+ * class answering to one name; `grid-lines` is the tiling every pattern shares,
9
+ * which is what keeps a dot grid on a line grid's intersections.
10
+ */
11
+ export * from "./kit/index.js";
12
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,OAAO,CAAA","sourcesContent":["/**\r\n * The patterns **kit**: what the three patterns share, and what a copied one does\r\n * not copy.\r\n *\r\n * `ms add` writes a pattern's own files into your project and rewrites its reach\r\n * for these to `@motionscript/patterns/kit`. The engine keys prop machinery to\r\n * class identity, so a second copy of `ViewportPattern` would be a second base\r\n * class answering to one name; `grid-lines` is the tiling every pattern shares,\r\n * which is what keeps a dot grid on a line grid's intersections.\r\n */\r\nexport * from \"./kit\"\r\n"]}
@@ -0,0 +1,31 @@
1
+ import { type AssetScope, type BoxBounds, type NodeConfig, type RenderContext2D, type ShapeProps, type Stroke, type StrokeResolved, type Vector2 } from "@motionscript/sdk";
2
+ import { ViewportPattern } from "../kit/index.js";
3
+ export interface GridPatternProps extends ShapeProps {
4
+ /** Spacing between grid lines in world units: one number for both axes, or `{ x, y }`. */
5
+ cellSize: number | Vector2;
6
+ /** Finer cells each cell is split into, as in {@link LineGridPattern.subdivisions}. */
7
+ subdivisions: number;
8
+ /** Stroke for the minor lines. Defaults to the major `stroke` at half opacity when `subdivisions > 1`. */
9
+ subStroke?: Stroke;
10
+ /** Scrolls the pattern relative to the world, which it is otherwise anchored to. */
11
+ offset: Vector2;
12
+ }
13
+ /**
14
+ * An infinite line grid that fills the camera's visible region. Like
15
+ * {@link LineGridPattern} it draws major and minor strokes over a fill and pans
16
+ * with `offset`, but it tiles a world-anchored grid (spacing `cellSize`) across
17
+ * what the parent {@link Camera} can see, regenerated each frame. With no camera
18
+ * it fills its own layout rect.
19
+ */
20
+ export declare class GridPattern extends ViewportPattern<GridPatternProps> {
21
+ readonly cellSize: number | Vector2;
22
+ readonly subdivisions: number;
23
+ get subStroke(): StrokeResolved[];
24
+ set subStroke(value: Stroke);
25
+ readonly offset: Vector2;
26
+ constructor(props: NodeConfig<GridPattern, GridPatternProps>);
27
+ declareAssets(assets: AssetScope): void;
28
+ protected renderPattern(draw: RenderContext2D, bounds: BoxBounds): void;
29
+ private _drawGroup;
30
+ }
31
+ //# sourceMappingURL=grid-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-pattern.d.ts","sourceRoot":"","sources":["../../src/grid-pattern/grid-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,OAAO,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA6C,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAEnG,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,uFAAuF;IACvF,YAAY,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,qBACa,WAAY,SAAQ,eAAe,CAAC,gBAAgB,CAAC;IAE9D,SACiB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,SAA2C,YAAY,EAAE,MAAM,CAAC;IAEhE,IACI,SAAS,IAAI,cAAc,EAAE,CAAuB;IACxD,IAAI,SAAS,CAAC,KAAK,EAAE,MAAM,EAAkC;IAC7D,SACiB,MAAM,EAAE,OAAO,CAAC;gBAErB,KAAK,EAAE,UAAU,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAQnD,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAKhD,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI;IAyCvE,OAAO,CAAC,UAAU;CAoCrB"}
@@ -0,0 +1,138 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Graphics2D, lerpNumber, lerpVector2, node, property, strokeProperty, } from "@motionscript/sdk";
8
+ import { centered, dimStroke, gridLines, maxWeight, ViewportPattern } from "../kit/index.js";
9
+ /**
10
+ * An infinite line grid that fills the camera's visible region. Like
11
+ * {@link LineGridPattern} it draws major and minor strokes over a fill and pans
12
+ * with `offset`, but it tiles a world-anchored grid (spacing `cellSize`) across
13
+ * what the parent {@link Camera} can see, regenerated each frame. With no camera
14
+ * it fills its own layout rect.
15
+ */
16
+ let GridPattern = class GridPattern extends ViewportPattern {
17
+ // Asymmetric accessor like `ShapeNode.stroke`: reads yield `StrokeResolved[]`, writes accept `Stroke`.
18
+ get subStroke() { return undefined; }
19
+ set subStroke(value) { }
20
+ constructor(props) {
21
+ super(props);
22
+ if (props.subStroke === undefined && props.stroke !== undefined && this.subdivisions > 1) {
23
+ this.set({ subStroke: dimStroke(this.stroke, 0.5) });
24
+ }
25
+ }
26
+ declareAssets(assets) {
27
+ super.declareAssets(assets);
28
+ for (const stroke of this.subStroke)
29
+ assets.fill(stroke.fill);
30
+ }
31
+ renderPattern(draw, bounds) {
32
+ const halfW = bounds.width / 2;
33
+ const halfH = bounds.height / 2;
34
+ // `bounds` is centred on (x, y) in y-up world space: descriptor coordinates are y-up
35
+ // and the renderer applies the single flip.
36
+ const left = bounds.x - halfW;
37
+ const right = bounds.x + halfW;
38
+ const top = bounds.y - halfH;
39
+ const bottom = bounds.y + halfH;
40
+ draw.draw(new Graphics2D()
41
+ .rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, start: this.start, end: this.end })
42
+ .shadow(this.shadow)
43
+ .fill(this.fill));
44
+ const subdivisions = Math.max(1, Math.floor(this.subdivisions));
45
+ const cell = this.cellSize;
46
+ const cellX = Math.max(1e-3, typeof cell === "number" ? cell : cell.x);
47
+ const cellY = Math.max(1e-3, typeof cell === "number" ? cell : cell.y);
48
+ const stepX = cellX / subdivisions;
49
+ const stepY = cellY / subdivisions;
50
+ const major = centered(this.stroke);
51
+ const minorStroke = centered(this.subStroke);
52
+ const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;
53
+ const xAxis = { min: left, max: right, step: stepX, offset: this.offset.x };
54
+ const yAxis = { min: top, max: bottom, step: stepY, offset: this.offset.y };
55
+ // Minor lines first so the major lines sit on top.
56
+ if (subdivisions > 1 && minorStroke.length > 0) {
57
+ this._drawGroup(draw, xAxis, yAxis, subdivisions, overscan, minorStroke, false);
58
+ }
59
+ if (major.length > 0) {
60
+ this._drawGroup(draw, xAxis, yAxis, subdivisions, overscan, major, true);
61
+ }
62
+ }
63
+ // A solid stroke paints the group as one union path. A dashed one draws each line on
64
+ // its own with its dash phase anchored to the line's world coordinate, so dashes never
65
+ // crawl as the camera pans or new lines scroll in.
66
+ _drawGroup(draw, xAxis, yAxis, subdivisions, overscan, stroke, isMajor) {
67
+ // Each line spans a whole number of dash cycles, so the renderer's per-path dash-fit
68
+ // is a no-op and every line dashes identically.
69
+ const cycle = dashCycle(stroke);
70
+ const g = gridLines(xAxis, yAxis, subdivisions, overscan, cycle);
71
+ const verticals = isMajor ? g.verticalMajor : g.verticalMinor;
72
+ const horizontals = isMajor ? g.horizontalMajor : g.horizontalMinor;
73
+ // Symmetric centerBounds give a zero recentre offset, so local coordinates draw verbatim.
74
+ const centerBounds = [-1, -1, 1, 1];
75
+ if (cycle <= 0) {
76
+ const data = [];
77
+ for (const px of verticals)
78
+ data.push({ type: "M", x: px, y: g.top }, { type: "L", x: px, y: g.bottom });
79
+ for (const py of horizontals)
80
+ data.push({ type: "M", x: g.left, y: py }, { type: "L", x: g.right, y: py });
81
+ if (data.length > 0)
82
+ draw.draw(new Graphics2D().path({ data, centerBounds }).stroke(stroke));
83
+ return;
84
+ }
85
+ for (const px of verticals) {
86
+ const data = [{ type: "M", x: px, y: g.top }, { type: "L", x: px, y: g.bottom }];
87
+ draw.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.top)));
88
+ }
89
+ for (const py of horizontals) {
90
+ const data = [{ type: "M", x: g.left, y: py }, { type: "L", x: g.right, y: py }];
91
+ draw.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.left)));
92
+ }
93
+ }
94
+ };
95
+ __decorate([
96
+ property({ default: 100, tween: lerpCellSize })
97
+ ], GridPattern.prototype, "cellSize", void 0);
98
+ __decorate([
99
+ property({ default: 1 })
100
+ ], GridPattern.prototype, "subdivisions", void 0);
101
+ __decorate([
102
+ strokeProperty()
103
+ ], GridPattern.prototype, "subStroke", null);
104
+ __decorate([
105
+ property({ default: { x: 0, y: 0 }, tween: lerpVector2 })
106
+ ], GridPattern.prototype, "offset", void 0);
107
+ GridPattern = __decorate([
108
+ node({ key: "gridPattern", parentKey: "shape", forkable: true })
109
+ ], GridPattern);
110
+ export { GridPattern };
111
+ // The largest dash-array sum across the layers, or 0 when none is dashed.
112
+ function dashCycle(strokes) {
113
+ let cycle = 0;
114
+ for (const s of strokes) {
115
+ if (s.dash && s.dash.length > 0) {
116
+ const sum = s.dash.reduce((a, b) => a + b, 0);
117
+ if (sum > cycle)
118
+ cycle = sum;
119
+ }
120
+ }
121
+ return cycle;
122
+ }
123
+ // `dashOffset` advances the pattern, so it is negated to put the "on" run at the phase one
124
+ // infinite line would have at this world coordinate.
125
+ function phaseShift(strokes, worldStart) {
126
+ return strokes.map(s => (s.dash && s.dash.length > 0)
127
+ ? { ...s, dashOffset: (s.dashOffset ?? 0) - worldStart }
128
+ : s);
129
+ }
130
+ // A number and a vector tween by promoting the number to a uniform vector.
131
+ function lerpCellSize(from, to, t) {
132
+ if (typeof from === "number" && typeof to === "number")
133
+ return lerpNumber(from, to, t);
134
+ const a = typeof from === "number" ? { x: from, y: from } : from;
135
+ const b = typeof to === "number" ? { x: to, y: to } : to;
136
+ return lerpVector2(a, b, t);
137
+ }
138
+ //# sourceMappingURL=grid-pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-pattern.js","sourceRoot":"","sources":["../../src/grid-pattern/grid-pattern.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,UAAU,EACV,UAAU,EACV,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,cAAc,GAUjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAanG;;;;;;GAMG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,eAAiC;IAK9D,uGAAuG;IAEvG,IAAI,SAAS,KAAuB,OAAO,SAAU,CAAC,CAAC,CAAC;IACxD,IAAI,SAAS,CAAC,KAAa,IAAiC,CAAC;IAI7D,YAAY,KAAgD;QACxD,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;YACvF,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,MAA0B,EAA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AkB;IAC7D,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACjD,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,UAAU,EAAE;QACxD,CAAC,CAAC,CAAC,CAAC,CAAC;AACb,CAAC;AAED,2EAA2E;AAC3E,SAAS,YAAY,CAAC,IAAsB,EAAE,EAAoB,EAAE,CAAS;IACzE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvF,MAAM,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,MAAM,CAAC,GAAG,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,OAAO,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import {\r\n Graphics2D,\r\n lerpNumber,\r\n lerpVector2,\r\n node,\r\n property,\r\n strokeProperty,\r\n type AssetScope,\r\n type BoxBounds,\r\n type NodeConfig,\r\n type PathCommand,\r\n type RenderContext2D,\r\n type ShapeProps,\r\n type Stroke,\r\n type StrokeResolved,\r\n type Vector2,\r\n} from \"@motionscript/sdk\";\r\n\r\nimport { centered, dimStroke, gridLines, maxWeight, ViewportPattern, type GridAxis } from \"../kit\";\r\n\r\nexport interface GridPatternProps extends ShapeProps {\r\n /** Spacing between grid lines in world units: one number for both axes, or `{ x, y }`. */\r\n cellSize: number | Vector2;\r\n /** Finer cells each cell is split into, as in {@link LineGridPattern.subdivisions}. */\r\n subdivisions: number;\r\n /** Stroke for the minor lines. Defaults to the major `stroke` at half opacity when `subdivisions > 1`. */\r\n subStroke?: Stroke;\r\n /** Scrolls the pattern relative to the world, which it is otherwise anchored to. */\r\n offset: Vector2;\r\n}\r\n\r\n/**\r\n * An infinite line grid that fills the camera's visible region. Like\r\n * {@link LineGridPattern} it draws major and minor strokes over a fill and pans\r\n * with `offset`, but it tiles a world-anchored grid (spacing `cellSize`) across\r\n * what the parent {@link Camera} can see, regenerated each frame. With no camera\r\n * it fills its own layout rect.\r\n */\r\n@node({ key: \"gridPattern\", parentKey: \"shape\", forkable: true })\r\nexport class GridPattern extends ViewportPattern<GridPatternProps> {\r\n\r\n @property({ default: 100, tween: lerpCellSize })\r\n declare readonly cellSize: number | Vector2;\r\n @property({ default: 1 }) declare readonly subdivisions: number;\r\n // Asymmetric accessor like `ShapeNode.stroke`: reads yield `StrokeResolved[]`, writes accept `Stroke`.\r\n @strokeProperty()\r\n get subStroke(): StrokeResolved[] { return undefined!; }\r\n set subStroke(value: Stroke) { /* installed by @property */ }\r\n @property({ default: { x: 0, y: 0 }, tween: lerpVector2 })\r\n declare readonly offset: Vector2;\r\n\r\n constructor(props: NodeConfig<GridPattern, GridPatternProps>) {\r\n super(props);\r\n\r\n if (props.subStroke === undefined && props.stroke !== undefined && this.subdivisions > 1) {\r\n this.set({ subStroke: dimStroke(this.stroke as StrokeResolved[], 0.5) });\r\n }\r\n }\r\n\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n for (const stroke of this.subStroke) assets.fill(stroke.fill);\r\n }\r\n\r\n protected renderPattern(draw: RenderContext2D, bounds: BoxBounds): void {\r\n const halfW = bounds.width / 2;\r\n const halfH = bounds.height / 2;\r\n // `bounds` is centred on (x, y) in y-up world space: descriptor coordinates are y-up\r\n // and the renderer applies the single flip.\r\n const left = bounds.x - halfW;\r\n const right = bounds.x + halfW;\r\n const top = bounds.y - halfH;\r\n const bottom = bounds.y + halfH;\r\n\r\n draw.draw(new Graphics2D()\r\n .rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, start: this.start, end: this.end })\r\n .shadow(this.shadow)\r\n .fill(this.fill));\r\n\r\n const subdivisions = Math.max(1, Math.floor(this.subdivisions));\r\n const cell = this.cellSize;\r\n const cellX = Math.max(1e-3, typeof cell === \"number\" ? cell : cell.x);\r\n const cellY = Math.max(1e-3, typeof cell === \"number\" ? cell : cell.y);\r\n const stepX = cellX / subdivisions;\r\n const stepY = cellY / subdivisions;\r\n\r\n const major = centered(this.stroke as StrokeResolved[]);\r\n const minorStroke = centered(this.subStroke as StrokeResolved[]);\r\n const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;\r\n\r\n const xAxis: GridAxis = { min: left, max: right, step: stepX, offset: this.offset.x };\r\n const yAxis: GridAxis = { min: top, max: bottom, step: stepY, offset: this.offset.y };\r\n\r\n // Minor lines first so the major lines sit on top.\r\n if (subdivisions > 1 && minorStroke.length > 0) {\r\n this._drawGroup(draw, xAxis, yAxis, subdivisions, overscan, minorStroke, false);\r\n }\r\n if (major.length > 0) {\r\n this._drawGroup(draw, xAxis, yAxis, subdivisions, overscan, major, true);\r\n }\r\n }\r\n\r\n // A solid stroke paints the group as one union path. A dashed one draws each line on\r\n // its own with its dash phase anchored to the line's world coordinate, so dashes never\r\n // crawl as the camera pans or new lines scroll in.\r\n private _drawGroup(\r\n draw: RenderContext2D,\r\n xAxis: GridAxis,\r\n yAxis: GridAxis,\r\n subdivisions: number,\r\n overscan: number,\r\n stroke: StrokeResolved[],\r\n isMajor: boolean,\r\n ): void {\r\n // Each line spans a whole number of dash cycles, so the renderer's per-path dash-fit\r\n // is a no-op and every line dashes identically.\r\n const cycle = dashCycle(stroke);\r\n const g = gridLines(xAxis, yAxis, subdivisions, overscan, cycle);\r\n const verticals = isMajor ? g.verticalMajor : g.verticalMinor;\r\n const horizontals = isMajor ? g.horizontalMajor : g.horizontalMinor;\r\n\r\n // Symmetric centerBounds give a zero recentre offset, so local coordinates draw verbatim.\r\n const centerBounds = [-1, -1, 1, 1] as const;\r\n\r\n if (cycle <= 0) {\r\n const data: PathCommand[] = [];\r\n for (const px of verticals) data.push({ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom });\r\n for (const py of horizontals) data.push({ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py });\r\n if (data.length > 0) draw.draw(new Graphics2D().path({ data, centerBounds }).stroke(stroke));\r\n return;\r\n }\r\n\r\n for (const px of verticals) {\r\n const data: PathCommand[] = [{ type: \"M\", x: px, y: g.top }, { type: \"L\", x: px, y: g.bottom }];\r\n draw.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.top)));\r\n }\r\n for (const py of horizontals) {\r\n const data: PathCommand[] = [{ type: \"M\", x: g.left, y: py }, { type: \"L\", x: g.right, y: py }];\r\n draw.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.left)));\r\n }\r\n }\r\n}\r\n\r\n// The largest dash-array sum across the layers, or 0 when none is dashed.\r\nfunction dashCycle(strokes: StrokeResolved[]): number {\r\n let cycle = 0;\r\n for (const s of strokes) {\r\n if (s.dash && s.dash.length > 0) {\r\n const sum = s.dash.reduce((a, b) => a + b, 0);\r\n if (sum > cycle) cycle = sum;\r\n }\r\n }\r\n return cycle;\r\n}\r\n\r\n// `dashOffset` advances the pattern, so it is negated to put the \"on\" run at the phase one\r\n// infinite line would have at this world coordinate.\r\nfunction phaseShift(strokes: StrokeResolved[], worldStart: number): StrokeResolved[] {\r\n return strokes.map(s => (s.dash && s.dash.length > 0)\r\n ? { ...s, dashOffset: (s.dashOffset ?? 0) - worldStart }\r\n : s);\r\n}\r\n\r\n// A number and a vector tween by promoting the number to a uniform vector.\r\nfunction lerpCellSize(from: number | Vector2, to: number | Vector2, t: number): number | Vector2 {\r\n if (typeof from === \"number\" && typeof to === \"number\") return lerpNumber(from, to, t);\r\n const a = typeof from === \"number\" ? { x: from, y: from } : from;\r\n const b = typeof to === \"number\" ? { x: to, y: to } : to;\r\n return lerpVector2(a, b, t);\r\n}\r\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./grid-pattern.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/grid-pattern/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./grid-pattern.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/grid-pattern/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA","sourcesContent":["export * from \"./grid-pattern\"\r\n"]}
@@ -0,0 +1,6 @@
1
+ export * from "./line-grid-pattern/index.js";
2
+ export * from "./dot-grid-pattern/index.js";
3
+ export * from "./grid-pattern/index.js";
4
+ export * from "./engine.js";
5
+ export { NODES } from "./nodes.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./line-grid-pattern/index.js";
2
+ export * from "./dot-grid-pattern/index.js";
3
+ export * from "./grid-pattern/index.js";
4
+ export * from "./engine.js";
5
+ export { NODES } from "./nodes.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA","sourcesContent":["export * from \"./line-grid-pattern\"\r\nexport * from \"./dot-grid-pattern\"\r\nexport * from \"./grid-pattern\"\r\nexport * from \"./engine\"\r\nexport { NODES } from \"./nodes\"\r\n"]}
@@ -0,0 +1,104 @@
1
+ import { type PathCommand, type StrokeResolved } from "@motionscript/sdk";
2
+ /**
3
+ * Shared geometry for line grids. Both {@link LineGridPattern} (a fixed grid filling
4
+ * its layout rect) and {@link GridPattern} (an infinite grid tiled across the
5
+ * camera's visible region) build the same multi-subpath line paths from these
6
+ * helpers — they differ only in how the extent and step are chosen.
7
+ *
8
+ * Lines are tiled by the minor step and panned by an origin offset: every
9
+ * position within the extent (grown by `overscan` so thick lines clip out
10
+ * smoothly) is emitted regardless of the offset, so the area always stays full
11
+ * and animating the offset scrolls the grid. The lattice starts at the axis's
12
+ * `anchor` (the world origin unless it says otherwise). A tile whose index
13
+ * aligns to the division grid is major; the rest are minor. Each is built as a
14
+ * single multi-subpath path so the trailing stroke paints every line as one
15
+ * union with no destructive boolean op (which would erase the open lines).
16
+ */
17
+ /** A grid extent on one axis: lines tile within `[min, max]`, on a lattice that starts at `anchor`. */
18
+ export interface GridAxis {
19
+ /** Minimum coordinate (typically negative). */
20
+ min: number;
21
+ /** Maximum coordinate. */
22
+ max: number;
23
+ /** Spacing between adjacent (minor) lines. */
24
+ step: number;
25
+ /** Pan offset in pixels along this axis. */
26
+ offset: number;
27
+ /**
28
+ * Where the lattice starts: a line sits at `anchor + n * step`, and the tile
29
+ * index `n` that decides which lines are major counts from there. Omitted it is 0, the
30
+ * world origin, which is what a grid that follows a camera keeps. A grid with a box of its
31
+ * own sets it to `min`, so the box's edges are lines whatever the count of cells.
32
+ */
33
+ anchor?: number;
34
+ }
35
+ /** The resolved grid: where each line sits and how far it runs. Vertical lines
36
+ * sit at x = `verticalX[i]` and run from `top` to `bottom`; horizontal lines sit
37
+ * at y = `horizontalY[i]` and run from `left` to `right`. Positions are split
38
+ * into major (division) and minor (subdivision) lines. */
39
+ export interface GridLines {
40
+ /** y-extent every vertical line spans. */
41
+ top: number;
42
+ bottom: number;
43
+ /** x-extent every horizontal line spans. */
44
+ left: number;
45
+ right: number;
46
+ verticalMajor: number[];
47
+ verticalMinor: number[];
48
+ horizontalMajor: number[];
49
+ horizontalMinor: number[];
50
+ }
51
+ /**
52
+ * Resolve the grid for the given per-axis extents: the cross-axis span and the
53
+ * major/minor line positions on each axis. Vertical lines span the full y
54
+ * extent; horizontal lines span the full x extent. Both spans are grown by
55
+ * `overscan` so a thick line slides out under the clip instead of popping, and
56
+ * snapped outward to the grid so the endpoints sit on stable world positions
57
+ * (a line's start stays fixed as the camera pans, so a dashed stroke anchored to
58
+ * it doesn't crawl).
59
+ *
60
+ * `cycle` (the dash period, when dashed) snaps the cross-axis span to a whole
61
+ * number of dash cycles too, so each parallel line is the same dash-aligned
62
+ * length and the renderer's per-path dash-fit becomes a no-op (no per-frame
63
+ * resizing of the dashes as lines enter and leave view).
64
+ */
65
+ export declare function gridLines(x: GridAxis, y: GridAxis, subdivisions: number, overscan: number, cycle?: number): GridLines;
66
+ /**
67
+ * Build the grid lines as multi-subpath path commands, split into the major
68
+ * (division) lines and the minor (subdivision) lines, for the given per-axis
69
+ * extents. Every line in a group shares one stroke (drawn as one union path), so
70
+ * this is the path for solid strokes; dashed strokes that must stay world-locked
71
+ * draw per line from {@link gridLines} instead.
72
+ */
73
+ export declare function gridLinePaths(x: GridAxis, y: GridAxis, subdivisions: number, overscan: number): {
74
+ major: PathCommand[];
75
+ minor: PathCommand[];
76
+ };
77
+ /**
78
+ * Emit every grid line position in `[min, max]` (grown by `overscan` on each
79
+ * end) for a grid of spacing `step`, panned by `offset` px. Without panning the
80
+ * lattice starts at `anchor` (0 unless given) and its tile indices count outward
81
+ * from there; the line at tile index `n` is major when `n` is a multiple of
82
+ * `subdivisions`. The pan shifts each position by `offset` while keeping the
83
+ * area full, so `n` is taken relative to the un-panned lattice (offset folded
84
+ * out) to keep classification stable as it scrolls.
85
+ *
86
+ * A fixed grid anchors at `min`, so its first line is on the box's edge and the
87
+ * last is too whenever the extent is a whole number of steps. An infinite grid
88
+ * keeps the default, so its lines stay on the world's lattice.
89
+ */
90
+ export declare function addTiledLines(min: number, max: number, step: number, offset: number, subdivisions: number, overscan: number, emit: (pos: number, isMajor: boolean) => void, anchor?: number): void;
91
+ /** Largest stroke weight across the layers of a resolved stroke array. Used to
92
+ * overscan the tiling so a thick line stays drawn until fully off the area. */
93
+ export declare function maxWeight(strokes: StrokeResolved[]): number;
94
+ /** Force every layer of a resolved stroke array to centered alignment. Grid
95
+ * lines are open paths, not a closed region, so inside/outside alignment is
96
+ * meaningless — they always straddle their position. (Open paths are already
97
+ * stroked centered by the renderer; this makes the intent explicit and ignores
98
+ * any author `align`.) */
99
+ export declare function centered(strokes: StrokeResolved[]): StrokeResolved[];
100
+ /** Copy a resolved stroke array with every fill layer's opacity scaled by
101
+ * `factor`. Used to derive the default minor-line stroke from the major one.
102
+ * Every resolved fill carries an `opacity` field, so this is type-uniform. */
103
+ export declare function dimStroke(strokes: StrokeResolved[], factor: number): StrokeResolved[];
104
+ //# sourceMappingURL=grid-lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-lines.d.ts","sourceRoot":"","sources":["../../src/kit/grid-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,WAAW,EAAmB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtG;;;;;;;;;;;;;;GAcG;AAEH,uGAAuG;AACvG,MAAM,WAAW,QAAQ;IACrB,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,8CAA8C;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