@cardstack/choreo 0.0.0 → 0.1.0-unstable.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 +15 -0
- package/LICENSE +21 -0
- package/README.md +55 -6
- package/addon-main.cjs +4 -0
- package/declarations/anchors.d.ts +26 -0
- package/declarations/anchors.d.ts.map +1 -0
- package/declarations/arming.d.ts +33 -0
- package/declarations/arming.d.ts.map +1 -0
- package/declarations/beacon.d.ts +9 -0
- package/declarations/beacon.d.ts.map +1 -0
- package/declarations/beacons.d.ts +23 -0
- package/declarations/beacons.d.ts.map +1 -0
- package/declarations/changeset.d.ts +46 -0
- package/declarations/changeset.d.ts.map +1 -0
- package/declarations/choreo.d.ts +261 -0
- package/declarations/choreo.d.ts.map +1 -0
- package/declarations/compile.d.ts +45 -0
- package/declarations/compile.d.ts.map +1 -0
- package/declarations/deliver.d.ts +44 -0
- package/declarations/deliver.d.ts.map +1 -0
- package/declarations/easings.d.ts +20 -0
- package/declarations/easings.d.ts.map +1 -0
- package/declarations/far.d.ts +33 -0
- package/declarations/far.d.ts.map +1 -0
- package/declarations/film/clip.d.ts +51 -0
- package/declarations/film/clip.d.ts.map +1 -0
- package/declarations/film/clips.d.ts +155 -0
- package/declarations/film/clips.d.ts.map +1 -0
- package/declarations/film/film.d.ts +1208 -0
- package/declarations/film/film.d.ts.map +1 -0
- package/declarations/film/graph/adjust.d.ts +112 -0
- package/declarations/film/graph/adjust.d.ts.map +1 -0
- package/declarations/film/graph/compile.d.ts +140 -0
- package/declarations/film/graph/compile.d.ts.map +1 -0
- package/declarations/film/graph/host.d.ts +67 -0
- package/declarations/film/graph/host.d.ts.map +1 -0
- package/declarations/film/graph/nodes.d.ts +287 -0
- package/declarations/film/graph/nodes.d.ts.map +1 -0
- package/declarations/film/index.d.ts +24 -0
- package/declarations/film/index.d.ts.map +1 -0
- package/declarations/film/joins.d.ts +143 -0
- package/declarations/film/joins.d.ts.map +1 -0
- package/declarations/film/math.d.ts +15 -0
- package/declarations/film/math.d.ts.map +1 -0
- package/declarations/film/overlays.d.ts +54 -0
- package/declarations/film/overlays.d.ts.map +1 -0
- package/declarations/film/picture.d.ts +104 -0
- package/declarations/film/picture.d.ts.map +1 -0
- package/declarations/film/plate.d.ts +37 -0
- package/declarations/film/plate.d.ts.map +1 -0
- package/declarations/film/player.d.ts +120 -0
- package/declarations/film/player.d.ts.map +1 -0
- package/declarations/film/rail.d.ts +40 -0
- package/declarations/film/rail.d.ts.map +1 -0
- package/declarations/film/schedule.d.ts +93 -0
- package/declarations/film/schedule.d.ts.map +1 -0
- package/declarations/film/seam.d.ts +38 -0
- package/declarations/film/seam.d.ts.map +1 -0
- package/declarations/film/titles.d.ts +37 -0
- package/declarations/film/titles.d.ts.map +1 -0
- package/declarations/film/types.d.ts +544 -0
- package/declarations/film/types.d.ts.map +1 -0
- package/declarations/film.d.ts +3 -0
- package/declarations/film.d.ts.map +1 -0
- package/declarations/gesture.d.ts +33 -0
- package/declarations/gesture.d.ts.map +1 -0
- package/declarations/index.d.ts +26 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/measure.d.ts +29 -0
- package/declarations/measure.d.ts.map +1 -0
- package/declarations/path.d.ts +73 -0
- package/declarations/path.d.ts.map +1 -0
- package/declarations/registry.d.ts +46 -0
- package/declarations/registry.d.ts.map +1 -0
- package/declarations/run.d.ts +406 -0
- package/declarations/run.d.ts.map +1 -0
- package/declarations/space.d.ts +31 -0
- package/declarations/space.d.ts.map +1 -0
- package/declarations/steps.d.ts +479 -0
- package/declarations/steps.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +30 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/types.d.ts +761 -0
- package/declarations/types.d.ts.map +1 -0
- package/dist/anchors.js +34 -0
- package/dist/anchors.js.map +1 -0
- package/dist/arming.js +120 -0
- package/dist/arming.js.map +1 -0
- package/dist/beacon.js +25 -0
- package/dist/beacon.js.map +1 -0
- package/dist/beacons.js +77 -0
- package/dist/beacons.js.map +1 -0
- package/dist/changeset.js +129 -0
- package/dist/changeset.js.map +1 -0
- package/dist/choreo.js +1026 -0
- package/dist/choreo.js.map +1 -0
- package/dist/compile.js +1403 -0
- package/dist/compile.js.map +1 -0
- package/dist/deliver.js +326 -0
- package/dist/deliver.js.map +1 -0
- package/dist/easings.js +39 -0
- package/dist/easings.js.map +1 -0
- package/dist/far.js +147 -0
- package/dist/far.js.map +1 -0
- package/dist/film/clip.js +100 -0
- package/dist/film/clip.js.map +1 -0
- package/dist/film/clips.js +147 -0
- package/dist/film/clips.js.map +1 -0
- package/dist/film/film.js +4424 -0
- package/dist/film/film.js.map +1 -0
- package/dist/film/graph/adjust.js +160 -0
- package/dist/film/graph/adjust.js.map +1 -0
- package/dist/film/graph/compile.js +225 -0
- package/dist/film/graph/compile.js.map +1 -0
- package/dist/film/graph/host.js +77 -0
- package/dist/film/graph/host.js.map +1 -0
- package/dist/film/graph/nodes.js +500 -0
- package/dist/film/graph/nodes.js.map +1 -0
- package/dist/film/index.js +18 -0
- package/dist/film/index.js.map +1 -0
- package/dist/film/joins.js +260 -0
- package/dist/film/joins.js.map +1 -0
- package/dist/film/math.js +49 -0
- package/dist/film/math.js.map +1 -0
- package/dist/film/overlays.js +66 -0
- package/dist/film/overlays.js.map +1 -0
- package/dist/film/picture.js +58 -0
- package/dist/film/picture.js.map +1 -0
- package/dist/film/plate.js +36 -0
- package/dist/film/plate.js.map +1 -0
- package/dist/film/player.js +79 -0
- package/dist/film/player.js.map +1 -0
- package/dist/film/rail.js +38 -0
- package/dist/film/rail.js.map +1 -0
- package/dist/film/schedule.js +238 -0
- package/dist/film/schedule.js.map +1 -0
- package/dist/film/seam.js +64 -0
- package/dist/film/seam.js.map +1 -0
- package/dist/film/titles.js +45 -0
- package/dist/film/titles.js.map +1 -0
- package/dist/film/types.js +2 -0
- package/dist/film/types.js.map +1 -0
- package/dist/film.js +18 -0
- package/dist/film.js.map +1 -0
- package/dist/gesture.js +111 -0
- package/dist/gesture.js.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/measure.js +99 -0
- package/dist/measure.js.map +1 -0
- package/dist/path.js +272 -0
- package/dist/path.js.map +1 -0
- package/dist/registry.js +55 -0
- package/dist/registry.js.map +1 -0
- package/dist/run.js +2423 -0
- package/dist/run.js.map +1 -0
- package/dist/space.js +57 -0
- package/dist/space.js.map +1 -0
- package/dist/steps.js +831 -0
- package/dist/steps.js.map +1 -0
- package/dist/test-support/index.js +150 -0
- package/dist/test-support/index.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +202 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,kFAAkF;AAClF,MAAM,WAAW,MAAM;IACrB,+DAA+D;IAC/D,OAAO,EAAE,IAAI,CAAC;IACd,2BAA2B;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,EAAE,IAAI,CAAC;IACb;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,IAAI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I,EAAE,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC;QACvC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;KACnB,CAAC;IACF,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC"}
|
package/dist/anchors.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anchors — "with / after build N", as typed helpers rather than a string
|
|
3
|
+
* micro-DSL (docs/choreo-constructs.md §4.2). A step names itself with
|
|
4
|
+
* `@name`; any later step may start against it with `@at`:
|
|
5
|
+
*
|
|
6
|
+
* <c.Tween @name='head' … />
|
|
7
|
+
* <c.Tween @at={{at 'head' 0.4}} … /> start at 40% of head
|
|
8
|
+
* <c.Tween @at={{after 'head' 0.2}} … /> start 0.2s after head ends
|
|
9
|
+
*
|
|
10
|
+
* `at name 1` and `after name` are the same moment. Anchors point up the
|
|
11
|
+
* score, the way Keynote's build list does; a forward reference is a
|
|
12
|
+
* compile error, as is a duplicate name.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** start at the named step's start, plus `progress` (0–1) of its length */
|
|
16
|
+
function at(name, progress = 0) {
|
|
17
|
+
return {
|
|
18
|
+
anchor: name,
|
|
19
|
+
edge: 'start',
|
|
20
|
+
progress
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** start at the named step's end, plus `delay` seconds */
|
|
25
|
+
function after(name, delay = 0) {
|
|
26
|
+
return {
|
|
27
|
+
anchor: name,
|
|
28
|
+
delay,
|
|
29
|
+
edge: 'end'
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { after, at };
|
|
34
|
+
//# sourceMappingURL=anchors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchors.js","sources":["../src/anchors.ts"],"sourcesContent":["/**\n * Anchors — \"with / after build N\", as typed helpers rather than a string\n * micro-DSL (docs/choreo-constructs.md §4.2). A step names itself with\n * `@name`; any later step may start against it with `@at`:\n *\n * <c.Tween @name='head' … />\n * <c.Tween @at={{at 'head' 0.4}} … /> start at 40% of head\n * <c.Tween @at={{after 'head' 0.2}} … /> start 0.2s after head ends\n *\n * `at name 1` and `after name` are the same moment. Anchors point up the\n * score, the way Keynote's build list does; a forward reference is a\n * compile error, as is a duplicate name.\n */\n\nexport interface AnchorRef {\n anchor: string;\n /** seconds past the named step's end (`after`) */\n delay?: number;\n edge: 'end' | 'start';\n /** 0..1 of the named step's own length (`at`) */\n progress?: number;\n}\n\n/** start at the named step's start, plus `progress` (0–1) of its length */\nexport function at(name: string, progress = 0): AnchorRef {\n return { anchor: name, edge: 'start', progress };\n}\n\n/** start at the named step's end, plus `delay` seconds */\nexport function after(name: string, delay = 0): AnchorRef {\n return { anchor: name, delay, edge: 'end' };\n}\n"],"names":["at","name","progress","anchor","edge","after","delay"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACO,SAASA,EAAEA,CAACC,IAAY,EAAEC,QAAQ,GAAG,CAAC,EAAa;EACxD,OAAO;AAAEC,IAAAA,MAAM,EAAEF,IAAI;AAAEG,IAAAA,IAAI,EAAE,OAAO;AAAEF,IAAAA;GAAU;AAClD;;AAEA;AACO,SAASG,KAAKA,CAACJ,IAAY,EAAEK,KAAK,GAAG,CAAC,EAAa;EACxD,OAAO;AAAEH,IAAAA,MAAM,EAAEF,IAAI;IAAEK,KAAK;AAAEF,IAAAA,IAAI,EAAE;GAAO;AAC7C;;;;"}
|
package/dist/arming.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { tracked } from '@glimmer/tracking';
|
|
2
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Arming — "a scene change is under way", as a value a host can read.
|
|
6
|
+
*
|
|
7
|
+
* A region is router-agnostic by design (§9): it discovers a crossing by
|
|
8
|
+
* rendering one, and it says nothing about it to anybody. But the host around
|
|
9
|
+
* it usually has to KNOW — to skip the entrance animations of cards mounting
|
|
10
|
+
* mid-flight, to hold a heavy mount back until the landing, to gate anything
|
|
11
|
+
* that would otherwise fire twenty springs into the middle of a move.
|
|
12
|
+
*
|
|
13
|
+
* Knowing turns out to be four subtleties, and two apps in a row hand-copied
|
|
14
|
+
* all four before this became a library part:
|
|
15
|
+
*
|
|
16
|
+
* - **The run does not exist yet.** The decision to cross is made in a route
|
|
17
|
+
* hook; the run is born after the swap renders. So the flag stands up
|
|
18
|
+
* first and the watch latches the first live run the region produces.
|
|
19
|
+
* - **A run can be REPLACED mid-flight.** A real interruption recompiles the
|
|
20
|
+
* score, and the old run's `finished` resolves as its successor takes off.
|
|
21
|
+
* Standing down there ends the crossing while it is still visibly moving,
|
|
22
|
+
* so the watch hands over to the successor instead.
|
|
23
|
+
* - **A stale settle must not stand down a newer crossing.** Generations.
|
|
24
|
+
* - **Some crossings never produce a pass at all** — aborted, or rendered
|
|
25
|
+
* identically. A deadline is the backstop, and without it the flag is a
|
|
26
|
+
* latch that never opens.
|
|
27
|
+
*
|
|
28
|
+
* Host-blind on purpose: no router, no owner, no framework beyond the one
|
|
29
|
+
* tracked flag the templates need in order to re-render when it changes.
|
|
30
|
+
*/
|
|
31
|
+
class Armed {
|
|
32
|
+
static {
|
|
33
|
+
g(this.prototype, "on", [tracked], function () {
|
|
34
|
+
return false;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
#on = (i(this, "on"), void 0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A run that is genuinely still working. A parked run is a still and a
|
|
42
|
+
* STANDING run is an annotation that is simply on (a score of nothing but
|
|
43
|
+
* open steps has no end to wait for) — waiting for either to finish would
|
|
44
|
+
* wait forever.
|
|
45
|
+
*/
|
|
46
|
+
const busy = run => Boolean(run) && !run.isDone() && !run.standing;
|
|
47
|
+
function createArming(options = {}) {
|
|
48
|
+
const {
|
|
49
|
+
deadline = 4000,
|
|
50
|
+
onStandDown
|
|
51
|
+
} = options;
|
|
52
|
+
const state = new Armed();
|
|
53
|
+
/** which crossing is current — a stale run's settle must not end a newer one */
|
|
54
|
+
let generation = 0;
|
|
55
|
+
const settlers = [];
|
|
56
|
+
const standDown = () => {
|
|
57
|
+
// guarded: writing the same value still dirties a tracked field, and a
|
|
58
|
+
// host that stands an unarmed crossing down (a test reset) must not
|
|
59
|
+
// invalidate everything reading the flag
|
|
60
|
+
if (state.on) {
|
|
61
|
+
state.on = false;
|
|
62
|
+
}
|
|
63
|
+
onStandDown?.();
|
|
64
|
+
settlers.splice(0).forEach(resolve => resolve());
|
|
65
|
+
};
|
|
66
|
+
const watch = (gen, region) => {
|
|
67
|
+
const started = performance.now();
|
|
68
|
+
const latch = run => {
|
|
69
|
+
void run.finished.then(() => {
|
|
70
|
+
if (gen !== generation) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const current = region.run;
|
|
74
|
+
if (current && current !== run && busy(current)) {
|
|
75
|
+
// replaced mid-flight: the crossing is still on screen, and it is
|
|
76
|
+
// the successor's landing that ends it
|
|
77
|
+
latch(current);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
standDown();
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
const look = () => {
|
|
84
|
+
if (!state.on || gen !== generation) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const run = region.run;
|
|
88
|
+
if (busy(run)) {
|
|
89
|
+
latch(run);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (performance.now() - started > deadline) {
|
|
93
|
+
standDown();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
requestAnimationFrame(look);
|
|
97
|
+
};
|
|
98
|
+
requestAnimationFrame(look);
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
active: () => state.on,
|
|
102
|
+
begin(region) {
|
|
103
|
+
state.on = true;
|
|
104
|
+
watch(++generation, region);
|
|
105
|
+
},
|
|
106
|
+
end() {
|
|
107
|
+
generation++;
|
|
108
|
+
standDown();
|
|
109
|
+
},
|
|
110
|
+
settled() {
|
|
111
|
+
if (!state.on) {
|
|
112
|
+
return Promise.resolve();
|
|
113
|
+
}
|
|
114
|
+
return new Promise(resolve => settlers.push(resolve));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export { createArming };
|
|
120
|
+
//# sourceMappingURL=arming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arming.js","sources":["../src/arming.ts"],"sourcesContent":["/**\n * Arming — \"a scene change is under way\", as a value a host can read.\n *\n * A region is router-agnostic by design (§9): it discovers a crossing by\n * rendering one, and it says nothing about it to anybody. But the host around\n * it usually has to KNOW — to skip the entrance animations of cards mounting\n * mid-flight, to hold a heavy mount back until the landing, to gate anything\n * that would otherwise fire twenty springs into the middle of a move.\n *\n * Knowing turns out to be four subtleties, and two apps in a row hand-copied\n * all four before this became a library part:\n *\n * - **The run does not exist yet.** The decision to cross is made in a route\n * hook; the run is born after the swap renders. So the flag stands up\n * first and the watch latches the first live run the region produces.\n * - **A run can be REPLACED mid-flight.** A real interruption recompiles the\n * score, and the old run's `finished` resolves as its successor takes off.\n * Standing down there ends the crossing while it is still visibly moving,\n * so the watch hands over to the successor instead.\n * - **A stale settle must not stand down a newer crossing.** Generations.\n * - **Some crossings never produce a pass at all** — aborted, or rendered\n * identically. A deadline is the backstop, and without it the flag is a\n * latch that never opens.\n *\n * Host-blind on purpose: no router, no owner, no framework beyond the one\n * tracked flag the templates need in order to re-render when it changes.\n */\nimport { tracked } from '@glimmer/tracking';\n\nimport type { Run } from './run.ts';\n\n/** the sliver of a region a watch needs: the run it is playing right now */\nexport interface ArmingRegion {\n readonly run: Run | null | undefined;\n}\n\nexport interface Arming {\n /** tracked: a crossing this arming is watching is under way */\n active(): boolean;\n /**\n * Arm now, and watch `region` until the run that survives has settled (or\n * the deadline passes). Called again while armed, it re-arms: the earlier\n * watch is abandoned rather than allowed to stand the new one down.\n */\n begin(region: ArmingRegion): void;\n /** stand down by hand — a test reset, or a host that knows the pass is off */\n end(): void;\n /**\n * Resolves when this arming stands down, immediately when nothing is armed.\n * What a host waits on before paying for an expensive mount.\n */\n settled(): Promise<void>;\n}\n\nexport interface ArmingOptions {\n /**\n * How long to wait for a run to appear before standing down anyway, in ms\n * (default 4000). The backstop for a crossing that never produced a pass.\n */\n deadline?: number;\n /** run whenever the arming stands down — where a host clears its own flags */\n onStandDown?: () => void;\n}\n\nclass Armed {\n @tracked on = false;\n}\n\n/**\n * A run that is genuinely still working. A parked run is a still and a\n * STANDING run is an annotation that is simply on (a score of nothing but\n * open steps has no end to wait for) — waiting for either to finish would\n * wait forever.\n */\nconst busy = (run: Run | null | undefined): run is Run =>\n Boolean(run) && !run!.isDone() && !run!.standing;\n\nexport function createArming(options: ArmingOptions = {}): Arming {\n const { deadline = 4000, onStandDown } = options;\n const state = new Armed();\n /** which crossing is current — a stale run's settle must not end a newer one */\n let generation = 0;\n const settlers: (() => void)[] = [];\n\n const standDown = () => {\n // guarded: writing the same value still dirties a tracked field, and a\n // host that stands an unarmed crossing down (a test reset) must not\n // invalidate everything reading the flag\n if (state.on) {\n state.on = false;\n }\n onStandDown?.();\n settlers.splice(0).forEach((resolve) => resolve());\n };\n\n const watch = (gen: number, region: ArmingRegion) => {\n const started = performance.now();\n const latch = (run: Run) => {\n void run.finished.then(() => {\n if (gen !== generation) {\n return;\n }\n const current = region.run;\n if (current && current !== run && busy(current)) {\n // replaced mid-flight: the crossing is still on screen, and it is\n // the successor's landing that ends it\n latch(current);\n return;\n }\n standDown();\n });\n };\n const look = () => {\n if (!state.on || gen !== generation) {\n return;\n }\n const run = region.run;\n if (busy(run)) {\n latch(run);\n return;\n }\n if (performance.now() - started > deadline) {\n standDown();\n return;\n }\n requestAnimationFrame(look);\n };\n requestAnimationFrame(look);\n };\n\n return {\n active: () => state.on,\n begin(region) {\n state.on = true;\n watch(++generation, region);\n },\n end() {\n generation++;\n standDown();\n },\n settled() {\n if (!state.on) {\n return Promise.resolve();\n }\n return new Promise<void>((resolve) => settlers.push(resolve));\n },\n };\n}\n"],"names":["Armed","g","prototype","tracked","i","busy","run","Boolean","isDone","standing","createArming","options","deadline","onStandDown","state","generation","settlers","standDown","on","splice","forEach","resolve","watch","gen","region","started","performance","now","latch","finished","then","current","look","requestAnimationFrame","active","begin","end","settled","Promise","push"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAsCA,MAAMA,KAAK,CAAC;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,IAAA,EAAA,CACTC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAM,KAAK;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,GAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,IAAA,CAAA,EAAA,MAAA;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,IAAI,GAAIC,GAA2B,IACvCC,OAAO,CAACD,GAAG,CAAC,IAAI,CAACA,GAAG,CAAEE,MAAM,EAAE,IAAI,CAACF,GAAG,CAAEG,QAAQ;AAE3C,SAASC,YAAYA,CAACC,OAAsB,GAAG,EAAE,EAAU;EAChE,MAAM;AAAEC,IAAAA,QAAQ,GAAG,IAAI;AAAEC,IAAAA;AAAY,GAAC,GAAGF,OAAO;AAChD,EAAA,MAAMG,KAAK,GAAG,IAAId,KAAK,EAAE;AACzB;EACA,IAAIe,UAAU,GAAG,CAAC;EAClB,MAAMC,QAAwB,GAAG,EAAE;EAEnC,MAAMC,SAAS,GAAGA,MAAM;AACtB;AACA;AACA;IACA,IAAIH,KAAK,CAACI,EAAE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AAC;EAED,OAAO;AACLE,IAAAA,MAAM,EAAEA,MAAMpB,KAAK,CAACI,EAAE;IACtBiB,KAAKA,CAACX,MAAM,EAAE;MACZV,KAAK,CAACI,EAAE,GAAG,IAAI;AACfI,MAAAA,KAAK,CAAC,EAAEP,UAAU,EAAES,MAAM,CAAC;IAC7B,CAAC;AACDY,IAAAA,GAAGA,GAAG;AACJrB,MAAAA,UAAU,EAAE;AACZE,MAAAA,SAAS,EAAE;IACb,CAAC;AACDoB,IAAAA,OAAOA,GAAG;AACR,MAAA,IAAI,CAACvB,KAAK,CAACI,EAAE,EAAE;AACb,QAAA,OAAOoB,OAAO,CAACjB,OAAO,EAAE;AAC1B,MAAA;MACA,OAAO,IAAIiB,OAAO,CAAQjB,OAAO,IAAKL,QAAQ,CAACuB,IAAI,CAAClB,OAAO,CAAC,CAAC;AAC/D,IAAA;GACD;AACH;;;;"}
|
package/dist/beacon.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { modifier } from 'ember-modifier';
|
|
2
|
+
import { registerBeacon } from './beacons.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `{{beacon 'trash'}}` — claim a name for this element's box.
|
|
6
|
+
*
|
|
7
|
+
* The element takes no part in any changeset and is never animated. A <Choreo>
|
|
8
|
+
* step reads its measurement to give another sprite a fake start or a fake end:
|
|
9
|
+
*
|
|
10
|
+
* <button type='button' {{beacon 'trash'}}>Trash</button>
|
|
11
|
+
* <c.Move @of={{c.removed 'row'}} @to={{c.beacon 'trash'}} />
|
|
12
|
+
*
|
|
13
|
+
* See ./beacons.ts for why the registry is global, and why this is not
|
|
14
|
+
* `layoutId`.
|
|
15
|
+
*/
|
|
16
|
+
const beacon = modifier((element, positional) => {
|
|
17
|
+
const name = positional[0];
|
|
18
|
+
if (!name) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
return registerBeacon(name, element);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { beacon, beacon as default };
|
|
25
|
+
//# sourceMappingURL=beacon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beacon.js","sources":["../src/beacon.ts"],"sourcesContent":["/**\n * `{{beacon 'trash'}}` — claim a name for this element's box.\n *\n * The element takes no part in any changeset and is never animated. A <Choreo>\n * step reads its measurement to give another sprite a fake start or a fake end:\n *\n * <button type='button' {{beacon 'trash'}}>Trash</button>\n * <c.Move @of={{c.removed 'row'}} @to={{c.beacon 'trash'}} />\n *\n * See ./beacons.ts for why the registry is global, and why this is not\n * `layoutId`.\n */\nimport { modifier } from 'ember-modifier';\n\nimport { registerBeacon } from './beacons.ts';\n\nexport const beacon = modifier((element: Element, positional: [string]) => {\n const name = positional[0];\n if (!name) {\n return;\n }\n return registerBeacon(name, element);\n});\n\nexport default beacon;\n"],"names":["beacon","modifier","element","positional","name","registerBeacon"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKO,MAAMA,MAAM,GAAGC,QAAQ,CAAC,CAACC,OAAgB,EAAEC,UAAoB,KAAK;AACzE,EAAA,MAAMC,IAAI,GAAGD,UAAU,CAAC,CAAC,CAAC;EAC1B,IAAI,CAACC,IAAI,EAAE;AACT,IAAA;AACF,EAAA;AACA,EAAA,OAAOC,cAAc,CAACD,IAAI,EAAEF,OAAO,CAAC;AACtC,CAAC;;;;"}
|
package/dist/beacons.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { measureBounds } from './measure.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Beacons — a named box that does not animate.
|
|
5
|
+
*
|
|
6
|
+
* Ember Animated's primitive: `<AnimatedBeacon>` measures its child when a
|
|
7
|
+
* transition starts, stores a sprite on the motion service, and a generator
|
|
8
|
+
* reads `context.beacons` to say "start here" or "end there". The beacon
|
|
9
|
+
* itself never moves.
|
|
10
|
+
*
|
|
11
|
+
* <button {{beacon 'trash'}}>Trash</button>
|
|
12
|
+
*
|
|
13
|
+
* <Choreo as |c|>
|
|
14
|
+
* …
|
|
15
|
+
* <c.Move @of={{c.removed 'row'}} @to={{c.beacon 'trash'}} />
|
|
16
|
+
* </Choreo>
|
|
17
|
+
*
|
|
18
|
+
* This is deliberately NOT `layoutId`. `layoutId` pairs two real elements that
|
|
19
|
+
* share an identity and morphs one into the other — putting it on a leaving row
|
|
20
|
+
* and on the bin would make the bin a shared element, and it would stretch. A
|
|
21
|
+
* beacon has no identity in the changeset: it is not inserted, kept or removed,
|
|
22
|
+
* it is a point other sprites may borrow. A beacon moving on its own never
|
|
23
|
+
* starts a run.
|
|
24
|
+
*
|
|
25
|
+
* The registry is document-global on purpose. The case that wants beacons is an
|
|
26
|
+
* inbox — the trash lives in the chrome, the list lives in the outlet, and they
|
|
27
|
+
* are different regions precisely so their changesets stay apart. A region-local
|
|
28
|
+
* registry could not see across that boundary, which is the whole point.
|
|
29
|
+
* docs/nested-choreo.md has the reasoning.
|
|
30
|
+
*/
|
|
31
|
+
/** name → the element claiming it. First registration this pass wins, as Ember Animated's `hasBeacon` does. */
|
|
32
|
+
const registry = new Map();
|
|
33
|
+
function registerBeacon(name, element) {
|
|
34
|
+
if (!registry.has(name)) {
|
|
35
|
+
registry.set(name, element);
|
|
36
|
+
}
|
|
37
|
+
return () => {
|
|
38
|
+
if (registry.get(name) === element) {
|
|
39
|
+
registry.delete(name);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Measure every live beacon, in the same window the region measures `final`.
|
|
46
|
+
*
|
|
47
|
+
* Re-measured every pass, never cached: the trash can move without the list
|
|
48
|
+
* rendering at all — a header that hides, a column that resizes, a scroll.
|
|
49
|
+
*/
|
|
50
|
+
function measureBeacons(root) {
|
|
51
|
+
const out = new Map();
|
|
52
|
+
for (const [name, el] of registry) {
|
|
53
|
+
if (!el.isConnected) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
out.set(name, measureBounds(el, root));
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Forget every claimed name. The registry outlives any one owner, so a test
|
|
63
|
+
* that tore down mid-flight would otherwise leave a dead element holding a
|
|
64
|
+
* name the next test wants — first-wins turns into first-test-wins.
|
|
65
|
+
* `setupChoreo(hooks)` runs this before and after every test; nothing in an
|
|
66
|
+
* app should.
|
|
67
|
+
*/
|
|
68
|
+
function resetBeacons() {
|
|
69
|
+
registry.clear();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** `{{c.beacon 'trash'}}` — a named point, not a sprite query */
|
|
73
|
+
|
|
74
|
+
const isBeaconRef = v => typeof v === 'object' && v !== null && typeof v.beacon === 'string';
|
|
75
|
+
|
|
76
|
+
export { isBeaconRef, measureBeacons, registerBeacon, resetBeacons };
|
|
77
|
+
//# sourceMappingURL=beacons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beacons.js","sources":["../src/beacons.ts"],"sourcesContent":["/**\n * Beacons — a named box that does not animate.\n *\n * Ember Animated's primitive: `<AnimatedBeacon>` measures its child when a\n * transition starts, stores a sprite on the motion service, and a generator\n * reads `context.beacons` to say \"start here\" or \"end there\". The beacon\n * itself never moves.\n *\n * <button {{beacon 'trash'}}>Trash</button>\n *\n * <Choreo as |c|>\n * …\n * <c.Move @of={{c.removed 'row'}} @to={{c.beacon 'trash'}} />\n * </Choreo>\n *\n * This is deliberately NOT `layoutId`. `layoutId` pairs two real elements that\n * share an identity and morphs one into the other — putting it on a leaving row\n * and on the bin would make the bin a shared element, and it would stretch. A\n * beacon has no identity in the changeset: it is not inserted, kept or removed,\n * it is a point other sprites may borrow. A beacon moving on its own never\n * starts a run.\n *\n * The registry is document-global on purpose. The case that wants beacons is an\n * inbox — the trash lives in the chrome, the list lives in the outlet, and they\n * are different regions precisely so their changesets stay apart. A region-local\n * registry could not see across that boundary, which is the whole point.\n * docs/nested-choreo.md has the reasoning.\n */\nimport { measureBounds } from './measure.ts';\nimport type { Bounds } from './types.ts';\n\n/** name → the element claiming it. First registration this pass wins, as Ember Animated's `hasBeacon` does. */\nconst registry = new Map<string, Element>();\n\nexport function registerBeacon(name: string, element: Element): () => void {\n if (!registry.has(name)) {\n registry.set(name, element);\n }\n return () => {\n if (registry.get(name) === element) {\n registry.delete(name);\n }\n };\n}\n\n/**\n * Measure every live beacon, in the same window the region measures `final`.\n *\n * Re-measured every pass, never cached: the trash can move without the list\n * rendering at all — a header that hides, a column that resizes, a scroll.\n */\nexport function measureBeacons(root: DOMRect): Map<string, Bounds> {\n const out = new Map<string, Bounds>();\n for (const [name, el] of registry) {\n if (!el.isConnected) {\n continue;\n }\n out.set(name, measureBounds(el, root));\n }\n return out;\n}\n\n/**\n * Forget every claimed name. The registry outlives any one owner, so a test\n * that tore down mid-flight would otherwise leave a dead element holding a\n * name the next test wants — first-wins turns into first-test-wins.\n * `setupChoreo(hooks)` runs this before and after every test; nothing in an\n * app should.\n */\nexport function resetBeacons() {\n registry.clear();\n}\n\n/** `{{c.beacon 'trash'}}` — a named point, not a sprite query */\nexport interface BeaconRef {\n beacon: string;\n}\n\nexport const isBeaconRef = (v: unknown): v is BeaconRef =>\n typeof v === 'object' &&\n v !== null &&\n typeof (v as BeaconRef).beacon === 'string';\n"],"names":["registry","Map","registerBeacon","name","element","has","set","get","delete","measureBeacons","root","out","el","isConnected","measureBounds","resetBeacons","clear","isBeaconRef","v","beacon"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA,MAAMA,QAAQ,GAAG,IAAIC,GAAG,EAAmB;AAEpC,SAASC,cAAcA,CAACC,IAAY,EAAEC,OAAgB,EAAc;AACzE,EAAA,IAAI,CAACJ,QAAQ,CAACK,GAAG,CAACF,IAAI,CAAC,EAAE;AACvBH,IAAAA,QAAQ,CAACM,GAAG,CAACH,IAAI,EAAEC,OAAO,CAAC;AAC7B,EAAA;AACA,EAAA,OAAO,MAAM;IACX,IAAIJ,QAAQ,CAACO,GAAG,CAACJ,IAAI,CAAC,KAAKC,OAAO,EAAE;AAClCJ,MAAAA,QAAQ,CAACQ,MAAM,CAACL,IAAI,CAAC;AACvB,IAAA;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,cAAcA,CAACC,IAAa,EAAuB;AACjE,EAAA,MAAMC,GAAG,GAAG,IAAIV,GAAG,EAAkB;EACrC,KAAK,MAAM,CAACE,IAAI,EAAES,EAAE,CAAC,IAAIZ,QAAQ,EAAE;AACjC,IAAA,IAAI,CAACY,EAAE,CAACC,WAAW,EAAE;AACnB,MAAA;AACF,IAAA;IACAF,GAAG,CAACL,GAAG,CAACH,IAAI,EAAEW,aAAa,CAACF,EAAE,EAAEF,IAAI,CAAC,CAAC;AACxC,EAAA;AACA,EAAA,OAAOC,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,YAAYA,GAAG;EAC7Bf,QAAQ,CAACgB,KAAK,EAAE;AAClB;;AAEA;;MAKaC,WAAW,GAAIC,CAAU,IACpC,OAAOA,CAAC,KAAK,QAAQ,IACrBA,CAAC,KAAK,IAAI,IACV,OAAQA,CAAC,CAAeC,MAAM,KAAK;;;;"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* boxel-motion's Changeset: the sprites one render pass produced, and the
|
|
3
|
+
* spritesFor / spriteFor queries its transitions selected them with.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Is any part of this sprite inside the window (Query.onstage)?
|
|
8
|
+
*
|
|
9
|
+
* A removed sprite is judged where the OLD scene showed it — its initial box,
|
|
10
|
+
* captured before the crossing scrolled the window — and everything else where
|
|
11
|
+
* the new scene will show it. Both boxes are client-space measurements taken
|
|
12
|
+
* on their own side of the scroll, so each is compared against the viewport
|
|
13
|
+
* that was (or will be) actually on screen with it.
|
|
14
|
+
*/
|
|
15
|
+
function onstage(s) {
|
|
16
|
+
const box = (s.type === 'removed' ? s.initial : s.final ?? s.initial)?.page;
|
|
17
|
+
if (!box) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return box.x < window.innerWidth && box.y < window.innerHeight && box.x + box.width > 0 && box.y + box.height > 0;
|
|
21
|
+
}
|
|
22
|
+
const isStill = s => !s.delta || s.delta.x === 0 && s.delta.y === 0 && s.delta.width === 0 && s.delta.height === 0;
|
|
23
|
+
class Changeset {
|
|
24
|
+
inserted;
|
|
25
|
+
kept;
|
|
26
|
+
removed;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The box a `{{beacon}}` claimed this pass, or null if nothing claimed that
|
|
30
|
+
* name. It is a measurement, not a sprite: a beacon is never inserted, kept
|
|
31
|
+
* or removed, and a missing one is a no-op for whatever wanted to borrow it.
|
|
32
|
+
*
|
|
33
|
+
* Closed over rather than stored as a field, so this class stays structurally
|
|
34
|
+
* identical to ChangesetLike — a property function written against the
|
|
35
|
+
* concrete Changeset must still accept the interface it is handed.
|
|
36
|
+
*/
|
|
37
|
+
beacon;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The camera zoom the world was measured under (§6.3). Every box in this
|
|
41
|
+
* changeset is a page-space measurement taken through the region's frame
|
|
42
|
+
* transform, but a step's values are written in the sprite's own local
|
|
43
|
+
* space — so geometry that becomes inline pixels must be divided back by
|
|
44
|
+
* this before it is animated. 1 when the frame is at rest.
|
|
45
|
+
*/
|
|
46
|
+
measureZoom;
|
|
47
|
+
|
|
48
|
+
/** the frame's own size in local pixels, from the same final layout */
|
|
49
|
+
frame;
|
|
50
|
+
|
|
51
|
+
/** what the page shows behind this region — see ChangesetLike.ground */
|
|
52
|
+
ground;
|
|
53
|
+
constructor(inserted, removed, kept, beacons = new Map(), measureZoom = 1, frame, ground) {
|
|
54
|
+
this.inserted = inserted;
|
|
55
|
+
this.removed = removed;
|
|
56
|
+
this.kept = kept;
|
|
57
|
+
this.beacon = name => beacons.get(name) ?? null;
|
|
58
|
+
this.measureZoom = measureZoom;
|
|
59
|
+
this.frame = frame;
|
|
60
|
+
this.ground = ground;
|
|
61
|
+
}
|
|
62
|
+
get all() {
|
|
63
|
+
return [...this.kept, ...this.inserted, ...this.removed];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** something happened this pass that a choreography could animate */
|
|
67
|
+
get dirty() {
|
|
68
|
+
return this.inserted.length > 0 || this.removed.length > 0 || this.kept.some(s => !isStill(s));
|
|
69
|
+
}
|
|
70
|
+
sprites(query) {
|
|
71
|
+
if (Array.isArray(query)) {
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const q of query) {
|
|
74
|
+
for (const s of this.sprites(q)) {
|
|
75
|
+
if (!out.includes(s)) {
|
|
76
|
+
out.push(s);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
let pool;
|
|
83
|
+
switch (query.type) {
|
|
84
|
+
case 'inserted':
|
|
85
|
+
pool = this.inserted;
|
|
86
|
+
break;
|
|
87
|
+
case 'removed':
|
|
88
|
+
pool = this.removed;
|
|
89
|
+
break;
|
|
90
|
+
case 'kept':
|
|
91
|
+
pool = this.kept;
|
|
92
|
+
break;
|
|
93
|
+
case 'still':
|
|
94
|
+
pool = this.kept.filter(isStill);
|
|
95
|
+
break;
|
|
96
|
+
case 'moved':
|
|
97
|
+
pool = this.kept.filter(s => !isStill(s));
|
|
98
|
+
break;
|
|
99
|
+
case 'received':
|
|
100
|
+
// the receiving half of a counterpart / far match: kept, but only
|
|
101
|
+
// because an arriving element claimed a leaving one's identity
|
|
102
|
+
pool = this.kept.filter(s => s.counterpart);
|
|
103
|
+
break;
|
|
104
|
+
case 'counterpart':
|
|
105
|
+
// the removed half that was claimed — the old element, orphaned so a
|
|
106
|
+
// step can cross-fade it while its replacement flies
|
|
107
|
+
pool = this.removed.filter(s => s.claimed);
|
|
108
|
+
break;
|
|
109
|
+
case 'departed':
|
|
110
|
+
// what only the old scene had: removed, claimed by nobody, not
|
|
111
|
+
// carried on by another region — the crossing's LEAVES
|
|
112
|
+
pool = this.removed.filter(s => !s.claimed && !s.sent);
|
|
113
|
+
break;
|
|
114
|
+
default:
|
|
115
|
+
pool = this.all;
|
|
116
|
+
}
|
|
117
|
+
return pool.filter(s => (query.id === undefined || s.id === query.id) && (query.role === undefined || s.role === query.role) && (!query.onstage || onstage(s)));
|
|
118
|
+
}
|
|
119
|
+
sprite(query) {
|
|
120
|
+
const found = this.sprites(query);
|
|
121
|
+
if (found.length > 1) {
|
|
122
|
+
throw new Error(`choreo: more than one sprite matches ${JSON.stringify(query)}`);
|
|
123
|
+
}
|
|
124
|
+
return found[0] ?? null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { Changeset, Changeset as default };
|
|
129
|
+
//# sourceMappingURL=changeset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeset.js","sources":["../src/changeset.ts"],"sourcesContent":["/**\n * boxel-motion's Changeset: the sprites one render pass produced, and the\n * spritesFor / spriteFor queries its transitions selected them with.\n */\nimport type { Bounds, ChangesetLike, Query, Sprite } from './types.ts';\n\n/**\n * Is any part of this sprite inside the window (Query.onstage)?\n *\n * A removed sprite is judged where the OLD scene showed it — its initial box,\n * captured before the crossing scrolled the window — and everything else where\n * the new scene will show it. Both boxes are client-space measurements taken\n * on their own side of the scroll, so each is compared against the viewport\n * that was (or will be) actually on screen with it.\n */\nfunction onstage(s: Sprite): boolean {\n const box = (s.type === 'removed' ? s.initial : (s.final ?? s.initial))?.page;\n if (!box) {\n return true;\n }\n return (\n box.x < window.innerWidth &&\n box.y < window.innerHeight &&\n box.x + box.width > 0 &&\n box.y + box.height > 0\n );\n}\n\nconst isStill = (s: Sprite) =>\n !s.delta ||\n (s.delta.x === 0 &&\n s.delta.y === 0 &&\n s.delta.width === 0 &&\n s.delta.height === 0);\n\nexport class Changeset implements ChangesetLike {\n readonly inserted: Sprite[];\n readonly kept: Sprite[];\n readonly removed: Sprite[];\n\n /**\n * The box a `{{beacon}}` claimed this pass, or null if nothing claimed that\n * name. It is a measurement, not a sprite: a beacon is never inserted, kept\n * or removed, and a missing one is a no-op for whatever wanted to borrow it.\n *\n * Closed over rather than stored as a field, so this class stays structurally\n * identical to ChangesetLike — a property function written against the\n * concrete Changeset must still accept the interface it is handed.\n */\n readonly beacon: (name: string) => Bounds | null;\n\n /**\n * The camera zoom the world was measured under (§6.3). Every box in this\n * changeset is a page-space measurement taken through the region's frame\n * transform, but a step's values are written in the sprite's own local\n * space — so geometry that becomes inline pixels must be divided back by\n * this before it is animated. 1 when the frame is at rest.\n */\n readonly measureZoom: number;\n\n /** the frame's own size in local pixels, from the same final layout */\n readonly frame?: { height: number; width: number };\n\n /** what the page shows behind this region — see ChangesetLike.ground */\n readonly ground?: string;\n\n constructor(\n inserted: Sprite[],\n removed: Sprite[],\n kept: Sprite[],\n beacons: Map<string, Bounds> = new Map(),\n measureZoom = 1,\n frame?: { height: number; width: number },\n ground?: string,\n ) {\n this.inserted = inserted;\n this.removed = removed;\n this.kept = kept;\n this.beacon = (name) => beacons.get(name) ?? null;\n this.measureZoom = measureZoom;\n this.frame = frame;\n this.ground = ground;\n }\n\n get all(): Sprite[] {\n return [...this.kept, ...this.inserted, ...this.removed];\n }\n\n /** something happened this pass that a choreography could animate */\n get dirty(): boolean {\n return (\n this.inserted.length > 0 ||\n this.removed.length > 0 ||\n this.kept.some((s) => !isStill(s))\n );\n }\n\n sprites(query: Query | Query[]): Sprite[] {\n if (Array.isArray(query)) {\n const out: Sprite[] = [];\n for (const q of query) {\n for (const s of this.sprites(q)) {\n if (!out.includes(s)) {\n out.push(s);\n }\n }\n }\n return out;\n }\n let pool: Sprite[];\n switch (query.type) {\n case 'inserted':\n pool = this.inserted;\n break;\n case 'removed':\n pool = this.removed;\n break;\n case 'kept':\n pool = this.kept;\n break;\n case 'still':\n pool = this.kept.filter(isStill);\n break;\n case 'moved':\n pool = this.kept.filter((s) => !isStill(s));\n break;\n case 'received':\n // the receiving half of a counterpart / far match: kept, but only\n // because an arriving element claimed a leaving one's identity\n pool = this.kept.filter((s) => s.counterpart);\n break;\n case 'counterpart':\n // the removed half that was claimed — the old element, orphaned so a\n // step can cross-fade it while its replacement flies\n pool = this.removed.filter((s) => s.claimed);\n break;\n case 'departed':\n // what only the old scene had: removed, claimed by nobody, not\n // carried on by another region — the crossing's LEAVES\n pool = this.removed.filter((s) => !s.claimed && !s.sent);\n break;\n default:\n pool = this.all;\n }\n return pool.filter(\n (s) =>\n (query.id === undefined || s.id === query.id) &&\n (query.role === undefined || s.role === query.role) &&\n (!query.onstage || onstage(s)),\n );\n }\n\n sprite(query: Query | Query[]): Sprite | null {\n const found = this.sprites(query);\n if (found.length > 1) {\n throw new Error(\n `choreo: more than one sprite matches ${JSON.stringify(query)}`,\n );\n }\n return found[0] ?? null;\n }\n}\n\nexport default Changeset;\n"],"names":["onstage","s","box","type","initial","final","page","x","window","innerWidth","y","innerHeight","width","height","isStill","delta","Changeset","inserted","kept","removed","beacon","measureZoom","frame","ground","constructor","beacons","Map","name","get","all","dirty","length","some","sprites","query","Array","isArray","out","q","includes","push","pool","filter","counterpart","claimed","sent","id","undefined","role","sprite","found","Error","JSON","stringify"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAOA,CAACC,CAAS,EAAW;EACnC,MAAMC,GAAG,GAAG,CAACD,CAAC,CAACE,IAAI,KAAK,SAAS,GAAGF,CAAC,CAACG,OAAO,GAAIH,CAAC,CAACI,KAAK,IAAIJ,CAAC,CAACG,OAAQ,GAAGE,IAAI;EAC7E,IAAI,CAACJ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