@atom.io/spa 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +63 -10
  2. package/README.mdx +26 -5
  3. package/dist/astro-application.d.ts +1 -1
  4. package/dist/astro-application.js +2 -2
  5. package/dist/astro-application.js.map +1 -1
  6. package/dist/astro-client.d.ts +1 -1
  7. package/dist/astro-client.js +2 -2
  8. package/dist/{astro-shared-DyzbUi6c.d.ts → astro-shared-BkWvVZWZ.d.ts} +2 -2
  9. package/dist/{astro-shared-DyzbUi6c.d.ts.map → astro-shared-BkWvVZWZ.d.ts.map} +1 -1
  10. package/dist/astro.d.ts +1 -1
  11. package/dist/capabilities-BkQ2i0vV.js +63 -0
  12. package/dist/capabilities-BkQ2i0vV.js.map +1 -0
  13. package/dist/{capabilities-yC9TsHDI.d.ts → capabilities-CFP-HIuY.d.ts} +54 -1
  14. package/dist/capabilities-CFP-HIuY.d.ts.map +1 -0
  15. package/dist/client.min.js +1 -1
  16. package/dist/{capabilities-BuZUQpiD.js → core-DCmqLZQP.js} +16 -59
  17. package/dist/core-DCmqLZQP.js.map +1 -0
  18. package/dist/development/astro-application.js +2 -2
  19. package/dist/development/astro-application.js.map +1 -1
  20. package/dist/development/astro-client.js +2 -2
  21. package/dist/development/capabilities-BkQ2i0vV.js +63 -0
  22. package/dist/development/capabilities-BkQ2i0vV.js.map +1 -0
  23. package/dist/development/{capabilities-DhOJmeoJ.js → core-p9vciX9C.js} +16 -59
  24. package/dist/development/core-p9vciX9C.js.map +1 -0
  25. package/dist/development/{dom-BKc6V_Kz.js → dom-Ci1XvbVJ.js} +16 -7
  26. package/dist/development/dom-Ci1XvbVJ.js.map +1 -0
  27. package/dist/development/index.js +3 -3
  28. package/dist/development/konva.js +25 -3
  29. package/dist/development/konva.js.map +1 -1
  30. package/dist/development/motion.js +392 -8
  31. package/dist/development/motion.js.map +1 -1
  32. package/dist/development/renderer.js +23 -10
  33. package/dist/development/renderer.js.map +1 -1
  34. package/dist/development/server.js +2 -1
  35. package/dist/development/server.js.map +1 -1
  36. package/dist/development/{src-Dh-d6w4y.js → src-DG0xjuS5.js} +2 -2
  37. package/dist/development/{src-Dh-d6w4y.js.map → src-DG0xjuS5.js.map} +1 -1
  38. package/dist/development/three.js +24 -10
  39. package/dist/development/three.js.map +1 -1
  40. package/dist/{dom-B2rm8o2L.js → dom-dHQM0O7Q.js} +16 -7
  41. package/dist/dom-dHQM0O7Q.js.map +1 -0
  42. package/dist/{index-BdwxmSKg.d.ts → index-CJJXcKaw.d.ts} +3 -3
  43. package/dist/{index-BdwxmSKg.d.ts.map → index-CJJXcKaw.d.ts.map} +1 -1
  44. package/dist/index.d.ts +3 -3
  45. package/dist/index.js +3 -3
  46. package/dist/{jsx-runtime-CZU7F8Qz.d.ts → jsx-runtime-CREZYKDC.d.ts} +2 -2
  47. package/dist/{jsx-runtime-CZU7F8Qz.d.ts.map → jsx-runtime-CREZYKDC.d.ts.map} +1 -1
  48. package/dist/jsx-runtime.d.ts +1 -1
  49. package/dist/konva.d.ts +3 -3
  50. package/dist/konva.d.ts.map +1 -1
  51. package/dist/konva.js +25 -3
  52. package/dist/konva.js.map +1 -1
  53. package/dist/motion.d.ts +2 -1
  54. package/dist/motion.d.ts.map +1 -1
  55. package/dist/motion.js +392 -8
  56. package/dist/motion.js.map +1 -1
  57. package/dist/renderer.d.ts +3 -3
  58. package/dist/renderer.d.ts.map +1 -1
  59. package/dist/renderer.js +23 -10
  60. package/dist/renderer.js.map +1 -1
  61. package/dist/server.d.ts +1 -1
  62. package/dist/server.js +2 -1
  63. package/dist/server.js.map +1 -1
  64. package/dist/size.json +12 -12
  65. package/dist/{src-BZxX4xbU.js → src-DCQa6qxs.js} +2 -2
  66. package/dist/{src-BZxX4xbU.js.map → src-DCQa6qxs.js.map} +1 -1
  67. package/dist/three.d.ts +3 -3
  68. package/dist/three.d.ts.map +1 -1
  69. package/dist/three.js +24 -10
  70. package/dist/three.js.map +1 -1
  71. package/package.json +8 -6
  72. package/src/astro-application.ts +2 -2
  73. package/src/capabilities.ts +21 -2
  74. package/src/core.ts +27 -2
  75. package/src/dom.ts +35 -4
  76. package/src/konva.ts +41 -14
  77. package/src/motion-tween.ts +106 -0
  78. package/src/motion.ts +122 -9
  79. package/src/presence.ts +324 -0
  80. package/src/renderer.ts +51 -14
  81. package/src/three-events.ts +13 -1
  82. package/src/three.ts +38 -15
  83. package/dist/capabilities-BuZUQpiD.js.map +0 -1
  84. package/dist/capabilities-yC9TsHDI.d.ts.map +0 -1
  85. package/dist/development/capabilities-DhOJmeoJ.js.map +0 -1
  86. package/dist/development/dom-BKc6V_Kz.js.map +0 -1
  87. package/dist/dom-B2rm8o2L.js.map +0 -1
package/dist/motion.js CHANGED
@@ -1,9 +1,311 @@
1
- import { animate, cancelFrame, frame, hover, motionValue, press, readStyleValue, styleEffect } from "motion";
1
+ import { a as invalidate, i as fail, o as isPresent, p as untrack, r as dispose } from "./core-DCmqLZQP.js";
2
+ import { animate, cancelFrame, frame, hover, keyframes, motionValue, press, readStyleValue, styleEffect } from "motion";
3
+ // src/motion-tween.ts
4
+ const trajectories = /* @__PURE__ */ new WeakMap();
5
+ const scalar = /^(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)([a-z%]*)$/i;
6
+ const brake = (progress) => progress * (2 - progress);
7
+ const returnToTarget = (progress) => progress * progress * (3 - 2 * progress);
8
+ /** Retarget a moving tween without changing its position or velocity at the join. */
9
+ function animateTween(value, goal, transition, interrupted) {
10
+ if (interrupted) value.stop();
11
+ const current = value.get();
12
+ const from = typeof current === `number` ? [
13
+ ``,
14
+ current,
15
+ ``
16
+ ] : scalar.exec(current);
17
+ const to = typeof goal === `number` ? [
18
+ ``,
19
+ goal,
20
+ ``
21
+ ] : scalar.exec(goal);
22
+ const previous = trajectories.get(value)?.();
23
+ const velocity = previous && from && Math.abs(previous.position - Number(from[1])) < .001 ? previous.velocity : value.getVelocity();
24
+ trajectories.delete(value);
25
+ const duration = transition.duration ?? .3;
26
+ const tween = transition.type === `tween` || transition.type === void 0 && (transition.duration !== void 0 || transition.ease !== void 0);
27
+ const moving = interrupted && tween && from && to && from[2] === to[2] && Number.isFinite(velocity) && velocity !== 0 && duration > 0;
28
+ const braking = .2;
29
+ const turn = from ? Number(from[1]) + velocity * duration * braking / 2 : 0;
30
+ const waypoint = typeof current === `number` ? turn : `${turn}${from?.[2]}`;
31
+ const frames = moving ? [
32
+ current,
33
+ waypoint,
34
+ goal
35
+ ] : [current, goal];
36
+ const next = moving ? {
37
+ ...transition,
38
+ type: `tween`,
39
+ duration,
40
+ delay: 0,
41
+ times: [
42
+ 0,
43
+ braking,
44
+ 1
45
+ ],
46
+ ease: [brake, returnToTarget]
47
+ } : transition;
48
+ const controls = animate(value, frames, tween && (moving || current !== goal) ? {
49
+ ...next,
50
+ isSync: true
51
+ } : next);
52
+ if (tween && (moving || current !== goal) && from && to && from[2] === to[2] && duration > 0) {
53
+ const curve = keyframes({
54
+ keyframes: moving ? [
55
+ Number(from[1]),
56
+ turn,
57
+ Number(to[1])
58
+ ] : [Number(from[1]), Number(to[1])],
59
+ duration: duration * 1e3,
60
+ times: moving ? [
61
+ 0,
62
+ braking,
63
+ 1
64
+ ] : [0, 1],
65
+ ease: next.ease ?? `easeOut`
66
+ });
67
+ const sample = (at) => curve.next(at * 1e3).value;
68
+ trajectories.set(value, () => {
69
+ const at = Math.max(0, Math.min(duration, controls.time));
70
+ const before = Math.max(0, at - 1e-4), after = Math.min(duration, at + 1e-4);
71
+ return {
72
+ position: sample(at),
73
+ velocity: at <= 0 || at >= duration ? 0 : (sample(after) - sample(before)) / (after - before)
74
+ };
75
+ });
76
+ }
77
+ return controls;
78
+ }
79
+ // src/presence.ts
80
+ /** Optional coordinator: only imported by integrations that support retention. */
81
+ function createPresence(root) {
82
+ const releases = /* @__PURE__ */ new Map();
83
+ const handlers = /* @__PURE__ */ new WeakMap();
84
+ const groups = /* @__PURE__ */ new Map();
85
+ const sessions = /* @__PURE__ */ new Set();
86
+ const active = /* @__PURE__ */ new Map();
87
+ const suspended = /* @__PURE__ */ new Map();
88
+ const suspend = (target) => {
89
+ if (target.kind !== `dom`) return target.suspend();
90
+ const node = target.node;
91
+ const inert = node.getAttribute(`inert`), hidden = node.getAttribute(`aria-hidden`);
92
+ const pointer = node.style.getPropertyValue(`pointer-events`), priority = node.style.getPropertyPriority(`pointer-events`);
93
+ const focused = node.ownerDocument.activeElement;
94
+ if (focused && node.contains(focused)) focused.blur();
95
+ node.setAttribute(`inert`, ``);
96
+ node.setAttribute(`aria-hidden`, `true`);
97
+ node.style.setProperty(`pointer-events`, `none`, `important`);
98
+ return () => {
99
+ for (const [key, value] of [[`inert`, inert], [`aria-hidden`, hidden]]) if (value === null) node.removeAttribute(key);
100
+ else node.setAttribute(key, value);
101
+ if (pointer) node.style.setProperty(`pointer-events`, pointer, priority);
102
+ else node.style.removeProperty(`pointer-events`);
103
+ };
104
+ };
105
+ const walk = (scope, visit) => {
106
+ const descend = (at) => {
107
+ visit(at);
108
+ for (const child of at._cleanups) if (typeof child !== `function`) descend(child);
109
+ };
110
+ descend(scope);
111
+ };
112
+ const ancestor = (scope, parent) => {
113
+ for (let at = scope; at; at = at._parent) if (at === parent) return true;
114
+ return false;
115
+ };
116
+ const report = (error) => {
117
+ if (root._dead) return;
118
+ try {
119
+ fail(root, error);
120
+ } catch (failure) {
121
+ root.error(failure);
122
+ }
123
+ };
124
+ const finish = () => {
125
+ for (const group of [...groups.values()]) {
126
+ if (group.scope._dead || group.sessions.some((session) => !session.done)) continue;
127
+ if ([...groups.keys()].some((scope) => scope !== group.scope && ancestor(group.scope, scope))) continue;
128
+ groups.delete(group.scope);
129
+ try {
130
+ group.done();
131
+ } catch (error) {
132
+ report(error);
133
+ }
134
+ }
135
+ };
136
+ const cancel = (session) => {
137
+ session.cancelled = true;
138
+ sessions.delete(session);
139
+ active.delete(session.participant);
140
+ session.handle.cancel();
141
+ };
142
+ const coordinator = {
143
+ target(scope, target) {
144
+ (scope._targets ??= /* @__PURE__ */ new Set()).add(target);
145
+ scope._cleanups.add(() => {
146
+ scope._targets.delete(target);
147
+ });
148
+ },
149
+ bind(scope, binding, props, namespace) {
150
+ const read = () => Object.fromEntries(Object.entries(props()).filter(([key]) => key.startsWith(`${namespace}:`)).map(([key, value]) => [key.slice(namespace.length + 1), value]));
151
+ if (!binding.exit) return;
152
+ const participant = {
153
+ exit: () => binding.exit(untrack(read)),
154
+ resume() {
155
+ binding.update(untrack(read));
156
+ binding.resume?.();
157
+ }
158
+ };
159
+ (scope._exits ??= /* @__PURE__ */ new Set()).add(participant);
160
+ const release = () => {
161
+ scope._exits.delete(participant);
162
+ scope._cleanups.delete(release);
163
+ releases.delete(binding);
164
+ };
165
+ releases.set(binding, release);
166
+ scope._cleanups.add(release);
167
+ },
168
+ unbind(binding) {
169
+ releases.get(binding)?.();
170
+ },
171
+ event(scope, handler) {
172
+ const cached = handlers.get(scope) ?? /* @__PURE__ */ new WeakMap();
173
+ handlers.set(scope, cached);
174
+ if (!cached.has(handler)) cached.set(handler, function(...args) {
175
+ if (isPresent(scope)) return handler.apply(this, args);
176
+ });
177
+ return cached.get(handler);
178
+ },
179
+ collection(scopeOf, compatible) {
180
+ let order = [];
181
+ const exiting = /* @__PURE__ */ new Map();
182
+ return {
183
+ take(key, value) {
184
+ if (value == null || typeof value === `boolean`) return void 0;
185
+ for (const [record, state] of exiting) if (state.eligible && state.key === key) {
186
+ if (!compatible(record, value)) {
187
+ state.eligible = false;
188
+ return;
189
+ }
190
+ exiting.delete(record);
191
+ return record;
192
+ }
193
+ },
194
+ remove(record, key, eligible, index, done) {
195
+ const position = order.indexOf(record);
196
+ const state = {
197
+ key,
198
+ eligible,
199
+ index: position < 0 ? index : position
200
+ };
201
+ exiting.set(record, state);
202
+ let pending = false;
203
+ const release = () => {
204
+ dispose(scopeOf(record));
205
+ exiting.delete(record);
206
+ order = order.filter((item) => item !== record);
207
+ for (const other of exiting.values()) if (other.index > state.index) other.index--;
208
+ if (pending) done();
209
+ };
210
+ pending = coordinator.remove(scopeOf(record), release);
211
+ if (!pending) release();
212
+ },
213
+ merge(records) {
214
+ const rendered = [...records];
215
+ for (const [record, state] of [...exiting].sort((a, b) => a[1].index - b[1].index)) {
216
+ rendered.splice(Math.min(state.index, rendered.length), 0, record);
217
+ state.index = rendered.indexOf(record);
218
+ }
219
+ order = [...rendered];
220
+ return rendered;
221
+ }
222
+ };
223
+ },
224
+ remove(scope, done) {
225
+ const collected = [];
226
+ walk(scope, (at) => {
227
+ for (const participant of at._exits ?? []) {
228
+ let session = active.get(participant);
229
+ if (!session) {
230
+ const handle = untrack(() => participant.exit());
231
+ if (!handle) continue;
232
+ session = {
233
+ scope: at,
234
+ participant,
235
+ handle,
236
+ done: false,
237
+ cancelled: false
238
+ };
239
+ sessions.add(session);
240
+ active.set(participant, session);
241
+ const held = session;
242
+ handle.finished.then(() => {
243
+ if (held.cancelled || root._dead) return;
244
+ held.done = true;
245
+ finish();
246
+ }, (error) => {
247
+ if (!held.cancelled) report(error);
248
+ });
249
+ }
250
+ collected.push(session);
251
+ }
252
+ });
253
+ if (!collected.some((session) => !session.done)) return false;
254
+ scope._exiting = true;
255
+ groups.set(scope, {
256
+ scope,
257
+ sessions: collected,
258
+ done
259
+ });
260
+ walk(scope, (at) => {
261
+ for (const target of at._targets ?? []) if (!suspended.has(target) && (target.kind === `dom` || target.suspend)) suspended.set(target, {
262
+ scope: at,
263
+ restore: suspend(target)
264
+ });
265
+ });
266
+ return true;
267
+ },
268
+ resume(scope) {
269
+ if (!groups.delete(scope)) return;
270
+ scope._exiting = false;
271
+ for (const session of [...sessions]) if (ancestor(session.scope, scope) && isPresent(session.scope)) cancel(session);
272
+ walk(scope, (at) => {
273
+ if (isPresent(at)) for (const participant of at._exits ?? []) participant.resume();
274
+ });
275
+ for (const [target, state] of suspended) if (isPresent(state.scope)) {
276
+ suspended.delete(target);
277
+ state.restore();
278
+ }
279
+ invalidate(scope);
280
+ queueMicrotask(finish);
281
+ },
282
+ forget(scope) {
283
+ const errors = [];
284
+ for (const session of [...sessions]) if (ancestor(session.scope, scope)) try {
285
+ cancel(session);
286
+ } catch (error) {
287
+ errors.push(error);
288
+ }
289
+ for (const at of groups.keys()) if (ancestor(at, scope)) groups.delete(at);
290
+ for (const [target, state] of suspended) if (ancestor(state.scope, scope)) {
291
+ suspended.delete(target);
292
+ try {
293
+ state.restore();
294
+ } catch (error) {
295
+ errors.push(error);
296
+ }
297
+ }
298
+ if (errors.length) throw new AggregateError(errors);
299
+ }
300
+ };
301
+ return coordinator;
302
+ }
2
303
  // src/motion.ts
3
304
  const transform = /^(x|y|z|translate.*|scale.*|rotate.*|skew.*|transformPerspective)$/;
4
305
  const allowed = /* @__PURE__ */ new Set([
5
306
  `initial`,
6
307
  `animate`,
308
+ `exit`,
7
309
  `transition`,
8
310
  `whileHover`,
9
311
  `whileTap`
@@ -22,6 +324,8 @@ function attach(target, options) {
22
324
  let tapped = false;
23
325
  let started = false;
24
326
  let dead = false;
327
+ let exiting = false;
328
+ let exitHandle;
25
329
  let gestures = [];
26
330
  const preference = options.reducedMotion !== `never` && typeof matchMedia === `function` ? matchMedia(`(prefers-reduced-motion: reduce)`) : void 0;
27
331
  const reduced = () => options.reducedMotion === `always` || options.reducedMotion !== `never` && preference?.matches;
@@ -73,8 +377,8 @@ function attach(target, options) {
73
377
  properties.set(key, property);
74
378
  return property;
75
379
  };
76
- const refresh = () => {
77
- if (dead) return;
380
+ const refresh = (force = false) => {
381
+ if (dead || exiting) return;
78
382
  const initial = props[`initial`] ?? {};
79
383
  const animateTo = props[`animate`] ?? {};
80
384
  const hoverTo = props[`whileHover`] ?? {};
@@ -102,13 +406,13 @@ function attach(target, options) {
102
406
  const transition = props[`transition`] ?? { type: `spring` };
103
407
  for (const [key, property] of properties) {
104
408
  const goal = goals[key] ?? (initial === false ? void 0 : initial[key]) ?? property.rest;
105
- if (equal(property.target, goal)) continue;
409
+ if (!force && equal(property.target, goal)) continue;
106
410
  property.target = Array.isArray(goal) ? [...goal] : goal;
107
411
  const next = Array.isArray(goal) ? goal : [goal];
108
412
  if (next.length !== property.values.length) throw new Error(`spa/motion: cannot change the shape of ${key}`);
109
413
  property.values.forEach((value, index) => {
110
414
  if (reduced() || !started && initial === false) value.jump(next[index]);
111
- else animate(value, next[index], transition);
415
+ else animateTween(value, next[index], transition, force || value.isAnimating());
112
416
  });
113
417
  }
114
418
  started = true;
@@ -170,21 +474,100 @@ function attach(target, options) {
170
474
  });
171
475
  }
172
476
  };
173
- preference?.addEventListener(`change`, preferenceChanged);
477
+ const finishExit = () => {
478
+ exitHandle?.cancel();
479
+ };
480
+ const mediaChanged = () => {
481
+ preferenceChanged();
482
+ if (reduced() && exiting) finishExit();
483
+ };
484
+ preference?.addEventListener(`change`, mediaChanged);
174
485
  return {
486
+ exit(next) {
487
+ const goals = next[`exit`];
488
+ exiting = true;
489
+ hovered = tapped = false;
490
+ clearGestures();
491
+ const moving = /* @__PURE__ */ new Set();
492
+ for (const property of properties.values()) for (const value of property.values) {
493
+ if (value.isAnimating()) moving.add(value);
494
+ value.stop();
495
+ }
496
+ if (!goals || !Object.keys(goals).length || reduced()) return void 0;
497
+ const transition = next[`transition`] ?? { type: `spring` };
498
+ for (const key of [
499
+ `duration`,
500
+ `delay`,
501
+ `visualDuration`,
502
+ `velocity`,
503
+ `bounce`,
504
+ `stiffness`,
505
+ `damping`,
506
+ `mass`,
507
+ `restDelta`,
508
+ `restSpeed`
509
+ ]) {
510
+ const value = transition[key];
511
+ if (value !== void 0 && (!Number.isFinite(value) || key !== `velocity` && value < 0 || key === `bounce` && value >= 1 || [
512
+ `stiffness`,
513
+ `damping`,
514
+ `mass`,
515
+ `restDelta`,
516
+ `restSpeed`
517
+ ].includes(key) && value === 0)) throw new Error(`spa/motion: exit requires a finite settling transition`);
518
+ }
519
+ let added = false;
520
+ for (const [key, goal] of Object.entries(goals)) {
521
+ const had = properties.has(key);
522
+ ensure(key, goal, {});
523
+ if (!had) added = true;
524
+ }
525
+ if (added) bindStyles();
526
+ let settle;
527
+ let reject;
528
+ const finished = new Promise((resolve, fail) => {
529
+ settle = resolve;
530
+ reject = fail;
531
+ });
532
+ const controls = [];
533
+ for (const [key, goal] of Object.entries(goals)) {
534
+ const property = properties.get(key);
535
+ property.target = Array.isArray(goal) ? [...goal] : goal;
536
+ const values = Array.isArray(goal) ? goal : [goal];
537
+ property.values.forEach((value, index) => controls.push(animateTween(value, values[index], transition, moving.has(value))));
538
+ }
539
+ Promise.all(controls.map((control) => Promise.resolve(control))).then(settle, reject);
540
+ exitHandle = {
541
+ finished,
542
+ cancel() {
543
+ for (const control of controls) control.stop();
544
+ settle();
545
+ }
546
+ };
547
+ return exitHandle;
548
+ },
549
+ resume() {
550
+ if (dead) return;
551
+ exitHandle?.cancel();
552
+ exitHandle = void 0;
553
+ exiting = false;
554
+ installGestures();
555
+ refresh(true);
556
+ },
175
557
  update(next) {
176
558
  if (dead) return;
177
559
  for (const key of Object.keys(next)) if (!allowed.has(key)) throw new Error(`spa/motion: unknown property motion:${key}`);
178
560
  const gestureChange = !started || Boolean(next[`whileHover`]) !== Boolean(props[`whileHover`]) || Boolean(next[`whileTap`]) !== Boolean(props[`whileTap`]);
179
561
  props = next;
180
- if (gestureChange) installGestures();
562
+ if (gestureChange && !exiting) installGestures();
181
563
  refresh();
182
564
  },
183
565
  dispose() {
184
566
  if (dead) return;
185
567
  dead = true;
186
568
  clearGestures();
187
- preference?.removeEventListener(`change`, preferenceChanged);
569
+ exitHandle?.cancel();
570
+ preference?.removeEventListener(`change`, mediaChanged);
188
571
  styles?.();
189
572
  for (const [key, property] of properties) {
190
573
  property.release();
@@ -200,6 +583,7 @@ function attach(target, options) {
200
583
  function motionCapability(options = {}) {
201
584
  return {
202
585
  namespace: `motion`,
586
+ presence: createPresence,
203
587
  attach: (target) => attach(target, options),
204
588
  scheduleFrame(callback) {
205
589
  const run = ({ timestamp }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"motion.js","names":[],"sources":["../src/motion.ts"],"sourcesContent":["import type { MotionValue, ValueAnimationTransition } from \"motion\"\nimport {\n\tanimate,\n\tcancelFrame,\n\tframe,\n\thover,\n\tmotionValue,\n\tpress,\n\treadStyleValue,\n\tstyleEffect,\n} from \"motion\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\n\nexport type MotionScalar = number | string\nexport type MotionDOMTarget = Partial<\n\tRecord<\n\t\t| keyof CSSStyleDeclaration\n\t\t| `x`\n\t\t| `y`\n\t\t| `z`\n\t\t| `scale`\n\t\t| `scaleX`\n\t\t| `scaleY`\n\t\t| `rotate`\n\t\t| `rotateX`\n\t\t| `rotateY`\n\t\t| `rotateZ`\n\t\t| `skewX`\n\t\t| `skewY`\n\t\t| `--${string}`,\n\t\tMotionScalar\n\t>\n>\nexport interface MotionThreeTarget {\n\tposition?: readonly [number, number, number]\n\trotation?: readonly [number, number, number]\n\tscale?: number | readonly [number, number, number]\n\topacity?: number\n\tintensity?: number\n\tcolor?: string\n}\nexport type MotionTarget<Kind extends string> = Kind extends `dom`\n\t? MotionDOMTarget\n\t: Kind extends `three`\n\t\t? MotionThreeTarget\n\t\t: Record<string, MotionScalar>\n/** Supported transition options; keep public declarations independent of optional peer types. */\nexport interface MotionTransition {\n\ttype?: `spring` | `tween`\n\tstiffness?: number\n\tdamping?: number\n\tmass?: number\n\tvelocity?: number\n\trestSpeed?: number\n\trestDelta?: number\n\tbounce?: number\n\tvisualDuration?: number\n\tduration?: number\n\tdelay?: number\n\tease?:\n\t\t| `linear`\n\t\t| `easeIn`\n\t\t| `easeOut`\n\t\t| `easeInOut`\n\t\t| `circIn`\n\t\t| `circOut`\n\t\t| `circInOut`\n\t\t| `backIn`\n\t\t| `backOut`\n\t\t| `backInOut`\n\t\t| readonly [number, number, number, number]\n}\nexport interface MotionAttributes<Kind extends string = `dom`> {\n\t[`motion:initial`]?: MotionTarget<Kind> | false\n\t[`motion:animate`]?: MotionTarget<Kind>\n\t[`motion:transition`]?: MotionTransition\n\t[`motion:whileHover`]?: MotionTarget<Kind>\n\t[`motion:whileTap`]?: MotionTarget<Kind>\n}\n\n// eslint-disable-next-line quotes -- TypeScript module augmentation requires a string literal.\ndeclare module \"@atom.io/spa/jsx-runtime\" {\n\t// oxlint-disable-next-line typescript/no-empty-interface -- Declaration merging adds optional motion attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends MotionAttributes<Kind> {}\n}\n\nexport interface MotionCapabilityOptions {\n\t/** Respect the user's reduced-motion preference by default. */\n\treducedMotion?: `user` | `always` | `never`\n}\ntype TargetValues = Record<string, MotionScalar | readonly number[]>\ninterface AnimatedProperty {\n\tvalues: MotionValue<MotionScalar>[]\n\tbase: MotionScalar | readonly number[]\n\trest: MotionScalar | readonly number[]\n\ttarget: MotionScalar | readonly number[]\n\trelease(): void\n}\nconst transform =\n\t/^(x|y|z|translate.*|scale.*|rotate.*|skew.*|transformPerspective)$/\nconst allowed = new Set([\n\t`initial`,\n\t`animate`,\n\t`transition`,\n\t`whileHover`,\n\t`whileTap`,\n])\nfunction equal(a: unknown, b: unknown): boolean {\n\treturn (\n\t\tObject.is(a, b) ||\n\t\t(Array.isArray(a) &&\n\t\t\tArray.isArray(b) &&\n\t\t\ta.length === b.length &&\n\t\t\ta.every((value, index) => Object.is(value, b[index])))\n\t)\n}\n\nfunction attach(\n\ttarget: CapabilityTarget,\n\toptions: MotionCapabilityOptions,\n): CapabilityBinding {\n\tif (target.kind !== `dom` && (!target.read || !target.write))\n\t\tthrow new Error(\n\t\t\t`spa/motion: renderer ${target.kind} does not support motion`,\n\t\t)\n\tconst element =\n\t\ttarget.kind === `dom` ? (target.node as HTMLElement | SVGElement) : undefined\n\tconst properties = new Map<string, AnimatedProperty>()\n\tconst originalStyles = new Map<string, { value: string; priority: string }>()\n\tlet styles: (() => void) | undefined\n\tlet props: Record<string, unknown> = {}\n\tlet hovered = false\n\tlet tapped = false\n\tlet started = false\n\tlet dead = false\n\tlet gestures: (() => void)[] = []\n\tconst preference =\n\t\toptions.reducedMotion !== `never` && typeof matchMedia === `function`\n\t\t\t? matchMedia(`(prefers-reduced-motion: reduce)`)\n\t\t\t: undefined\n\tconst reduced = () =>\n\t\toptions.reducedMotion === `always` ||\n\t\t(options.reducedMotion !== `never` && preference?.matches)\n\tconst read = (key: string, fallback: unknown): any => {\n\t\tconst value = element ? readStyleValue(element, key) : target.read!(key)\n\t\treturn value === undefined || value === ``\n\t\t\t? typeof fallback === `number`\n\t\t\t\t? key.startsWith(`scale`) || key === `opacity`\n\t\t\t\t\t? 1\n\t\t\t\t\t: 0\n\t\t\t\t: fallback\n\t\t\t: value\n\t}\n\tconst bindStyles = () => {\n\t\tstyles?.()\n\t\tif (element)\n\t\t\tstyles = styleEffect(\n\t\t\t\t[element],\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\t[...properties].map(([key, property]) => [key, property.values[0]]),\n\t\t\t\t) as any,\n\t\t\t)\n\t}\n\tconst ensure = (\n\t\tkey: string,\n\t\tgoal: MotionScalar | readonly number[],\n\t\tinitial: TargetValues | false,\n\t): AnimatedProperty => {\n\t\tconst existing = properties.get(key)\n\t\tif (existing) {\n\t\t\tif (existing.values.length !== (Array.isArray(goal) ? goal.length : 1))\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\treturn existing\n\t\t}\n\t\tconst base = read(key, goal) as MotionScalar | readonly number[]\n\t\tconst rest = !Array.isArray(goal) && Array.isArray(base) ? base[0]! : base\n\t\tlet start = initial === false ? goal : (initial[key] ?? rest)\n\t\tif (!Array.isArray(goal) && Array.isArray(start)) start = start[0]!\n\t\tif (\n\t\t\tArray.isArray(goal) &&\n\t\t\t(!Array.isArray(start) || start.length !== goal.length)\n\t\t)\n\t\t\tthrow new Error(`spa/motion: ${key} requires matching numeric tuples`)\n\t\tconst values = (Array.isArray(start) ? start : [start]).map((value) =>\n\t\t\tmotionValue(value),\n\t\t) as MotionValue<MotionScalar>[]\n\t\tconst unsubscribers: (() => void)[] = []\n\t\tif (element) {\n\t\t\tif (Array.isArray(goal))\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: DOM targets must be scalar styles or transforms`,\n\t\t\t\t)\n\t\t\tconst cssKey = transform.test(key)\n\t\t\t\t? `transform`\n\t\t\t\t: key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n\t\t\tif (!originalStyles.has(cssKey))\n\t\t\t\toriginalStyles.set(cssKey, {\n\t\t\t\t\tvalue: element.style.getPropertyValue(cssKey),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(cssKey),\n\t\t\t\t})\n\t\t} else {\n\t\t\tconst write = () => {\n\t\t\t\ttarget.write!(\n\t\t\t\t\tkey,\n\t\t\t\t\tArray.isArray(goal)\n\t\t\t\t\t\t? values.map((value) => value.get())\n\t\t\t\t\t\t: values[0].get(),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const value of values) unsubscribers.push(value.on(`change`, write))\n\t\t\twrite()\n\t\t}\n\t\tconst property: AnimatedProperty = {\n\t\t\tvalues,\n\t\t\tbase,\n\t\t\trest,\n\t\t\ttarget: start,\n\t\t\trelease() {\n\t\t\t\tfor (const release of unsubscribers) release()\n\t\t\t\tfor (const value of values) value.destroy()\n\t\t\t},\n\t\t}\n\t\tproperties.set(key, property)\n\t\treturn property\n\t}\n\tconst refresh = () => {\n\t\tif (dead) return\n\t\tconst initial = (props[`initial`] ?? {}) as TargetValues | false\n\t\tconst animateTo = (props[`animate`] ?? {}) as TargetValues\n\t\tconst hoverTo = (props[`whileHover`] ?? {}) as TargetValues\n\t\tconst tapTo = (props[`whileTap`] ?? {}) as TargetValues\n\t\tconst goals = {\n\t\t\t...animateTo,\n\t\t\t...(hovered ? hoverTo : {}),\n\t\t\t...(tapped ? tapTo : {}),\n\t\t}\n\t\tconst keys = new Set([\n\t\t\t...Object.keys(initial || {}),\n\t\t\t...Object.keys(animateTo),\n\t\t\t...Object.keys(hoverTo),\n\t\t\t...Object.keys(tapTo),\n\t\t])\n\t\tlet added = false\n\t\tfor (const key of keys) {\n\t\t\tconst sample =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\thoverTo[key] ??\n\t\t\t\ttapTo[key]\n\t\t\tif (sample === undefined) continue\n\t\t\tconst had = properties.has(key)\n\t\t\tensure(key, sample, started ? {} : initial)\n\t\t\tif (!had) added = true\n\t\t}\n\t\tif (added) bindStyles()\n\t\tconst transition = (props[`transition`] ?? {\n\t\t\ttype: `spring`,\n\t\t}) as ValueAnimationTransition\n\t\tfor (const [key, property] of properties) {\n\t\t\tconst goal =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\tproperty.rest\n\t\t\tif (equal(property.target, goal)) continue\n\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\tconst next = Array.isArray(goal) ? goal : [goal]\n\t\t\tif (next.length !== property.values.length)\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\tproperty.values.forEach((value, index) => {\n\t\t\t\tif (reduced() || (!started && initial === false)) value.jump(next[index])\n\t\t\t\telse animate(value, next[index], transition)\n\t\t\t})\n\t\t}\n\t\tstarted = true\n\t}\n\tconst clearGestures = () => {\n\t\tfor (const release of gestures) release()\n\t\tgestures = []\n\t}\n\tconst installGestures = () => {\n\t\tclearGestures()\n\t\tif (element) {\n\t\t\tif (props[`whileHover`])\n\t\t\t\tgestures.push(\n\t\t\t\t\thover([element], () => {\n\t\t\t\t\t\thovered = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\thovered = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\tif (props[`whileTap`])\n\t\t\t\tgestures.push(\n\t\t\t\t\tpress([element], () => {\n\t\t\t\t\t\ttapped = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttapped = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t} else if (props[`whileHover`] || props[`whileTap`]) {\n\t\t\tif (!target.listen)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: ${target.kind} gestures require a renderer event adapter`,\n\t\t\t\t)\n\t\t\tconst listen = (event: string, run: () => void) =>\n\t\t\t\tgestures.push(target.listen!(event, run))\n\t\t\tlisten(`pointerenter`, () => {\n\t\t\t\thovered = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerleave`, () => {\n\t\t\t\thovered = false\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerdown`, () => {\n\t\t\t\ttapped = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerup`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointercancel`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\tconst preferenceChanged = () => {\n\t\tif (reduced()) {\n\t\t\tfor (const property of properties.values()) {\n\t\t\t\tconst goal = Array.isArray(property.target)\n\t\t\t\t\t? property.target\n\t\t\t\t\t: [property.target]\n\t\t\t\tproperty.values.forEach((value, i) => {\n\t\t\t\t\tvalue.jump(goal[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tpreference?.addEventListener(`change`, preferenceChanged)\n\treturn {\n\t\tupdate(next) {\n\t\t\tif (dead) return\n\t\t\tfor (const key of Object.keys(next))\n\t\t\t\tif (!allowed.has(key))\n\t\t\t\t\tthrow new Error(`spa/motion: unknown property motion:${key}`)\n\t\t\tconst gestureChange =\n\t\t\t\t!started ||\n\t\t\t\tBoolean(next[`whileHover`]) !== Boolean(props[`whileHover`]) ||\n\t\t\t\tBoolean(next[`whileTap`]) !== Boolean(props[`whileTap`])\n\t\t\tprops = next\n\t\t\tif (gestureChange) installGestures()\n\t\t\trefresh()\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tclearGestures()\n\t\t\tpreference?.removeEventListener(`change`, preferenceChanged)\n\t\t\tstyles?.()\n\t\t\tfor (const [key, property] of properties) {\n\t\t\t\tproperty.release()\n\t\t\t\tif (!element) target.write!(key, property.base)\n\t\t\t}\n\t\t\tfor (const [key, value] of originalStyles) {\n\t\t\t\tif (value.value)\n\t\t\t\t\telement!.style.setProperty(key, value.value, value.priority)\n\t\t\t\telse element!.style.removeProperty(key)\n\t\t\t}\n\t\t\tproperties.clear()\n\t\t},\n\t}\n}\n\n/** Explicit, root-scoped motion:* integration. Importing it never registers globally. */\nexport function motionCapability(\n\toptions: MotionCapabilityOptions = {},\n): Capability {\n\treturn {\n\t\tnamespace: `motion`,\n\t\tattach: (target) => attach(target, options),\n\t\tscheduleFrame(callback) {\n\t\t\tconst run = ({ timestamp }: { timestamp: number }) => {\n\t\t\t\tcallback(timestamp)\n\t\t\t}\n\t\t\tframe.render(run, true)\n\t\t\treturn () => {\n\t\t\t\tcancelFrame(run)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;AAyGA,MAAM,YACL;AACD,MAAM,0BAAU,IAAI,IAAI;CACvB;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,MAAM,GAAY,GAAqB;CAC/C,OACC,OAAO,GAAG,GAAG,CAAC,KACb,MAAM,QAAQ,CAAC,KACf,MAAM,QAAQ,CAAC,KACf,EAAE,WAAW,EAAE,UACf,EAAE,OAAO,OAAO,UAAU,OAAO,GAAG,OAAO,EAAE,MAAM,CAAC;AAEvD;AAEA,SAAS,OACR,QACA,SACoB;CACpB,IAAI,OAAO,SAAS,UAAU,CAAC,OAAO,QAAQ,CAA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ACZ,IAAI,MAAM;GACV,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GACjC,IAAI,CAAC,QAAQ,IAAI,GAAG,GACnB,MAAM,IAAI,MAAM,uCAAuC,KAAK;GAC9D,MAAM,gBACL,CAAC,WACD,QAAQ,KAAK,aAAa,MAAM,QAAQ,MAAM,aAAa,KAC3D,QAAQ,KAAK,WAAW,MAAM,QAAQ,MAAM,WAAW;GACxD,QAAQ;GACR,IAAI,eAAe,gBAAgB;GACnC,QAAQ;EACT;EACA,UAAU;GACT,IAAI,MAAM;GACV,OAAO;GACP,cAAc;GACd,YAAY,oBAAoB,UAAU,iBAAiB;GAC3D,SAAS;GACT,KAAK,MAAM,CAAC,KAAK,aAAa,YAAY;IACzC,SAAS,QAAQ;IACjB,IAAI,CAAC,SAAS,OAAO,MAAO,KAAK,SAAS,IAAI;GAC/C;GACA,KAAK,MAAM,CAAC,KAAK,UAAU,gBAC1B,IAAI,MAAM,OACT,QAAS,MAAM,YAAY,KAAK,MAAM,OAAO,MAAM,QAAQ;QACvD,QAAS,MAAM,eAAe,GAAG;GAEvC,WAAW,MAAM;EAClB;CACD;AACD;;AAGA,SAAgB,iBACf,UAAmC,CAAC,GACvB;CACb,OAAO;EACN,WAAW;EACX,SAAS,WAAW,OAAO,QAAQ,OAAO;EAC1C,cAAc,UAAU;GACvB,MAAM,OAAO,EAAE,gBAAuC;IACrD,SAAS,SAAS;GACnB;GACA,MAAM,OAAO,KAAK,IAAI;GACtB,aAAa;IACZ,YAAY,GAAG;GAChB;EACD;CACD;AACD"}
1
+ {"version":3,"file":"motion.js","names":[],"sources":["../src/motion-tween.ts","../src/presence.ts","../src/motion.ts"],"sourcesContent":["import type { MotionValue, ValueAnimationTransition } from \"motion\"\nimport { animate, keyframes } from \"motion\"\n\nimport type { MotionScalar } from \"./motion.ts\"\n\nconst trajectories = new WeakMap<\n\tMotionValue<MotionScalar>,\n\t() => { position: number; velocity: number }\n>()\nconst scalar = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?)([a-z%]*)$/i\nconst brake = (progress: number) => progress * (2 - progress)\nconst returnToTarget = (progress: number) =>\n\tprogress * progress * (3 - 2 * progress)\n\n/** Retarget a moving tween without changing its position or velocity at the join. */\nexport function animateTween(\n\tvalue: MotionValue<MotionScalar>,\n\tgoal: MotionScalar,\n\ttransition: ValueAnimationTransition,\n\tinterrupted: boolean,\n): ReturnType<typeof animate> {\n\tif (interrupted) value.stop()\n\tconst current = value.get()\n\tconst from =\n\t\ttypeof current === `number` ? [``, current, ``] : scalar.exec(current)\n\tconst to = typeof goal === `number` ? [``, goal, ``] : scalar.exec(goal)\n\tconst previous = trajectories.get(value)?.()\n\tconst velocity =\n\t\tprevious && from && Math.abs(previous.position - Number(from[1])) < 0.001\n\t\t\t? previous.velocity\n\t\t\t: value.getVelocity()\n\ttrajectories.delete(value)\n\tconst duration = transition.duration ?? 0.3\n\t// A duration/ease without an explicit type is also a Motion tween. Springs keep\n\t// Motion's own velocity-aware integration; discrete values keep native mixing.\n\tconst tween =\n\t\ttransition.type === `tween` ||\n\t\t(transition.type === undefined &&\n\t\t\t(transition.duration !== undefined || transition.ease !== undefined))\n\tconst moving =\n\t\tinterrupted &&\n\t\ttween &&\n\t\tfrom &&\n\t\tto &&\n\t\tfrom[2] === to[2] &&\n\t\tNumber.isFinite(velocity) &&\n\t\tvelocity !== 0 &&\n\t\tduration > 0\n\tconst braking = 0.2\n\tconst turn = from ? Number(from[1]) + (velocity * duration * braking) / 2 : 0\n\tconst waypoint = typeof current === `number` ? turn : `${turn}${from?.[2]}`\n\tconst frames = moving ? [current, waypoint, goal] : [current, goal]\n\t// Constant deceleration: dx/dt at t=0 is v, and at the waypoint is zero.\n\t// The return starts and ends at rest. Keyframes also handle goal === current.\n\tconst next = moving\n\t\t? {\n\t\t\t\t...transition,\n\t\t\t\ttype: `tween` as const,\n\t\t\t\tduration,\n\t\t\t\tdelay: 0,\n\t\t\t\ttimes: [0, braking, 1],\n\t\t\t\tease: [brake, returnToTarget],\n\t\t\t}\n\t\t: transition\n\t// Values are already resolved. Synchronous numeric tweens also keep cancelled,\n\t// not-yet-started resolver work from being revived by a timeline read.\n\tconst controls = animate(\n\t\tvalue,\n\t\tframes,\n\t\ttween && (moving || current !== goal) ? { ...next, isSync: true } : next,\n\t)\n\tif (\n\t\ttween &&\n\t\t(moving || current !== goal) &&\n\t\tfrom &&\n\t\tto &&\n\t\tfrom[2] === to[2] &&\n\t\tduration > 0\n\t) {\n\t\tconst curve = keyframes({\n\t\t\tkeyframes: moving\n\t\t\t\t? [Number(from[1]), turn, Number(to[1])]\n\t\t\t\t: [Number(from[1]), Number(to[1])],\n\t\t\tduration: duration * 1000,\n\t\t\ttimes: moving ? [0, braking, 1] : [0, 1],\n\t\t\tease: next.ease ?? `easeOut`,\n\t\t})\n\t\tconst sample = (at: number) => curve.next(at * 1000).value\n\n\t\t// Use the tween's own timeline. Frame-estimated MotionValue velocity becomes\n\t\t// noisy when stop/resume happen several times within the same render frame.\n\t\ttrajectories.set(value, () => {\n\t\t\tconst at = Math.max(0, Math.min(duration, controls.time))\n\t\t\tconst before = Math.max(0, at - 0.0001),\n\t\t\t\tafter = Math.min(duration, at + 0.0001)\n\t\t\treturn {\n\t\t\t\tposition: sample(at),\n\t\t\t\tvelocity:\n\t\t\t\t\tat <= 0 || at >= duration\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: (sample(after) - sample(before)) / (after - before),\n\t\t\t}\n\t\t})\n\t}\n\treturn controls\n}\n","import type { CapabilityBinding } from \"./capabilities.ts\"\nimport type { Cleanup, Root, Scope } from \"./core.ts\"\nimport { dispose, fail, invalidate, isPresent, untrack } from \"./core.ts\"\n\nexport interface ExitHandle {\n\tfinished: Promise<void>\n\tcancel(): void\n}\nexport interface ExitParticipant {\n\texit(): ExitHandle | undefined\n\tresume(): void\n}\nexport interface PresenceTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n}\nexport interface PresenceCollection<T, V> {\n\ttake(key: unknown, value: V): T | undefined\n\tremove(\n\t\trecord: T,\n\t\tkey: unknown,\n\t\teligible: boolean,\n\t\tindex: number,\n\t\tdone: Cleanup,\n\t): void\n\tmerge(records: T[]): T[]\n}\nexport interface PresenceCoordinator {\n\tcollection<T, V>(\n\t\tscope: (record: T) => Scope,\n\t\tcompatible: (record: T, value: V) => boolean,\n\t): PresenceCollection<T, V>\n\ttarget(scope: Scope, target: PresenceTarget): void\n\tbind(\n\t\tscope: Scope,\n\t\tbinding: CapabilityBinding,\n\t\tread: () => Record<string, unknown>,\n\t\tnamespace: string,\n\t): void\n\tunbind(binding: CapabilityBinding): void\n\tevent(scope: Scope, handler: Function): Function\n\tremove(scope: Scope, done: Cleanup): boolean\n\tresume(scope: Scope): void\n\tforget(scope: Scope): void\n}\ninterface Session {\n\tscope: Scope\n\tparticipant: ExitParticipant\n\thandle: ExitHandle\n\tdone: boolean\n\tcancelled: boolean\n}\ninterface Group {\n\tscope: Scope\n\tsessions: Session[]\n\tdone: Cleanup\n}\n\n/** Optional coordinator: only imported by integrations that support retention. */\nexport function createPresence(root: Root): PresenceCoordinator {\n\tconst releases = new Map<CapabilityBinding, Cleanup>()\n\tconst handlers = new WeakMap<Scope, WeakMap<Function, Function>>()\n\t// Groups own absent ranges; sessions can be shared when a parent adopts a child exit.\n\tconst groups = new Map<Scope, Group>()\n\tconst sessions = new Set<Session>()\n\tconst active = new Map<ExitParticipant, Session>()\n\tconst suspended = new Map<PresenceTarget, { scope: Scope; restore: Cleanup }>()\n\tconst suspend = (target: PresenceTarget): Cleanup => {\n\t\tif (target.kind !== `dom`) return target.suspend!()\n\t\tconst node = target.node as HTMLElement\n\t\tconst inert = node.getAttribute(`inert`),\n\t\t\thidden = node.getAttribute(`aria-hidden`)\n\t\tconst pointer = node.style.getPropertyValue(`pointer-events`),\n\t\t\tpriority = node.style.getPropertyPriority(`pointer-events`)\n\t\tconst focused = node.ownerDocument.activeElement as HTMLElement | null\n\t\tif (focused && node.contains(focused)) focused.blur()\n\t\tnode.setAttribute(`inert`, ``)\n\t\tnode.setAttribute(`aria-hidden`, `true`)\n\t\tnode.style.setProperty(`pointer-events`, `none`, `important`)\n\t\treturn () => {\n\t\t\tfor (const [key, value] of [\n\t\t\t\t[`inert`, inert],\n\t\t\t\t[`aria-hidden`, hidden],\n\t\t\t] as const) {\n\t\t\t\tif (value === null) node.removeAttribute(key)\n\t\t\t\telse node.setAttribute(key, value)\n\t\t\t}\n\t\t\tif (pointer) node.style.setProperty(`pointer-events`, pointer, priority)\n\t\t\telse node.style.removeProperty(`pointer-events`)\n\t\t}\n\t}\n\tconst walk = (scope: Scope, visit: (scope: Scope) => void) => {\n\t\tconst descend = (at: Scope) => {\n\t\t\tvisit(at)\n\t\t\tfor (const child of at._cleanups)\n\t\t\t\tif (typeof child !== `function`) descend(child)\n\t\t}\n\t\tdescend(scope)\n\t}\n\tconst ancestor = (scope: Scope, parent: Scope) => {\n\t\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\t\tif (at === parent) return true\n\t\treturn false\n\t}\n\tconst report = (error: unknown) => {\n\t\tif (root._dead) return\n\t\ttry {\n\t\t\tfail(root, error)\n\t\t} catch (failure) {\n\t\t\troot.error(failure)\n\t\t}\n\t}\n\tconst finish = () => {\n\t\tfor (const group of [...groups.values()]) {\n\t\t\tif (group.scope._dead || group.sessions.some((session) => !session.done))\n\t\t\t\tcontinue\n\t\t\tif (\n\t\t\t\t[...groups.keys()].some(\n\t\t\t\t\t(scope) => scope !== group.scope && ancestor(group.scope, scope),\n\t\t\t\t)\n\t\t\t)\n\t\t\t\tcontinue\n\t\t\tgroups.delete(group.scope)\n\t\t\ttry {\n\t\t\t\tgroup.done()\n\t\t\t} catch (error) {\n\t\t\t\treport(error)\n\t\t\t}\n\t\t}\n\t}\n\tconst cancel = (session: Session) => {\n\t\tsession.cancelled = true\n\t\tsessions.delete(session)\n\t\tactive.delete(session.participant)\n\t\tsession.handle.cancel()\n\t}\n\tconst coordinator: PresenceCoordinator = {\n\t\ttarget(scope, target) {\n\t\t\t;(scope._targets ??= new Set()).add(target)\n\t\t\tscope._cleanups.add(() => {\n\t\t\t\tscope._targets!.delete(target)\n\t\t\t})\n\t\t},\n\t\tbind(scope, binding, props, namespace) {\n\t\t\tconst read = () =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries(props())\n\t\t\t\t\t\t.filter(([key]) => key.startsWith(`${namespace}:`))\n\t\t\t\t\t\t.map(([key, value]) => [key.slice(namespace.length + 1), value]),\n\t\t\t\t)\n\t\t\tif (!binding.exit) return\n\t\t\tconst participant = {\n\t\t\t\texit: () => binding.exit!(untrack(read)),\n\t\t\t\tresume() {\n\t\t\t\t\tbinding.update(untrack(read))\n\t\t\t\t\tbinding.resume?.()\n\t\t\t\t},\n\t\t\t}\n\t\t\t;(scope._exits ??= new Set()).add(participant)\n\t\t\tconst release = () => {\n\t\t\t\tscope._exits!.delete(participant)\n\t\t\t\tscope._cleanups.delete(release)\n\t\t\t\treleases.delete(binding)\n\t\t\t}\n\t\t\treleases.set(binding, release)\n\t\t\tscope._cleanups.add(release)\n\t\t},\n\t\tunbind(binding) {\n\t\t\treleases.get(binding)?.()\n\t\t},\n\t\tevent(scope, handler) {\n\t\t\tconst cached = handlers.get(scope) ?? new WeakMap<Function, Function>()\n\t\t\thandlers.set(scope, cached)\n\t\t\tif (!cached.has(handler))\n\t\t\t\tcached.set(handler, function (this: unknown, ...args: unknown[]) {\n\t\t\t\t\tif (isPresent(scope)) return handler.apply(this, args)\n\t\t\t\t})\n\t\t\treturn cached.get(handler)!\n\t\t},\n\t\tcollection<T, V>(\n\t\t\tscopeOf: (record: T) => Scope,\n\t\t\tcompatible: (record: T, value: V) => boolean,\n\t\t): PresenceCollection<T, V> {\n\t\t\tlet order: T[] = []\n\t\t\tconst exiting = new Map<\n\t\t\t\tT,\n\t\t\t\t{ key: unknown; eligible: boolean; index: number }\n\t\t\t>()\n\t\t\treturn {\n\t\t\t\ttake(key, value) {\n\t\t\t\t\t// Empty conditional children do not replace an exiting generation.\n\t\t\t\t\tif (value == null || typeof value === `boolean`) return undefined\n\t\t\t\t\tfor (const [record, state] of exiting)\n\t\t\t\t\t\tif (state.eligible && state.key === key) {\n\t\t\t\t\t\t\tif (!compatible(record, value)) {\n\t\t\t\t\t\t\t\tstate.eligible = false\n\t\t\t\t\t\t\t\treturn undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\texiting.delete(record)\n\t\t\t\t\t\t\treturn record\n\t\t\t\t\t\t}\n\t\t\t\t\treturn undefined\n\t\t\t\t},\n\t\t\t\tremove(record, key, eligible, index, done) {\n\t\t\t\t\tconst position = order.indexOf(record)\n\t\t\t\t\tconst state = { key, eligible, index: position < 0 ? index : position }\n\t\t\t\t\texiting.set(record, state)\n\t\t\t\t\tlet pending = false\n\t\t\t\t\tconst release = () => {\n\t\t\t\t\t\tdispose(scopeOf(record))\n\t\t\t\t\t\texiting.delete(record)\n\t\t\t\t\t\torder = order.filter((item) => item !== record)\n\t\t\t\t\t\tfor (const other of exiting.values())\n\t\t\t\t\t\t\tif (other.index > state.index) other.index--\n\t\t\t\t\t\tif (pending) done()\n\t\t\t\t\t}\n\t\t\t\t\tpending = coordinator.remove(scopeOf(record), release)\n\t\t\t\t\tif (!pending) release()\n\t\t\t\t},\n\t\t\t\tmerge(records) {\n\t\t\t\t\tconst rendered = [...records]\n\t\t\t\t\tfor (const [record, state] of [...exiting].sort(\n\t\t\t\t\t\t(a, b) => a[1].index - b[1].index,\n\t\t\t\t\t)) {\n\t\t\t\t\t\trendered.splice(Math.min(state.index, rendered.length), 0, record)\n\t\t\t\t\t\tstate.index = rendered.indexOf(record)\n\t\t\t\t\t}\n\t\t\t\t\t// DOM reconciliation reverses its result while moving ranges. Keep a snapshot.\n\t\t\t\t\torder = [...rendered]\n\t\t\t\t\treturn rendered\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tremove(scope, done) {\n\t\t\tconst collected: Session[] = []\n\t\t\twalk(scope, (at) => {\n\t\t\t\tfor (const participant of at._exits ?? []) {\n\t\t\t\t\tlet session = active.get(participant)\n\t\t\t\t\tif (!session) {\n\t\t\t\t\t\tconst handle = untrack(() => participant.exit())\n\t\t\t\t\t\tif (!handle) continue\n\t\t\t\t\t\tsession = {\n\t\t\t\t\t\t\tscope: at,\n\t\t\t\t\t\t\tparticipant,\n\t\t\t\t\t\t\thandle,\n\t\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsessions.add(session)\n\t\t\t\t\t\tactive.set(participant, session)\n\t\t\t\t\t\tconst held = session\n\t\t\t\t\t\tvoid handle.finished.then(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tif (held.cancelled || root._dead) return\n\t\t\t\t\t\t\t\theld.done = true\n\t\t\t\t\t\t\t\tfinish()\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t\tif (!held.cancelled) report(error)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tcollected.push(session)\n\t\t\t\t}\n\t\t\t})\n\t\t\tif (!collected.some((session) => !session.done)) return false\n\t\t\tscope._exiting = true\n\t\t\tgroups.set(scope, { scope, sessions: collected, done })\n\t\t\twalk(scope, (at) => {\n\t\t\t\tfor (const target of at._targets ?? [])\n\t\t\t\t\tif (\n\t\t\t\t\t\t!suspended.has(target) &&\n\t\t\t\t\t\t(target.kind === `dom` || target.suspend)\n\t\t\t\t\t)\n\t\t\t\t\t\tsuspended.set(target, { scope: at, restore: suspend(target) })\n\t\t\t})\n\t\t\treturn true\n\t\t},\n\t\tresume(scope) {\n\t\t\tif (!groups.delete(scope)) return\n\t\t\tscope._exiting = false\n\t\t\tfor (const session of [...sessions])\n\t\t\t\tif (ancestor(session.scope, scope) && isPresent(session.scope)) {\n\t\t\t\t\tcancel(session)\n\t\t\t\t}\n\t\t\twalk(scope, (at) => {\n\t\t\t\tif (isPresent(at))\n\t\t\t\t\tfor (const participant of at._exits ?? []) participant.resume()\n\t\t\t})\n\t\t\tfor (const [target, state] of suspended)\n\t\t\t\tif (isPresent(state.scope)) {\n\t\t\t\t\tsuspended.delete(target)\n\t\t\t\t\tstate.restore()\n\t\t\t\t}\n\t\t\tinvalidate(scope)\n\t\t\t// Reconcile returning descendants before releasing their adopted, completed exits.\n\t\t\tqueueMicrotask(finish)\n\t\t},\n\t\tforget(scope) {\n\t\t\tconst errors: unknown[] = []\n\t\t\tfor (const session of [...sessions])\n\t\t\t\tif (ancestor(session.scope, scope)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcancel(session)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tfor (const at of groups.keys()) if (ancestor(at, scope)) groups.delete(at)\n\t\t\tfor (const [target, state] of suspended)\n\t\t\t\tif (ancestor(state.scope, scope)) {\n\t\t\t\t\tsuspended.delete(target)\n\t\t\t\t\ttry {\n\t\t\t\t\t\tstate.restore()\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tif (errors.length) throw new AggregateError(errors)\n\t\t},\n\t}\n\treturn coordinator\n}\n","import type { animate, MotionValue, ValueAnimationTransition } from \"motion\"\nimport {\n\tcancelFrame,\n\tframe,\n\thover,\n\tmotionValue,\n\tpress,\n\treadStyleValue,\n\tstyleEffect,\n} from \"motion\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport { animateTween } from \"./motion-tween.ts\"\nimport type { ExitHandle } from \"./presence.ts\"\nimport { createPresence } from \"./presence.ts\"\n\nexport type MotionScalar = number | string\nexport type MotionDOMTarget = Partial<\n\tRecord<\n\t\t| keyof CSSStyleDeclaration\n\t\t| `x`\n\t\t| `y`\n\t\t| `z`\n\t\t| `scale`\n\t\t| `scaleX`\n\t\t| `scaleY`\n\t\t| `rotate`\n\t\t| `rotateX`\n\t\t| `rotateY`\n\t\t| `rotateZ`\n\t\t| `skewX`\n\t\t| `skewY`\n\t\t| `--${string}`,\n\t\tMotionScalar\n\t>\n>\nexport interface MotionThreeTarget {\n\tposition?: readonly [number, number, number]\n\trotation?: readonly [number, number, number]\n\tscale?: number | readonly [number, number, number]\n\topacity?: number\n\tintensity?: number\n\tcolor?: string\n}\nexport type MotionTarget<Kind extends string> = Kind extends `dom`\n\t? MotionDOMTarget\n\t: Kind extends `three`\n\t\t? MotionThreeTarget\n\t\t: Record<string, MotionScalar>\n/** Supported transition options; keep public declarations independent of optional peer types. */\nexport interface MotionTransition {\n\ttype?: `spring` | `tween`\n\tstiffness?: number\n\tdamping?: number\n\tmass?: number\n\tvelocity?: number\n\trestSpeed?: number\n\trestDelta?: number\n\tbounce?: number\n\tvisualDuration?: number\n\tduration?: number\n\tdelay?: number\n\tease?:\n\t\t| `linear`\n\t\t| `easeIn`\n\t\t| `easeOut`\n\t\t| `easeInOut`\n\t\t| `circIn`\n\t\t| `circOut`\n\t\t| `circInOut`\n\t\t| `backIn`\n\t\t| `backOut`\n\t\t| `backInOut`\n\t\t| readonly [number, number, number, number]\n}\nexport interface MotionAttributes<Kind extends string = `dom`> {\n\t[`motion:initial`]?: MotionTarget<Kind> | false\n\t[`motion:animate`]?: MotionTarget<Kind>\n\t[`motion:exit`]?: MotionTarget<Kind>\n\t[`motion:transition`]?: MotionTransition\n\t[`motion:whileHover`]?: MotionTarget<Kind>\n\t[`motion:whileTap`]?: MotionTarget<Kind>\n}\n\n// eslint-disable-next-line quotes -- TypeScript module augmentation requires a string literal.\ndeclare module \"@atom.io/spa/jsx-runtime\" {\n\t// oxlint-disable-next-line typescript/no-empty-interface -- Declaration merging adds optional motion attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends MotionAttributes<Kind> {}\n}\n\nexport interface MotionCapabilityOptions {\n\t/** Respect the user's reduced-motion preference by default. */\n\treducedMotion?: `user` | `always` | `never`\n}\ntype TargetValues = Record<string, MotionScalar | readonly number[]>\ninterface AnimatedProperty {\n\tvalues: MotionValue<MotionScalar>[]\n\tbase: MotionScalar | readonly number[]\n\trest: MotionScalar | readonly number[]\n\ttarget: MotionScalar | readonly number[]\n\trelease(): void\n}\nconst transform =\n\t/^(x|y|z|translate.*|scale.*|rotate.*|skew.*|transformPerspective)$/\nconst allowed = new Set([\n\t`initial`,\n\t`animate`,\n\t`exit`,\n\t`transition`,\n\t`whileHover`,\n\t`whileTap`,\n])\nfunction equal(a: unknown, b: unknown): boolean {\n\treturn (\n\t\tObject.is(a, b) ||\n\t\t(Array.isArray(a) &&\n\t\t\tArray.isArray(b) &&\n\t\t\ta.length === b.length &&\n\t\t\ta.every((value, index) => Object.is(value, b[index])))\n\t)\n}\n\nfunction attach(\n\ttarget: CapabilityTarget,\n\toptions: MotionCapabilityOptions,\n): CapabilityBinding {\n\tif (target.kind !== `dom` && (!target.read || !target.write))\n\t\tthrow new Error(\n\t\t\t`spa/motion: renderer ${target.kind} does not support motion`,\n\t\t)\n\tconst element =\n\t\ttarget.kind === `dom` ? (target.node as HTMLElement | SVGElement) : undefined\n\tconst properties = new Map<string, AnimatedProperty>()\n\tconst originalStyles = new Map<string, { value: string; priority: string }>()\n\tlet styles: (() => void) | undefined\n\tlet props: Record<string, unknown> = {}\n\tlet hovered = false\n\tlet tapped = false\n\tlet started = false\n\tlet dead = false\n\tlet exiting = false\n\tlet exitHandle: ExitHandle | undefined\n\tlet gestures: (() => void)[] = []\n\tconst preference =\n\t\toptions.reducedMotion !== `never` && typeof matchMedia === `function`\n\t\t\t? matchMedia(`(prefers-reduced-motion: reduce)`)\n\t\t\t: undefined\n\tconst reduced = () =>\n\t\toptions.reducedMotion === `always` ||\n\t\t(options.reducedMotion !== `never` && preference?.matches)\n\tconst read = (key: string, fallback: unknown): any => {\n\t\tconst value = element ? readStyleValue(element, key) : target.read!(key)\n\t\treturn value === undefined || value === ``\n\t\t\t? typeof fallback === `number`\n\t\t\t\t? key.startsWith(`scale`) || key === `opacity`\n\t\t\t\t\t? 1\n\t\t\t\t\t: 0\n\t\t\t\t: fallback\n\t\t\t: value\n\t}\n\tconst bindStyles = () => {\n\t\tstyles?.()\n\t\tif (element)\n\t\t\tstyles = styleEffect(\n\t\t\t\t[element],\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\t[...properties].map(([key, property]) => [key, property.values[0]]),\n\t\t\t\t) as any,\n\t\t\t)\n\t}\n\tconst ensure = (\n\t\tkey: string,\n\t\tgoal: MotionScalar | readonly number[],\n\t\tinitial: TargetValues | false,\n\t): AnimatedProperty => {\n\t\tconst existing = properties.get(key)\n\t\tif (existing) {\n\t\t\tif (existing.values.length !== (Array.isArray(goal) ? goal.length : 1))\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\treturn existing\n\t\t}\n\t\tconst base = read(key, goal) as MotionScalar | readonly number[]\n\t\tconst rest = !Array.isArray(goal) && Array.isArray(base) ? base[0]! : base\n\t\tlet start = initial === false ? goal : (initial[key] ?? rest)\n\t\tif (!Array.isArray(goal) && Array.isArray(start)) start = start[0]!\n\t\tif (\n\t\t\tArray.isArray(goal) &&\n\t\t\t(!Array.isArray(start) || start.length !== goal.length)\n\t\t)\n\t\t\tthrow new Error(`spa/motion: ${key} requires matching numeric tuples`)\n\t\tconst values = (Array.isArray(start) ? start : [start]).map((value) =>\n\t\t\tmotionValue(value),\n\t\t) as MotionValue<MotionScalar>[]\n\t\tconst unsubscribers: (() => void)[] = []\n\t\tif (element) {\n\t\t\tif (Array.isArray(goal))\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: DOM targets must be scalar styles or transforms`,\n\t\t\t\t)\n\t\t\tconst cssKey = transform.test(key)\n\t\t\t\t? `transform`\n\t\t\t\t: key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)\n\t\t\tif (!originalStyles.has(cssKey))\n\t\t\t\toriginalStyles.set(cssKey, {\n\t\t\t\t\tvalue: element.style.getPropertyValue(cssKey),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(cssKey),\n\t\t\t\t})\n\t\t} else {\n\t\t\tconst write = () => {\n\t\t\t\ttarget.write!(\n\t\t\t\t\tkey,\n\t\t\t\t\tArray.isArray(goal)\n\t\t\t\t\t\t? values.map((value) => value.get())\n\t\t\t\t\t\t: values[0].get(),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const value of values) unsubscribers.push(value.on(`change`, write))\n\t\t\twrite()\n\t\t}\n\t\tconst property: AnimatedProperty = {\n\t\t\tvalues,\n\t\t\tbase,\n\t\t\trest,\n\t\t\ttarget: start,\n\t\t\trelease() {\n\t\t\t\tfor (const release of unsubscribers) release()\n\t\t\t\tfor (const value of values) value.destroy()\n\t\t\t},\n\t\t}\n\t\tproperties.set(key, property)\n\t\treturn property\n\t}\n\tconst refresh = (force = false) => {\n\t\tif (dead || exiting) return\n\t\tconst initial = (props[`initial`] ?? {}) as TargetValues | false\n\t\tconst animateTo = (props[`animate`] ?? {}) as TargetValues\n\t\tconst hoverTo = (props[`whileHover`] ?? {}) as TargetValues\n\t\tconst tapTo = (props[`whileTap`] ?? {}) as TargetValues\n\t\tconst goals = {\n\t\t\t...animateTo,\n\t\t\t...(hovered ? hoverTo : {}),\n\t\t\t...(tapped ? tapTo : {}),\n\t\t}\n\t\tconst keys = new Set([\n\t\t\t...Object.keys(initial || {}),\n\t\t\t...Object.keys(animateTo),\n\t\t\t...Object.keys(hoverTo),\n\t\t\t...Object.keys(tapTo),\n\t\t])\n\t\tlet added = false\n\t\tfor (const key of keys) {\n\t\t\tconst sample =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\thoverTo[key] ??\n\t\t\t\ttapTo[key]\n\t\t\tif (sample === undefined) continue\n\t\t\tconst had = properties.has(key)\n\t\t\tensure(key, sample, started ? {} : initial)\n\t\t\tif (!had) added = true\n\t\t}\n\t\tif (added) bindStyles()\n\t\tconst transition = (props[`transition`] ?? {\n\t\t\ttype: `spring`,\n\t\t}) as ValueAnimationTransition\n\t\tfor (const [key, property] of properties) {\n\t\t\tconst goal =\n\t\t\t\tgoals[key] ??\n\t\t\t\t(initial === false ? undefined : initial[key]) ??\n\t\t\t\tproperty.rest\n\t\t\tif (!force && equal(property.target, goal)) continue\n\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\tconst next = Array.isArray(goal) ? goal : [goal]\n\t\t\tif (next.length !== property.values.length)\n\t\t\t\tthrow new Error(`spa/motion: cannot change the shape of ${key}`)\n\t\t\tproperty.values.forEach((value, index) => {\n\t\t\t\tif (reduced() || (!started && initial === false)) value.jump(next[index])\n\t\t\t\telse\n\t\t\t\t\tanimateTween(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tnext[index],\n\t\t\t\t\t\ttransition,\n\t\t\t\t\t\tforce || value.isAnimating(),\n\t\t\t\t\t)\n\t\t\t})\n\t\t}\n\t\tstarted = true\n\t}\n\tconst clearGestures = () => {\n\t\tfor (const release of gestures) release()\n\t\tgestures = []\n\t}\n\tconst installGestures = () => {\n\t\tclearGestures()\n\t\tif (element) {\n\t\t\tif (props[`whileHover`])\n\t\t\t\tgestures.push(\n\t\t\t\t\thover([element], () => {\n\t\t\t\t\t\thovered = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\thovered = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\tif (props[`whileTap`])\n\t\t\t\tgestures.push(\n\t\t\t\t\tpress([element], () => {\n\t\t\t\t\t\ttapped = true\n\t\t\t\t\t\trefresh()\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\ttapped = false\n\t\t\t\t\t\t\trefresh()\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t} else if (props[`whileHover`] || props[`whileTap`]) {\n\t\t\tif (!target.listen)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`spa/motion: ${target.kind} gestures require a renderer event adapter`,\n\t\t\t\t)\n\t\t\tconst listen = (event: string, run: () => void) =>\n\t\t\t\tgestures.push(target.listen!(event, run))\n\t\t\tlisten(`pointerenter`, () => {\n\t\t\t\thovered = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerleave`, () => {\n\t\t\t\thovered = false\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerdown`, () => {\n\t\t\t\ttapped = true\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointerup`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t\tlisten(`pointercancel`, () => {\n\t\t\t\ttapped = false\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\tconst preferenceChanged = () => {\n\t\tif (reduced()) {\n\t\t\tfor (const property of properties.values()) {\n\t\t\t\tconst goal = Array.isArray(property.target)\n\t\t\t\t\t? property.target\n\t\t\t\t\t: [property.target]\n\t\t\t\tproperty.values.forEach((value, i) => {\n\t\t\t\t\tvalue.jump(goal[i])\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tconst finishExit = () => {\n\t\texitHandle?.cancel()\n\t}\n\tconst mediaChanged = () => {\n\t\tpreferenceChanged()\n\t\tif (reduced() && exiting) finishExit()\n\t}\n\tpreference?.addEventListener(`change`, mediaChanged)\n\treturn {\n\t\texit(next) {\n\t\t\tconst goals = next[`exit`] as TargetValues | undefined\n\t\t\texiting = true\n\t\t\thovered = tapped = false\n\t\t\tclearGestures()\n\t\t\tconst moving = new Set<MotionValue<MotionScalar>>()\n\t\t\tfor (const property of properties.values())\n\t\t\t\tfor (const value of property.values) {\n\t\t\t\t\tif (value.isAnimating()) moving.add(value)\n\t\t\t\t\tvalue.stop()\n\t\t\t\t}\n\t\t\tif (!goals || !Object.keys(goals).length || reduced()) return undefined\n\t\t\tconst transition = (next[`transition`] ?? {\n\t\t\t\ttype: `spring`,\n\t\t\t}) as MotionTransition\n\t\t\tfor (const key of [\n\t\t\t\t`duration`,\n\t\t\t\t`delay`,\n\t\t\t\t`visualDuration`,\n\t\t\t\t`velocity`,\n\t\t\t\t`bounce`,\n\t\t\t\t`stiffness`,\n\t\t\t\t`damping`,\n\t\t\t\t`mass`,\n\t\t\t\t`restDelta`,\n\t\t\t\t`restSpeed`,\n\t\t\t] as const) {\n\t\t\t\tconst value = transition[key]\n\t\t\t\tif (\n\t\t\t\t\tvalue !== undefined &&\n\t\t\t\t\t(!Number.isFinite(value) ||\n\t\t\t\t\t\t(key !== `velocity` && value < 0) ||\n\t\t\t\t\t\t(key === `bounce` && value >= 1) ||\n\t\t\t\t\t\t([`stiffness`, `damping`, `mass`, `restDelta`, `restSpeed`].includes(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\tvalue === 0))\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`spa/motion: exit requires a finite settling transition`,\n\t\t\t\t\t)\n\t\t\t}\n\t\t\tlet added = false\n\t\t\tfor (const [key, goal] of Object.entries(goals)) {\n\t\t\t\tconst had = properties.has(key)\n\t\t\t\tensure(key, goal, {})\n\t\t\t\tif (!had) added = true\n\t\t\t}\n\t\t\tif (added) bindStyles()\n\t\t\tlet settle!: () => void\n\t\t\tlet reject!: (error: unknown) => void\n\t\t\tconst finished = new Promise<void>((resolve, fail) => {\n\t\t\t\tsettle = resolve\n\t\t\t\treject = fail\n\t\t\t})\n\t\t\tconst controls: ReturnType<typeof animate>[] = []\n\t\t\tfor (const [key, goal] of Object.entries(goals)) {\n\t\t\t\tconst property = properties.get(key)!\n\t\t\t\tproperty.target = Array.isArray(goal) ? [...goal] : goal\n\t\t\t\tconst values = Array.isArray(goal) ? goal : [goal]\n\t\t\t\tproperty.values.forEach((value, index) =>\n\t\t\t\t\tcontrols.push(\n\t\t\t\t\t\tanimateTween(\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\tvalues[index],\n\t\t\t\t\t\t\ttransition as ValueAnimationTransition,\n\t\t\t\t\t\t\tmoving.has(value),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t\tvoid Promise.all(controls.map((control) => Promise.resolve(control))).then(\n\t\t\t\tsettle,\n\t\t\t\treject,\n\t\t\t)\n\t\t\texitHandle = {\n\t\t\t\tfinished,\n\t\t\t\tcancel() {\n\t\t\t\t\tfor (const control of controls) control.stop()\n\t\t\t\t\tsettle()\n\t\t\t\t},\n\t\t\t}\n\t\t\treturn exitHandle\n\t\t},\n\t\tresume() {\n\t\t\tif (dead) return\n\t\t\texitHandle?.cancel()\n\t\t\texitHandle = undefined\n\t\t\texiting = false\n\t\t\tinstallGestures()\n\t\t\trefresh(true)\n\t\t},\n\t\tupdate(next) {\n\t\t\tif (dead) return\n\t\t\tfor (const key of Object.keys(next))\n\t\t\t\tif (!allowed.has(key))\n\t\t\t\t\tthrow new Error(`spa/motion: unknown property motion:${key}`)\n\t\t\tconst gestureChange =\n\t\t\t\t!started ||\n\t\t\t\tBoolean(next[`whileHover`]) !== Boolean(props[`whileHover`]) ||\n\t\t\t\tBoolean(next[`whileTap`]) !== Boolean(props[`whileTap`])\n\t\t\tprops = next\n\t\t\tif (gestureChange && !exiting) installGestures()\n\t\t\trefresh()\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tclearGestures()\n\t\t\texitHandle?.cancel()\n\t\t\tpreference?.removeEventListener(`change`, mediaChanged)\n\t\t\tstyles?.()\n\t\t\tfor (const [key, property] of properties) {\n\t\t\t\tproperty.release()\n\t\t\t\tif (!element) target.write!(key, property.base)\n\t\t\t}\n\t\t\tfor (const [key, value] of originalStyles) {\n\t\t\t\tif (value.value)\n\t\t\t\t\telement!.style.setProperty(key, value.value, value.priority)\n\t\t\t\telse element!.style.removeProperty(key)\n\t\t\t}\n\t\t\tproperties.clear()\n\t\t},\n\t}\n}\n\n/** Explicit, root-scoped motion:* integration. Importing it never registers globally. */\nexport function motionCapability(\n\toptions: MotionCapabilityOptions = {},\n): Capability {\n\treturn {\n\t\tnamespace: `motion`,\n\t\tpresence: createPresence,\n\t\tattach: (target) => attach(target, options),\n\t\tscheduleFrame(callback) {\n\t\t\tconst run = ({ timestamp }: { timestamp: number }) => {\n\t\t\t\tcallback(timestamp)\n\t\t\t}\n\t\t\tframe.render(run, true)\n\t\t\treturn () => {\n\t\t\t\tcancelFrame(run)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,+BAAe,IAAI,QAGvB;AACF,MAAM,SAAS;AACf,MAAM,SAAS,aAAqB,YAAY,IAAI;AACpD,MAAM,kBAAkB,aACvB,WAAW,YAAY,IAAI,IAAI;;AAGhC,SAAgB,aACf,OACA,MACA,YACA,aAC6B;CAC7B,IAAI,aAAa,MAAM,KAAK;CAC5B,MAAM,UAAU,MAAM,IAAI;CAC1B,MAAM,OACL,OAAO,YAAY,WAAW;EAAC;EAAI;EAAS;CAAE,IAAI,OAAO,KAAK,OAAO;CACtE,MAAM,KAAK,OAAO,SAAS,WAAW;EAAC;EAAI;EAAM;CAAE,IAAI,OAAO,KAAK,IAAI;CACvE,MAAM,WAAW,aAAa,IAAI,KAAK,CAAC,GAAG;CAC3C,MAAM,WACL,YAAY,QAAQ,KAAK,IAAI,SAAS,WAAW,OAAO,KAAK,EAAE,CAAC,IAAI,OACjE,SAAS,WACT,MAAM,YAAY;CACtB,aAAa,OAAO,KAAK;CACzB,MAAM,WAAW,WAAW,YAAY;CAGxC,MAAM,QACL,WAAW,SAAS,WACnB,WAAW,SAAS,KAAA,MACnB,WAAW,aAAa,KAAA,KAAa,WAAW,SAAS,KAAA;CAC5D,MAAM,SACL,eACA,SAC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AM;GACV,YAAY,OAAO;GACnB,aAAa,KAAA;GACb,UAAU;GACV,gBAAgB;GAChB,QAAQ,IAAI;EACb;EACA,OAAO,MAAM;GACZ,IAAI,MAAM;GACV,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GACjC,IAAI,CAAC,QAAQ,IAAI,GAAG,GACnB,MAAM,IAAI,MAAM,uCAAuC,KAAK;GAC9D,MAAM,gBACL,CAAC,WACD,QAAQ,KAAK,aAAa,MAAM,QAAQ,MAAM,aAAa,KAC3D,QAAQ,KAAK,WAAW,MAAM,QAAQ,MAAM,WAAW;GACxD,QAAQ;GACR,IAAI,iBAAiB,CAAC,SAAS,gBAAgB;GAC/C,QAAQ;EACT;EACA,UAAU;GACT,IAAI,MAAM;GACV,OAAO;GACP,cAAc;GACd,YAAY,OAAO;GACnB,YAAY,oBAAoB,UAAU,YAAY;GACtD,SAAS;GACT,KAAK,MAAM,CAAC,KAAK,aAAa,YAAY;IACzC,SAAS,QAAQ;IACjB,IAAI,CAAC,SAAS,OAAO,MAAO,KAAK,SAAS,IAAI;GAC/C;GACA,KAAK,MAAM,CAAC,KAAK,UAAU,gBAC1B,IAAI,MAAM,OACT,QAAS,MAAM,YAAY,KAAK,MAAM,OAAO,MAAM,QAAQ;QACvD,QAAS,MAAM,eAAe,GAAG;GAEvC,WAAW,MAAM;EAClB;CACD;AACD;;AAGA,SAAgB,iBACf,UAAmC,CAAC,GACvB;CACb,OAAO;EACN,WAAW;EACX,UAAU;EACV,SAAS,WAAW,OAAO,QAAQ,OAAO;EAC1C,cAAc,UAAU;GACvB,MAAM,OAAO,EAAE,gBAAuC;IACrD,SAAS,SAAS;GACnB;GACA,MAAM,OAAO,KAAK,IAAI;GACtB,aAAa;IACZ,YAAY,GAAG;GAChB;EACD;CACD;AACD"}
@@ -1,9 +1,9 @@
1
- import { a as Child, l as VNode, r as CapabilityTarget, s as RootOptions } from "./capabilities-yC9TsHDI.js";
1
+ import { a as Child, l as VNode, r as CapabilityTarget, s as RootOptions } from "./capabilities-CFP-HIuY.js";
2
2
  export interface SceneHost<N> {
3
3
  target?(node: N): CapabilityTarget;
4
4
  create(type: string, props: Record<string, any>): N;
5
5
  update(node: N, props: Record<string, any>, previous: Record<string, any>): void;
6
- children(parent: N, children: N[]): void;
6
+ children(parent: N, children: N[], activeChildren: N[]): void;
7
7
  destroy(node: N): void;
8
8
  }
9
9
  export interface SceneRenderer<N> {
@@ -20,5 +20,5 @@ export declare function sceneComponent<P>(type: string): (props: P) => VNode;
20
20
  /** Bind imperative scene work to the current owner and its reactive dependencies. */
21
21
  export declare function bindScene<T>(read: () => T, apply: (value: T) => void): void;
22
22
  /** Scene drawing follows an installed capability clock, or the browser clock. */
23
- export declare function onSceneFrame(callback: (time: number) => void): void;
23
+ export declare function onSceneFrame(callback: (time: number) => void, infrastructure?: boolean): void;
24
24
  //# sourceMappingURL=renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","names":[],"sources":["../src/renderer.ts"],"mappings":";iBAgBiB,UAAU;EAC1B,QAAQ,MAAM,IAAI;EAClB,OAAO,cAAc,OAAO,sBAAsB;EAClD,OACC,MAAM,GACN,OAAO,qBACP,UAAU;EAEX,SAAS,QAAQ,GAAG,UAAU;EAC9B,QAAQ,MAAM;;iBAQE,cAAc;EAC9B,MAAM,aAAa,OAAO,QAAQ;EAClC,OACC,aAAa,OACb,QAAQ,GACR,UAAU;IACN;IAAe;;;;wBAIL,oBAAoB,GAAG,MAAM,UAAU,KAAK,cAAc;;wBAyJ1D,eAAe,GAAG,gBAAgB,OAAO,MAAM;;wBAK/C,UAAU,GAAG,YAAY,GAAG,QAAQ,OAAO;;wBAK3C,aAAa,WAAW"}
1
+ {"version":3,"file":"renderer.d.ts","names":[],"sources":["../src/renderer.ts"],"mappings":";iBAiBiB,UAAU;EAC1B,QAAQ,MAAM,IAAI;EAClB,OAAO,cAAc,OAAO,sBAAsB;EAClD,OACC,MAAM,GACN,OAAO,qBACP,UAAU;EAEX,SAAS,QAAQ,GAAG,UAAU,KAAK,gBAAgB;EACnD,QAAQ,MAAM;;iBAUE,cAAc;EAC9B,MAAM,aAAa,OAAO,QAAQ;EAClC,OACC,aAAa,OACb,QAAQ,GACR,UAAU;IACN;IAAe;;;;wBAIL,oBAAoB,GAAG,MAAM,UAAU,KAAK,cAAc;;wBAwL1D,eAAe,GAAG,gBAAgB,OAAO,MAAM;;wBAK/C,UAAU,GAAG,YAAY,GAAG,QAAQ,OAAO;;wBAK3C,aACf,WAAW,uBACX"}