@motionscript/grids 0.1.0-alpha.4 → 0.1.0-alpha.6

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 (50) hide show
  1. package/CHANGELOG.md +79 -41
  2. package/README.md +47 -15
  3. package/dist/browser/chunks/chunk-J62D7EFZ.js +2 -0
  4. package/dist/browser/chunks/chunk-J62D7EFZ.js.map +7 -0
  5. package/dist/browser/index.js +1 -1
  6. package/dist/browser/index.js.map +3 -3
  7. package/dist/browser/kit.js +1 -1
  8. package/dist/browser/manifest.json +1 -1
  9. package/dist/engine.d.ts +4 -4
  10. package/dist/engine.js +4 -4
  11. package/dist/engine.js.map +1 -1
  12. package/dist/kit/index.d.ts +3 -1
  13. package/dist/kit/index.d.ts.map +1 -1
  14. package/dist/kit/index.js +4 -1
  15. package/dist/kit/index.js.map +1 -1
  16. package/dist/kit/item-grid.d.ts +203 -198
  17. package/dist/kit/item-grid.d.ts.map +1 -1
  18. package/dist/kit/item-grid.js +413 -440
  19. package/dist/kit/item-grid.js.map +1 -1
  20. package/dist/nodes.d.ts +8 -3
  21. package/dist/nodes.d.ts.map +1 -1
  22. package/dist/nodes.js +6 -10
  23. package/dist/nodes.js.map +1 -1
  24. package/dist/path-grid/path-grid.d.ts +108 -73
  25. package/dist/path-grid/path-grid.d.ts.map +1 -1
  26. package/dist/path-grid/path-grid.js +129 -172
  27. package/dist/path-grid/path-grid.js.map +1 -1
  28. package/dist/radial-grid/radial-grid.d.ts +97 -45
  29. package/dist/radial-grid/radial-grid.d.ts.map +1 -1
  30. package/dist/radial-grid/radial-grid.js +55 -87
  31. package/dist/radial-grid/radial-grid.js.map +1 -1
  32. package/dist/rectangular-grid/rectangular-grid.d.ts +114 -70
  33. package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -1
  34. package/dist/rectangular-grid/rectangular-grid.js +107 -145
  35. package/dist/rectangular-grid/rectangular-grid.js.map +1 -1
  36. package/dist/sphere-grid/sphere-grid.d.ts +109 -60
  37. package/dist/sphere-grid/sphere-grid.d.ts.map +1 -1
  38. package/dist/sphere-grid/sphere-grid.js +90 -137
  39. package/dist/sphere-grid/sphere-grid.js.map +1 -1
  40. package/package.json +4 -4
  41. package/src/engine.ts +4 -4
  42. package/src/kit/index.ts +13 -1
  43. package/src/kit/item-grid.ts +505 -442
  44. package/src/nodes.ts +18 -3
  45. package/src/path-grid/path-grid.ts +137 -164
  46. package/src/radial-grid/radial-grid.ts +69 -78
  47. package/src/rectangular-grid/rectangular-grid.ts +118 -133
  48. package/src/sphere-grid/sphere-grid.ts +103 -117
  49. package/dist/browser/chunks/chunk-XDUDKWM7.js +0 -2
  50. package/dist/browser/chunks/chunk-XDUDKWM7.js.map +0 -7
@@ -1,192 +1,149 @@
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 { command, node, Path, pathOps, PathShape, pathProperty, property, } from "@motionscript/sdk";
8
- import { findNode2D, frameIn, ItemGrid, PATH_SPACINGS, PATH_TEMPLATES, staggerArgs, TRANSITION_STAGGER, templatePath, } from "../kit/index.js";
9
- /** A template, or `custom` for the grid's own {@link PathGrid.path}. */
1
+ import { component2d, pathOps, Types, } from "@motionscript/sdk";
2
+ import { ItemGrid, PATH_SPACINGS, PATH_TEMPLATES, staggerArgs, TRANSITION_STAGGER, templatePath, } from "../kit/index.js";
3
+ /** A template, or `custom` for the grid's own `path`. */
10
4
  export const PATH_GRID_SHAPES = [...PATH_TEMPLATES, "custom"];
5
+ const own = {
6
+ shape: Types.oneOf(PATH_GRID_SHAPES, { default: "circle" }),
7
+ /** Used when `shape` is `custom`: an SVG path, y-down as SVG writes one, centred on its own bounds. */
8
+ path: Types.path,
9
+ /** A path node to follow instead, by id — the items track it wherever it goes. */
10
+ pathNode: ItemGrid.nodeRef(["path"]),
11
+ spacing: Types.oneOf(PATH_SPACINGS, { default: "distribute" }),
12
+ spacingDistance: Types.number(80, { min: 0, step: 1 }),
13
+ /** Share of the path the items are moved along — `1` is once round. */
14
+ offset: Types.number(0, { step: 0.01 }),
15
+ /** Share of the path per second the items travel on their own. */
16
+ flowSpeed: Types.number(0, { step: 0.01, unit: "/s" }),
17
+ trimStart: Types.number(0, { min: 0, max: 1, step: 0.01 }),
18
+ trimEnd: Types.number(1, { min: 0, max: 1, step: 0.01 }),
19
+ alignToPath: true,
20
+ };
11
21
  const AT_ORIGIN = { originX: 0, originY: 0, x: 0, y: 0, rotation: 0, scale: 1 };
12
22
  /** The size a path grid is placed at when nothing says otherwise, since a template is drawn to fill it. */
13
23
  const DEFAULT_SIZE = { width: 640, height: 400 };
24
+ const arranger = {
25
+ arrangement: (s, box) => {
26
+ const { path, placement } = pathIn(s, box);
27
+ return {
28
+ kind: "path",
29
+ path,
30
+ placement,
31
+ spacing: s.spacing,
32
+ spacingDistance: s.spacingDistance,
33
+ offset: s.offset,
34
+ flowSpeed: s.flowSpeed,
35
+ trimStart: s.trimStart,
36
+ trimEnd: s.trimEnd,
37
+ alignToPath: s.alignToPath,
38
+ };
39
+ },
40
+ };
14
41
  /**
15
42
  * Children along a path: one of the templates drawn to fill the node's box,
16
- * a path of the grid's own, or a `Path` node elsewhere in the scene, followed
43
+ * a path of the grid's own, or a path node elsewhere in the scene, followed
17
44
  * wherever it is.
18
45
  *
19
46
  * Items are spaced by distance along the curve, so they sit evenly on a tight
20
- * bend and a straight alike. Animating {@link offset} moves them along it — on
21
- * a closed path they come round again, which is a conveyor belt for free.
47
+ * bend and a straight alike. Animating `offset` moves them along it — on a
48
+ * closed path they come round again, which is a conveyor belt for free.
22
49
  */
23
- let PathGrid = class PathGrid extends ItemGrid {
24
- constructor(props) {
25
- super(props);
26
- }
27
- /** Move the items along the path by `loops` — `1` is once round, and they keep their spacing. */
28
- flow(args) {
29
- const loops = args.data?.loops ?? 1;
30
- return this.to({ data: { offset: this.offset + loops }, duration: args.duration, easing: args.easing });
31
- }
32
- /** Squeeze the items into part of the path, between two shares of its length. */
33
- trimTo(args) {
34
- return this.to({
35
- data: { trimStart: args.data?.trimStart ?? this.trimStart, trimEnd: args.data?.trimEnd ?? this.trimEnd },
36
- duration: args.duration,
37
- easing: args.easing,
38
- });
39
- }
40
- /**
41
- * Move the items onto another path — a template, or a `Path` node in the
42
- * scene. Each item travels from its place on the old path to its place on the
43
- * new one; the path itself is not morphed.
44
- */
45
- setPath(args) {
46
- const pathNode = args.data?.pathNode ?? "";
47
- const changes = pathNode ? { pathNode } : { shape: args.data?.shape ?? this.shape, pathNode: "" };
48
- return this._transitionTo(changes, args);
49
- }
50
- arrangementFor(box) {
51
- const { path, placement } = this._pathIn(box);
52
- return {
53
- kind: "path",
54
- path,
55
- placement,
56
- spacing: this.spacing,
57
- spacingDistance: this.spacingDistance,
58
- offset: this.offset,
59
- flowSpeed: this.flowSpeed,
60
- trimStart: this.trimStart,
61
- trimEnd: this.trimEnd,
62
- alignToPath: this.alignToPath,
63
- };
64
- }
50
+ export const PathGrid = ItemGrid.define(component2d({
51
+ key: "pathGrid",
52
+ state: { ...ItemGrid.state, ...own },
65
53
  // A template is drawn to fill the box, so a path grid needs one of its own
66
54
  // rather than hugging items whose places depend on it.
67
- applyDefaultSize(props) {
68
- if (!props || props.width === undefined)
69
- this.applyProp("width", DEFAULT_SIZE.width);
70
- if (!props || props.height === undefined)
71
- this.applyProp("height", DEFAULT_SIZE.height);
55
+ defaults: { ...DEFAULT_SIZE },
56
+ commands: {
57
+ ...ItemGrid.commands,
58
+ /** Move the items along the path by `loops` — `1` is once round, and they keep their spacing. */
59
+ flow: {
60
+ args: { loops: Types.number(1, { step: 0.25 }) },
61
+ run: (timeline, s) => timeline.tween({ offset: s.offset + (timeline.args.loops ?? 1) }),
62
+ },
63
+ /** Squeeze the items into part of the path, between two shares of its length. */
64
+ trimTo: {
65
+ args: {
66
+ trimStart: ItemGrid.hinted(0.25, { min: 0, max: 1, step: 0.01 }),
67
+ trimEnd: ItemGrid.hinted(0.75, { min: 0, max: 1, step: 0.01 }),
68
+ },
69
+ run: (timeline, s) => timeline.tween({
70
+ trimStart: timeline.args.trimStart ?? s.trimStart,
71
+ trimEnd: timeline.args.trimEnd ?? s.trimEnd,
72
+ }),
73
+ },
74
+ /**
75
+ * Move the items onto another path — a template, or a path node in the
76
+ * scene. Each item travels from its place on the old path to its place on
77
+ * the new one; the path itself is not morphed.
78
+ */
79
+ setPath: {
80
+ args: {
81
+ shape: ItemGrid.hinted("heart", { kind: "enum", options: PATH_GRID_SHAPES }),
82
+ pathNode: ItemGrid.nodeRefArg(["path"]),
83
+ ...staggerArgs(TRANSITION_STAGGER),
84
+ },
85
+ run: (timeline, s, children) => {
86
+ const pathNode = timeline.args.pathNode ?? "";
87
+ const changes = pathNode ? { pathNode } : { shape: timeline.args.shape ?? s.shape, pathNode: "" };
88
+ return ItemGrid.transitionTo(timeline, s, children, changes);
89
+ },
90
+ },
91
+ },
92
+ ...ItemGrid.fields(arranger),
93
+ }), arranger);
94
+ /** The path the items follow, and where its coordinates land in this grid's frame. */
95
+ function pathIn(s, box) {
96
+ const linked = s.pathNode;
97
+ // A document `path` draws its data in its own unit box, at its own position.
98
+ if (linked?.key === "path")
99
+ return { path: unitPath(linked), placement: { ...AT_ORIGIN, ...linked.frame } };
100
+ // A face-value path draws its data centred on the data's own bounds, at its own position.
101
+ const data = linked?.key === "facePath" ? dataOf(linked) : undefined;
102
+ const bounds = data !== undefined ? pathOps.bounds(data) : null;
103
+ if (linked && data !== undefined && bounds) {
104
+ return {
105
+ path: data,
106
+ placement: {
107
+ originX: (bounds.minX + bounds.maxX) / 2,
108
+ originY: (bounds.minY + bounds.maxY) / 2,
109
+ ...linked.frame,
110
+ },
111
+ };
72
112
  }
73
- _linked = null;
74
- /** The path the items follow, and where its coordinates land in this grid's frame. */
75
- _pathIn(box) {
76
- const linked = this.pathNode ? findNode2D(this, this.pathNode) : null;
77
- if (linked instanceof PathShape) {
78
- return { path: this._unitPath(linked), placement: { ...AT_ORIGIN, ...frameIn(this, linked) } };
79
- }
80
- if (linked instanceof Path && pathOps.bounds(linked.data)) {
81
- // A `Path` draws its data centred on the data's own bounds, at its own position.
82
- const bounds = pathOps.bounds(linked.data);
83
- const frame = frameIn(this, linked);
113
+ if (s.shape === "custom") {
114
+ const own = pathOps.bounds(s.path);
115
+ if (own) {
84
116
  return {
85
- path: linked.data,
117
+ path: s.path,
86
118
  placement: {
87
- originX: (bounds.minX + bounds.maxX) / 2,
88
- originY: (bounds.minY + bounds.maxY) / 2,
89
- ...frame,
119
+ ...AT_ORIGIN,
120
+ originX: (own.minX + own.maxX) / 2,
121
+ originY: (own.minY + own.maxY) / 2,
122
+ flipY: true,
90
123
  },
91
124
  };
92
125
  }
93
- if (this.shape === "custom") {
94
- const bounds = pathOps.bounds(this.path);
95
- if (bounds) {
96
- return {
97
- path: this.path,
98
- placement: {
99
- ...AT_ORIGIN,
100
- originX: (bounds.minX + bounds.maxX) / 2,
101
- originY: (bounds.minY + bounds.maxY) / 2,
102
- flipY: true,
103
- },
104
- };
105
- }
106
- }
107
- const template = this.shape === "custom" ? "circle" : this.shape;
108
- return { path: templatePath(template, box), placement: AT_ORIGIN };
109
126
  }
110
- /**
111
- * A path node's geometry as it draws it: stored in its unit box, y-down, and
112
- * scaled to its laid-out size — kept while neither changes, so the path's
113
- * measurement is kept with it.
114
- */
115
- _unitPath(shape) {
116
- const { width, height } = shape.layoutBounds;
117
- const cached = this._linked;
118
- if (cached && cached.data === shape.data && cached.width === width && cached.height === height)
119
- return cached.path;
120
- const path = pathOps.anchorCommands(pathOps.anchors(shape.data), (p) => ({ x: p.x * width, y: -p.y * height }));
121
- this._linked = { data: shape.data, width, height, path };
122
- return path;
123
- }
124
- };
125
- __decorate([
126
- property({ default: "circle", kind: "enum", options: PATH_GRID_SHAPES })
127
- ], PathGrid.prototype, "shape", void 0);
128
- __decorate([
129
- pathProperty()
130
- ], PathGrid.prototype, "path", void 0);
131
- __decorate([
132
- property({ default: "", kind: "nodeRef", nodeTypes: ["path"], animatable: false })
133
- ], PathGrid.prototype, "pathNode", void 0);
134
- __decorate([
135
- property({ default: "distribute", kind: "enum", options: PATH_SPACINGS })
136
- ], PathGrid.prototype, "spacing", void 0);
137
- __decorate([
138
- property({ default: 80, min: 0, step: 1 })
139
- ], PathGrid.prototype, "spacingDistance", void 0);
140
- __decorate([
141
- property({ default: 0, step: 0.01 })
142
- ], PathGrid.prototype, "offset", void 0);
143
- __decorate([
144
- property({ default: 0, step: 0.01, unit: "/s" })
145
- ], PathGrid.prototype, "flowSpeed", void 0);
146
- __decorate([
147
- property({ default: 0, min: 0, max: 1, step: 0.01 })
148
- ], PathGrid.prototype, "trimStart", void 0);
149
- __decorate([
150
- property({ default: 1, min: 0, max: 1, step: 0.01 })
151
- ], PathGrid.prototype, "trimEnd", void 0);
152
- __decorate([
153
- property({ default: true })
154
- ], PathGrid.prototype, "alignToPath", void 0);
155
- __decorate([
156
- command({ args: [{ key: "loops", step: 0.25, default: 1 }] })
157
- ], PathGrid.prototype, "flow", null);
158
- __decorate([
159
- command({
160
- args: [
161
- { key: "trimStart", min: 0, max: 1, step: 0.01, default: 0.25 },
162
- { key: "trimEnd", min: 0, max: 1, step: 0.01, default: 0.75 },
163
- ],
164
- })
165
- ], PathGrid.prototype, "trimTo", null);
166
- __decorate([
167
- command({
168
- args: [
169
- { key: "shape", kind: "enum", options: PATH_GRID_SHAPES, default: "heart" },
170
- { key: "pathNode", kind: "nodeRef", nodeTypes: ["path"] },
171
- ...staggerArgs(TRANSITION_STAGGER),
172
- ],
173
- })
174
- ], PathGrid.prototype, "setPath", null);
175
- PathGrid = __decorate([
176
- node({
177
- key: "pathGrid",
178
- parentKey: "node",
179
- forkable: true,
180
- layout: {
181
- children: "freeform",
182
- acceptsChildren: true,
183
- defaultWidthMode: "fixed",
184
- defaultHeightMode: "fixed",
185
- defaultWidth: DEFAULT_SIZE.width,
186
- defaultHeight: DEFAULT_SIZE.height,
187
- },
188
- seed: { ...DEFAULT_SIZE },
189
- })
190
- ], PathGrid);
191
- export { PathGrid };
127
+ const template = s.shape === "custom" ? "circle" : s.shape;
128
+ return { path: templatePath(template, box), placement: AT_ORIGIN };
129
+ }
130
+ function dataOf(view) {
131
+ return view.state.data;
132
+ }
133
+ const unitPaths = new WeakMap();
134
+ /**
135
+ * A path node's geometry as it draws it: stored in its unit box, y-down, and
136
+ * scaled to its laid-out size — kept while neither changes, so the path's
137
+ * measurement is kept with it.
138
+ */
139
+ function unitPath(view) {
140
+ const data = dataOf(view);
141
+ const { width, height } = view.size;
142
+ const cached = unitPaths.get(view);
143
+ if (cached && cached.data === data && cached.width === width && cached.height === height)
144
+ return cached.path;
145
+ const path = pathOps.anchorCommands(pathOps.anchors(data), (p) => ({ x: p.x * width, y: -p.y * height }));
146
+ unitPaths.set(view, { data, width, height, path });
147
+ return path;
148
+ }
192
149
  //# sourceMappingURL=path-grid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"path-grid.js","sourceRoot":"","sources":["../../src/path-grid/path-grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,GAMT,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,UAAU,EACV,OAAO,EACP,QAAQ,EACR,aAAa,EACb,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,YAAY,GAOb,MAAM,QAAQ,CAAA;AAEf,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,cAAc,EAAE,QAAQ,CAAU,CAAA;AAgBtE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,OAAO,EAAE,IAAI,EAAE;YAC/D,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;SAC9D;KACF,CAAC;sCAOD;AAcD;IAPC,OAAO,CAAC;QACP,IAAI,EAAE;YACJ,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE;YAC3E,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE;YACzD,GAAG,WAAW,CAAC,kBAAkB,CAAC;SACnC;KACF,CAAC;uCAKD;AA1DU,QAAQ;IAdpB,IAAI,CAAC;QACJ,GAAG,EAAE,UAAU;QACf,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,QAAQ,EAAE,UAAU;YACpB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE,OAAO;YACzB,iBAAiB,EAAE,OAAO;YAC1B,YAAY,EAAE,YAAY,CAAC,KAAK;YAChC,aAAa,EAAE,YAAY,CAAC,MAAM;SACnC;QACD,IAAI,EAAE,EAAE,GAAG,YAAY,EAAE;KAC1B,CAAC;GACW,QAAQ,CAuIpB","sourcesContent":["import {\r\n command,\r\n node,\r\n Path,\r\n pathOps,\r\n PathShape,\r\n pathProperty,\r\n property,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type PathData,\r\n type Size2D,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport {\r\n findNode2D,\r\n frameIn,\r\n ItemGrid,\r\n PATH_SPACINGS,\r\n PATH_TEMPLATES,\r\n staggerArgs,\r\n TRANSITION_STAGGER,\r\n templatePath,\r\n type ItemGridProps,\r\n type PathArrangement,\r\n type PathPlacement,\r\n type PathSpacing,\r\n type PathTemplate,\r\n type StaggerArgs,\r\n} from \"../kit\"\r\n\r\n/** A template, or `custom` for the grid's own {@link PathGrid.path}. */\r\nexport const PATH_GRID_SHAPES = [...PATH_TEMPLATES, \"custom\"] as const\r\nexport type PathGridShape = (typeof PATH_GRID_SHAPES)[number]\r\n\r\nexport interface PathGridProps extends ItemGridProps {\r\n shape: PathGridShape\r\n path: PathData\r\n pathNode: string\r\n spacing: PathSpacing\r\n spacingDistance: number\r\n offset: number\r\n flowSpeed: number\r\n trimStart: number\r\n trimEnd: number\r\n alignToPath: boolean\r\n}\r\n\r\nconst AT_ORIGIN: PathPlacement = { originX: 0, originY: 0, x: 0, y: 0, rotation: 0, scale: 1 }\r\n\r\n/** The size a path grid is placed at when nothing says otherwise, since a template is drawn to fill it. */\r\nconst DEFAULT_SIZE = { width: 640, height: 400 }\r\n\r\n/**\r\n * Children along a path: one of the templates drawn to fill the node's box,\r\n * a path of the grid's own, or a `Path` node elsewhere in the scene, followed\r\n * wherever it is.\r\n *\r\n * Items are spaced by distance along the curve, so they sit evenly on a tight\r\n * bend and a straight alike. Animating {@link offset} moves them along it — on\r\n * a closed path they come round again, which is a conveyor belt for free.\r\n */\r\n@node({\r\n key: \"pathGrid\",\r\n parentKey: \"node\",\r\n forkable: true,\r\n layout: {\r\n children: \"freeform\",\r\n acceptsChildren: true,\r\n defaultWidthMode: \"fixed\",\r\n defaultHeightMode: \"fixed\",\r\n defaultWidth: DEFAULT_SIZE.width,\r\n defaultHeight: DEFAULT_SIZE.height,\r\n },\r\n seed: { ...DEFAULT_SIZE },\r\n})\r\nexport class PathGrid extends ItemGrid<PathGridProps> {\r\n @property({ default: \"circle\", kind: \"enum\", options: PATH_GRID_SHAPES }) declare shape: PathGridShape\r\n /** Used when {@link shape} is `custom`: an SVG path, y-down as SVG writes one, centred on its own bounds. */\r\n @pathProperty() declare path: PathData\r\n /** A path node to follow instead, by id — the items track it wherever it goes. */\r\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"path\"], animatable: false }) declare pathNode: string\r\n @property({ default: \"distribute\", kind: \"enum\", options: PATH_SPACINGS }) declare spacing: PathSpacing\r\n @property({ default: 80, min: 0, step: 1 }) declare spacingDistance: number\r\n /** Share of the path the items are moved along — `1` is once round. */\r\n @property({ default: 0, step: 0.01 }) declare offset: number\r\n /** Share of the path per second the items travel on their own. */\r\n @property({ default: 0, step: 0.01, unit: \"/s\" }) declare flowSpeed: number\r\n @property({ default: 0, min: 0, max: 1, step: 0.01 }) declare trimStart: number\r\n @property({ default: 1, min: 0, max: 1, step: 0.01 }) declare trimEnd: number\r\n @property({ default: true }) declare alignToPath: boolean\r\n\r\n constructor(props?: NodeConfig<PathGrid, PathGridProps>) {\r\n super(props)\r\n }\r\n\r\n /** Move the items along the path by `loops` — `1` is once round, and they keep their spacing. */\r\n @command({ args: [{ key: \"loops\", step: 0.25, default: 1 }] })\r\n flow(args: CommandArgs<{ loops?: number }> & { duration: number }): Command<PathGridProps> {\r\n const loops = args.data?.loops ?? 1\r\n return this.to({ data: { offset: this.offset + loops }, duration: args.duration, easing: args.easing })\r\n }\r\n\r\n /** Squeeze the items into part of the path, between two shares of its length. */\r\n @command({\r\n args: [\r\n { key: \"trimStart\", min: 0, max: 1, step: 0.01, default: 0.25 },\r\n { key: \"trimEnd\", min: 0, max: 1, step: 0.01, default: 0.75 },\r\n ],\r\n })\r\n trimTo(args: CommandArgs<{ trimStart?: number; trimEnd?: number }> & { duration: number }): Command<PathGridProps> {\r\n return this.to({\r\n data: { trimStart: args.data?.trimStart ?? this.trimStart, trimEnd: args.data?.trimEnd ?? this.trimEnd },\r\n duration: args.duration,\r\n easing: args.easing,\r\n })\r\n }\r\n\r\n /**\r\n * Move the items onto another path — a template, or a `Path` node in the\r\n * scene. Each item travels from its place on the old path to its place on the\r\n * new one; the path itself is not morphed.\r\n */\r\n @command({\r\n args: [\r\n { key: \"shape\", kind: \"enum\", options: PATH_GRID_SHAPES, default: \"heart\" },\r\n { key: \"pathNode\", kind: \"nodeRef\", nodeTypes: [\"path\"] },\r\n ...staggerArgs(TRANSITION_STAGGER),\r\n ],\r\n })\r\n setPath(args: CommandArgs<{ shape?: PathGridShape; pathNode?: string } & StaggerArgs> & { duration: number }): Command<PathGridProps> {\r\n const pathNode = args.data?.pathNode ?? \"\"\r\n const changes: Partial<PathGridProps> = pathNode ? { pathNode } : { shape: args.data?.shape ?? this.shape, pathNode: \"\" }\r\n return this._transitionTo(changes, args)\r\n }\r\n\r\n protected override arrangementFor(box: Size2D): PathArrangement {\r\n const { path, placement } = this._pathIn(box)\r\n return {\r\n kind: \"path\",\r\n path,\r\n placement,\r\n spacing: this.spacing,\r\n spacingDistance: this.spacingDistance,\r\n offset: this.offset,\r\n flowSpeed: this.flowSpeed,\r\n trimStart: this.trimStart,\r\n trimEnd: this.trimEnd,\r\n alignToPath: this.alignToPath,\r\n }\r\n }\r\n\r\n // A template is drawn to fill the box, so a path grid needs one of its own\r\n // rather than hugging items whose places depend on it.\r\n protected override applyDefaultSize(props?: { readonly width?: unknown; readonly height?: unknown }): void {\r\n if (!props || props.width === undefined) this.applyProp(\"width\", DEFAULT_SIZE.width)\r\n if (!props || props.height === undefined) this.applyProp(\"height\", DEFAULT_SIZE.height)\r\n }\r\n\r\n private _linked: { data: PathData; width: number; height: number; path: PathData } | null = null\r\n\r\n /** The path the items follow, and where its coordinates land in this grid's frame. */\r\n private _pathIn(box: Size2D): { path: PathData; placement: PathPlacement } {\r\n const linked = this.pathNode ? findNode2D(this, this.pathNode) : null\r\n if (linked instanceof PathShape) {\r\n return { path: this._unitPath(linked), placement: { ...AT_ORIGIN, ...frameIn(this, linked) } }\r\n }\r\n if (linked instanceof Path && pathOps.bounds(linked.data)) {\r\n // A `Path` draws its data centred on the data's own bounds, at its own position.\r\n const bounds = pathOps.bounds(linked.data)!\r\n const frame = frameIn(this, linked)\r\n return {\r\n path: linked.data,\r\n placement: {\r\n originX: (bounds.minX + bounds.maxX) / 2,\r\n originY: (bounds.minY + bounds.maxY) / 2,\r\n ...frame,\r\n },\r\n }\r\n }\r\n if (this.shape === \"custom\") {\r\n const bounds = pathOps.bounds(this.path)\r\n if (bounds) {\r\n return {\r\n path: this.path,\r\n placement: {\r\n ...AT_ORIGIN,\r\n originX: (bounds.minX + bounds.maxX) / 2,\r\n originY: (bounds.minY + bounds.maxY) / 2,\r\n flipY: true,\r\n },\r\n }\r\n }\r\n }\r\n const template: PathTemplate = this.shape === \"custom\" ? \"circle\" : this.shape\r\n return { path: templatePath(template, box), placement: AT_ORIGIN }\r\n }\r\n\r\n /**\r\n * A path node's geometry as it draws it: stored in its unit box, y-down, and\r\n * scaled to its laid-out size — kept while neither changes, so the path's\r\n * measurement is kept with it.\r\n */\r\n private _unitPath(shape: PathShape): PathData {\r\n const { width, height } = shape.layoutBounds\r\n const cached = this._linked\r\n if (cached && cached.data === shape.data && cached.width === width && cached.height === height) return cached.path\r\n const path = pathOps.anchorCommands(pathOps.anchors(shape.data), (p) => ({ x: p.x * width, y: -p.y * height }))\r\n this._linked = { data: shape.data, width, height, path }\r\n return path\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"path-grid.js","sourceRoot":"","sources":["../../src/path-grid/path-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,OAAO,EACP,KAAK,GASN,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,QAAQ,EACR,aAAa,EACb,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,YAAY,GAIb,MAAM,QAAQ,CAAA;AAEf,yDAAyD;AACzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,cAAc,EAAE,QAAQ,CAAU,CAAA;AAGtE,MAAM,GAAG,GAAG;IACV,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC3D,uGAAuG;IACvG,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,kFAAkF;IAClF,QAAQ,EAAE,QA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IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IAClD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import {\r\n component2d,\r\n pathOps,\r\n Types,\r\n type NodeOf,\r\n type NodeView,\r\n type PathData,\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 Node2D as _Node2D,\r\n type Node2DProps as _Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport {\r\n ItemGrid,\r\n PATH_SPACINGS,\r\n PATH_TEMPLATES,\r\n staggerArgs,\r\n TRANSITION_STAGGER,\r\n templatePath,\r\n type PathArrangement,\r\n type PathPlacement,\r\n type PathTemplate,\r\n} from \"../kit\"\r\n\r\n/** A template, or `custom` for the grid's own `path`. */\r\nexport const PATH_GRID_SHAPES = [...PATH_TEMPLATES, \"custom\"] as const\r\nexport type PathGridShape = (typeof PATH_GRID_SHAPES)[number]\r\n\r\nconst own = {\r\n shape: Types.oneOf(PATH_GRID_SHAPES, { default: \"circle\" }),\r\n /** Used when `shape` is `custom`: an SVG path, y-down as SVG writes one, centred on its own bounds. */\r\n path: Types.path,\r\n /** A path node to follow instead, by id — the items track it wherever it goes. */\r\n pathNode: ItemGrid.nodeRef([\"path\"]),\r\n spacing: Types.oneOf(PATH_SPACINGS, { default: \"distribute\" }),\r\n spacingDistance: Types.number(80, { min: 0, step: 1 }),\r\n /** Share of the path the items are moved along — `1` is once round. */\r\n offset: Types.number(0, { step: 0.01 }),\r\n /** Share of the path per second the items travel on their own. */\r\n flowSpeed: Types.number(0, { step: 0.01, unit: \"/s\" }),\r\n trimStart: Types.number(0, { min: 0, max: 1, step: 0.01 }),\r\n trimEnd: Types.number(1, { min: 0, max: 1, step: 0.01 }),\r\n alignToPath: true,\r\n}\r\n\r\ntype Own = Values<typeof own>\r\n\r\nconst AT_ORIGIN: PathPlacement = { originX: 0, originY: 0, x: 0, y: 0, rotation: 0, scale: 1 }\r\n\r\n/** The size a path grid is placed at when nothing says otherwise, since a template is drawn to fill it. */\r\nconst DEFAULT_SIZE = { width: 640, height: 400 }\r\n\r\nconst arranger: ItemGrid.Arranger<Own> = {\r\n arrangement: (s, box): PathArrangement => {\r\n const { path, placement } = pathIn(s, box)\r\n return {\r\n kind: \"path\",\r\n path,\r\n placement,\r\n spacing: s.spacing,\r\n spacingDistance: s.spacingDistance,\r\n offset: s.offset,\r\n flowSpeed: s.flowSpeed,\r\n trimStart: s.trimStart,\r\n trimEnd: s.trimEnd,\r\n alignToPath: s.alignToPath,\r\n }\r\n },\r\n}\r\n\r\n/**\r\n * Children along a path: one of the templates drawn to fill the node's box,\r\n * a path of the grid's own, or a path node elsewhere in the scene, followed\r\n * wherever it is.\r\n *\r\n * Items are spaced by distance along the curve, so they sit evenly on a tight\r\n * bend and a straight alike. Animating `offset` moves them along it — on a\r\n * closed path they come round again, which is a conveyor belt for free.\r\n */\r\nexport const PathGrid = ItemGrid.define(component2d({\r\n key: \"pathGrid\",\r\n state: { ...ItemGrid.state, ...own },\r\n // A template is drawn to fill the box, so a path grid needs one of its own\r\n // rather than hugging items whose places depend on it.\r\n defaults: { ...DEFAULT_SIZE },\r\n commands: {\r\n ...ItemGrid.commands,\r\n /** Move the items along the path by `loops` — `1` is once round, and they keep their spacing. */\r\n flow: {\r\n args: { loops: Types.number(1, { step: 0.25 }) },\r\n run: (timeline, s) => timeline.tween({ offset: s.offset + (timeline.args.loops ?? 1) }),\r\n },\r\n /** Squeeze the items into part of the path, between two shares of its length. */\r\n trimTo: {\r\n args: {\r\n trimStart: ItemGrid.hinted(0.25, { min: 0, max: 1, step: 0.01 }),\r\n trimEnd: ItemGrid.hinted(0.75, { min: 0, max: 1, step: 0.01 }),\r\n },\r\n run: (timeline, s) => timeline.tween({\r\n trimStart: timeline.args.trimStart ?? s.trimStart,\r\n trimEnd: timeline.args.trimEnd ?? s.trimEnd,\r\n }),\r\n },\r\n /**\r\n * Move the items onto another path — a template, or a path node in the\r\n * scene. Each item travels from its place on the old path to its place on\r\n * the new one; the path itself is not morphed.\r\n */\r\n setPath: {\r\n args: {\r\n shape: ItemGrid.hinted(\"heart\", { kind: \"enum\", options: PATH_GRID_SHAPES }),\r\n pathNode: ItemGrid.nodeRefArg([\"path\"]),\r\n ...staggerArgs(TRANSITION_STAGGER),\r\n },\r\n run: (timeline, s, children) => {\r\n const pathNode = timeline.args.pathNode ?? \"\"\r\n const changes = pathNode ? { pathNode } : { shape: timeline.args.shape ?? s.shape, pathNode: \"\" }\r\n return ItemGrid.transitionTo(timeline as never, s, children, changes)\r\n },\r\n },\r\n },\r\n ...ItemGrid.fields(arranger),\r\n}), arranger)\r\n\r\nexport type PathGrid = NodeOf<typeof PathGrid>\r\n/** What a call or a document row may set. */\r\nexport type PathGridProps = NonNullable<Parameters<typeof PathGrid>[0]>\r\n\r\n/** The path the items follow, and where its coordinates land in this grid's frame. */\r\nfunction pathIn(s: Own, box: Size2D): { path: PathData; placement: PathPlacement } {\r\n const linked = s.pathNode\r\n // A document `path` draws its data in its own unit box, at its own position.\r\n if (linked?.key === \"path\") return { path: unitPath(linked), placement: { ...AT_ORIGIN, ...linked.frame } }\r\n // A face-value path draws its data centred on the data's own bounds, at its own position.\r\n const data = linked?.key === \"facePath\" ? dataOf(linked) : undefined\r\n const bounds = data !== undefined ? pathOps.bounds(data) : null\r\n if (linked && data !== undefined && bounds) {\r\n return {\r\n path: data,\r\n placement: {\r\n originX: (bounds.minX + bounds.maxX) / 2,\r\n originY: (bounds.minY + bounds.maxY) / 2,\r\n ...linked.frame,\r\n },\r\n }\r\n }\r\n if (s.shape === \"custom\") {\r\n const own = pathOps.bounds(s.path)\r\n if (own) {\r\n return {\r\n path: s.path,\r\n placement: {\r\n ...AT_ORIGIN,\r\n originX: (own.minX + own.maxX) / 2,\r\n originY: (own.minY + own.maxY) / 2,\r\n flipY: true,\r\n },\r\n }\r\n }\r\n }\r\n const template: PathTemplate = s.shape === \"custom\" ? \"circle\" : s.shape\r\n return { path: templatePath(template, box), placement: AT_ORIGIN }\r\n}\r\n\r\nfunction dataOf(view: NodeView): PathData {\r\n return (view.state as { readonly data: PathData }).data\r\n}\r\n\r\nconst unitPaths = new WeakMap<NodeView, { data: PathData; width: number; height: number; path: PathData }>()\r\n\r\n/**\r\n * A path node's geometry as it draws it: stored in its unit box, y-down, and\r\n * scaled to its laid-out size — kept while neither changes, so the path's\r\n * measurement is kept with it.\r\n */\r\nfunction unitPath(view: NodeView): PathData {\r\n const data = dataOf(view)\r\n const { width, height } = view.size\r\n const cached = unitPaths.get(view)\r\n if (cached && cached.data === data && cached.width === width && cached.height === height) return cached.path\r\n const path = pathOps.anchorCommands(pathOps.anchors(data), (p) => ({ x: p.x * width, y: -p.y * height }))\r\n unitPaths.set(view, { data, width, height, path })\r\n return path\r\n}\r\n"]}
@@ -1,51 +1,103 @@
1
- import { type Command, type CommandArgs, type NodeConfig } from "@motionscript/sdk";
2
- import { ItemGrid, type ItemGridProps, type RadialArrangement, type RadialDirection } from "../kit/index.js";
3
- export interface RadialGridProps extends ItemGridProps {
4
- radius: number;
5
- startAngle: number;
6
- sweep: number;
7
- direction: RadialDirection;
8
- rotateItems: boolean;
9
- spinSpeed: number;
10
- }
1
+ import { type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps } from "@motionscript/sdk";
2
+ import { ItemGrid } from "../kit/index.js";
11
3
  /**
12
4
  * Children round a circle, or along an arc of one.
13
5
  *
14
6
  * A full circle spaces the items evenly with none on top of another; an arc
15
- * puts one at each end. Angles run clockwise from twelve o'clock, so
16
- * {@link turnTo} can bring any item to the top like a dial.
7
+ * puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`
8
+ * can bring any item to the top like a dial.
17
9
  */
18
- export declare class RadialGrid extends ItemGrid<RadialGridProps> {
19
- radius: number;
20
- startAngle: number;
21
- sweep: number;
22
- direction: RadialDirection;
23
- rotateItems: boolean;
24
- spinSpeed: number;
25
- constructor(props?: NodeConfig<RadialGrid, RadialGridProps>);
26
- /** Orbit the items round the centre by `degrees` — `360` is one full turn. */
27
- spin(args: CommandArgs<{
28
- degrees?: number;
29
- }> & {
30
- duration: number;
31
- }): Command<RadialGridProps>;
32
- /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */
33
- turnTo(args: CommandArgs<{
34
- item?: number;
35
- }> & {
36
- duration: number;
37
- }): Command<RadialGridProps>;
38
- radiusTo(args: CommandArgs<{
39
- radius: number;
40
- }> & {
41
- duration: number;
42
- }): Command<RadialGridProps>;
43
- /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */
44
- sweepTo(args: CommandArgs<{
45
- sweep: number;
46
- }> & {
47
- duration: number;
48
- }): Command<RadialGridProps>;
49
- protected arrangementFor(): RadialArrangement;
50
- }
10
+ export declare const RadialGrid: import("@motionscript/sdk").Component<"radialGrid", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
11
+ readonly radius: import("@motionscript/sdk").Type<number, number, false>;
12
+ readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
13
+ readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
14
+ readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
15
+ readonly rotateItems: boolean;
16
+ readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
17
+ readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
18
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
19
+ readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
20
+ readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
21
+ readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
22
+ readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
23
+ readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
24
+ readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
25
+ }>, {
26
+ readonly spin: {
27
+ readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
28
+ };
29
+ readonly turnTo: {
30
+ readonly item: import("@motionscript/sdk").Type<number, number, false>;
31
+ };
32
+ readonly radiusTo: {
33
+ readonly radius: import("@motionscript/sdk").Type<280 | undefined, 280 | undefined, false>;
34
+ };
35
+ readonly sweepTo: {
36
+ readonly sweep: import("@motionscript/sdk").Type<360 | undefined, 360 | undefined, false>;
37
+ };
38
+ readonly reveal: {
39
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
40
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
41
+ readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
42
+ };
43
+ readonly conceal: {
44
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
45
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
46
+ readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
47
+ };
48
+ readonly wave: {
49
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
50
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
51
+ readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
52
+ readonly amount: import("@motionscript/sdk").Type<number, number, false>;
53
+ };
54
+ readonly focus: {
55
+ readonly item: import("@motionscript/sdk").Type<number, number, false>;
56
+ readonly dim: import("@motionscript/sdk").Type<number, number, false>;
57
+ readonly grow: import("@motionscript/sdk").Type<number, number, false>;
58
+ };
59
+ readonly unfocus: unknown;
60
+ readonly spreadTo: {
61
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
62
+ };
63
+ readonly shuffle: {
64
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
65
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
66
+ readonly seed: import("@motionscript/sdk").Type<number, number, false>;
67
+ };
68
+ readonly swap: {
69
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
70
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
71
+ readonly first: import("@motionscript/sdk").Type<number, number, false>;
72
+ readonly second: import("@motionscript/sdk").Type<number, number, false>;
73
+ };
74
+ readonly reorder: {
75
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
76
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
77
+ readonly order: import("@motionscript/sdk").Type<string, string, false>;
78
+ };
79
+ readonly morphInto: {
80
+ readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
81
+ readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
82
+ readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
83
+ };
84
+ }, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
85
+ readonly radius: import("@motionscript/sdk").Type<number, number, false>;
86
+ readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
87
+ readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
88
+ readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
89
+ readonly rotateItems: boolean;
90
+ readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
91
+ readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
92
+ readonly spread: import("@motionscript/sdk").Type<number, number, false>;
93
+ readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
94
+ readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
95
+ readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
96
+ readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
97
+ readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
98
+ readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
99
+ }>, null>>;
100
+ export type RadialGrid = NodeOf<typeof RadialGrid>;
101
+ /** What a call or a document row may set. */
102
+ export type RadialGridProps = NonNullable<Parameters<typeof RadialGrid>[0]>;
51
103
  //# sourceMappingURL=radial-grid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radial-grid.d.ts","sourceRoot":"","sources":["../../src/radial-grid/radial-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE5G,OAAO,EACL,QAAQ,EAIR,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,QAAQ,CAAA;AAEf,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,eAAe,CAAA;IAC1B,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;GAMG;AACH,qBAWa,UAAW,SAAQ,QAAQ,CAAC,eAAe,CAAC;IACF,MAAM,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IACK,KAAK,EAAE,MAAM,CAAA;IACJ,SAAS,EAAE,eAAe,CAAA;IAC1E,WAAW,EAAE,OAAO,CAAA;IACF,SAAS,EAAE,MAAM,CAAA;gBAE7D,KAAK,CAAC,EAAE,UAAU,CAAC,UAAU,EAAE,eAAe,CAAC;IAI3D,8EAA8E;IAE9E,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAK9F,sGAAsG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