@motionscript/grids 0.0.0-stage → 0.1.0-alpha.10

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 (133) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +49 -0
  4. package/README.md +117 -2
  5. package/dist/browser/chunks/chunk-TYNFMZ3D.js +2 -0
  6. package/dist/browser/chunks/chunk-TYNFMZ3D.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/engine.d.ts +13 -0
  13. package/dist/engine.d.ts.map +1 -0
  14. package/dist/engine.js +13 -0
  15. package/dist/engine.js.map +1 -0
  16. package/dist/index.d.ts +7 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +7 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/kit/index.d.ts +9 -0
  21. package/dist/kit/index.d.ts.map +1 -0
  22. package/dist/kit/index.js +10 -0
  23. package/dist/kit/index.js.map +1 -0
  24. package/dist/kit/item-effects.d.ts +37 -0
  25. package/dist/kit/item-effects.d.ts.map +1 -0
  26. package/dist/kit/item-effects.js +76 -0
  27. package/dist/kit/item-effects.js.map +1 -0
  28. package/dist/kit/item-grid.d.ts +240 -0
  29. package/dist/kit/item-grid.d.ts.map +1 -0
  30. package/dist/kit/item-grid.js +492 -0
  31. package/dist/kit/item-grid.js.map +1 -0
  32. package/dist/kit/order.d.ts +13 -0
  33. package/dist/kit/order.d.ts.map +1 -0
  34. package/dist/kit/order.js +43 -0
  35. package/dist/kit/order.js.map +1 -0
  36. package/dist/kit/random.d.ts +7 -0
  37. package/dist/kit/random.d.ts.map +1 -0
  38. package/dist/kit/random.js +29 -0
  39. package/dist/kit/random.js.map +1 -0
  40. package/dist/kit/slots/index.d.ts +22 -0
  41. package/dist/kit/slots/index.d.ts.map +1 -0
  42. package/dist/kit/slots/index.js +28 -0
  43. package/dist/kit/slots/index.js.map +1 -0
  44. package/dist/kit/slots/path-templates.d.ts +15 -0
  45. package/dist/kit/slots/path-templates.d.ts.map +1 -0
  46. package/dist/kit/slots/path-templates.js +113 -0
  47. package/dist/kit/slots/path-templates.js.map +1 -0
  48. package/dist/kit/slots/path.d.ts +45 -0
  49. package/dist/kit/slots/path.d.ts.map +1 -0
  50. package/dist/kit/slots/path.js +87 -0
  51. package/dist/kit/slots/path.js.map +1 -0
  52. package/dist/kit/slots/radial.d.ts +30 -0
  53. package/dist/kit/slots/radial.d.ts.map +1 -0
  54. package/dist/kit/slots/radial.js +45 -0
  55. package/dist/kit/slots/radial.js.map +1 -0
  56. package/dist/kit/slots/rectangular.d.ts +42 -0
  57. package/dist/kit/slots/rectangular.d.ts.map +1 -0
  58. package/dist/kit/slots/rectangular.js +79 -0
  59. package/dist/kit/slots/rectangular.js.map +1 -0
  60. package/dist/kit/slots/slot.d.ts +62 -0
  61. package/dist/kit/slots/slot.d.ts.map +1 -0
  62. package/dist/kit/slots/slot.js +41 -0
  63. package/dist/kit/slots/slot.js.map +1 -0
  64. package/dist/kit/slots/sphere.d.ts +36 -0
  65. package/dist/kit/slots/sphere.d.ts.map +1 -0
  66. package/dist/kit/slots/sphere.js +68 -0
  67. package/dist/kit/slots/sphere.js.map +1 -0
  68. package/dist/kit/stagger.d.ts +24 -0
  69. package/dist/kit/stagger.d.ts.map +1 -0
  70. package/dist/kit/stagger.js +90 -0
  71. package/dist/kit/stagger.js.map +1 -0
  72. package/dist/nodes.d.ts +20 -0
  73. package/dist/nodes.d.ts.map +1 -0
  74. package/dist/nodes.js +11 -0
  75. package/dist/nodes.js.map +1 -0
  76. package/dist/path-grid/index.d.ts +2 -0
  77. package/dist/path-grid/index.d.ts.map +1 -0
  78. package/dist/path-grid/index.js +2 -0
  79. package/dist/path-grid/index.js.map +1 -0
  80. package/dist/path-grid/path-grid.d.ts +196 -0
  81. package/dist/path-grid/path-grid.d.ts.map +1 -0
  82. package/dist/path-grid/path-grid.js +149 -0
  83. package/dist/path-grid/path-grid.js.map +1 -0
  84. package/dist/radial-grid/index.d.ts +2 -0
  85. package/dist/radial-grid/index.d.ts.map +1 -0
  86. package/dist/radial-grid/index.js +2 -0
  87. package/dist/radial-grid/index.js.map +1 -0
  88. package/dist/radial-grid/radial-grid.d.ts +177 -0
  89. package/dist/radial-grid/radial-grid.d.ts.map +1 -0
  90. package/dist/radial-grid/radial-grid.js +63 -0
  91. package/dist/radial-grid/radial-grid.js.map +1 -0
  92. package/dist/rectangular-grid/index.d.ts +2 -0
  93. package/dist/rectangular-grid/index.d.ts.map +1 -0
  94. package/dist/rectangular-grid/index.js +2 -0
  95. package/dist/rectangular-grid/index.js.map +1 -0
  96. package/dist/rectangular-grid/rectangular-grid.d.ts +212 -0
  97. package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -0
  98. package/dist/rectangular-grid/rectangular-grid.js +118 -0
  99. package/dist/rectangular-grid/rectangular-grid.js.map +1 -0
  100. package/dist/sphere-grid/index.d.ts +2 -0
  101. package/dist/sphere-grid/index.d.ts.map +1 -0
  102. package/dist/sphere-grid/index.js +2 -0
  103. package/dist/sphere-grid/index.js.map +1 -0
  104. package/dist/sphere-grid/sphere-grid.d.ts +200 -0
  105. package/dist/sphere-grid/sphere-grid.d.ts.map +1 -0
  106. package/dist/sphere-grid/sphere-grid.js +102 -0
  107. package/dist/sphere-grid/sphere-grid.js.map +1 -0
  108. package/package.json +72 -3
  109. package/registry.json +32 -0
  110. package/src/engine.ts +12 -0
  111. package/src/index.ts +6 -0
  112. package/src/kit/index.ts +18 -0
  113. package/src/kit/item-effects.ts +114 -0
  114. package/src/kit/item-grid.ts +648 -0
  115. package/src/kit/order.ts +41 -0
  116. package/src/kit/random.ts +29 -0
  117. package/src/kit/slots/index.ts +39 -0
  118. package/src/kit/slots/path-templates.ts +120 -0
  119. package/src/kit/slots/path.ts +120 -0
  120. package/src/kit/slots/radial.ts +62 -0
  121. package/src/kit/slots/rectangular.ts +108 -0
  122. package/src/kit/slots/slot.ts +82 -0
  123. package/src/kit/slots/sphere.ts +94 -0
  124. package/src/kit/stagger.ts +96 -0
  125. package/src/nodes.ts +30 -0
  126. package/src/path-grid/index.ts +1 -0
  127. package/src/path-grid/path-grid.ts +186 -0
  128. package/src/radial-grid/index.ts +1 -0
  129. package/src/radial-grid/radial-grid.ts +81 -0
  130. package/src/rectangular-grid/index.ts +1 -0
  131. package/src/rectangular-grid/rectangular-grid.ts +145 -0
  132. package/src/sphere-grid/index.ts +1 -0
  133. package/src/sphere-grid/sphere-grid.ts +129 -0
@@ -0,0 +1,492 @@
1
+ import { commandsFor, easeIn, easeInOut, easeOut, flowOps, insetsOps, Types, } from "@motionscript/sdk";
2
+ import { applyItemEffects, REVEAL_STYLES, WAVE_STYLES, } from "./item-effects.js";
3
+ import { normalizeOrder, parseOrder, slotOfItem } from "./order.js";
4
+ import { hashSeed, shuffled } from "./random.js";
5
+ import { blendSlot, focalLengthOf, slotsOf, spreadSlot } from "./slots/index.js";
6
+ import { STAGGER_ORDERS, staggerProgress, staggerRanks } from "./stagger.js";
7
+ /**
8
+ * Every grid's document key — what a reference to "another grid" may name. A
9
+ * `nodeRef` descriptor carries it as `nodeTypes`, for a host's picker to offer
10
+ * only those.
11
+ */
12
+ export const ITEM_GRID_TYPES = ["rectangularGrid", "radialGrid", "pathGrid", "sphereGrid"];
13
+ /** The stagger a move to new slots takes when its command states none. */
14
+ export const TRANSITION_STAGGER = 0.3;
15
+ /** A reference to another node, a host's picker offering only `types`. Its fields read a view of it. */
16
+ export function nodeRef(types) {
17
+ const described = { kind: "nodeRef", nodeTypes: types, animatable: false };
18
+ return Types.custom("", described);
19
+ }
20
+ /** The stagger args every per-item command takes, `stagger` defaulting to `fallback`. */
21
+ export function staggerArgs(fallback) {
22
+ return {
23
+ staggerOrder: Types.oneOf(STAGGER_ORDERS, { default: "index" }),
24
+ stagger: Types.number(fallback, { min: 0, max: 0.95, step: 0.05 }),
25
+ };
26
+ }
27
+ /**
28
+ * A command arg a host fills in with `hint`, which a row may leave out: the
29
+ * command then keeps what the grid has. A run arg's default is both what a
30
+ * host offers and what an omitted arg means, so the hint rides on the arg's
31
+ * description alone, and an omitted arg reads `undefined`.
32
+ */
33
+ export function hinted(hint, options = {}) {
34
+ const described = { ...options, default: hint };
35
+ return Types.custom(undefined, described);
36
+ }
37
+ /** A command arg naming another node, a host's picker offering only `types`; left out, it reads `undefined`. */
38
+ export function nodeRefArg(types) {
39
+ const described = { kind: "nodeRef", nodeTypes: types };
40
+ return Types.custom(undefined, described);
41
+ }
42
+ /** The state every grid shares. */
43
+ export const state = {
44
+ /** Items in slot order: slot `k` holds child `order[k]`. Empty is the children's own order. */
45
+ order: Types.custom([], { kind: "order", animatable: false }),
46
+ /** `0` gathers every item at the centre, `1` is the arrangement, past `1` pushes them apart. */
47
+ spread: Types.number(1, { min: 0, max: 3, step: 0.05 }),
48
+ /** Another grid whose arrangement this one takes on — what `morphInto` animates. */
49
+ arrangeLike: nodeRef(ITEM_GRID_TYPES),
50
+ // What the per-item commands write. State rather than settings: a command
51
+ // owns each while it runs, and a document has no reason to name them. Unset
52
+ // until a command writes one, so a fresh node's row does not state them.
53
+ revealState: Types.custom(undefined, { kind: "state", animatable: false }),
54
+ waveState: Types.custom(undefined, { kind: "state", animatable: false }),
55
+ focusState: Types.custom(undefined, { kind: "state", animatable: false }),
56
+ transition: Types.custom(undefined, { kind: "state", animatable: false }),
57
+ /** The grid a transition's leaving arrangement was borrowed from, followed while the items travel. */
58
+ transitionSource: Types.custom("", { kind: "nodeRef", private: true }),
59
+ };
60
+ /** A grid's size is what its items come to, whether it was built with children or they arrive after it. */
61
+ export const defaults = { width: "hug", height: "hug" };
62
+ const GRIDS = new Map();
63
+ /**
64
+ * `component` as a grid: registers its `arranger`, which another grid borrowing
65
+ * its arrangement or morphing into it reads it by, and which {@link isGrid} knows it by.
66
+ */
67
+ export function define(component, arranger) {
68
+ GRIDS.set(component.key, { component, arranger: arranger });
69
+ return component;
70
+ }
71
+ /** Whether `value` is a node of one of the grids {@link define} has seen. */
72
+ export function isGrid(value) {
73
+ for (const { component } of GRIDS.values())
74
+ if (value instanceof component.node)
75
+ return true;
76
+ return false;
77
+ }
78
+ /** The grid's measure, layout and render, for `arranger`'s arrangement: spread them into the component. */
79
+ export function fields(arranger) {
80
+ return {
81
+ measure: (measurer, s, children) => measure(measurer, s, children, arranger),
82
+ layout: (box, s, children) => layout(box, s, children, arranger),
83
+ render: (ctx, s) => render(ctx, s, arranger),
84
+ };
85
+ }
86
+ const NO_CONTENT = { width: 0, height: 0 };
87
+ const CENTRE = { x: 0, y: 0 };
88
+ /** What `measure` found, for `layout` to reuse in the same pass. Keyed by the grid's state, one object per node. */
89
+ const measured = new WeakMap();
90
+ export function measure(measurer, s, children, arranger) {
91
+ const constraints = { maxWidth: measurer.max.width, maxHeight: measurer.max.height };
92
+ const padding = s.padding;
93
+ if (children.length === 0) {
94
+ measured.delete(s);
95
+ return flowOps.size(s, constraints, padding, NO_CONTENT);
96
+ }
97
+ const space = flowOps.contentBox(s, constraints, padding);
98
+ const sizes = measureItems(children, space, s, arranger);
99
+ measured.set(s, { space, sizes });
100
+ const grid = { state: s, arranger, children, isSelf: sharesChildren(children) };
101
+ const target = targetSlots(grid, sizes.length, sizes, space, measurer.time.total);
102
+ return flowOps.size(s, constraints, padding, extentOf(target.slots, sizes, focalOf(s, target.arrangement)));
103
+ }
104
+ export function layout(box, s, children, arranger) {
105
+ const kept = measured.get(s);
106
+ measured.delete(s);
107
+ if (children.length === 0)
108
+ return [];
109
+ const inner = insetsOps.insetBounds(box.width, box.height, s.padding);
110
+ const sizes = kept && kept.sizes.length === children.length && sameSize(kept.space, inner)
111
+ ? kept.sizes
112
+ : measureItems(children, inner, s, arranger);
113
+ const slots = resolve({ state: s, arranger, children, isSelf: sharesChildren(children) }, sizes, inner, box.time.total);
114
+ return slots.map((slot, i) => placement(inner, slot, sizes[i]));
115
+ }
116
+ /**
117
+ * A grid whose arrangement has depth is seen through a camera of its own,
118
+ * which paints its items far to near — unless it already sits in a space (an
119
+ * orbit camera, a 3D stage), where its items join that one and its camera.
120
+ */
121
+ export function render(ctx, s, arranger) {
122
+ // With no items there is nothing to see through a camera.
123
+ const focal = s.children.length === 0 ? 0 : focalOf(s, arrangementOf({ state: s, arranger, children: [], isSelf: () => false }, contentBox(ctx.size, s.padding)));
124
+ if (focal > 0 && !ctx.inSpace)
125
+ ctx.space(cameraAt(focal));
126
+ else
127
+ ctx.children();
128
+ }
129
+ /** A node's content box: its laid-out size inside its padding. */
130
+ export function contentBoxOf(grid) {
131
+ const b = grid.layoutBounds;
132
+ return contentBox({ width: b.width, height: b.height }, grid.effectivePadding());
133
+ }
134
+ /**
135
+ * Each item's slot in its arrangement as it stands, for a command being built,
136
+ * at the clock commands are built against (the tree stands at time 0 while a
137
+ * timeline compiles): what its stagger is ranked by.
138
+ */
139
+ export function itemSlots(timeline, s, children) {
140
+ const grid = commandGrid(timeline, s, children);
141
+ const sizes = children.map((child) => child.size);
142
+ return targetSlots(grid, children.length, sizes, contentBox(timeline.node.size, s.padding), 0).slots;
143
+ }
144
+ /** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */
145
+ export function ranks(timeline, s, children, order) {
146
+ return staggerRanks(order ?? "index", itemSlots(timeline, s, children), hashSeed(timeline.node.id));
147
+ }
148
+ /**
149
+ * Write `changes` to the arrangement and move each item from its slot in the
150
+ * one being left to its slot in the new one, staggered.
151
+ */
152
+ export function transitionTo(timeline, s, children, changes, stagger = TRANSITION_STAGGER) {
153
+ const from = snapshot(timeline, s, children);
154
+ const ease = timeline.easing ?? easeInOut("cubic");
155
+ const order = ranks(timeline, s, children, timeline.args.staggerOrder);
156
+ const spread = timeline.args.stagger ?? stagger;
157
+ return timeline.animate((t) => {
158
+ if (t >= 1)
159
+ return { ...changes, transition: null, transitionSource: "" };
160
+ const mix = order.map((rank) => ease(staggerProgress(rank, t, spread)));
161
+ return { ...changes, transition: { from, mix }, transitionSource: from.source };
162
+ }, { eased: false });
163
+ }
164
+ /** Emphasise the items `isFocus` picks and push the rest back. */
165
+ export function focusOn(timeline, s, isFocus, count, dim, grow) {
166
+ const from = s.focusState;
167
+ const target = Array.from({ length: count }, (_, i) => (isFocus(i) ? 1 : -1));
168
+ const ease = timeline.easing ?? easeInOut("cubic");
169
+ return timeline.animate((t) => {
170
+ const e = ease(t);
171
+ return {
172
+ focusState: {
173
+ dim: lerp(from?.dim ?? dim, dim, e),
174
+ grow: lerp(from?.grow ?? grow, grow, e),
175
+ values: target.map((v, i) => lerp(from?.values[i] ?? 0, v, e)),
176
+ },
177
+ };
178
+ }, { eased: false });
179
+ }
180
+ // What the commands are typed against: the shared state, and the padding every node has.
181
+ const GRID_STATE = { ...state, padding: Types.insets };
182
+ export const commands = commandsFor(GRID_STATE, {
183
+ /**
184
+ * Bring the items in, one after another. Every item starts hidden, so place
185
+ * it where the grid enters — or after a `conceal`.
186
+ */
187
+ reveal: {
188
+ args: { style: Types.oneOf(REVEAL_STYLES, { default: "scale" }), ...staggerArgs(0.5) },
189
+ run: (timeline, s, children) => {
190
+ const style = timeline.args.style ?? "scale";
191
+ const ease = timeline.easing ?? (style === "scale" || style === "flip" ? easeOut("back") : easeOut("cubic"));
192
+ const order = ranks(timeline, s, children, timeline.args.staggerOrder);
193
+ const stagger = timeline.args.stagger ?? 0.5;
194
+ return timeline.animate((t) => {
195
+ if (t >= 1)
196
+ return { revealState: null };
197
+ return { revealState: { style, values: order.map((rank) => ease(staggerProgress(rank, t, stagger))) } };
198
+ }, { eased: false });
199
+ },
200
+ },
201
+ /** Take the items out, one after another — `reveal` in reverse. They stay hidden after. */
202
+ conceal: {
203
+ args: { style: Types.oneOf(REVEAL_STYLES, { default: "scale" }), ...staggerArgs(0.5) },
204
+ run: (timeline, s, children) => {
205
+ const style = timeline.args.style ?? "scale";
206
+ const ease = timeline.easing ?? (style === "scale" || style === "flip" ? easeIn("back") : easeInOut("cubic"));
207
+ const order = ranks(timeline, s, children, timeline.args.staggerOrder);
208
+ const stagger = timeline.args.stagger ?? 0.5;
209
+ const from = s.revealState?.values;
210
+ return timeline.animate((t) => ({
211
+ revealState: {
212
+ style,
213
+ values: order.map((rank, i) => (from?.[i] ?? 1) * (1 - ease(staggerProgress(rank, t, stagger)))),
214
+ },
215
+ }), { eased: false });
216
+ },
217
+ },
218
+ /** Send a ripple through the items that swells each in turn and settles back. */
219
+ wave: {
220
+ args: {
221
+ style: Types.oneOf(WAVE_STYLES, { default: "scale" }),
222
+ amount: Types.number(0.3, { min: 0, max: 2, step: 0.05 }),
223
+ ...staggerArgs(0.7),
224
+ },
225
+ run: (timeline, s, children) => {
226
+ const style = timeline.args.style ?? "scale";
227
+ const amount = timeline.args.amount ?? 0.3;
228
+ const ease = timeline.easing ?? easeInOut("sine");
229
+ const order = ranks(timeline, s, children, timeline.args.staggerOrder);
230
+ const stagger = timeline.args.stagger ?? 0.7;
231
+ return timeline.animate((t) => {
232
+ if (t >= 1)
233
+ return { waveState: null };
234
+ return { waveState: { style, amount, values: order.map((rank) => Math.sin(Math.PI * ease(staggerProgress(rank, t, stagger)))) } };
235
+ }, { eased: false });
236
+ },
237
+ },
238
+ /** Bring one item (by its place in the layers, from 0) forward and push the rest back. */
239
+ focus: {
240
+ args: {
241
+ item: Types.number(0, { min: 0, step: 1 }),
242
+ dim: Types.number(0.7, { min: 0, max: 1, step: 0.05 }),
243
+ grow: Types.number(0.15, { min: 0, max: 1, step: 0.05 }),
244
+ },
245
+ run: (timeline, s, children) => {
246
+ const item = Math.round(timeline.args.item ?? 0);
247
+ return focusOn(timeline, s, (i) => i === item, children.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15);
248
+ },
249
+ },
250
+ /** Bring every item back to even. */
251
+ unfocus: (timeline, s) => {
252
+ const from = s.focusState;
253
+ const ease = timeline.easing ?? easeInOut("cubic");
254
+ return timeline.animate((t) => {
255
+ if (t >= 1 || !from)
256
+ return { focusState: null };
257
+ const k = 1 - ease(t);
258
+ return { focusState: { ...from, values: from.values.map((v) => v * k) } };
259
+ }, { eased: false });
260
+ },
261
+ /** Gather the items toward the centre (`0`), back to the arrangement (`1`), or push them apart. */
262
+ spreadTo: {
263
+ args: { spread: Types.number(1, { min: 0, max: 3, step: 0.05 }) },
264
+ run: (timeline) => timeline.tween({ spread: timeline.args.spread ?? 1 }),
265
+ },
266
+ /** Send every item to a random slot. The same `seed` always deals the same way. */
267
+ shuffle: {
268
+ args: { seed: Types.number(1, { min: 0, step: 1 }), ...staggerArgs(TRANSITION_STAGGER) },
269
+ run: (timeline, s, children) => {
270
+ const current = normalizeOrder(s.order, children.length);
271
+ let next = shuffled(current, timeline.args.seed ?? 1);
272
+ // A shuffle that deals everything back where it was would look like nothing happened.
273
+ if (next.length > 1 && next.every((item, k) => item === current[k]))
274
+ next = [...next.slice(1), next[0]];
275
+ return transitionTo(timeline, s, children, { order: next });
276
+ },
277
+ },
278
+ /** Two items trade places, by their place in the layers. */
279
+ swap: {
280
+ args: {
281
+ first: Types.number(0, { min: 0, step: 1 }),
282
+ second: Types.number(1, { min: 0, step: 1 }),
283
+ ...staggerArgs(0),
284
+ },
285
+ run: (timeline, s, children) => {
286
+ const order = normalizeOrder(s.order, children.length);
287
+ const a = order.indexOf(Math.round(timeline.args.first ?? 0));
288
+ const b = order.indexOf(Math.round(timeline.args.second ?? 1));
289
+ if (a >= 0 && b >= 0)
290
+ [order[a], order[b]] = [order[b], order[a]];
291
+ return transitionTo(timeline, s, children, { order }, 0);
292
+ },
293
+ },
294
+ /** Move the items into a new order — a list of layer indices, first slot first, like `"2, 0, 1"`. */
295
+ reorder: {
296
+ args: { order: Types.text(""), ...staggerArgs(TRANSITION_STAGGER) },
297
+ run: (timeline, s, children) => {
298
+ const order = normalizeOrder(parseOrder(timeline.args.order), children.length);
299
+ return transitionTo(timeline, s, children, { order });
300
+ },
301
+ },
302
+ /**
303
+ * Move every item into another grid's arrangement — a grid into a ring, a ring
304
+ * onto a sphere — and keep following it. An empty `target` morphs back to
305
+ * this grid's own.
306
+ */
307
+ morphInto: {
308
+ args: { target: nodeRefArg(ITEM_GRID_TYPES), ...staggerArgs(TRANSITION_STAGGER) },
309
+ run: (timeline, s, children) => transitionTo(timeline, s, children, { arrangeLike: timeline.args.target ?? "" }),
310
+ },
311
+ });
312
+ function arrangerOf(key) {
313
+ const grid = GRIDS.get(key);
314
+ if (!grid)
315
+ throw new Error(`"${key}" is no grid: pass its component through ItemGrid.define.`);
316
+ return grid.arranger;
317
+ }
318
+ /** A grid `view` names, when it is one this kit can arrange and not the reader itself. */
319
+ function gridIn(view, grid) {
320
+ if (!view)
321
+ return null;
322
+ const found = GRIDS.get(view.key);
323
+ if (!found || grid.isSelf(view))
324
+ return null;
325
+ return { view, arranger: found.arranger };
326
+ }
327
+ /** In layout, a view is this grid when it holds the same children: a child has one parent. */
328
+ function sharesChildren(children) {
329
+ return (view) => {
330
+ if (children.length === 0)
331
+ return false;
332
+ const theirs = view.state.children;
333
+ return theirs?.[0] === children[0];
334
+ };
335
+ }
336
+ function commandGrid(timeline, s, children) {
337
+ return { state: s, arranger: arrangerOf(timeline.node.key), children, isSelf: (view) => view.id === timeline.node.id };
338
+ }
339
+ function snapshot(timeline, s, children) {
340
+ const grid = commandGrid(timeline, s, children);
341
+ const source = gridIn(s.arrangeLike, grid);
342
+ return {
343
+ arrangement: source
344
+ ? source.arranger.arrangement(source.view.state, viewBox(source.view))
345
+ : grid.arranger.arrangement(s, contentBox(timeline.node.size, s.padding)),
346
+ source: source?.view.id ?? "",
347
+ order: normalizeOrder(s.order, children.length),
348
+ spread: s.spread,
349
+ };
350
+ }
351
+ function measureItems(children, space, s, arranger) {
352
+ const sizes = children.map((child) => child.measure(space));
353
+ const cell = arranger.itemSpace ? arranger.itemSpace(s, children.length, space) : space;
354
+ if (cell === space)
355
+ return sizes;
356
+ return children.map((child) => child.measure(cell));
357
+ }
358
+ /** The arrangement the grid is heading for: the one it borrows, or its own. */
359
+ function arrangementOf(grid, box) {
360
+ const source = gridIn(grid.state.arrangeLike, grid);
361
+ return source ? source.arranger.arrangement(source.view.state, viewBox(source.view)) : grid.arranger.arrangement(grid.state, box);
362
+ }
363
+ /** Where each item sits in the arrangement it is heading for, before any transition or effect. */
364
+ function targetSlots(grid, count, sizes, box, time) {
365
+ const s = grid.state;
366
+ const source = gridIn(s.arrangeLike, grid);
367
+ const sourceBox = source ? viewBox(source.view) : box;
368
+ const arrangement = source ? source.arranger.arrangement(source.view.state, sourceBox) : grid.arranger.arrangement(s, box);
369
+ let slots = slotsOf(arrangement, { count, sizes, box: sourceBox, time });
370
+ if (source)
371
+ slots = inFrame(source.view.frame, slots);
372
+ const slotOf = slotOfItem(normalizeOrder(s.order, count));
373
+ return { slots: slotOf.map((k) => spreadSlot(slots[k], s.spread)), arrangement };
374
+ }
375
+ /** Each item's final slot this frame: the target, blended from any transition, with its effects on. */
376
+ function resolve(grid, sizes, box, time) {
377
+ const s = grid.state;
378
+ const count = sizes.length;
379
+ const slots = targetSlots(grid, count, sizes, box, time).slots;
380
+ const transition = s.transition;
381
+ if (transition) {
382
+ const { from } = transition;
383
+ const named = from.source ? s.transitionSource : null;
384
+ const source = named && named.id === from.source && GRIDS.has(named.key) ? named : null;
385
+ const self = source !== null && grid.isSelf(source);
386
+ const fromBox = source && !self ? viewBox(source) : box;
387
+ let leaving = slotsOf(from.arrangement, { count, sizes, box: fromBox, time });
388
+ if (source && !self)
389
+ leaving = inFrame(source.frame, leaving);
390
+ const slotOf = slotOfItem(normalizeOrder(from.order, count));
391
+ for (let i = 0; i < count; i++) {
392
+ slots[i] = blendSlot(spreadSlot(leaving[slotOf[i]], from.spread), slots[i], transition.mix[i] ?? 1);
393
+ }
394
+ }
395
+ const reveal = s.revealState;
396
+ const wave = s.waveState;
397
+ const focus = s.focusState;
398
+ if (reveal || wave || focus) {
399
+ for (let i = 0; i < count; i++)
400
+ applyItemEffects(slots[i], i, sizes[i], reveal, wave, focus);
401
+ }
402
+ return slots;
403
+ }
404
+ /** The camera distance the grid is seen through: the target's, or, while a morph runs, the one it is leaving. */
405
+ function focalOf(s, target) {
406
+ // A morph into or out of depth keeps the camera for its whole length.
407
+ return focalLengthOf(target) || (s.transition ? focalLengthOf(s.transition.from.arrangement) : 0);
408
+ }
409
+ function cameraAt(focal) {
410
+ return {
411
+ perspective: focal,
412
+ orbit: 0,
413
+ elevation: 0,
414
+ dolly: 0,
415
+ lookAt: CENTRE,
416
+ zoom: 1,
417
+ heading: 0,
418
+ viewportX: 0,
419
+ viewportY: 0,
420
+ };
421
+ }
422
+ /** A slot as a child's placement: its box centred on the slot, and the slot's transform when it has one. */
423
+ function placement(inner, s, size) {
424
+ const box = { x: inner.x + s.x, y: s.y - inner.y, width: size.width, height: size.height };
425
+ if (s.rotation === 0 && s.scale === 1 && s.rotationX === 0 && s.rotationY === 0 && s.depth === 0 && s.opacity === 1)
426
+ return box;
427
+ return {
428
+ ...box,
429
+ rotation: s.rotation,
430
+ scale: s.scale,
431
+ rotationX: s.rotationX,
432
+ rotationY: s.rotationY,
433
+ depth: s.depth,
434
+ opacity: s.opacity,
435
+ };
436
+ }
437
+ /** `slots`, laid out in another grid's frame, moved into this grid's. */
438
+ function inFrame(frame, slots) {
439
+ return slots.map((s) => {
440
+ const p = rotateClockwise(s.x * frame.scale, s.y * frame.scale, frame.rotation);
441
+ return {
442
+ ...s,
443
+ x: frame.x + p.x,
444
+ y: frame.y + p.y,
445
+ depth: s.depth * frame.scale,
446
+ rotation: s.rotation + frame.rotation,
447
+ scale: s.scale * frame.scale,
448
+ };
449
+ });
450
+ }
451
+ function viewBox(view) {
452
+ return contentBox(view.size, view.state.padding);
453
+ }
454
+ /** A box of `size` inside `padding`: what a command reads as its grid's content box from `timeline.node.size`. */
455
+ export function contentBox(size, padding) {
456
+ const inner = insetsOps.insetBounds(size.width, size.height, padding);
457
+ return { width: inner.width, height: inner.height };
458
+ }
459
+ /** The box, centred on the grid, that holds every item where its slot puts it. */
460
+ function extentOf(slots, sizes, focal) {
461
+ let halfWidth = 0;
462
+ let halfHeight = 0;
463
+ for (let i = 0; i < slots.length; i++) {
464
+ const s = slots[i];
465
+ const size = sizes[i];
466
+ const rad = (s.rotation * Math.PI) / 180;
467
+ const cos = Math.abs(Math.cos(rad));
468
+ const sin = Math.abs(Math.sin(rad));
469
+ // What the camera does to a slot at depth, so a sphere hugs its front.
470
+ const lens = focal > 0 && focal - s.depth > 1 ? focal / (focal - s.depth) : 1;
471
+ const w = ((size.width * cos + size.height * sin) / 2) * s.scale * lens;
472
+ const h = ((size.width * sin + size.height * cos) / 2) * s.scale * lens;
473
+ halfWidth = Math.max(halfWidth, Math.abs(s.x) * lens + w);
474
+ halfHeight = Math.max(halfHeight, Math.abs(s.y) * lens + h);
475
+ }
476
+ return { width: halfWidth * 2, height: halfHeight * 2 };
477
+ }
478
+ function rotateClockwise(x, y, degrees) {
479
+ if (degrees === 0)
480
+ return { x, y };
481
+ const rad = (degrees * Math.PI) / 180;
482
+ const cos = Math.cos(rad);
483
+ const sin = Math.sin(rad);
484
+ return { x: x * cos + y * sin, y: -x * sin + y * cos };
485
+ }
486
+ function sameSize(a, b) {
487
+ return Math.abs(a.width - b.width) < 1e-6 && Math.abs(a.height - b.height) < 1e-6;
488
+ }
489
+ function lerp(a, b, t) {
490
+ return a + (b - a) * t;
491
+ }
492
+ //# sourceMappingURL=item-grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-grid.js","sourceRoot":"","sources":["../../src/kit/item-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,GAgBN,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,WAAW,GAIZ,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,UAAU,EAA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AAI,OAAO,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IAClC,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACzB,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,CAAA;AACxD,CAAC;AAED,SAAS,QAAQ,CAAC,CAAS,EAAE,CAAS;IACpC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;AACnF,CAAC;AAED,SAAS,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAC3C,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC","sourcesContent":["import {\n commandsFor,\n easeIn,\n easeInOut,\n easeOut,\n flowOps,\n insetsOps,\n Types,\n type ChildView,\n type InsetsResolved,\n type LayoutBox,\n type LayoutItem,\n type Measurer,\n type Node2D,\n type NodeFrame,\n type NodeView,\n type Piece,\n type Placement2D,\n type RenderContext,\n type Size2D,\n type SpaceCamera,\n type Timeline,\n type Values,\n} from \"@motionscript/sdk\"\n\nimport {\n applyItemEffects,\n REVEAL_STYLES,\n WAVE_STYLES,\n type FocusState,\n type RevealState,\n type WaveState,\n} from \"./item-effects\"\nimport { normalizeOrder, parseOrder, slotOfItem } from \"./order\"\nimport { hashSeed, shuffled } from \"./random\"\nimport { blendSlot, focalLengthOf, slotsOf, spreadSlot, type Arrangement, type Slot } from \"./slots\"\nimport { STAGGER_ORDERS, staggerProgress, staggerRanks, type StaggerOrder } from \"./stagger\"\n\n/**\n * What every grid is built from: a container that places each of its children\n * in a slot of an arrangement — a rectangular grid, a ring, a path, a sphere.\n * Spread `state` and `commands` in, take `defaults`, hand `fields` the\n * {@link Arranger} that makes this grid's arrangement from its state, and pass\n * the finished component and its arranger through {@link define}.\n *\n * ## Children only\n *\n * The items are the children, in layer order. A child's slot is a parent\n * transform on it, so its own `x`/`y`/`rotation`/`scale` — and any command on\n * them — still work, relative to the slot. A group is one item; a grid of\n * grids is a grid of items that happen to be grids.\n *\n * ## One pass\n *\n * Every frame: measure the children, ask the arrangement for its slots (a pure\n * function of the state, the sizes and the clock), blend them from where a\n * transition is leaving, and layer on the per-item effects — reveal, wave,\n * focus. What is left is each child's box and slot, which the renderer,\n * picking and `global` all read, so a selection outline lands on the pixels\n * even on a sphere.\n *\n * ## Commands\n *\n * Every command is a pure function of time. The per-item ones stagger *inside*\n * their duration — a one-second reveal takes one second for four children or\n * four hundred — and write their per-item state into entries\n * (`revealState` and its siblings), which is what keeps them seekable. The ones\n * that change the arrangement itself (a reorder, a morph, a column count) keep\n * the arrangement they are leaving as data and blend each item from its old\n * slot to its new one.\n */\n\n/** An arrangement a grid is leaving, kept as data so its slots can be worked out afresh every frame. */\nexport interface GridSnapshot {\n arrangement: Arrangement\n /** The grid the arrangement was borrowed from, or `\"\"` for the grid's own. */\n source: string\n order: readonly number[]\n spread: number\n}\n\n/** A change of arrangement under way: where the items are coming from, and how far each has come. */\nexport interface GridTransition {\n from: GridSnapshot\n /** Each item's eased, staggered progress, `0..1`. */\n mix: readonly number[]\n}\n\n/** The stagger options every per-item command takes. */\nexport interface StaggerArgs {\n staggerOrder?: StaggerOrder\n /** `0..0.95`: how much of the command's length the items' offsets take up. */\n stagger?: number\n}\n\n/**\n * Every grid's document key — what a reference to \"another grid\" may name. A\n * `nodeRef` descriptor carries it as `nodeTypes`, for a host's picker to offer\n * only those.\n */\nexport const ITEM_GRID_TYPES = [\"rectangularGrid\", \"radialGrid\", \"pathGrid\", \"sphereGrid\"] as const\n\n/** The stagger a move to new slots takes when its command states none. */\nexport const TRANSITION_STAGGER = 0.3\n\n/** A reference to another node, a host's picker offering only `types`. Its fields read a view of it. */\nexport function nodeRef(types: readonly string[]) {\n const described = { kind: \"nodeRef\", nodeTypes: types, animatable: false }\n return Types.custom<string, NodeView | null>(\"\", described)\n}\n\n/** The stagger args every per-item command takes, `stagger` defaulting to `fallback`. */\nexport function staggerArgs(fallback: number) {\n return {\n staggerOrder: Types.oneOf(STAGGER_ORDERS, { default: \"index\" }),\n stagger: Types.number(fallback, { min: 0, max: 0.95, step: 0.05 }),\n }\n}\n\n/**\n * A command arg a host fills in with `hint`, which a row may leave out: the\n * command then keeps what the grid has. A run arg's default is both what a\n * host offers and what an omitted arg means, so the hint rides on the arg's\n * description alone, and an omitted arg reads `undefined`.\n */\nexport function hinted<T extends number | string>(hint: T, options: object = {}) {\n const described: Record<string, unknown> = { ...options, default: hint }\n return Types.custom<T | undefined>(undefined, described as never)\n}\n\n/** A command arg naming another node, a host's picker offering only `types`; left out, it reads `undefined`. */\nexport function nodeRefArg(types: readonly string[]) {\n const described = { kind: \"nodeRef\", nodeTypes: types }\n return Types.custom<string | undefined>(undefined, described)\n}\n\n/** The state every grid shares. */\nexport const state = {\n /** Items in slot order: slot `k` holds child `order[k]`. Empty is the children's own order. */\n order: Types.custom<number[]>([], { kind: \"order\", animatable: false }),\n /** `0` gathers every item at the centre, `1` is the arrangement, past `1` pushes them apart. */\n spread: Types.number(1, { min: 0, max: 3, step: 0.05 }),\n /** Another grid whose arrangement this one takes on — what `morphInto` animates. */\n arrangeLike: nodeRef(ITEM_GRID_TYPES),\n // What the per-item commands write. State rather than settings: a command\n // owns each while it runs, and a document has no reason to name them. Unset\n // until a command writes one, so a fresh node's row does not state them.\n revealState: Types.custom<RevealState | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n waveState: Types.custom<WaveState | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n focusState: Types.custom<FocusState | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n transition: Types.custom<GridTransition | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n /** The grid a transition's leaving arrangement was borrowed from, followed while the items travel. */\n transitionSource: Types.custom<string, NodeView | null, { readonly private: true }>(\"\", { kind: \"nodeRef\", private: true }),\n}\n\n/** A grid's size is what its items come to, whether it was built with children or they arrive after it. */\nexport const defaults = { width: \"hug\", height: \"hug\" } as const\n\n/** What a grid's commands read of its state, beyond its own arrangement's entries. */\nexport type GridValues = Values<typeof state> & { readonly padding: InsetsResolved }\n\n/** What a grid's measure, layout and render read of its state, beyond its own arrangement's entries. */\nexport type GridState = GridValues & {\n readonly width: LayoutItem[\"width\"]\n readonly height: LayoutItem[\"height\"]\n readonly children: readonly ChildView[]\n}\n\n/** What makes one grid's arrangement from its state: the rest of a grid is this module. */\nexport interface Arranger<S = unknown> {\n /** This grid's own arrangement, for a content box of `box`. */\n arrangement(state: S, box: Size2D): Arrangement\n /** The room each item is measured in — the whole content box, unless the arrangement has cells. */\n itemSpace?(state: S, count: number, space: Size2D): Size2D\n}\n\ntype GridComponent = { readonly key: string; readonly node: abstract new (...args: never[]) => object }\n\nconst GRIDS = new Map<string, { readonly component: GridComponent; readonly arranger: Arranger<never> }>()\n\n/**\n * `component` as a grid: registers its `arranger`, which another grid borrowing\n * its arrangement or morphing into it reads it by, and which {@link isGrid} knows it by.\n */\nexport function define<C extends GridComponent, S>(component: C, arranger: Arranger<S>): C {\n GRIDS.set(component.key, { component, arranger: arranger as Arranger<never> })\n return component\n}\n\n/** Whether `value` is a node of one of the grids {@link define} has seen. */\nexport function isGrid(value: unknown): boolean {\n for (const { component } of GRIDS.values()) if (value instanceof component.node) return true\n return false\n}\n\n/** The grid's measure, layout and render, for `arranger`'s arrangement: spread them into the component. */\nexport function fields<S>(arranger: Arranger<S>) {\n return {\n measure: (measurer: Measurer, s: GridState & S, children: readonly ChildView[]) => measure(measurer, s, children, arranger),\n layout: (box: LayoutBox, s: GridState & S, children: readonly ChildView[]) => layout(box, s, children, arranger),\n render: (ctx: RenderContext, s: GridState & S) => render(ctx, s, arranger),\n }\n}\n\nconst NO_CONTENT: Size2D = { width: 0, height: 0 }\nconst CENTRE = { x: 0, y: 0 }\n\n/** What `measure` found, for `layout` to reuse in the same pass. Keyed by the grid's state, one object per node. */\nconst measured = new WeakMap<object, { space: Size2D; sizes: Size2D[] }>()\n\nexport function measure<S>(measurer: Measurer, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): Size2D {\n const constraints = { maxWidth: measurer.max.width, maxHeight: measurer.max.height }\n const padding = s.padding\n if (children.length === 0) {\n measured.delete(s)\n return flowOps.size(s, constraints, padding, NO_CONTENT)\n }\n const space = flowOps.contentBox(s, constraints, padding)\n const sizes = measureItems(children, space, s, arranger)\n measured.set(s, { space, sizes })\n const grid = { state: s, arranger, children, isSelf: sharesChildren(children) }\n const target = targetSlots(grid, sizes.length, sizes, space, measurer.time.total)\n return flowOps.size(s, constraints, padding, extentOf(target.slots, sizes, focalOf(s, target.arrangement)))\n}\n\nexport function layout<S>(box: LayoutBox, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): readonly Placement2D[] {\n const kept = measured.get(s)\n measured.delete(s)\n if (children.length === 0) return []\n const inner = insetsOps.insetBounds(box.width, box.height, s.padding)\n const sizes = kept && kept.sizes.length === children.length && sameSize(kept.space, inner)\n ? kept.sizes\n : measureItems(children, inner, s, arranger)\n const slots = resolve({ state: s, arranger, children, isSelf: sharesChildren(children) }, sizes, inner, box.time.total)\n return slots.map((slot, i) => placement(inner, slot, sizes[i]))\n}\n\n/**\n * A grid whose arrangement has depth is seen through a camera of its own,\n * which paints its items far to near — unless it already sits in a space (an\n * orbit camera, a 3D stage), where its items join that one and its camera.\n */\nexport function render<S>(ctx: RenderContext, s: GridState & S, arranger: Arranger<S>): void {\n // With no items there is nothing to see through a camera.\n const focal = s.children.length === 0 ? 0 : focalOf(s, arrangementOf({ state: s, arranger, children: [], isSelf: () => false }, contentBox(ctx.size, s.padding)))\n if (focal > 0 && !ctx.inSpace) ctx.space(cameraAt(focal))\n else ctx.children()\n}\n\n/** A node's content box: its laid-out size inside its padding. */\nexport function contentBoxOf(grid: Node2D): Size2D {\n const b = grid.layoutBounds\n return contentBox({ width: b.width, height: b.height }, grid.effectivePadding())\n}\n\n// ---- what commands share --------------------------------------------------\n\ntype GridTimeline = Timeline<StaggerArgs, never>\n\n/**\n * Each item's slot in its arrangement as it stands, for a command being built,\n * at the clock commands are built against (the tree stands at time 0 while a\n * timeline compiles): what its stagger is ranked by.\n */\nexport function itemSlots(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): Slot[] {\n const grid = commandGrid(timeline, s, children)\n const sizes = children.map((child) => child.size)\n return targetSlots(grid, children.length, sizes, contentBox(timeline.node.size, s.padding), 0).slots\n}\n\n/** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */\nexport function ranks(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[], order: StaggerOrder | undefined): number[] {\n return staggerRanks(order ?? \"index\", itemSlots(timeline, s, children), hashSeed(timeline.node.id))\n}\n\n/**\n * Write `changes` to the arrangement and move each item from its slot in the\n * one being left to its slot in the new one, staggered.\n */\nexport function transitionTo(\n timeline: GridTimeline,\n s: GridValues,\n children: readonly ChildView[],\n changes: Record<string, unknown>,\n stagger = TRANSITION_STAGGER,\n): Piece {\n const from = snapshot(timeline, s, children)\n const ease = timeline.easing ?? easeInOut(\"cubic\")\n const order = ranks(timeline, s, children, timeline.args.staggerOrder)\n const spread = timeline.args.stagger ?? stagger\n return timeline.animate((t) => {\n if (t >= 1) return { ...changes, transition: null, transitionSource: \"\" } as never\n const mix = order.map((rank) => ease(staggerProgress(rank, t, spread)))\n return { ...changes, transition: { from, mix }, transitionSource: from.source } as never\n }, { eased: false })\n}\n\n/** Emphasise the items `isFocus` picks and push the rest back. */\nexport function focusOn(\n timeline: Timeline<object, never>,\n s: GridValues,\n isFocus: (item: number) => boolean,\n count: number,\n dim: number,\n grow: number,\n): Piece {\n const from = s.focusState\n const target = Array.from({ length: count }, (_, i) => (isFocus(i) ? 1 : -1))\n const ease = timeline.easing ?? easeInOut(\"cubic\")\n return timeline.animate((t) => {\n const e = ease(t)\n return {\n focusState: {\n dim: lerp(from?.dim ?? dim, dim, e),\n grow: lerp(from?.grow ?? grow, grow, e),\n values: target.map((v, i) => lerp(from?.values[i] ?? 0, v, e)),\n },\n } as never\n }, { eased: false })\n}\n\n// What the commands are typed against: the shared state, and the padding every node has.\nconst GRID_STATE = { ...state, padding: Types.insets }\n\nexport const commands = commandsFor(GRID_STATE, {\n /**\n * Bring the items in, one after another. Every item starts hidden, so place\n * it where the grid enters — or after a `conceal`.\n */\n reveal: {\n args: { style: Types.oneOf(REVEAL_STYLES, { default: \"scale\" }), ...staggerArgs(0.5) },\n run: (timeline, s, children) => {\n const style = timeline.args.style ?? \"scale\"\n const ease = timeline.easing ?? (style === \"scale\" || style === \"flip\" ? easeOut(\"back\") : easeOut(\"cubic\"))\n const order = ranks(timeline as never, s, children, timeline.args.staggerOrder)\n const stagger = timeline.args.stagger ?? 0.5\n return timeline.animate((t) => {\n if (t >= 1) return { revealState: null }\n return { revealState: { style, values: order.map((rank) => ease(staggerProgress(rank, t, stagger))) } }\n }, { eased: false })\n },\n },\n /** Take the items out, one after another — `reveal` in reverse. They stay hidden after. */\n conceal: {\n args: { style: Types.oneOf(REVEAL_STYLES, { default: \"scale\" }), ...staggerArgs(0.5) },\n run: (timeline, s, children) => {\n const style = timeline.args.style ?? \"scale\"\n const ease = timeline.easing ?? (style === \"scale\" || style === \"flip\" ? easeIn(\"back\") : easeInOut(\"cubic\"))\n const order = ranks(timeline as never, s, children, timeline.args.staggerOrder)\n const stagger = timeline.args.stagger ?? 0.5\n const from = s.revealState?.values\n return timeline.animate((t) => ({\n revealState: {\n style,\n values: order.map((rank, i) => (from?.[i] ?? 1) * (1 - ease(staggerProgress(rank, t, stagger)))),\n },\n }), { eased: false })\n },\n },\n /** Send a ripple through the items that swells each in turn and settles back. */\n wave: {\n args: {\n style: Types.oneOf(WAVE_STYLES, { default: \"scale\" }),\n amount: Types.number(0.3, { min: 0, max: 2, step: 0.05 }),\n ...staggerArgs(0.7),\n },\n run: (timeline, s, children) => {\n const style = timeline.args.style ?? \"scale\"\n const amount = timeline.args.amount ?? 0.3\n const ease = timeline.easing ?? easeInOut(\"sine\")\n const order = ranks(timeline as never, s, children, timeline.args.staggerOrder)\n const stagger = timeline.args.stagger ?? 0.7\n return timeline.animate((t) => {\n if (t >= 1) return { waveState: null }\n return { waveState: { style, amount, values: order.map((rank) => Math.sin(Math.PI * ease(staggerProgress(rank, t, stagger)))) } }\n }, { eased: false })\n },\n },\n /** Bring one item (by its place in the layers, from 0) forward and push the rest back. */\n focus: {\n args: {\n item: Types.number(0, { min: 0, step: 1 }),\n dim: Types.number(0.7, { min: 0, max: 1, step: 0.05 }),\n grow: Types.number(0.15, { min: 0, max: 1, step: 0.05 }),\n },\n run: (timeline, s, children) => {\n const item = Math.round(timeline.args.item ?? 0)\n return focusOn(timeline as never, s, (i) => i === item, children.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15)\n },\n },\n /** Bring every item back to even. */\n unfocus: (timeline, s) => {\n const from = s.focusState\n const ease = timeline.easing ?? easeInOut(\"cubic\")\n return timeline.animate((t) => {\n if (t >= 1 || !from) return { focusState: null }\n const k = 1 - ease(t)\n return { focusState: { ...from, values: from.values.map((v) => v * k) } }\n }, { eased: false })\n },\n /** Gather the items toward the centre (`0`), back to the arrangement (`1`), or push them apart. */\n spreadTo: {\n args: { spread: Types.number(1, { min: 0, max: 3, step: 0.05 }) },\n run: (timeline) => timeline.tween({ spread: timeline.args.spread ?? 1 }),\n },\n /** Send every item to a random slot. The same `seed` always deals the same way. */\n shuffle: {\n args: { seed: Types.number(1, { min: 0, step: 1 }), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => {\n const current = normalizeOrder(s.order, children.length)\n let next = shuffled(current, timeline.args.seed ?? 1)\n // A shuffle that deals everything back where it was would look like nothing happened.\n if (next.length > 1 && next.every((item, k) => item === current[k])) next = [...next.slice(1), next[0]]\n return transitionTo(timeline as never, s, children, { order: next })\n },\n },\n /** Two items trade places, by their place in the layers. */\n swap: {\n args: {\n first: Types.number(0, { min: 0, step: 1 }),\n second: Types.number(1, { min: 0, step: 1 }),\n ...staggerArgs(0),\n },\n run: (timeline, s, children) => {\n const order = normalizeOrder(s.order, children.length)\n const a = order.indexOf(Math.round(timeline.args.first ?? 0))\n const b = order.indexOf(Math.round(timeline.args.second ?? 1))\n if (a >= 0 && b >= 0) [order[a], order[b]] = [order[b], order[a]]\n return transitionTo(timeline as never, s, children, { order }, 0)\n },\n },\n /** Move the items into a new order — a list of layer indices, first slot first, like `\"2, 0, 1\"`. */\n reorder: {\n args: { order: Types.text(\"\"), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => {\n const order = normalizeOrder(parseOrder(timeline.args.order), children.length)\n return transitionTo(timeline as never, s, children, { order })\n },\n },\n /**\n * Move every item into another grid's arrangement — a grid into a ring, a ring\n * onto a sphere — and keep following it. An empty `target` morphs back to\n * this grid's own.\n */\n morphInto: {\n args: { target: nodeRefArg(ITEM_GRID_TYPES), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => transitionTo(timeline as never, s, children, { arrangeLike: timeline.args.target ?? \"\" }),\n },\n})\n\n// ---- the one pass ------------------------------------------------------------\n\ninterface Grid {\n readonly state: GridValues\n readonly arranger: Arranger<never>\n readonly children: readonly ChildView[]\n /** Whether a view is this grid itself, which borrows nothing from itself. */\n readonly isSelf: (view: NodeView) => boolean\n}\n\nfunction arrangerOf(key: string): Arranger<never> {\n const grid = GRIDS.get(key)\n if (!grid) throw new Error(`\"${key}\" is no grid: pass its component through ItemGrid.define.`)\n return grid.arranger\n}\n\n/** A grid `view` names, when it is one this kit can arrange and not the reader itself. */\nfunction gridIn(view: NodeView | null | undefined, grid: Grid): { view: NodeView; arranger: Arranger<never> } | null {\n if (!view) return null\n const found = GRIDS.get(view.key)\n if (!found || grid.isSelf(view)) return null\n return { view, arranger: found.arranger }\n}\n\n/** In layout, a view is this grid when it holds the same children: a child has one parent. */\nfunction sharesChildren(children: readonly ChildView[]): (view: NodeView) => boolean {\n return (view) => {\n if (children.length === 0) return false\n const theirs = (view.state as { readonly children?: readonly ChildView[] }).children\n return theirs?.[0] === children[0]\n }\n}\n\nfunction commandGrid(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): Grid {\n return { state: s, arranger: arrangerOf(timeline.node.key), children, isSelf: (view) => view.id === timeline.node.id }\n}\n\nfunction snapshot(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): GridSnapshot {\n const grid = commandGrid(timeline, s, children)\n const source = gridIn(s.arrangeLike, grid)\n return {\n arrangement: source\n ? source.arranger.arrangement(source.view.state as never, viewBox(source.view))\n : grid.arranger.arrangement(s as never, contentBox(timeline.node.size, s.padding)),\n source: source?.view.id ?? \"\",\n order: normalizeOrder(s.order, children.length),\n spread: s.spread,\n }\n}\n\nfunction measureItems(children: readonly ChildView[], space: Size2D, s: unknown, arranger: Arranger<never>): Size2D[] {\n const sizes = children.map((child) => child.measure(space))\n const cell = arranger.itemSpace ? arranger.itemSpace(s as never, children.length, space) : space\n if (cell === space) return sizes\n return children.map((child) => child.measure(cell))\n}\n\n/** The arrangement the grid is heading for: the one it borrows, or its own. */\nfunction arrangementOf(grid: Grid, box: Size2D): Arrangement {\n const source = gridIn(grid.state.arrangeLike, grid)\n return source ? source.arranger.arrangement(source.view.state as never, viewBox(source.view)) : grid.arranger.arrangement(grid.state as never, box)\n}\n\n/** Where each item sits in the arrangement it is heading for, before any transition or effect. */\nfunction targetSlots(grid: Grid, count: number, sizes: readonly Size2D[], box: Size2D, time: number): { slots: Slot[]; arrangement: Arrangement } {\n const s = grid.state\n const source = gridIn(s.arrangeLike, grid)\n const sourceBox = source ? viewBox(source.view) : box\n const arrangement = source ? source.arranger.arrangement(source.view.state as never, sourceBox) : grid.arranger.arrangement(s as never, box)\n let slots = slotsOf(arrangement, { count, sizes, box: sourceBox, time })\n if (source) slots = inFrame(source.view.frame, slots)\n const slotOf = slotOfItem(normalizeOrder(s.order, count))\n return { slots: slotOf.map((k) => spreadSlot(slots[k], s.spread)), arrangement }\n}\n\n/** Each item's final slot this frame: the target, blended from any transition, with its effects on. */\nfunction resolve(grid: Grid, sizes: readonly Size2D[], box: Size2D, time: number): Slot[] {\n const s = grid.state\n const count = sizes.length\n const slots = targetSlots(grid, count, sizes, box, time).slots\n const transition = s.transition\n if (transition) {\n const { from } = transition\n const named = from.source ? s.transitionSource : null\n const source = named && named.id === from.source && GRIDS.has(named.key) ? named : null\n const self = source !== null && grid.isSelf(source)\n const fromBox = source && !self ? viewBox(source) : box\n let leaving = slotsOf(from.arrangement, { count, sizes, box: fromBox, time })\n if (source && !self) leaving = inFrame(source.frame, leaving)\n const slotOf = slotOfItem(normalizeOrder(from.order, count))\n for (let i = 0; i < count; i++) {\n slots[i] = blendSlot(spreadSlot(leaving[slotOf[i]], from.spread), slots[i], transition.mix[i] ?? 1)\n }\n }\n const reveal = s.revealState\n const wave = s.waveState\n const focus = s.focusState\n if (reveal || wave || focus) {\n for (let i = 0; i < count; i++) applyItemEffects(slots[i], i, sizes[i], reveal, wave, focus)\n }\n return slots\n}\n\n/** The camera distance the grid is seen through: the target's, or, while a morph runs, the one it is leaving. */\nfunction focalOf(s: GridValues, target: Arrangement): number {\n // A morph into or out of depth keeps the camera for its whole length.\n return focalLengthOf(target) || (s.transition ? focalLengthOf(s.transition.from.arrangement) : 0)\n}\n\nfunction cameraAt(focal: number): SpaceCamera {\n return {\n perspective: focal,\n orbit: 0,\n elevation: 0,\n dolly: 0,\n lookAt: CENTRE,\n zoom: 1,\n heading: 0,\n viewportX: 0,\n viewportY: 0,\n }\n}\n\n/** A slot as a child's placement: its box centred on the slot, and the slot's transform when it has one. */\nfunction placement(inner: { x: number; y: number }, s: Slot, size: Size2D): Placement2D {\n const box = { x: inner.x + s.x, y: s.y - inner.y, width: size.width, height: size.height }\n if (s.rotation === 0 && s.scale === 1 && s.rotationX === 0 && s.rotationY === 0 && s.depth === 0 && s.opacity === 1) return box\n return {\n ...box,\n rotation: s.rotation,\n scale: s.scale,\n rotationX: s.rotationX,\n rotationY: s.rotationY,\n depth: s.depth,\n opacity: s.opacity,\n }\n}\n\n/** `slots`, laid out in another grid's frame, moved into this grid's. */\nfunction inFrame(frame: NodeFrame, slots: Slot[]): Slot[] {\n return slots.map((s) => {\n const p = rotateClockwise(s.x * frame.scale, s.y * frame.scale, frame.rotation)\n return {\n ...s,\n x: frame.x + p.x,\n y: frame.y + p.y,\n depth: s.depth * frame.scale,\n rotation: s.rotation + frame.rotation,\n scale: s.scale * frame.scale,\n }\n })\n}\n\nfunction viewBox(view: NodeView): Size2D {\n return contentBox(view.size, (view.state as { readonly padding: InsetsResolved }).padding)\n}\n\n/** A box of `size` inside `padding`: what a command reads as its grid's content box from `timeline.node.size`. */\nexport function contentBox(size: Size2D, padding: InsetsResolved): Size2D {\n const inner = insetsOps.insetBounds(size.width, size.height, padding)\n return { width: inner.width, height: inner.height }\n}\n\n/** The box, centred on the grid, that holds every item where its slot puts it. */\nfunction extentOf(slots: readonly Slot[], sizes: readonly Size2D[], focal: number): Size2D {\n let halfWidth = 0\n let halfHeight = 0\n for (let i = 0; i < slots.length; i++) {\n const s = slots[i]\n const size = sizes[i]\n const rad = (s.rotation * Math.PI) / 180\n const cos = Math.abs(Math.cos(rad))\n const sin = Math.abs(Math.sin(rad))\n // What the camera does to a slot at depth, so a sphere hugs its front.\n const lens = focal > 0 && focal - s.depth > 1 ? focal / (focal - s.depth) : 1\n const w = ((size.width * cos + size.height * sin) / 2) * s.scale * lens\n const h = ((size.width * sin + size.height * cos) / 2) * s.scale * lens\n halfWidth = Math.max(halfWidth, Math.abs(s.x) * lens + w)\n halfHeight = Math.max(halfHeight, Math.abs(s.y) * lens + h)\n }\n return { width: halfWidth * 2, height: halfHeight * 2 }\n}\n\nfunction rotateClockwise(x: number, y: number, degrees: number): { x: number; y: number } {\n if (degrees === 0) return { x, y }\n const rad = (degrees * Math.PI) / 180\n const cos = Math.cos(rad)\n const sin = Math.sin(rad)\n return { x: x * cos + y * sin, y: -x * sin + y * cos }\n}\n\nfunction sameSize(a: Size2D, b: Size2D): boolean {\n return Math.abs(a.width - b.width) < 1e-6 && Math.abs(a.height - b.height) < 1e-6\n}\n\nfunction lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A grid's `order` lists items in slot order: slot `k` holds item `order[k]`.
3
+ * These keep it a permutation whatever it was written as — a stale entry past
4
+ * the count, a repeat, or nothing at all — so a child added or removed never
5
+ * leaves a slot empty or two items in one.
6
+ */
7
+ /** `order` repaired into a permutation of `0..count-1`: its valid entries first, then the rest in item order. */
8
+ export declare function normalizeOrder(order: readonly number[] | undefined, count: number): number[];
9
+ /** For each item, the slot it sits in. */
10
+ export declare function slotOfItem(order: readonly number[]): number[];
11
+ /** An order written as `"2, 0, 1"` or as numbers. */
12
+ export declare function parseOrder(value: unknown): number[];
13
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/kit/order.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAY5F;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAM7D;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAQnD"}