@motionscript/grids 0.1.0 → 0.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/browser/chunks/chunk-7SRKSZ7X.js +2 -0
- package/dist/browser/chunks/chunk-7SRKSZ7X.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/engine.d.ts +0 -11
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -11
- package/dist/engine.js.map +1 -1
- package/dist/kit/index.d.ts +0 -1
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +0 -2
- package/dist/kit/index.js.map +1 -1
- package/dist/kit/item-effects.d.ts +2 -5
- package/dist/kit/item-effects.d.ts.map +1 -1
- package/dist/kit/item-effects.js +5 -7
- package/dist/kit/item-effects.js.map +1 -1
- package/dist/kit/item-grid.d.ts +4 -48
- package/dist/kit/item-grid.d.ts.map +1 -1
- package/dist/kit/item-grid.js +4 -15
- package/dist/kit/item-grid.js.map +1 -1
- package/dist/kit/order.d.ts +3 -5
- package/dist/kit/order.d.ts.map +1 -1
- package/dist/kit/order.js +3 -5
- package/dist/kit/order.js.map +1 -1
- package/dist/kit/random.d.ts +0 -2
- package/dist/kit/random.d.ts.map +1 -1
- package/dist/kit/random.js +1 -1
- package/dist/kit/random.js.map +1 -1
- package/dist/kit/slots/index.d.ts +0 -1
- package/dist/kit/slots/index.d.ts.map +1 -1
- package/dist/kit/slots/index.js.map +1 -1
- package/dist/kit/slots/path-templates.d.ts +1 -6
- package/dist/kit/slots/path-templates.d.ts.map +1 -1
- package/dist/kit/slots/path-templates.js +1 -6
- package/dist/kit/slots/path-templates.js.map +1 -1
- package/dist/kit/slots/path.d.ts.map +1 -1
- package/dist/kit/slots/path.js +6 -9
- package/dist/kit/slots/path.js.map +1 -1
- package/dist/kit/slots/radial.d.ts +3 -5
- package/dist/kit/slots/radial.d.ts.map +1 -1
- package/dist/kit/slots/radial.js +3 -5
- package/dist/kit/slots/radial.js.map +1 -1
- package/dist/kit/slots/rectangular.d.ts +1 -5
- package/dist/kit/slots/rectangular.d.ts.map +1 -1
- package/dist/kit/slots/rectangular.js +1 -5
- package/dist/kit/slots/rectangular.js.map +1 -1
- package/dist/kit/slots/slot.d.ts +1 -7
- package/dist/kit/slots/slot.d.ts.map +1 -1
- package/dist/kit/slots/slot.js.map +1 -1
- package/dist/kit/stagger.d.ts +2 -13
- package/dist/kit/stagger.d.ts.map +1 -1
- package/dist/kit/stagger.js +2 -13
- package/dist/kit/stagger.js.map +1 -1
- package/dist/nodes.d.ts +0 -12
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/dist/path-grid/path-grid.d.ts +0 -3
- package/dist/path-grid/path-grid.d.ts.map +1 -1
- package/dist/path-grid/path-grid.js.map +1 -1
- package/dist/radial-grid/radial-grid.d.ts +0 -2
- package/dist/radial-grid/radial-grid.d.ts.map +1 -1
- package/dist/radial-grid/radial-grid.js.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.d.ts +0 -2
- package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.js.map +1 -1
- package/dist/sphere-grid/sphere-grid.d.ts +0 -2
- package/dist/sphere-grid/sphere-grid.d.ts.map +1 -1
- package/dist/sphere-grid/sphere-grid.js.map +1 -1
- package/package.json +4 -4
- package/src/engine.ts +3 -11
- package/src/kit/index.ts +0 -3
- package/src/kit/item-effects.ts +6 -13
- package/src/kit/item-grid.ts +15 -52
- package/src/kit/order.ts +3 -6
- package/src/kit/random.ts +1 -1
- package/src/kit/slots/index.ts +0 -2
- package/src/kit/slots/path-templates.ts +1 -6
- package/src/kit/slots/path.ts +6 -10
- package/src/kit/slots/radial.ts +3 -5
- package/src/kit/slots/rectangular.ts +1 -5
- package/src/kit/slots/slot.ts +1 -7
- package/src/kit/stagger.ts +2 -13
- package/src/nodes.ts +0 -12
- package/src/path-grid/path-grid.ts +0 -3
- package/src/radial-grid/radial-grid.ts +0 -2
- package/src/rectangular-grid/rectangular-grid.ts +0 -2
- package/src/sphere-grid/sphere-grid.ts +0 -2
- package/dist/browser/chunks/chunk-TYNFMZ3D.js +0 -2
- package/dist/browser/chunks/chunk-TYNFMZ3D.js.map +0 -7
package/dist/engine.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* A copy takes a grid's own files into your project and rewrites its reach for
|
|
6
|
-
* these to `@motionscript/grids`, so the shared parts stay a real
|
|
7
|
-
* dependency. That is not a size decision. `ItemGrid` keeps the register of
|
|
8
|
-
* grids a morph looks another grid's arrangement up in, so a second copy of it
|
|
9
|
-
* would be a second register, and a morph from one grid to another would only
|
|
10
|
-
* find the grids its own copy was told of.
|
|
11
|
-
*/
|
|
1
|
+
// What the four grids share. A copied grid imports it from `@motionscript/grids` because `ItemGrid`
|
|
2
|
+
// keeps the register a morph looks another grid up in: a second copy would be a second register,
|
|
3
|
+
// and a morph would find only the grids its own copy knew.
|
|
12
4
|
export * from "./kit/index.js";
|
|
13
5
|
//# sourceMappingURL=engine.js.map
|
package/dist/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,iGAAiG;AACjG,2DAA2D;AAC3D,cAAc,OAAO,CAAA","sourcesContent":["// What the four grids share. A copied grid imports it from `@motionscript/grids` because `ItemGrid`\n// keeps the register a morph looks another grid up in: a second copy would be a second register,\n// and a morph would find only the grids its own copy knew.\nexport * from \"./kit\"\n"]}
|
package/dist/kit/index.d.ts
CHANGED
|
@@ -5,5 +5,4 @@ export * from "./order.js";
|
|
|
5
5
|
export * from "./random.js";
|
|
6
6
|
export * as ItemGrid from "./item-grid.js";
|
|
7
7
|
export { contentBoxOf, ITEM_GRID_TYPES, staggerArgs, TRANSITION_STAGGER, type GridSnapshot, type GridTransition, type StaggerArgs, } from "./item-grid.js";
|
|
8
|
-
export { findNode2D, frameIn } from "@motionscript/sdk";
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/kit/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAA"}
|
package/dist/kit/index.js
CHANGED
|
@@ -5,6 +5,4 @@ export * from "./order.js";
|
|
|
5
5
|
export * from "./random.js";
|
|
6
6
|
export * as ItemGrid from "./item-grid.js";
|
|
7
7
|
export { contentBoxOf, ITEM_GRID_TYPES, staggerArgs, TRANSITION_STAGGER, } from "./item-grid.js";
|
|
8
|
-
// Once this kit's own; kept on its barrel for whoever imports them from it.
|
|
9
|
-
export { findNode2D, frameIn } from "@motionscript/sdk";
|
|
10
8
|
//# sourceMappingURL=index.js.map
|
package/dist/kit/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,kBAAkB,GAInB,MAAM,aAAa,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,WAAW,EACX,kBAAkB,GAInB,MAAM,aAAa,CAAA","sourcesContent":["export * from \"./slots\"\nexport * from \"./stagger\"\nexport * from \"./item-effects\"\nexport * from \"./order\"\nexport * from \"./random\"\nexport * as ItemGrid from \"./item-grid\"\nexport {\n contentBoxOf,\n ITEM_GRID_TYPES,\n staggerArgs,\n TRANSITION_STAGGER,\n type GridSnapshot,\n type GridTransition,\n type StaggerArgs,\n} from \"./item-grid\"\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Size2D } from "@motionscript/sdk";
|
|
2
2
|
import type { Slot } from "./slots/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* What an item does on its way in (or out): grow from nothing, fade, fly out of
|
|
@@ -9,10 +9,7 @@ export type RevealStyle = (typeof REVEAL_STYLES)[number];
|
|
|
9
9
|
/** What a wave does to each item as it passes. */
|
|
10
10
|
export declare const WAVE_STYLES: readonly ["scale", "lift", "fade", "spin"];
|
|
11
11
|
export type WaveStyle = (typeof WAVE_STYLES)[number];
|
|
12
|
-
/**
|
|
13
|
-
* How far into view each item is, `1` shown and `0` gone — past `1` on the
|
|
14
|
-
* way to it under an overshooting ease. Absent means every item is shown.
|
|
15
|
-
*/
|
|
12
|
+
/** `1` shown and `0` gone, past `1` under an overshooting ease; absent means every item is shown. */
|
|
16
13
|
export interface RevealState {
|
|
17
14
|
style: RevealStyle;
|
|
18
15
|
values: readonly number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-effects.d.ts","sourceRoot":"","sources":["../../src/kit/item-effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"item-effects.d.ts","sourceRoot":"","sources":["../../src/kit/item-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,aAAa,8DAA+D,CAAA;AACzF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAExD,kDAAkD;AAClD,eAAO,MAAM,WAAW,4CAA6C,CAAA;AACrE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAA;IAClB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B;AAED,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,SAAS,CAAA;IAChB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAA;IACX,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAClC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,CAIN"}
|
package/dist/kit/item-effects.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { clamp } from "@motionscript/sdk";
|
|
1
2
|
/**
|
|
2
3
|
* What an item does on its way in (or out): grow from nothing, fade, fly out of
|
|
3
4
|
* the grid's centre, rise into place, flip up, or spin in.
|
|
@@ -17,7 +18,7 @@ export function applyItemEffects(s, i, size, reveal, wave, focus) {
|
|
|
17
18
|
function applyReveal(s, style, v, size) {
|
|
18
19
|
if (v === 1)
|
|
19
20
|
return;
|
|
20
|
-
const shown =
|
|
21
|
+
const shown = clamp(v, 0, 1);
|
|
21
22
|
switch (style) {
|
|
22
23
|
case "fade":
|
|
23
24
|
s.opacity *= shown;
|
|
@@ -26,7 +27,7 @@ function applyReveal(s, style, v, size) {
|
|
|
26
27
|
s.x *= v;
|
|
27
28
|
s.y *= v;
|
|
28
29
|
s.depth *= v;
|
|
29
|
-
s.opacity *=
|
|
30
|
+
s.opacity *= clamp(v * 4, 0, 1);
|
|
30
31
|
break;
|
|
31
32
|
case "rise":
|
|
32
33
|
s.y -= (1 - v) * Math.max(40, size.height);
|
|
@@ -51,7 +52,7 @@ function applyWave(s, wave, w, size) {
|
|
|
51
52
|
s.y += wave.amount * w * Math.max(40, size.height);
|
|
52
53
|
break;
|
|
53
54
|
case "fade":
|
|
54
|
-
s.opacity *=
|
|
55
|
+
s.opacity *= clamp(1 - wave.amount * w, 0, 1);
|
|
55
56
|
break;
|
|
56
57
|
case "spin":
|
|
57
58
|
s.rotation += wave.amount * w * 360;
|
|
@@ -67,10 +68,7 @@ function applyFocus(s, focus, f) {
|
|
|
67
68
|
s.scale *= 1 + focus.grow * f;
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
|
-
s.opacity *=
|
|
71
|
+
s.opacity *= clamp(1 - focus.dim * -f, 0, 1);
|
|
71
72
|
s.scale *= Math.max(0, 1 + focus.grow * 0.5 * f);
|
|
72
73
|
}
|
|
73
|
-
function clamp01(v) {
|
|
74
|
-
return v < 0 ? 0 : v > 1 ? 1 : v;
|
|
75
|
-
}
|
|
76
74
|
//# sourceMappingURL=item-effects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-effects.js","sourceRoot":"","sources":["../../src/kit/item-effects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"item-effects.js","sourceRoot":"","sources":["../../src/kit/item-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,MAAM,mBAAmB,CAAA;AAItD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA;AAGzF,kDAAkD;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA;AA0BrE,uEAAuE;AACvE,MAAM,UAAU,gBAAgB,CAC9B,CAAO,EACP,CAAS,EACT,IAAY,EACZ,MAAs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AAG,CAAC,CAAA;QAC7B,OAAM;IACR,CAAC;IACD,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5C,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAA;AAClD,CAAC","sourcesContent":["import { clamp, type Size2D } from \"@motionscript/sdk\"\n\nimport type { Slot } from \"./slots\"\n\n/**\n * What an item does on its way in (or out): grow from nothing, fade, fly out of\n * the grid's centre, rise into place, flip up, or spin in.\n */\nexport const REVEAL_STYLES = [\"scale\", \"fade\", \"center\", \"rise\", \"flip\", \"spin\"] as const\nexport type RevealStyle = (typeof REVEAL_STYLES)[number]\n\n/** What a wave does to each item as it passes. */\nexport const WAVE_STYLES = [\"scale\", \"lift\", \"fade\", \"spin\"] as const\nexport type WaveStyle = (typeof WAVE_STYLES)[number]\n\n/** `1` shown and `0` gone, past `1` under an overshooting ease; absent means every item is shown. */\nexport interface RevealState {\n style: RevealStyle\n values: readonly number[]\n}\n\n/** Each item's share of the wave passing through it, `0` at rest and `1` at the crest. */\nexport interface WaveState {\n style: WaveStyle\n /** How big the crest is — a share of the item's size, opacity or a turn, by style. */\n amount: number\n values: readonly number[]\n}\n\n/** Each item's emphasis: `1` the focus, `-1` pushed back, `0` untouched. */\nexport interface FocusState {\n /** How far the others fade, `0..1`. */\n dim: number\n /** How much the focus grows, as a share of its size; the others shrink by half that. */\n grow: number\n values: readonly number[]\n}\n\n/** Layer item `i`'s reveal, wave and focus onto its slot, in place. */\nexport function applyItemEffects(\n s: Slot,\n i: number,\n size: Size2D,\n reveal: RevealState | null | undefined,\n wave: WaveState | null | undefined,\n focus: FocusState | null | undefined,\n): void {\n if (reveal) applyReveal(s, reveal.style, reveal.values[i] ?? 1, size)\n if (wave) applyWave(s, wave, wave.values[i] ?? 0, size)\n if (focus) applyFocus(s, focus, focus.values[i] ?? 0)\n}\n\nfunction applyReveal(s: Slot, style: RevealStyle, v: number, size: Size2D): void {\n if (v === 1) return\n const shown = clamp(v, 0, 1)\n switch (style) {\n case \"fade\":\n s.opacity *= shown\n break\n case \"center\":\n s.x *= v\n s.y *= v\n s.depth *= v\n s.opacity *= clamp(v * 4, 0, 1)\n break\n case \"rise\":\n s.y -= (1 - v) * Math.max(40, size.height)\n s.opacity *= shown\n break\n case \"flip\":\n s.rotationX += (1 - v) * 90\n break\n case \"spin\":\n s.rotation -= (1 - v) * 180\n s.scale *= Math.max(0, v)\n break\n default:\n s.scale *= Math.max(0, v)\n }\n}\n\nfunction applyWave(s: Slot, wave: WaveState, w: number, size: Size2D): void {\n if (w === 0) return\n switch (wave.style) {\n case \"lift\":\n s.y += wave.amount * w * Math.max(40, size.height)\n break\n case \"fade\":\n s.opacity *= clamp(1 - wave.amount * w, 0, 1)\n break\n case \"spin\":\n s.rotation += wave.amount * w * 360\n break\n default:\n s.scale *= 1 + wave.amount * w\n }\n}\n\nfunction applyFocus(s: Slot, focus: FocusState, f: number): void {\n if (f === 0) return\n if (f > 0) {\n s.scale *= 1 + focus.grow * f\n return\n }\n s.opacity *= clamp(1 - focus.dim * -f, 0, 1)\n s.scale *= Math.max(0, 1 + focus.grow * 0.5 * f)\n}\n"]}
|
package/dist/kit/item-grid.d.ts
CHANGED
|
@@ -2,39 +2,6 @@ import { type ChildView, type InsetsResolved, type LayoutBox, type LayoutItem, t
|
|
|
2
2
|
import { type FocusState, type RevealState, type WaveState } from "./item-effects.js";
|
|
3
3
|
import { type Arrangement, type Slot } from "./slots/index.js";
|
|
4
4
|
import { type StaggerOrder } from "./stagger.js";
|
|
5
|
-
/**
|
|
6
|
-
* What every grid is built from: a container that places each of its children
|
|
7
|
-
* in a slot of an arrangement — a rectangular grid, a ring, a path, a sphere.
|
|
8
|
-
* Spread `state` and `commands` in, take `defaults`, hand `fields` the
|
|
9
|
-
* {@link Arranger} that makes this grid's arrangement from its state, and pass
|
|
10
|
-
* the finished component and its arranger through {@link define}.
|
|
11
|
-
*
|
|
12
|
-
* ## Children only
|
|
13
|
-
*
|
|
14
|
-
* The items are the children, in layer order. A child's slot is a parent
|
|
15
|
-
* transform on it, so its own `x`/`y`/`rotation`/`scale` — and any command on
|
|
16
|
-
* them — still work, relative to the slot. A group is one item; a grid of
|
|
17
|
-
* grids is a grid of items that happen to be grids.
|
|
18
|
-
*
|
|
19
|
-
* ## One pass
|
|
20
|
-
*
|
|
21
|
-
* Every frame: measure the children, ask the arrangement for its slots (a pure
|
|
22
|
-
* function of the state, the sizes and the clock), blend them from where a
|
|
23
|
-
* transition is leaving, and layer on the per-item effects — reveal, wave,
|
|
24
|
-
* focus. What is left is each child's box and slot, which the renderer,
|
|
25
|
-
* picking and `global` all read, so a selection outline lands on the pixels
|
|
26
|
-
* even on a sphere.
|
|
27
|
-
*
|
|
28
|
-
* ## Commands
|
|
29
|
-
*
|
|
30
|
-
* Every command is a pure function of time. The per-item ones stagger *inside*
|
|
31
|
-
* their duration — a one-second reveal takes one second for four children or
|
|
32
|
-
* four hundred — and write their per-item state into entries
|
|
33
|
-
* (`revealState` and its siblings), which is what keeps them seekable. The ones
|
|
34
|
-
* that change the arrangement itself (a reorder, a morph, a column count) keep
|
|
35
|
-
* the arrangement they are leaving as data and blend each item from its old
|
|
36
|
-
* slot to its new one.
|
|
37
|
-
*/
|
|
38
5
|
/** An arrangement a grid is leaving, kept as data so its slots can be worked out afresh every frame. */
|
|
39
6
|
export interface GridSnapshot {
|
|
40
7
|
arrangement: Arrangement;
|
|
@@ -135,27 +102,16 @@ export declare function fields<S>(arranger: Arranger<S>): {
|
|
|
135
102
|
};
|
|
136
103
|
export declare function measure<S>(measurer: Measurer, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): Size2D;
|
|
137
104
|
export declare function layout<S>(box: LayoutBox, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): readonly Placement2D[];
|
|
138
|
-
/**
|
|
139
|
-
* A grid whose arrangement has depth is seen through a camera of its own,
|
|
140
|
-
* which paints its items far to near — unless it already sits in a space (an
|
|
141
|
-
* orbit camera, a 3D stage), where its items join that one and its camera.
|
|
142
|
-
*/
|
|
105
|
+
/** A grid with depth is seen through a camera of its own, painting far to near, unless it already sits in a space, whose camera its items join. */
|
|
143
106
|
export declare function render<S>(ctx: RenderContext, s: GridState & S, arranger: Arranger<S>): void;
|
|
144
|
-
/**
|
|
107
|
+
/** Its laid-out size inside its padding. */
|
|
145
108
|
export declare function contentBoxOf(grid: Node2D): Size2D;
|
|
146
109
|
type GridTimeline = Timeline<StaggerArgs, never>;
|
|
147
|
-
/**
|
|
148
|
-
* Each item's slot in its arrangement as it stands, for a command being built,
|
|
149
|
-
* at the clock commands are built against (the tree stands at time 0 while a
|
|
150
|
-
* timeline compiles): what its stagger is ranked by.
|
|
151
|
-
*/
|
|
110
|
+
/** Each item's slot as the arrangement stands while a command is built (the tree stands at time 0 then): what its stagger is ranked by. */
|
|
152
111
|
export declare function itemSlots(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): Slot[];
|
|
153
112
|
/** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */
|
|
154
113
|
export declare function ranks(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[], order: StaggerOrder | undefined): number[];
|
|
155
|
-
/**
|
|
156
|
-
* Write `changes` to the arrangement and move each item from its slot in the
|
|
157
|
-
* one being left to its slot in the new one, staggered.
|
|
158
|
-
*/
|
|
114
|
+
/** Writes `changes` to the arrangement and moves each item, staggered, from its slot in the one being left to its slot in the new one. */
|
|
159
115
|
export declare function transitionTo(timeline: GridTimeline, s: GridValues, children: readonly ChildView[], changes: Record<string, unknown>, stagger?: number): Piece;
|
|
160
116
|
/** Emphasise the items `isFocus` picks and push the rest back. */
|
|
161
117
|
export declare function focusOn(timeline: Timeline<object, never>, s: GridValues, isFocus: (item: number) => boolean, count: number, dim: number, grow: number): Piece;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-grid.d.ts","sourceRoot":"","sources":["../../src/kit/item-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,MAAM,EAEX,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EAAiD,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;AACpG,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"item-grid.d.ts","sourceRoot":"","sources":["../../src/kit/item-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,MAAM,EAEX,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EAAiD,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;AACpG,OAAO,EAAiD,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAc5F,wGAAwG;AACxG,MAAM,W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AC,EAChC,OAAO,SAAqB,GAC3B,KAAK,CAUP;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CACrB,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,EACjC,CAAC,EAAE,UAAU,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EAClC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,KAAK,CAcP;AAKD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HnB,CAAA;AA6JF,kHAAkH;AAClH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAGxE"}
|
package/dist/kit/item-grid.js
CHANGED
|
@@ -113,11 +113,7 @@ export function layout(box, s, children, arranger) {
|
|
|
113
113
|
const slots = resolve({ state: s, arranger, children, isSelf: sharesChildren(children) }, sizes, inner, box.time.total);
|
|
114
114
|
return slots.map((slot, i) => placement(inner, slot, sizes[i]));
|
|
115
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
|
-
*/
|
|
116
|
+
/** A grid with depth is seen through a camera of its own, painting far to near, unless it already sits in a space, whose camera its items join. */
|
|
121
117
|
export function render(ctx, s, arranger) {
|
|
122
118
|
// With no items there is nothing to see through a camera.
|
|
123
119
|
const focal = s.children.length === 0 ? 0 : focalOf(s, arrangementOf({ state: s, arranger, children: [], isSelf: () => false }, contentBox(ctx.size, s.padding)));
|
|
@@ -126,16 +122,12 @@ export function render(ctx, s, arranger) {
|
|
|
126
122
|
else
|
|
127
123
|
ctx.children();
|
|
128
124
|
}
|
|
129
|
-
/**
|
|
125
|
+
/** Its laid-out size inside its padding. */
|
|
130
126
|
export function contentBoxOf(grid) {
|
|
131
127
|
const b = grid.layoutBounds;
|
|
132
128
|
return contentBox({ width: b.width, height: b.height }, grid.effectivePadding());
|
|
133
129
|
}
|
|
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
|
-
*/
|
|
130
|
+
/** Each item's slot as the arrangement stands while a command is built (the tree stands at time 0 then): what its stagger is ranked by. */
|
|
139
131
|
export function itemSlots(timeline, s, children) {
|
|
140
132
|
const grid = commandGrid(timeline, s, children);
|
|
141
133
|
const sizes = children.map((child) => child.size);
|
|
@@ -145,10 +137,7 @@ export function itemSlots(timeline, s, children) {
|
|
|
145
137
|
export function ranks(timeline, s, children, order) {
|
|
146
138
|
return staggerRanks(order ?? "index", itemSlots(timeline, s, children), hashSeed(timeline.node.id));
|
|
147
139
|
}
|
|
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
|
-
*/
|
|
140
|
+
/** Writes `changes` to the arrangement and moves each item, staggered, from its slot in the one being left to its slot in the new one. */
|
|
152
141
|
export function transitionTo(timeline, s, children, changes, stagger = TRANSITION_STAGGER) {
|
|
153
142
|
const from = snapshot(timeline, s, children);
|
|
154
143
|
const ease = timeline.easing ?? easeInOut("cubic");
|
|
@@ -1 +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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C,CAAS,EAAE,CAAS,EAAE,OAAe;IAC5D,IAAI,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"]}
|
|
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,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAA+B,MAAM,SAAS,CAAA;AACpG,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAA;AAqC5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAU,CAAA;AAEnG,0EAA0E;AAC1E,MAAM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AG,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// What every grid is built from: spread `state`, `commands` and `defaults` in, give `fields` the\n// {@link Arranger} that makes the arrangement from the state, and pass the component and its\n// arranger through {@link define}.\n// The items are the children in layer order; a slot is a parent transform on a child, so its own\n// x/y/rotation/scale and their commands still work relative to it.\n// Every frame measures the children, asks the arrangement for slots (pure in state, sizes and\n// clock), blends from the arrangement a transition leaves, and layers the per-item effects; the\n// result is each child's box and slot, which rendering, picking and `global` all read.\n// Every command is a pure function of time. Per-item ones stagger inside their duration and write\n// their state to entries, which keeps them seekable; ones that change the arrangement keep the one\n// they leave as data and blend each item from its old slot to its new.\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/** A grid with depth is seen through a camera of its own, painting far to near, unless it already sits in a space, whose camera its items join. */\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/** 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\ntype GridTimeline = Timeline<StaggerArgs, never>\n\n/** Each item's slot as the arrangement stands while a command is built (the tree stands at time 0 then): what its stagger is ranked by. */\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/** Writes `changes` to the arrangement and moves each item, staggered, from its slot in the one being left to its slot in the new one. */\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\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"]}
|
package/dist/kit/order.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* leaves a slot empty or two items in one.
|
|
2
|
+
* `order` lists items in slot order (slot `k` holds item `order[k]`), repaired into a
|
|
3
|
+
* permutation of `0..count-1` — valid entries first, then the rest — so a stale entry, a
|
|
4
|
+
* repeat or a child added or removed never leaves a slot empty or doubled.
|
|
6
5
|
*/
|
|
7
|
-
/** `order` repaired into a permutation of `0..count-1`: its valid entries first, then the rest in item order. */
|
|
8
6
|
export declare function normalizeOrder(order: readonly number[] | undefined, count: number): number[];
|
|
9
7
|
/** For each item, the slot it sits in. */
|
|
10
8
|
export declare function slotOfItem(order: readonly number[]): number[];
|
package/dist/kit/order.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/kit/order.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/kit/order.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,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"}
|
package/dist/kit/order.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* leaves a slot empty or two items in one.
|
|
2
|
+
* `order` lists items in slot order (slot `k` holds item `order[k]`), repaired into a
|
|
3
|
+
* permutation of `0..count-1` — valid entries first, then the rest — so a stale entry, a
|
|
4
|
+
* repeat or a child added or removed never leaves a slot empty or doubled.
|
|
6
5
|
*/
|
|
7
|
-
/** `order` repaired into a permutation of `0..count-1`: its valid entries first, then the rest in item order. */
|
|
8
6
|
export function normalizeOrder(order, count) {
|
|
9
7
|
const out = [];
|
|
10
8
|
const taken = new Array(count).fill(false);
|