@atom.io/spa 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +194 -30
  2. package/README.mdx +78 -20
  3. package/dist/BrandMarkScene-CBYk-RJ2.js +140 -0
  4. package/dist/BrandMarkScene-CBYk-RJ2.js.map +1 -0
  5. package/dist/astro-application.d.ts +1 -1
  6. package/dist/astro-client.d.ts +1 -1
  7. package/dist/astro-client.d.ts.map +1 -1
  8. package/dist/astro-client.js +5 -4
  9. package/dist/astro-client.js.map +1 -1
  10. package/dist/astro-resumability-client.d.ts +1 -1
  11. package/dist/astro-server.js +4 -4
  12. package/dist/astro-server.js.map +1 -1
  13. package/dist/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  14. package/dist/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  15. package/dist/{astro-shared-DZp1x8RQ.d.ts → astro-shared-KxK9OUSj.d.ts} +2 -2
  16. package/dist/{astro-shared-DZp1x8RQ.d.ts.map → astro-shared-KxK9OUSj.d.ts.map} +1 -1
  17. package/dist/astro.d.ts +1 -1
  18. package/dist/astro.js +1 -1
  19. package/dist/brand-css.d.ts +2 -0
  20. package/dist/brand-model.d.ts +32 -0
  21. package/dist/brand-model.d.ts.map +1 -0
  22. package/dist/brand-model.js +120 -0
  23. package/dist/brand-model.js.map +1 -0
  24. package/dist/brand.css +37 -0
  25. package/dist/brand.d.ts +13 -0
  26. package/dist/brand.d.ts.map +1 -0
  27. package/dist/brand.js +94 -0
  28. package/dist/brand.js.map +1 -0
  29. package/dist/{capabilities-DNcnGRv_.d.ts → capabilities-ChgSs6bp.d.ts} +34 -6
  30. package/dist/capabilities-ChgSs6bp.d.ts.map +1 -0
  31. package/dist/client.min.js +1 -1
  32. package/dist/core-DD2giR6E.js +451 -0
  33. package/dist/core-DD2giR6E.js.map +1 -0
  34. package/dist/development/BrandMarkScene-BDdC7K5M.js +140 -0
  35. package/dist/development/BrandMarkScene-BDdC7K5M.js.map +1 -0
  36. package/dist/development/astro-client.js +5 -4
  37. package/dist/development/astro-client.js.map +1 -1
  38. package/dist/development/astro-server.js +4 -4
  39. package/dist/development/astro-server.js.map +1 -1
  40. package/dist/development/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  41. package/dist/development/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  42. package/dist/development/astro.js +1 -1
  43. package/dist/development/brand-model.js +120 -0
  44. package/dist/development/brand-model.js.map +1 -0
  45. package/dist/development/brand.css +37 -0
  46. package/dist/development/brand.js +94 -0
  47. package/dist/development/brand.js.map +1 -0
  48. package/dist/development/core-DrUd8x25.js +465 -0
  49. package/dist/development/core-DrUd8x25.js.map +1 -0
  50. package/dist/development/{dom-DQ0M3rLL.js → dom-CEVtlaav.js} +152 -36
  51. package/dist/development/dom-CEVtlaav.js.map +1 -0
  52. package/dist/development/floating.js +2 -6
  53. package/dist/development/floating.js.map +1 -1
  54. package/dist/development/hot.js +164 -0
  55. package/dist/development/hot.js.map +1 -0
  56. package/dist/development/identity-B8wTFkyW.js +121 -0
  57. package/dist/development/identity-B8wTFkyW.js.map +1 -0
  58. package/dist/development/index.js +5 -5
  59. package/dist/development/jsx-runtime-BGDPK50B.js +49 -0
  60. package/dist/development/jsx-runtime-BGDPK50B.js.map +1 -0
  61. package/dist/development/jsx-runtime.js +1 -25
  62. package/dist/development/konva.js +12 -5
  63. package/dist/development/konva.js.map +1 -1
  64. package/dist/development/motion.js +41 -39
  65. package/dist/development/motion.js.map +1 -1
  66. package/dist/development/renderer.js +41 -40
  67. package/dist/development/renderer.js.map +1 -1
  68. package/dist/development/{server-renderer-DCLoMdOX.js → server-renderer-zAqEL1g1.js} +8 -18
  69. package/dist/development/server-renderer-zAqEL1g1.js.map +1 -0
  70. package/dist/development/server.js +1 -1
  71. package/dist/{src-Bme1kz2b.js → development/src-CB7ruwRs.js} +3 -3
  72. package/dist/development/src-CB7ruwRs.js.map +1 -0
  73. package/dist/development/three-CsZ6Od1C.js +527 -0
  74. package/dist/development/three-CsZ6Od1C.js.map +1 -0
  75. package/dist/development/three.js +1 -508
  76. package/dist/development/vite-WUiz1ju6.js +545 -0
  77. package/dist/development/vite-WUiz1ju6.js.map +1 -0
  78. package/dist/development/vite.js +1 -1
  79. package/dist/{dom-D8g3roX9.js → dom-DUpa3Sj2.js} +141 -33
  80. package/dist/dom-DUpa3Sj2.js.map +1 -0
  81. package/dist/floating.d.ts +1 -1
  82. package/dist/floating.d.ts.map +1 -1
  83. package/dist/floating.js +2 -6
  84. package/dist/floating.js.map +1 -1
  85. package/dist/hot.d.ts +15 -0
  86. package/dist/hot.d.ts.map +1 -0
  87. package/dist/hot.js +19 -0
  88. package/dist/hot.js.map +1 -0
  89. package/dist/identity-ByJswZtF.js +121 -0
  90. package/dist/identity-ByJswZtF.js.map +1 -0
  91. package/dist/{index-BFnXIfOj.d.ts → index-DdA39aMv.d.ts} +4 -4
  92. package/dist/{index-BFnXIfOj.d.ts.map → index-DdA39aMv.d.ts.map} +1 -1
  93. package/dist/index.d.ts +4 -4
  94. package/dist/index.js +5 -5
  95. package/dist/jsx-runtime-BGDPK50B.js +49 -0
  96. package/dist/jsx-runtime-BGDPK50B.js.map +1 -0
  97. package/dist/{jsx-runtime-DQnpyT_g.d.ts → jsx-runtime-CCvcEosg.d.ts} +14 -9
  98. package/dist/jsx-runtime-CCvcEosg.d.ts.map +1 -0
  99. package/dist/jsx-runtime.d.ts +1 -1
  100. package/dist/jsx-runtime.js +1 -25
  101. package/dist/konva.d.ts +46 -9
  102. package/dist/konva.d.ts.map +1 -1
  103. package/dist/konva.js +12 -5
  104. package/dist/konva.js.map +1 -1
  105. package/dist/motion.d.ts +3 -1
  106. package/dist/motion.d.ts.map +1 -1
  107. package/dist/motion.js +41 -39
  108. package/dist/motion.js.map +1 -1
  109. package/dist/renderer.d.ts +1 -1
  110. package/dist/renderer.d.ts.map +1 -1
  111. package/dist/renderer.js +39 -40
  112. package/dist/renderer.js.map +1 -1
  113. package/dist/{server-renderer-D0rsFL_-.js → server-renderer-D7CdyOMo.js} +8 -18
  114. package/dist/server-renderer-D7CdyOMo.js.map +1 -0
  115. package/dist/server.d.ts +1 -1
  116. package/dist/server.js +1 -1
  117. package/dist/size.json +12 -12
  118. package/dist/{development/src-DoQgCX-O.js → src-B2W_TA_X.js} +3 -3
  119. package/dist/src-B2W_TA_X.js.map +1 -0
  120. package/dist/three-DcYxRXPW.js +527 -0
  121. package/dist/three-DcYxRXPW.js.map +1 -0
  122. package/dist/three.d.ts +24 -3
  123. package/dist/three.d.ts.map +1 -1
  124. package/dist/three.js +1 -508
  125. package/dist/vite-WUiz1ju6.js +545 -0
  126. package/dist/vite-WUiz1ju6.js.map +1 -0
  127. package/dist/vite.d.ts.map +1 -1
  128. package/dist/vite.js +1 -1
  129. package/package.json +45 -18
  130. package/src/BrandMark.module.css +25 -0
  131. package/src/BrandMark.tsx +106 -0
  132. package/src/BrandMarkScene.module.css +10 -0
  133. package/src/BrandMarkScene.tsx +116 -0
  134. package/src/astro-client.ts +3 -2
  135. package/src/astro-server.ts +2 -2
  136. package/src/brand-css.d.ts +2 -0
  137. package/src/brand-model.ts +177 -0
  138. package/src/brand.ts +3 -0
  139. package/src/capabilities.ts +48 -21
  140. package/src/compiler-hmr.ts +297 -0
  141. package/src/compiler.ts +127 -25
  142. package/src/core.ts +282 -33
  143. package/src/dom-forms.ts +127 -0
  144. package/src/dom.ts +124 -53
  145. package/src/floating.ts +2 -6
  146. package/src/hot.ts +191 -0
  147. package/src/identity.ts +39 -0
  148. package/src/index.ts +2 -0
  149. package/src/jsx-runtime.ts +6 -26
  150. package/src/jsx-types.d.ts +8 -3
  151. package/src/konva.ts +66 -10
  152. package/src/lasertag.d.ts +1 -0
  153. package/src/motion-layout.ts +55 -26
  154. package/src/motion.ts +3 -0
  155. package/src/presence.ts +11 -23
  156. package/src/props.ts +55 -0
  157. package/src/renderer.ts +91 -71
  158. package/src/server-renderer.ts +18 -13
  159. package/src/three.ts +92 -46
  160. package/src/use-loadable.ts +2 -2
  161. package/src/vite.ts +44 -4
  162. package/dist/capabilities-DNcnGRv_.d.ts.map +0 -1
  163. package/dist/capabilities-nOIitQ-_.js +0 -65
  164. package/dist/capabilities-nOIitQ-_.js.map +0 -1
  165. package/dist/core-B4rJ0xdc.js +0 -268
  166. package/dist/core-B4rJ0xdc.js.map +0 -1
  167. package/dist/development/capabilities-nOIitQ-_.js +0 -65
  168. package/dist/development/capabilities-nOIitQ-_.js.map +0 -1
  169. package/dist/development/core-BHA7I1nf.js +0 -271
  170. package/dist/development/core-BHA7I1nf.js.map +0 -1
  171. package/dist/development/dom-DQ0M3rLL.js.map +0 -1
  172. package/dist/development/jsx-runtime.js.map +0 -1
  173. package/dist/development/server-renderer-DCLoMdOX.js.map +0 -1
  174. package/dist/development/src-DoQgCX-O.js.map +0 -1
  175. package/dist/development/three.js.map +0 -1
  176. package/dist/development/vite-Bmyb6P5w.js +0 -265
  177. package/dist/development/vite-Bmyb6P5w.js.map +0 -1
  178. package/dist/dom-D8g3roX9.js.map +0 -1
  179. package/dist/jsx-runtime-DQnpyT_g.d.ts.map +0 -1
  180. package/dist/jsx-runtime.js.map +0 -1
  181. package/dist/server-renderer-D0rsFL_-.js.map +0 -1
  182. package/dist/src-Bme1kz2b.js.map +0 -1
  183. package/dist/three.js.map +0 -1
  184. package/dist/vite-Bmyb6P5w.js +0 -265
  185. package/dist/vite-Bmyb6P5w.js.map +0 -1
@@ -1,9 +1,104 @@
1
- import { n as capabilityProps } from "./capabilities-nOIitQ-_.js";
2
- import { S as within, a as invalidate, d as plain, i as fail, n as createScope, p as untrack, r as dispose, s as observe, t as createRoot } from "./core-B4rJ0xdc.js";
3
- import { Fragment, merge } from "./jsx-runtime.js";
1
+ import { i as capabilityProps, n as trackKeys, t as identifyChildren } from "./identity-ByJswZtF.js";
2
+ import { D as within, a as enqueue, c as isPresent, i as dispose, l as observe, m as plain, n as createRoot, o as fail, r as createScope, s as invalidate, v as untrack } from "./core-DD2giR6E.js";
3
+ import { a as instanceProps, t as Fragment } from "./jsx-runtime-BGDPK50B.js";
4
+ // src/dom-forms.ts
5
+ const changes = /* @__PURE__ */ new WeakMap();
6
+ const requests = /* @__PURE__ */ new WeakMap();
7
+ const events = [
8
+ `input`,
9
+ `change`,
10
+ `click`
11
+ ];
12
+ const wake = () => {};
13
+ /** Keep native input events, using per-edit change semantics for text/range controls. */
14
+ function changeHandler(handler) {
15
+ let wrapped = changes.get(handler);
16
+ if (!wrapped) {
17
+ wrapped = (event) => {
18
+ const target = event.target;
19
+ const editing = target?.localName === `textarea` || target?.localName === `input` && !/^(checkbox|radio|file)$/.test(target.type);
20
+ if (event.type === (editing ? `input` : `change`)) handler.call(event.currentTarget, event);
21
+ };
22
+ changes.set(handler, wrapped);
23
+ }
24
+ return wrapped;
25
+ }
26
+ function controlValue(control, value) {
27
+ if (control.localName === `input` && control.type === `number` && typeof value === `number` && control.value !== `` && Number(control.value) === value) return;
28
+ if (control.value !== String(value)) control.value = String(value);
29
+ if (control.localName === `select`) {
30
+ const select = control;
31
+ if (select.selectedIndex < 0) {
32
+ const first = [...select.options].find((option) => !option.disabled);
33
+ if (first) first.selected = true;
34
+ }
35
+ }
36
+ }
37
+ function requestRestore(control) {
38
+ requests.get(control)?.();
39
+ if (control.localName !== `input` || control.type !== `radio`) return;
40
+ const input = control;
41
+ for (const peer of input.getRootNode().querySelectorAll(`input`)) if (peer !== input && peer.type === `radio` && peer.name === input.name && peer.form === input.form) requests.get(peer)?.();
42
+ }
43
+ /** Restore controlled fields after event handlers and all queued option/prop updates. */
44
+ function bindForm(control, props, scope) {
45
+ let active;
46
+ let timer;
47
+ const restore = () => {
48
+ if (!isPresent(scope)) return true;
49
+ const value = props[`value`];
50
+ const checked = control.localName === `input` ? props[`checked`] : void 0;
51
+ if (active?.eventPhase) return value == null && checked == null;
52
+ if (value != null) controlValue(control, value);
53
+ if (checked != null) {
54
+ const input = control;
55
+ if (input.checked !== Boolean(checked)) input.checked = Boolean(checked);
56
+ }
57
+ return true;
58
+ };
59
+ const finish = () => {
60
+ active = void 0;
61
+ clearTimeout(timer);
62
+ enqueue(scope, wake);
63
+ };
64
+ const capture = (event) => {
65
+ if (event.type === `click` && !/^(checkbox|radio)$/.test(control.type)) return;
66
+ active = event;
67
+ clearTimeout(timer);
68
+ timer = setTimeout(() => {
69
+ requestRestore(control);
70
+ }, 0);
71
+ };
72
+ const root = scope._root;
73
+ if (!root._forms) {
74
+ root._forms = /* @__PURE__ */ new Set();
75
+ const end = (event) => {
76
+ const target = event.target;
77
+ if (event.type === `click` || event.type === `input` && /^(checkbox|radio)$/.test(target.type)) return;
78
+ requestRestore(target);
79
+ };
80
+ for (const event of events) root._host.addEventListener(event, end);
81
+ root._cleanups.add(() => {
82
+ for (const event of events) root._host.removeEventListener(event, end);
83
+ });
84
+ }
85
+ const forms = root._forms;
86
+ forms.add(restore);
87
+ requests.set(control, finish);
88
+ for (const event of events) control.addEventListener(event, capture, true);
89
+ scope._cleanups.add(() => {
90
+ clearTimeout(timer);
91
+ forms.delete(restore);
92
+ requests.delete(control);
93
+ for (const event of events) control.removeEventListener(event, capture, true);
94
+ });
95
+ }
4
96
  // src/dom.ts
5
97
  const HTML = `http://www.w3.org/1999/xhtml`;
6
98
  const SVG = `http://www.w3.org/2000/svg`;
99
+ function compatible(record, child) {
100
+ return typeof record._value === typeof child && record._value?.type === child?.type;
101
+ }
7
102
  function finish(cursor) {
8
103
  if (cursor?.node) {
9
104
  cursor.report(null, cursor.node);
@@ -42,63 +137,70 @@ function property(element, key, value, previous) {
42
137
  if (key.startsWith(`on`)) {
43
138
  const capture = /(?<!Pointer)Capture$/.test(key);
44
139
  const event = key.slice(2, capture ? -7 : void 0).toLowerCase().replace(`doubleclick`, `dblclick`);
45
- if (previous) element.removeEventListener(event, previous, capture);
46
- if (value != null) element.addEventListener(event, value, capture);
140
+ const events = event === `change` ? [`input`, `change`] : [event === `focus` ? `focusin` : event === `blur` ? `focusout` : event];
141
+ if (previous) for (const name of events) element.removeEventListener(name, event === `change` ? changeHandler(previous) : previous, capture);
142
+ if (value != null) for (const name of events) element.addEventListener(name, event === `change` ? changeHandler(value) : value, capture);
47
143
  return;
48
144
  }
49
145
  if (key === `className`) key = `class`;
50
146
  if (key === `htmlFor`) key = `for`;
147
+ if (element.namespaceURI === SVG && key === `focusable` && typeof value === `boolean`) value = String(value);
51
148
  if (element.namespaceURI === HTML && key in element && !/^(style|form|list)$/.test(key)) {
52
149
  const target = element;
53
- target[key] = value ?? (typeof target[key] === `boolean` ? false : ``);
150
+ if (key === `value` && /^(input|textarea|select)$/.test(element.localName) && value != null) controlValue(target, value);
151
+ else target[key] = value ?? (typeof target[key] === `boolean` ? false : ``);
152
+ if (value == null) element.removeAttribute(key);
54
153
  } else if (value == null || value === false && !/^(aria-|data-)/.test(key)) element.removeAttribute(key);
55
154
  else element.setAttribute(key, value === true && !/^(aria-|data-)/.test(key) ? `` : String(value));
56
155
  }
57
- function mount(value, parent, before, owner, namespace, cursor, source = () => value) {
156
+ function mount(value, parent, before, owner, namespace, cursor, source = () => value, initialKey) {
58
157
  if (typeof value === `function`) {
59
- comment(`{`, parent, before, owner, cursor);
158
+ const begin = comment(`{`, parent, before, owner, cursor);
60
159
  let end = null;
61
160
  let records = /* @__PURE__ */ new Map();
62
- const presence = owner._root._presence?.collection((record) => record._scope, (record, child) => typeof record._value === typeof child && record._value?.type === child?.type);
161
+ let presence;
63
162
  const retire = (record, key, eligible, index) => {
64
163
  if (presence) presence.remove(record, key, eligible, index, () => {});
65
164
  else dispose(record._scope);
66
165
  };
67
166
  let initial = cursor;
68
- observe(owner, () => source()(), (next) => {
69
- const values = [next].flat(Infinity);
167
+ observe(owner, () => identifyChildren(source()()), (values) => {
168
+ presence ??= owner._root._presence?.collection((record) => record._scope, compatible);
70
169
  const kept = /* @__PURE__ */ new Map();
170
+ let previous;
71
171
  const focus = parent.ownerDocument.activeElement;
72
172
  for (let index = 0; index < values.length; index++) {
73
- const child = values[index];
74
- const vnode = child;
75
- const explicit = vnode?.props?.[`key`];
76
- const key = explicit == null ? index : String(explicit);
77
- let record = records.get(key);
78
- if (record && (typeof record._value !== typeof child || record._value?.type !== vnode?.type)) {
79
- retire(record, key, child == null || typeof child === `boolean`, [...records.keys()].indexOf(key));
173
+ const { value: child, key, id } = values[index];
174
+ let record = records.get(id);
175
+ if (record && !compatible(record, child)) {
176
+ retire(record, id, child == null || typeof child === `boolean`, record._index);
80
177
  record = void 0;
81
178
  }
82
- record ??= presence?.take(key, child);
179
+ record ??= presence?.take(id, child);
83
180
  if (!record) {
181
+ const at = previous ? previous._end.nextSibling : begin.nextSibling;
84
182
  const childOwner = createScope(owner);
85
183
  record = {
184
+ _index: index,
86
185
  _value: child,
87
186
  _scope: childOwner,
88
- _start: comment(`[`, parent, end ?? before, childOwner, initial),
187
+ _start: comment(`[`, parent, at, childOwner, initial),
89
188
  _end: null
90
189
  };
91
190
  const held = record;
92
- mount(child, parent, end ?? before, childOwner, namespace, initial, () => held._value);
93
- record._end = comment(`]`, parent, end ?? before, childOwner, initial);
191
+ mount(child, parent, at, childOwner, namespace, initial, () => held._value, key);
192
+ record._end = comment(`]`, parent, at, childOwner, initial);
94
193
  } else {
194
+ const reusable = record._value === child && typeof child === `object` && child !== null && Object.isFrozen(child) && Object.isFrozen(child.props);
95
195
  record._value = child;
96
196
  owner._root._presence?.resume(record._scope);
97
- invalidate(record._scope);
197
+ if (!reusable) invalidate(record._scope);
98
198
  }
99
- kept.set(key, record);
199
+ record._index = index;
200
+ previous = record;
201
+ kept.set(id, record);
100
202
  }
101
- for (const [key, record] of records) if (!kept.has(key)) retire(record, key, true, [...records.keys()].indexOf(key));
203
+ for (const [key, record] of records) if (!kept.has(key)) retire(record, key, true, record._index);
102
204
  if (!initial) {
103
205
  let at = end ?? before;
104
206
  const rendered = presence?.merge([...kept.values()]) ?? [...kept.values()];
@@ -134,18 +236,23 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
134
236
  return;
135
237
  }
136
238
  const vnode = value;
137
- const props = merge(() => source().props);
239
+ const props = instanceProps(() => source().props, initialKey);
138
240
  if (!vnode.type || vnode.type === Fragment) {
139
241
  mount(() => props[`children`], parent, before, owner, namespace, cursor);
140
242
  return;
141
243
  }
142
244
  if (typeof vnode.type === `function`) {
143
245
  const childOwner = createScope(owner);
144
- mount(within(childOwner, () => untrack(() => vnode.type(props))), parent, before, childOwner, namespace, cursor);
246
+ const output = within(childOwner, () => untrack(() => vnode.type(props)));
247
+ mount(trackKeys(output), parent, before, childOwner, namespace, cursor);
145
248
  return;
146
249
  }
147
250
  const ns = vnode.type === `svg` ? SVG : namespace;
148
251
  const element = take(parent.ownerDocument.createElementNS(ns, vnode.type), parent, before, owner, cursor);
252
+ if (ns === HTML && /^(input|textarea|select)$/.test(vnode.type)) bindForm(element, props, owner);
253
+ if (ns === HTML && (props[`autoFocus`] || props[`autofocus`])) owner._root._mounts.push(() => {
254
+ if (!owner._dead) element.focus();
255
+ });
149
256
  if (vnode.type === `astro-slot`) {
150
257
  if (!cursor) element.innerHTML = props[`innerHTML`] ?? ``;
151
258
  } else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) observe(owner, () => plain(vnode.type === `textarea` ? props[`value`] ?? props[`children`] : props[`children`]), (text) => {
@@ -183,11 +290,11 @@ function mount(value, parent, before, owner, namespace, cursor, source = () => v
183
290
  if (ref) owner._root._mounts.unshift(() => {
184
291
  if (!owner._dead) {
185
292
  owner._cleanups.add(() => ref(null));
186
- ref(element);
293
+ within(owner, () => ref(element));
187
294
  }
188
295
  });
189
296
  }
190
- function start(setup, host, options, hydrating) {
297
+ function start(setup, host, options, hydrating, before = null) {
191
298
  let reported = false;
192
299
  const cursor = hydrating ? {
193
300
  node: host.firstChild,
@@ -205,13 +312,14 @@ function start(setup, host, options, hydrating) {
205
312
  const marker = cursor?.node;
206
313
  const prefix = marker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`) ? marker.nodeValue.slice(2) : void 0;
207
314
  const root = createRoot(options);
315
+ root._host = host;
208
316
  if (prefix !== void 0 && options.idPrefix === void 0) root._prefix = prefix;
209
317
  try {
210
- comment(`w:${root._prefix}`, host, null, root, cursor);
318
+ comment(`w:${root._prefix}`, host, before, root, cursor);
211
319
  within(root, () => {
212
- mount(untrack(setup), host, null, root, host.namespaceURI === SVG ? SVG : HTML, cursor);
320
+ mount(trackKeys(untrack(setup)), host, before, root, host.namespaceURI === SVG ? SVG : HTML, cursor);
213
321
  });
214
- comment(`/w`, host, null, root, cursor);
322
+ comment(`/w`, host, before, root, cursor);
215
323
  finish(cursor);
216
324
  root.flush();
217
325
  } catch (error) {
@@ -232,4 +340,4 @@ function hydrate(setup, host, options = {}) {
232
340
  }
233
341
  export { render as n, hydrate as t };
234
342
 
235
- //# sourceMappingURL=dom-D8g3roX9.js.map
343
+ //# sourceMappingURL=dom-DUpa3Sj2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-DUpa3Sj2.js","names":[],"sources":["../src/dom-forms.ts","../src/dom.ts"],"sourcesContent":["import type { Scope } from \"./core.ts\"\nimport { enqueue, isPresent } from \"./core.ts\"\n\ntype Control = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement\nconst changes = new WeakMap<EventListener, EventListener>()\nconst requests = new WeakMap<Element, () => void>()\nconst events = [`input`, `change`, `click`]\nconst wake = () => {}\n\n/** Keep native input events, using per-edit change semantics for text/range controls. */\nexport function changeHandler(handler: EventListener): EventListener {\n\tlet wrapped = changes.get(handler)\n\tif (!wrapped) {\n\t\twrapped = (event) => {\n\t\t\tconst target = event.target as Control | null\n\t\t\tconst editing =\n\t\t\t\ttarget?.localName === `textarea` ||\n\t\t\t\t(target?.localName === `input` &&\n\t\t\t\t\t!/^(checkbox|radio|file)$/.test(target.type))\n\t\t\tif (event.type === (editing ? `input` : `change`))\n\t\t\t\thandler.call(event.currentTarget, event)\n\t\t}\n\t\tchanges.set(handler, wrapped)\n\t}\n\treturn wrapped\n}\n\nexport function controlValue(control: Control, value: string | number): void {\n\tif (\n\t\tcontrol.localName === `input` &&\n\t\tcontrol.type === `number` &&\n\t\ttypeof value === `number` &&\n\t\tcontrol.value !== `` &&\n\t\tNumber(control.value) === value\n\t)\n\t\treturn\n\tif (control.value !== String(value)) control.value = String(value)\n\tif (control.localName === `select`) {\n\t\tconst select = control as HTMLSelectElement\n\t\tif (select.selectedIndex < 0) {\n\t\t\tconst first = [...select.options].find((option) => !option.disabled)\n\t\t\tif (first) first.selected = true\n\t\t}\n\t}\n}\n\nfunction requestRestore(control: Control): void {\n\trequests.get(control)?.()\n\tif (control.localName !== `input` || control.type !== `radio`) return\n\tconst input = control as HTMLInputElement\n\tfor (const peer of (\n\t\tinput.getRootNode() as ParentNode\n\t).querySelectorAll<HTMLInputElement>(`input`)) {\n\t\tif (\n\t\t\tpeer !== input &&\n\t\t\tpeer.type === `radio` &&\n\t\t\tpeer.name === input.name &&\n\t\t\tpeer.form === input.form\n\t\t)\n\t\t\trequests.get(peer)?.()\n\t}\n}\n\n/** Restore controlled fields after event handlers and all queued option/prop updates. */\nexport function bindForm(\n\tcontrol: Control,\n\tprops: Record<string, any>,\n\tscope: Scope,\n): void {\n\tlet active: Event | undefined\n\tlet timer: ReturnType<typeof setTimeout> | undefined\n\tconst restore = () => {\n\t\tif (!isPresent(scope)) return true\n\t\tconst value = props[`value`]\n\t\tconst checked = control.localName === `input` ? props[`checked`] : undefined\n\t\tif (active?.eventPhase) return value == null && checked == null\n\t\tif (value != null) controlValue(control, value)\n\t\tif (checked != null) {\n\t\t\tconst input = control as HTMLInputElement\n\t\t\tif (input.checked !== Boolean(checked)) input.checked = Boolean(checked)\n\t\t}\n\t\treturn true\n\t}\n\tconst finish = () => {\n\t\tactive = undefined\n\t\tclearTimeout(timer)\n\t\tenqueue(scope, wake)\n\t}\n\tconst capture = (event: Event) => {\n\t\tif (event.type === `click` && !/^(checkbox|radio)$/.test(control.type))\n\t\t\treturn\n\t\tactive = event\n\t\tclearTimeout(timer)\n\t\t// A stopped native event never reaches the root's bubble listener.\n\t\ttimer = setTimeout(() => {\n\t\t\trequestRestore(control)\n\t\t}, 0)\n\t}\n\tconst root = scope._root\n\tif (!root._forms) {\n\t\troot._forms = new Set()\n\t\tconst end = (event: Event) => {\n\t\t\tconst target = event.target as Control\n\t\t\t// Checkbox/radio change follows click and input; its handlers must see the edit.\n\t\t\tif (\n\t\t\t\tevent.type === `click` ||\n\t\t\t\t(event.type === `input` && /^(checkbox|radio)$/.test(target.type))\n\t\t\t)\n\t\t\t\treturn\n\t\t\trequestRestore(target)\n\t\t}\n\t\tfor (const event of events) root._host!.addEventListener(event, end)\n\t\troot._cleanups.add(() => {\n\t\t\tfor (const event of events) root._host!.removeEventListener(event, end)\n\t\t})\n\t}\n\tconst forms = root._forms\n\tforms.add(restore)\n\trequests.set(control, finish)\n\tfor (const event of events) control.addEventListener(event, capture, true)\n\tscope._cleanups.add(() => {\n\t\tclearTimeout(timer)\n\t\tforms.delete(restore)\n\t\trequests.delete(control)\n\t\tfor (const event of events) control.removeEventListener(event, capture, true)\n\t})\n}\n","import type { Canonical } from \"atom.io/foundations/canonical\"\n\nimport { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { bindForm, changeHandler, controlValue } from \"./dom-forms.ts\"\nimport { hotRoot, trackRoot } from \"./hot.ts\"\nimport { identifyChildren, trackKeys } from \"./identity.ts\"\nimport { Fragment } from \"./jsx-runtime.ts\"\nimport type { PresenceCollection } from \"./presence.ts\"\nimport { instanceProps } from \"./props.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = {\n\t_value: Children\n\t_scope: Scope\n\t_start: Node\n\t_end: Node\n\t_index: number\n}\nfunction compatible(record: RecordNode, child: Children): boolean {\n\treturn (\n\t\ttypeof record._value === typeof child &&\n\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t(child as SpaElement | null)?.type\n\t)\n}\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tconst events =\n\t\t\tevent === `change`\n\t\t\t\t? [`input`, `change`]\n\t\t\t\t: [event === `focus` ? `focusin` : event === `blur` ? `focusout` : event]\n\t\tif (previous)\n\t\t\tfor (const name of events)\n\t\t\t\telement.removeEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tevent === `change` ? changeHandler(previous) : previous,\n\t\t\t\t\tcapture,\n\t\t\t\t)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\tfor (const name of events)\n\t\t\t\telement.addEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tevent === `change` ? changeHandler(value) : value,\n\t\t\t\t\tcapture,\n\t\t\t\t)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === SVG &&\n\t\tkey === `focusable` &&\n\t\ttypeof value === `boolean`\n\t)\n\t\tvalue = String(value)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\tif (\n\t\t\tkey === `value` &&\n\t\t\t/^(input|textarea|select)$/.test(element.localName) &&\n\t\t\tvalue != null\n\t\t)\n\t\t\tcontrolValue(target, value)\n\t\telse target[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t\tif (value == null) element.removeAttribute(key)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n\tinitialKey?: Canonical,\n): void {\n\tif (typeof value === `function`) {\n\t\tconst begin = comment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<string | number, RecordNode>()\n\t\tlet presence: PresenceCollection<RecordNode, Children> | undefined\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => identifyChildren((source() as () => Children)()),\n\t\t\t(values) => {\n\t\t\t\tpresence ??= owner._root._presence?.collection(\n\t\t\t\t\t(record: RecordNode) => record._scope,\n\t\t\t\t\tcompatible,\n\t\t\t\t)\n\t\t\t\tconst kept = new Map<string | number, RecordNode>()\n\t\t\t\tlet previous: RecordNode | undefined\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst { value: child, key, id } = values[index]\n\t\t\t\t\tlet record = records.get(id)\n\t\t\t\t\tif (record && !compatible(record, child)) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\trecord._index,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(id, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst at = previous ? previous._end.nextSibling : begin.nextSibling\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_index: index,\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, at, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tat,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(`]`, parent, at, childOwner, initial)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Frozen descriptors opt into reuse; mutable props and accessors must refresh.\n\t\t\t\t\t\tconst reusable =\n\t\t\t\t\t\t\trecord._value === child &&\n\t\t\t\t\t\t\ttypeof child === `object` &&\n\t\t\t\t\t\t\tchild !== null &&\n\t\t\t\t\t\t\tObject.isFrozen(child) &&\n\t\t\t\t\t\t\tObject.isFrozen((child as SpaElement).props)\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tif (!reusable) invalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\trecord._index = index\n\t\t\t\t\tprevious = record\n\t\t\t\t\tkept.set(id, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key)) retire(record, key, true, record._index)\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = instanceProps(() => (source() as SpaElement).props, initialKey)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(trackKeys(output), parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (ns === HTML && /^(input|textarea|select)$/.test(vnode.type))\n\t\tbindForm(element as HTMLInputElement, props, owner)\n\tif (ns === HTML && (props[`autoFocus`] || props[`autofocus`])) {\n\t\towner._root._mounts!.push(() => {\n\t\t\tif (!owner._dead) (element as HTMLElement).focus()\n\t\t})\n\t}\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tlet previous: Record<string, any> = {}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t\t(next) => {\n\t\t\tconst previousStyle =\n\t\t\t\tprevious[`style`] !== next[`style`]\n\t\t\t\t\t? (element.getAttribute(`style`) ?? ``)\n\t\t\t\t\t: undefined\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t\treturn previousStyle\n\t\t},\n\t)\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(owner, () => ({ ...props }), nativeProps)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\twithin(owner, () => ref(element))\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n\tbefore: Node | null = null,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\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: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\troot._host = host\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\tif (import.meta.env.DEV) trackRoot(root)\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, before, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\ttrackKeys(untrack(setup)),\n\t\t\t\thost,\n\t\t\t\tbefore,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, before, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\tif (import.meta.env.DEV)\n\t\treturn hotRoot(\n\t\t\t(next, before) => start(setup, host, next, false, before),\n\t\t\toptions,\n\t\t\thost,\n\t\t)\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\tif (import.meta.env.DEV) {\n\t\tlet initial = true\n\t\treturn hotRoot(\n\t\t\t(next, before) => {\n\t\t\t\tconst current = start(setup, host, next, initial, before)\n\t\t\t\tinitial = false\n\t\t\t\treturn current\n\t\t\t},\n\t\t\toptions,\n\t\t\thost,\n\t\t)\n\t}\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAIA,MAAM,0BAAU,IAAI,QAAsC;AAC1D,MAAM,2BAAW,IAAI,QAA6B;AAClD,MAAM,SAAS;CAAC;CAAS;CAAU;AAAO;AAC1C,MAAM,aAAa,CAAC;;AAGpB,SAAgB,cAAc,SAAuC;CACpE,IAAI,UAAU,QAAQ,IAAI,OAAO;CACjC,IAAI,CAAC,SAAS;EACb,WAAW,UAAU;GACpB,MAAM,SAAS,MAAM;GACrB,MAAM,UACL,QAAQ,cAAc,cACrB,QAAQ,cAAc,WACtB,CAAC,0BAA0B,KAAK,OAAO,IAAI;GAC7C,IAAI,MAAM,UAAU,UAAU,UAAU,WACvC,QAAQ,KAAK,MAAM,eAAe,KAAK;EACzC;EACA,QAAQ,IAAI,SAAS,OAAO;CAC7B;CACA,OAAO;AACR;AAEA,SAAgB,aAAa,SAAkB,OAA8B;CAC5E,IACC,QAAQ,cAAc,WACtB,QAAQ,SAAS,YACjB,OAAO,UAAU,YACjB,QAAQ,UAAU,MAClB,OAAO,QAAQ,KAAK,MAAM,OAE1B;CACD,IAAI,QAAQ,UAAU,OAAO,KAAK,GAAG,QAAQ,QAAQ,OAAO,KAAK;CACjE,IAAI,QAAQ,cAAc,UAAU;EACnC,MAAM,SAAS;EACf,IAAI,OAAO,gBAAgB,GAAG;GAC7B,MAAM,QAAQ,CAAC,GAAG,OAAO,OAAO,CAAC,CAAC,MAAM,WAAW,CAAC,OAAO,QAAQ;GACnE,IAAI,OAAO,MAAM,WAAW;EAC7B;CACD;AACD;AAEA,SAAS,eAAe,SAAwB;CAC/C,SAAS,IAAI,OAAO,CAAC,GAAG;CACxB,IAAI,QAAQ,cAAc,WAAW,QAAQ,SAAS,SAAS;CAC/D,MAAM,QAAQ;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ities-DNcnGRv_.js";
1
+ import { t as Capability } from "./capabilities-ChgSs6bp.js";
2
2
  import { AutoUpdateOptions, Middleware, Placement, ReferenceElement, Strategy } from "@floating-ui/dom";
3
3
  export interface FloatingAttributes<Kind extends string = `dom`> {
4
4
  [`floating:reference`]?: Kind extends `dom` ? ReferenceElement | null : never;
@@ -1 +1 @@
1
- {"version":3,"file":"floating.d.ts","names":[],"sources":["../src/floating.ts"],"mappings":";;iBAiBiB,mBAAmB;GAClC,wBAAwB,qBAAqB;GAC7C,wBAAwB,qBAAqB;GAC7C,uBAAuB,qBAAqB;GAC5C,yBAAyB,8BAA8B;GACvD,sBAAsB;GACtB,yBAAyB,+BACb;;;YAOH,qBACT,6BACS,mBAAmB;;;wBAsMd,sBAAsB"}
1
+ {"version":3,"file":"floating.d.ts","names":[],"sources":["../src/floating.ts"],"mappings":";;iBAiBiB,mBAAmB;GAClC,wBAAwB,qBAAqB;GAC7C,wBAAwB,qBAAqB;GAC7C,uBAAuB,qBAAqB;GAC5C,yBAAyB,8BAA8B;GACvD,sBAAsB;GACtB,yBAAyB,+BACb;;;YAOH,qBACT,6BACS,mBAAmB;;;wBAkMd,sBAAsB"}
package/dist/floating.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as within, i as fail, l as onMount } from "./core-B4rJ0xdc.js";
1
+ import { D as within, f as onMount, h as reportScopeError } from "./core-DD2giR6E.js";
2
2
  import { autoUpdate, computePosition } from "@floating-ui/dom";
3
3
  // src/floating.ts
4
4
  const allowed = /* @__PURE__ */ new Set([
@@ -58,11 +58,7 @@ function attach(target, scope) {
58
58
  });
59
59
  return;
60
60
  }
61
- try {
62
- fail(scope._root, error);
63
- } catch (failure) {
64
- scope._root.error(failure);
65
- }
61
+ reportScopeError(scope, error);
66
62
  };
67
63
  const updatePosition = () => {
68
64
  const anchor = reference;
@@ -1 +1 @@
1
- {"version":3,"file":"floating.js","names":[],"sources":["../src/floating.ts"],"sourcesContent":["import type {\n\tAutoUpdateOptions,\n\tMiddleware,\n\tPlacement,\n\tReferenceElement,\n\tStrategy,\n} from \"@floating-ui/dom\"\nimport { autoUpdate, computePosition } from \"@floating-ui/dom\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport type { Scope } from \"./core.ts\"\nimport { fail, onMount, within } from \"./core.ts\"\n\nexport interface FloatingAttributes<Kind extends string = `dom`> {\n\t[`floating:reference`]?: Kind extends `dom` ? ReferenceElement | null : never\n\t[`floating:placement`]?: Kind extends `dom` ? Placement : never\n\t[`floating:strategy`]?: Kind extends `dom` ? Strategy : never\n\t[`floating:middleware`]?: Kind extends `dom` ? readonly Middleware[] : never\n\t[`floating:enabled`]?: Kind extends `dom` ? boolean : never\n\t[`floating:autoUpdate`]?: Kind extends `dom`\n\t\t? boolean | AutoUpdateOptions\n\t\t: never\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 supplies optional floating attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends FloatingAttributes<Kind> {}\n}\n\ninterface FloatingProps {\n\treference?: ReferenceElement | null\n\tplacement?: Placement\n\tstrategy?: Strategy\n\tmiddleware?: readonly Middleware[]\n\tenabled?: boolean\n\tautoUpdate?: boolean | AutoUpdateOptions\n}\nconst allowed = new Set([\n\t`reference`,\n\t`placement`,\n\t`strategy`,\n\t`middleware`,\n\t`enabled`,\n\t`autoUpdate`,\n])\nconst observerKeys = [\n\t`ancestorScroll`,\n\t`ancestorResize`,\n\t`elementResize`,\n\t`layoutShift`,\n\t`animationFrame`,\n] as const\nconst ownedStyles = [\n\t`position`,\n\t`left`,\n\t`top`,\n\t`translate`,\n\t`visibility`,\n] as const\n\nfunction attach(target: CapabilityTarget, scope?: Scope): CapabilityBinding {\n\tconst element = target.node as HTMLElement\n\tif (\n\t\ttarget.kind !== `dom` ||\n\t\telement?.namespaceURI !== `http://www.w3.org/1999/xhtml`\n\t)\n\t\tthrow new Error(`spa/floating: floating elements must be HTML elements`)\n\tlet props: FloatingProps = {}\n\tlet dead = false\n\tlet mounted = false\n\tlet generation = 0\n\tlet request = 0\n\tlet stop: (() => void) | undefined\n\tlet reference: ReferenceElement | undefined\n\tlet observing: boolean | AutoUpdateOptions | undefined\n\tlet original: Map<string, { value: string; priority: string }> | undefined\n\tlet positioned = false\n\tlet translation = ``\n\n\tconst restore = () => {\n\t\tif (!original) return\n\t\tfor (const [key, style] of original) {\n\t\t\tif (style.value)\n\t\t\t\telement.style.setProperty(key, style.value, style.priority)\n\t\t\telse element.style.removeProperty(key)\n\t\t}\n\t\toriginal = undefined\n\t\tpositioned = false\n\t\ttranslation = ``\n\t}\n\tconst disconnect = () => {\n\t\t++generation\n\t\tstop?.()\n\t\tstop = undefined\n\t\treference = undefined\n\t}\n\tconst report = (error: unknown) => {\n\t\tif (!scope) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tfail(scope._root, error)\n\t\t} catch (failure) {\n\t\t\tscope._root.error(failure)\n\t\t}\n\t}\n\tconst updatePosition = () => {\n\t\tconst anchor = reference\n\t\tif (dead || !anchor) return\n\t\tconst currentGeneration = generation\n\t\tconst currentRequest = ++request\n\t\tvoid computePosition(anchor, element, {\n\t\t\tplacement: props.placement ?? `bottom`,\n\t\t\tstrategy: props.strategy ?? `absolute`,\n\t\t\tmiddleware: props.middleware ? [...props.middleware] : [],\n\t\t}).then(\n\t\t\t({ x, y }) => {\n\t\t\t\tif (\n\t\t\t\t\tdead ||\n\t\t\t\t\tgeneration !== currentGeneration ||\n\t\t\t\t\tcurrentRequest !== request\n\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\ttranslation = `${x}px ${y}px`\n\t\t\t\telement.style.setProperty(`translate`, translation)\n\t\t\t\tif (!positioned) {\n\t\t\t\t\tpositioned = true\n\t\t\t\t\tconst visibility = original!.get(`visibility`)!\n\t\t\t\t\tif (visibility.value)\n\t\t\t\t\t\telement.style.setProperty(\n\t\t\t\t\t\t\t`visibility`,\n\t\t\t\t\t\t\tvisibility.value,\n\t\t\t\t\t\t\tvisibility.priority,\n\t\t\t\t\t\t)\n\t\t\t\t\telse element.style.removeProperty(`visibility`)\n\t\t\t\t}\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tif (\n\t\t\t\t\t!dead &&\n\t\t\t\t\tgeneration === currentGeneration &&\n\t\t\t\t\tcurrentRequest === request\n\t\t\t\t)\n\t\t\t\t\treport(error)\n\t\t\t},\n\t\t)\n\t}\n\tconst connect = () => {\n\t\tif (dead || !mounted) return\n\t\tconst nextReference =\n\t\t\tprops.enabled === false ? undefined : (props.reference ?? undefined)\n\t\tconst nextObserving = props.autoUpdate ?? true\n\t\tconst optionsChanged =\n\t\t\ttypeof nextObserving !== typeof observing ||\n\t\t\t(typeof nextObserving === `object` && typeof observing === `object`\n\t\t\t\t? observerKeys.some(\n\t\t\t\t\t\t(key) =>\n\t\t\t\t\t\t\tnextObserving[key] !== (observing as AutoUpdateOptions)[key],\n\t\t\t\t\t)\n\t\t\t\t: nextObserving !== observing)\n\t\tconst reconnect = nextReference !== reference || optionsChanged\n\t\tif (reconnect) disconnect()\n\t\tif (!nextReference) {\n\t\t\trestore()\n\t\t\treturn\n\t\t}\n\t\toriginal ??= new Map(\n\t\t\townedStyles.map((key) => [\n\t\t\t\tkey,\n\t\t\t\t{\n\t\t\t\t\tvalue: element.style.getPropertyValue(key),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(key),\n\t\t\t\t},\n\t\t\t]),\n\t\t)\n\t\telement.style.setProperty(`position`, props.strategy ?? `absolute`)\n\t\telement.style.setProperty(`left`, `0px`)\n\t\telement.style.setProperty(`top`, `0px`)\n\t\tif (positioned) element.style.setProperty(`translate`, translation)\n\t\telse element.style.setProperty(`visibility`, `hidden`, `important`)\n\t\treference = nextReference\n\t\tobserving =\n\t\t\ttypeof nextObserving === `object` ? { ...nextObserving } : nextObserving\n\t\tif (reconnect && nextObserving !== false) {\n\t\t\tstop = autoUpdate(\n\t\t\t\tnextReference,\n\t\t\t\telement,\n\t\t\t\tupdatePosition,\n\t\t\t\ttypeof nextObserving === `object` ? nextObserving : undefined,\n\t\t\t)\n\t\t} else updatePosition()\n\t}\n\tconst mount = () => {\n\t\tif (dead) return\n\t\tmounted = true\n\t\tconnect()\n\t}\n\tif (scope)\n\t\twithin(scope, () => {\n\t\t\tonMount(mount)\n\t\t})\n\telse queueMicrotask(mount)\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/floating: unknown property floating:${key}`)\n\t\t\tprops = next\n\t\t\tconnect()\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tdisconnect()\n\t\t\trestore()\n\t\t},\n\t}\n}\n\n/** Position HTML overlays using CSS translate, leaving transform available to Motion. */\nexport function floatingCapability(): Capability {\n\treturn { namespace: `floating`, attach }\n}\n"],"mappings":";;;AA4CA,MAAM,0BAAU,IAAI,IAAI;CACvB;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;AACD;AAEA,SAAS,OAAO,QAA0B,OAAkC;CAC3E,MAAM,UAAU,OAAO;CACvB,IACC,OAAO,SAAS,SAChB,SAAS,iBAAiB,gCAE1B,MAAM,IAAI,MAAM,uDAAuD;CACxE,IAAI,QAAuB,CAAC;CAC5B,IAAI,OAAO;CACX,IAAI,UAAU;CACd,IAAI,aAAa;CACjB,IAAI,UAAU;CACd,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI,aAAa;CACjB,IAAI,cAA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;GACR,QAAQ;EACT;EACA,UAAU;GACT,IAAI,MAAM;GACV,OAAO;GACP,WAAW;GACX,QAAQ;EACT;CACD;AACD;;AAGA,SAAgB,qBAAiC;CAChD,OAAO;EAAE,WAAW;EAAY;CAAO;AACxC"}
1
+ {"version":3,"file":"floating.js","names":[],"sources":["../src/floating.ts"],"sourcesContent":["import type {\n\tAutoUpdateOptions,\n\tMiddleware,\n\tPlacement,\n\tReferenceElement,\n\tStrategy,\n} from \"@floating-ui/dom\"\nimport { autoUpdate, computePosition } from \"@floating-ui/dom\"\n\nimport type {\n\tCapability,\n\tCapabilityBinding,\n\tCapabilityTarget,\n} from \"./capabilities.ts\"\nimport type { Scope } from \"./core.ts\"\nimport { onMount, reportScopeError, within } from \"./core.ts\"\n\nexport interface FloatingAttributes<Kind extends string = `dom`> {\n\t[`floating:reference`]?: Kind extends `dom` ? ReferenceElement | null : never\n\t[`floating:placement`]?: Kind extends `dom` ? Placement : never\n\t[`floating:strategy`]?: Kind extends `dom` ? Strategy : never\n\t[`floating:middleware`]?: Kind extends `dom` ? readonly Middleware[] : never\n\t[`floating:enabled`]?: Kind extends `dom` ? boolean : never\n\t[`floating:autoUpdate`]?: Kind extends `dom`\n\t\t? boolean | AutoUpdateOptions\n\t\t: never\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 supplies optional floating attributes.\n\tinterface CapabilityAttributes<\n\t\tKind extends string,\n\t> extends FloatingAttributes<Kind> {}\n}\n\ninterface FloatingProps {\n\treference?: ReferenceElement | null\n\tplacement?: Placement\n\tstrategy?: Strategy\n\tmiddleware?: readonly Middleware[]\n\tenabled?: boolean\n\tautoUpdate?: boolean | AutoUpdateOptions\n}\nconst allowed = new Set([\n\t`reference`,\n\t`placement`,\n\t`strategy`,\n\t`middleware`,\n\t`enabled`,\n\t`autoUpdate`,\n])\nconst observerKeys = [\n\t`ancestorScroll`,\n\t`ancestorResize`,\n\t`elementResize`,\n\t`layoutShift`,\n\t`animationFrame`,\n] as const\nconst ownedStyles = [\n\t`position`,\n\t`left`,\n\t`top`,\n\t`translate`,\n\t`visibility`,\n] as const\n\nfunction attach(target: CapabilityTarget, scope?: Scope): CapabilityBinding {\n\tconst element = target.node as HTMLElement\n\tif (\n\t\ttarget.kind !== `dom` ||\n\t\telement?.namespaceURI !== `http://www.w3.org/1999/xhtml`\n\t)\n\t\tthrow new Error(`spa/floating: floating elements must be HTML elements`)\n\tlet props: FloatingProps = {}\n\tlet dead = false\n\tlet mounted = false\n\tlet generation = 0\n\tlet request = 0\n\tlet stop: (() => void) | undefined\n\tlet reference: ReferenceElement | undefined\n\tlet observing: boolean | AutoUpdateOptions | undefined\n\tlet original: Map<string, { value: string; priority: string }> | undefined\n\tlet positioned = false\n\tlet translation = ``\n\n\tconst restore = () => {\n\t\tif (!original) return\n\t\tfor (const [key, style] of original) {\n\t\t\tif (style.value)\n\t\t\t\telement.style.setProperty(key, style.value, style.priority)\n\t\t\telse element.style.removeProperty(key)\n\t\t}\n\t\toriginal = undefined\n\t\tpositioned = false\n\t\ttranslation = ``\n\t}\n\tconst disconnect = () => {\n\t\t++generation\n\t\tstop?.()\n\t\tstop = undefined\n\t\treference = undefined\n\t}\n\tconst report = (error: unknown) => {\n\t\tif (!scope) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\treportScopeError(scope, error)\n\t}\n\tconst updatePosition = () => {\n\t\tconst anchor = reference\n\t\tif (dead || !anchor) return\n\t\tconst currentGeneration = generation\n\t\tconst currentRequest = ++request\n\t\tvoid computePosition(anchor, element, {\n\t\t\tplacement: props.placement ?? `bottom`,\n\t\t\tstrategy: props.strategy ?? `absolute`,\n\t\t\tmiddleware: props.middleware ? [...props.middleware] : [],\n\t\t}).then(\n\t\t\t({ x, y }) => {\n\t\t\t\tif (\n\t\t\t\t\tdead ||\n\t\t\t\t\tgeneration !== currentGeneration ||\n\t\t\t\t\tcurrentRequest !== request\n\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\ttranslation = `${x}px ${y}px`\n\t\t\t\telement.style.setProperty(`translate`, translation)\n\t\t\t\tif (!positioned) {\n\t\t\t\t\tpositioned = true\n\t\t\t\t\tconst visibility = original!.get(`visibility`)!\n\t\t\t\t\tif (visibility.value)\n\t\t\t\t\t\telement.style.setProperty(\n\t\t\t\t\t\t\t`visibility`,\n\t\t\t\t\t\t\tvisibility.value,\n\t\t\t\t\t\t\tvisibility.priority,\n\t\t\t\t\t\t)\n\t\t\t\t\telse element.style.removeProperty(`visibility`)\n\t\t\t\t}\n\t\t\t},\n\t\t\t(error: unknown) => {\n\t\t\t\tif (\n\t\t\t\t\t!dead &&\n\t\t\t\t\tgeneration === currentGeneration &&\n\t\t\t\t\tcurrentRequest === request\n\t\t\t\t)\n\t\t\t\t\treport(error)\n\t\t\t},\n\t\t)\n\t}\n\tconst connect = () => {\n\t\tif (dead || !mounted) return\n\t\tconst nextReference =\n\t\t\tprops.enabled === false ? undefined : (props.reference ?? undefined)\n\t\tconst nextObserving = props.autoUpdate ?? true\n\t\tconst optionsChanged =\n\t\t\ttypeof nextObserving !== typeof observing ||\n\t\t\t(typeof nextObserving === `object` && typeof observing === `object`\n\t\t\t\t? observerKeys.some(\n\t\t\t\t\t\t(key) =>\n\t\t\t\t\t\t\tnextObserving[key] !== (observing as AutoUpdateOptions)[key],\n\t\t\t\t\t)\n\t\t\t\t: nextObserving !== observing)\n\t\tconst reconnect = nextReference !== reference || optionsChanged\n\t\tif (reconnect) disconnect()\n\t\tif (!nextReference) {\n\t\t\trestore()\n\t\t\treturn\n\t\t}\n\t\toriginal ??= new Map(\n\t\t\townedStyles.map((key) => [\n\t\t\t\tkey,\n\t\t\t\t{\n\t\t\t\t\tvalue: element.style.getPropertyValue(key),\n\t\t\t\t\tpriority: element.style.getPropertyPriority(key),\n\t\t\t\t},\n\t\t\t]),\n\t\t)\n\t\telement.style.setProperty(`position`, props.strategy ?? `absolute`)\n\t\telement.style.setProperty(`left`, `0px`)\n\t\telement.style.setProperty(`top`, `0px`)\n\t\tif (positioned) element.style.setProperty(`translate`, translation)\n\t\telse element.style.setProperty(`visibility`, `hidden`, `important`)\n\t\treference = nextReference\n\t\tobserving =\n\t\t\ttypeof nextObserving === `object` ? { ...nextObserving } : nextObserving\n\t\tif (reconnect && nextObserving !== false) {\n\t\t\tstop = autoUpdate(\n\t\t\t\tnextReference,\n\t\t\t\telement,\n\t\t\t\tupdatePosition,\n\t\t\t\ttypeof nextObserving === `object` ? nextObserving : undefined,\n\t\t\t)\n\t\t} else updatePosition()\n\t}\n\tconst mount = () => {\n\t\tif (dead) return\n\t\tmounted = true\n\t\tconnect()\n\t}\n\tif (scope)\n\t\twithin(scope, () => {\n\t\t\tonMount(mount)\n\t\t})\n\telse queueMicrotask(mount)\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/floating: unknown property floating:${key}`)\n\t\t\tprops = next\n\t\t\tconnect()\n\t\t},\n\t\tdispose() {\n\t\t\tif (dead) return\n\t\t\tdead = true\n\t\t\tdisconnect()\n\t\t\trestore()\n\t\t},\n\t}\n}\n\n/** Position HTML overlays using CSS translate, leaving transform available to Motion. */\nexport function floatingCapability(): Capability {\n\treturn { namespace: `floating`, attach }\n}\n"],"mappings":";;;AA4CA,MAAM,0BAAU,IAAI,IAAI;CACvB;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,MAAM,eAAe;CACpB;CACA;CACA;CACA;CACA;AACD;AACA,MAAM,cAAc;CACnB;CACA;CACA;CACA;CACA;AACD;AAEA,SAAS,OAAO,QAA0B,OAAkC;CAC3E,MAAM,UAAU,OAAO;CACvB,IACC,OAAO,SAAS,SAChB,SAAS,iBAAiB,gCAE1B,MAAM,IAAI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V,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GACjC,IAAI,CAAC,QAAQ,IAAI,GAAG,GACnB,MAAM,IAAI,MAAM,2CAA2C,KAAK;GAClE,QAAQ;GACR,QAAQ;EACT;EACA,UAAU;GACT,IAAI,MAAM;GACV,OAAO;GACP,WAAW;GACX,QAAQ;EACT;CACD;AACD;;AAGA,SAAgB,qBAAiC;CAChD,OAAO;EAAE,WAAW;EAAY;CAAO;AACxC"}
package/dist/hot.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { l as RootOptions, o as Component, s as Root } from "./capabilities-ChgSs6bp.js";
2
+ interface Handle {
3
+ dispose(): void;
4
+ flush(): void;
5
+ }
6
+ type Factory = (options: RootOptions, before: Node | null) => Handle;
7
+ /** Development protocol used by the Vite transform. */
8
+ export declare function registerComponent<T extends Component>(id: string, name: string, implementation: T): T;
9
+ export declare function refresh(id: string): void;
10
+ export declare function trackRoot(root: Root): void;
11
+ /** Release root lifetime resources, retaining them through development remounts. */
12
+ export declare function onRootDispose(cleanup: () => void): void;
13
+ export declare function hotRoot(factory: Factory, options: RootOptions, host?: Element): Handle;
14
+ export {};
15
+ //# sourceMappingURL=hot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot.d.ts","names":[],"sources":["../src/hot.ts"],"mappings":";UAKU;EACT;EACA;;KAEI,WAAW,SAAS,aAAa,QAAQ,gBAAgB;;wBA6J9C,kBAAkB,UAAU,WAC3C,YACA,cACA,gBAAgB,IACd;wBAGa,QAAQ;wBAGR,UAAU,MAAM;;wBAIhB,cAAc;wBAId,QACf,SAAS,SACT,SAAS,aACT,OAAO,UACL"}
package/dist/hot.js ADDED
@@ -0,0 +1,19 @@
1
+ import { u as onCleanup } from "./core-DD2giR6E.js";
2
+ import "atom.io/internal";
3
+ // src/hot.ts
4
+ /** Development protocol used by the Vite transform. */
5
+ function registerComponent(id, name, implementation) {
6
+ return implementation;
7
+ }
8
+ function refresh(id) {}
9
+ function trackRoot(root) {}
10
+ /** Release root lifetime resources, retaining them through development remounts. */
11
+ function onRootDispose(cleanup) {
12
+ onCleanup(cleanup);
13
+ }
14
+ function hotRoot(factory, options, host) {
15
+ return factory(options, null);
16
+ }
17
+ export { hotRoot, onRootDispose, refresh, registerComponent, trackRoot };
18
+
19
+ //# sourceMappingURL=hot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot.js","names":[],"sources":["../src/hot.ts"],"sourcesContent":["import { IMPLICIT } from \"atom.io/internal\"\n\nimport type { Component, Root, RootOptions } from \"./core.ts\"\nimport { onCleanup, owner } from \"./core.ts\"\n\ninterface Handle {\n\tdispose(): void\n\tflush(): void\n}\ntype Factory = (options: RootOptions, before: Node | null) => Handle\ninterface View {\n\tmodules: Set<string>\n\toptions: RootOptions\n\trefreshing: boolean\n\trefresh(): void\n\treport(error: unknown): void\n}\n\nfunction createHotRuntime() {\n\tconst components = new Map<string, { current: Component; proxy: Component }>()\n\tconst roots = new WeakMap<Root, View>()\n\tconst views = new Set<View>()\n\tlet mounting: View | undefined\n\tfunction track(root: Root): void {\n\t\tif (mounting) {\n\t\t\troots.set(root, mounting)\n\t\t\tmounting.options.idPrefix ??= root._prefix\n\t\t}\n\t}\n\tfunction onDispose(cleanup: () => void): void {\n\t\tconst view = roots.get(owner!._root)\n\t\tonCleanup(() => {\n\t\t\tif (!view?.refreshing) cleanup()\n\t\t})\n\t}\n\tfunction register<T extends Component>(\n\t\tid: string,\n\t\tname: string,\n\t\timplementation: T,\n\t): T {\n\t\tconst key = JSON.stringify([id, name])\n\t\tlet record = components.get(key)\n\t\tif (record) record.current = implementation\n\t\telse {\n\t\t\tconst created = {\n\t\t\t\tcurrent: implementation as Component,\n\t\t\t\tproxy: null! as Component,\n\t\t\t}\n\t\t\tcreated.proxy = Object.assign(\n\t\t\t\t(...args: Parameters<Component>) => {\n\t\t\t\t\tif (owner) {\n\t\t\t\t\t\tconst root = owner._root\n\t\t\t\t\t\tconst view = roots.get(root) ?? mounting\n\t\t\t\t\t\tif (view) {\n\t\t\t\t\t\t\troots.set(root, view)\n\t\t\t\t\t\t\tview.options.idPrefix ??= root._prefix\n\t\t\t\t\t\t\tview.modules.add(id)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Compiled JSX mount helpers can take options after their first argument.\n\t\t\t\t\treturn created.current(...args)\n\t\t\t\t},\n\t\t\t\t{ spa: true },\n\t\t\t)\n\t\t\trecord = created\n\t\t\tcomponents.set(key, record)\n\t\t}\n\t\treturn record.proxy as T\n\t}\n\tfunction manage(\n\t\tfactory: Factory,\n\t\toptions: RootOptions,\n\t\thost?: Element,\n\t): Handle {\n\t\tconst settings = { ...options, store: options.store ?? IMPLICIT.STORE }\n\t\tconst anchor = host?.ownerDocument.createComment(`spa-hot`)\n\t\tlet current: Handle\n\t\tlet errorNode: HTMLElement | undefined\n\t\tlet disposed = false\n\t\tconst placeAnchor = () => {\n\t\t\tif (!anchor || anchor.parentNode) return\n\t\t\tlet inside = false\n\t\t\tfor (const node of [...host!.childNodes]) {\n\t\t\t\tif (node.nodeType === 8 && node.nodeValue === `w:${settings.idPrefix}`)\n\t\t\t\t\tinside = true\n\t\t\t\tif (inside && node.nodeType === 8 && node.nodeValue === `/w`) {\n\t\t\t\t\thost!.insertBefore(anchor, node.nextSibling)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\thost!.append(anchor)\n\t\t}\n\t\tconst boot = () => {\n\t\t\tconst previous = mounting\n\t\t\tmounting = view\n\t\t\ttry {\n\t\t\t\tcurrent = factory(settings, anchor?.parentNode ? anchor : null)\n\t\t\t} finally {\n\t\t\t\tmounting = previous\n\t\t\t}\n\t\t}\n\t\tconst view: View = {\n\t\t\tmodules: new Set(),\n\t\t\toptions: settings,\n\t\t\trefreshing: false,\n\t\t\trefresh() {\n\t\t\t\tview.refreshing = true\n\t\t\t\ttry {\n\t\t\t\t\tplaceAnchor()\n\t\t\t\t\tcurrent.dispose()\n\t\t\t\t\terrorNode?.remove()\n\t\t\t\t\tboot()\n\t\t\t\t} finally {\n\t\t\t\t\tview.refreshing = false\n\t\t\t\t}\n\t\t\t},\n\t\t\treport(error) {\n\t\t\t\tconst target =\n\t\t\t\t\thost ?? (typeof document === `undefined` ? undefined : document.body)\n\t\t\t\tif (target) {\n\t\t\t\t\terrorNode = target.ownerDocument.createElement(`pre`)\n\t\t\t\t\terrorNode.setAttribute(`data-spa-hot-error`, ``)\n\t\t\t\t\terrorNode.textContent = `SPA hot refresh failed: ${String(error)}`\n\t\t\t\t\ttarget.insertBefore(errorNode, anchor?.parentNode ? anchor : null)\n\t\t\t\t}\n\t\t\t\toptions.onError?.(error)\n\t\t\t},\n\t\t}\n\t\tviews.add(view)\n\t\ttry {\n\t\t\tboot()\n\t\t} catch (error) {\n\t\t\tviews.delete(view)\n\t\t\tthrow error\n\t\t}\n\t\tif (view.modules.size) placeAnchor()\n\t\treturn {\n\t\t\tflush() {\n\t\t\t\tcurrent.flush()\n\t\t\t},\n\t\t\tdispose() {\n\t\t\t\tif (disposed) return\n\t\t\t\tdisposed = true\n\t\t\t\tviews.delete(view)\n\t\t\t\terrorNode?.remove()\n\t\t\t\tanchor?.remove()\n\t\t\t\tcurrent.dispose()\n\t\t\t},\n\t\t}\n\t}\n\tfunction refreshViews(id: string): void {\n\t\tfor (const view of [...views]) {\n\t\t\tif (!views.has(view) || !view.modules.has(id)) continue\n\t\t\ttry {\n\t\t\t\tview.refresh()\n\t\t\t} catch (error) {\n\t\t\t\tview.report(error)\n\t\t\t}\n\t\t}\n\t}\n\treturn { register, root: manage, refresh: refreshViews, track, onDispose }\n}\n\nconst runtime = import.meta.env.DEV ? createHotRuntime() : undefined\n\n/** Development protocol used by the Vite transform. */\nexport function registerComponent<T extends Component>(\n\tid: string,\n\tname: string,\n\timplementation: T,\n): T {\n\treturn runtime ? runtime.register(id, name, implementation) : implementation\n}\nexport function refresh(id: string): void {\n\truntime?.refresh(id)\n}\nexport function trackRoot(root: Root): void {\n\truntime?.track(root)\n}\n/** Release root lifetime resources, retaining them through development remounts. */\nexport function onRootDispose(cleanup: () => void): void {\n\tif (runtime) runtime.onDispose(cleanup)\n\telse onCleanup(cleanup)\n}\nexport function hotRoot(\n\tfactory: Factory,\n\toptions: RootOptions,\n\thost?: Element,\n): Handle {\n\treturn runtime ? runtime.root(factory, options, host) : factory(options, null)\n}\n"],"mappings":";;;;AAsKA,SAAgB,kBACf,IACA,MACA,gBACI;CACJ,OAA8D;AAC/D;AACA,SAAgB,QAAQ,IAAkB,CAE1C;AACA,SAAgB,UAAU,MAAkB,CAE5C;;AAEA,SAAgB,cAAc,SAA2B;CAEnD,UAAU,OAAO;AACvB;AACA,SAAgB,QACf,SACA,SACA,MACS;CACT,OAAwD,QAAQ,SAAS,IAAI;AAC9E"}
@@ -0,0 +1,121 @@
1
+ import { _ as scopeCapabilities, c as isPresent } from "./core-DD2giR6E.js";
2
+ import { packCanonical } from "atom.io/foundations/canonical";
3
+ // src/capabilities.ts
4
+ function capabilityNamespace(key) {
5
+ const colon = key.indexOf(`:`);
6
+ if (colon < 0) return void 0;
7
+ const namespace = key.slice(0, colon);
8
+ return /^(xml|xmlns|xlink)$/.test(namespace) ? void 0 : namespace;
9
+ }
10
+ function requireCapability(capabilities, namespace) {
11
+ const capability = capabilities.get(namespace);
12
+ if (!capability) throw new Error(`spa: capability "${namespace}" is not registered for this root`);
13
+ return capability;
14
+ }
15
+ function validateCapabilities(scope, props) {
16
+ const capabilities = scopeCapabilities(scope);
17
+ for (const key of Object.keys(props)) {
18
+ const namespace = capabilityNamespace(key);
19
+ if (namespace) requireCapability(capabilities, namespace);
20
+ }
21
+ }
22
+ /** Separate framework properties from native attributes and own their bindings. */
23
+ function capabilityProps(scope, target, read, applyNative) {
24
+ const root = scope._root;
25
+ const bindings = /* @__PURE__ */ new Map();
26
+ let handlers;
27
+ const event = (handler) => {
28
+ const cache = handlers ??= /* @__PURE__ */ new WeakMap();
29
+ let wrapped = cache.get(handler);
30
+ if (!wrapped) {
31
+ wrapped = function(...args) {
32
+ if (!root._presence || isPresent(scope)) return handler.apply(this, args);
33
+ };
34
+ cache.set(handler, wrapped);
35
+ }
36
+ return wrapped;
37
+ };
38
+ if (root._presence) root._presence.target(scope, target);
39
+ else (scope._targets ??= /* @__PURE__ */ new Set()).add(target);
40
+ const cleanup = () => {
41
+ const errors = [];
42
+ for (const binding of [...bindings.values()].reverse()) try {
43
+ binding.dispose();
44
+ } catch (error) {
45
+ errors.push(error);
46
+ }
47
+ bindings.clear();
48
+ if (errors.length) throw new AggregateError(errors);
49
+ };
50
+ scope._cleanups.add(cleanup);
51
+ return (props) => {
52
+ const capabilities = scopeCapabilities(scope);
53
+ const native = {};
54
+ const groups = /* @__PURE__ */ new Map();
55
+ for (const key of Object.keys(props)) {
56
+ const namespace = capabilityNamespace(key);
57
+ if (!namespace) {
58
+ const value = props[key];
59
+ native[key] = key.startsWith(`on`) && typeof value === `function` ? event(value) : value;
60
+ continue;
61
+ }
62
+ const capability = requireCapability(capabilities, namespace);
63
+ const group = groups.get(capability) ?? {};
64
+ group[key.slice(namespace.length + 1)] = props[key];
65
+ groups.set(capability, group);
66
+ }
67
+ const previousStyle = applyNative?.(native);
68
+ for (const [capability, values] of groups) {
69
+ let binding = bindings.get(capability);
70
+ if (!binding) {
71
+ binding = capability.attach(target, scope);
72
+ bindings.set(capability, binding);
73
+ root._presence?.bind(scope, binding, read ?? (() => props), capability.namespace);
74
+ }
75
+ if (previousStyle !== void 0) binding.update(values, previousStyle);
76
+ else binding.update(values);
77
+ }
78
+ for (const [capability, binding] of bindings) if (!groups.has(capability)) {
79
+ bindings.delete(capability);
80
+ root._presence?.unbind(binding);
81
+ binding.dispose();
82
+ }
83
+ return native;
84
+ };
85
+ }
86
+ // src/identity.ts
87
+ function childProps(value) {
88
+ return value?.props;
89
+ }
90
+ function hasKey(value) {
91
+ if (Array.isArray(value)) return value.some(hasKey);
92
+ const props = childProps(value);
93
+ return props !== void 0 && Object.hasOwn(props, `key`);
94
+ }
95
+ /** Direct output opts into key tracking when it first mounts. */
96
+ function trackKeys(value) {
97
+ return hasKey(value) ? () => value : value;
98
+ }
99
+ function identifyChildren(output, duplicate = `spa: duplicate key`) {
100
+ const values = [output].flat(1e400);
101
+ const seen = /* @__PURE__ */ new Set();
102
+ return values.map((value, index) => {
103
+ const key = childProps(value)?.[`key`];
104
+ if (key === void 0) return {
105
+ value,
106
+ key,
107
+ id: index
108
+ };
109
+ const id = packCanonical(key);
110
+ if (seen.has(id)) throw new Error(duplicate);
111
+ seen.add(id);
112
+ return {
113
+ value,
114
+ key,
115
+ id
116
+ };
117
+ });
118
+ }
119
+ export { validateCapabilities as a, capabilityProps as i, trackKeys as n, capabilityNamespace as r, identifyChildren as t };
120
+
121
+ //# sourceMappingURL=identity-ByJswZtF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-ByJswZtF.js","names":[],"sources":["../src/capabilities.ts","../src/identity.ts"],"sourcesContent":["import type { Cleanup, Root, Scope } from \"./core.ts\"\nimport { isPresent, scopeCapabilities } from \"./core.ts\"\nimport type { ExitHandle, PresenceCoordinator } from \"./presence.ts\"\n\n/** Native renderers expose property access without importing capability engines. */\nexport interface CapabilityTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n\tread?(key: string): unknown\n\twrite?(key: string, value: unknown): void\n\tlisten?(event: string, listener: () => void): Cleanup\n}\nexport interface CapabilityBinding {\n\texit?(props: Record<string, unknown>): ExitHandle | undefined\n\tresume?(): void\n\t/** Inline CSS before native style replacement, for restoring capability-owned values. */\n\tupdate(props: Record<string, unknown>, previousStyle?: string): void\n\tdispose(): void\n}\nexport interface Capability {\n\tnamespace: string\n\t/** Prepare a synchronous update batch and return its commit callback. */\n\tbeforeUpdate?(root: Root): Cleanup\n\tpresence?(root: Root): PresenceCoordinator\n\tscheduleFrame?(callback: (time: number) => void): Cleanup\n\t/** SPA supplies ownership for integrations that measure after mount or report async errors. */\n\tattach(target: CapabilityTarget, scope?: Scope): CapabilityBinding\n}\ntype EventHandler = (this: unknown, ...args: unknown[]) => unknown\n\nexport function capabilityNamespace(key: string): string | undefined {\n\tconst colon = key.indexOf(`:`)\n\tif (colon < 0) return undefined\n\tconst namespace = key.slice(0, colon)\n\treturn /^(xml|xmlns|xlink)$/.test(namespace) ? undefined : namespace\n}\nfunction requireCapability(\n\tcapabilities: Map<string, Capability>,\n\tnamespace: string,\n) {\n\tconst capability = capabilities.get(namespace)\n\tif (!capability)\n\t\tthrow new Error(\n\t\t\t`spa: capability \"${namespace}\" is not registered for this root`,\n\t\t)\n\treturn capability\n}\nexport function validateCapabilities(\n\tscope: Scope,\n\tprops: Record<string, unknown>,\n): void {\n\tconst capabilities = scopeCapabilities(scope)\n\tfor (const key of Object.keys(props)) {\n\t\tconst namespace = capabilityNamespace(key)\n\t\tif (namespace) requireCapability(capabilities, namespace)\n\t}\n}\n\n/** Separate framework properties from native attributes and own their bindings. */\nexport function capabilityProps(\n\tscope: Scope,\n\ttarget: CapabilityTarget,\n\tread?: () => Record<string, any>,\n\tapplyNative?: (props: Record<string, any>) => string | undefined,\n): (props: Record<string, any>) => Record<string, any> {\n\tconst root = scope._root\n\tconst bindings = new Map<Capability, CapabilityBinding>()\n\tlet handlers: WeakMap<EventHandler, EventHandler> | undefined\n\tconst event = (handler: EventHandler) => {\n\t\tconst cache = (handlers ??= new WeakMap())\n\t\tlet wrapped = cache.get(handler)\n\t\tif (!wrapped) {\n\t\t\twrapped = function (this: unknown, ...args: unknown[]) {\n\t\t\t\t// Presence may activate after this listener mounts.\n\t\t\t\tif (!root._presence || isPresent(scope)) return handler.apply(this, args)\n\t\t\t}\n\t\t\tcache.set(handler, wrapped)\n\t\t}\n\t\treturn wrapped\n\t}\n\n\tif (root._presence) root._presence.target(scope, target)\n\telse (scope._targets ??= new Set()).add(target)\n\tconst cleanup: Cleanup = () => {\n\t\tconst errors: unknown[] = []\n\t\tfor (const binding of [...bindings.values()].reverse()) {\n\t\t\ttry {\n\t\t\t\tbinding.dispose()\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\t}\n\t\tbindings.clear()\n\t\tif (errors.length) throw new AggregateError(errors)\n\t}\n\tscope._cleanups.add(cleanup)\n\treturn (props) => {\n\t\tconst capabilities = scopeCapabilities(scope)\n\t\tconst native: Record<string, any> = {}\n\t\tconst groups = new Map<Capability, Record<string, unknown>>()\n\t\tfor (const key of Object.keys(props)) {\n\t\t\tconst namespace = capabilityNamespace(key)\n\t\t\tif (!namespace) {\n\t\t\t\tconst value = props[key]\n\t\t\t\tnative[key] =\n\t\t\t\t\tkey.startsWith(`on`) && typeof value === `function`\n\t\t\t\t\t\t? event(value)\n\t\t\t\t\t\t: value\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst capability = requireCapability(capabilities, namespace)\n\t\t\tconst group = groups.get(capability) ?? {}\n\t\t\tgroup[key.slice(namespace.length + 1)] = props[key]\n\t\t\tgroups.set(capability, group)\n\t\t}\n\t\tconst previousStyle = applyNative?.(native)\n\t\tfor (const [capability, values] of groups) {\n\t\t\tlet binding = bindings.get(capability)\n\t\t\tif (!binding) {\n\t\t\t\tbinding = capability.attach(target, scope)\n\t\t\t\tbindings.set(capability, binding)\n\t\t\t\troot._presence?.bind(\n\t\t\t\t\tscope,\n\t\t\t\t\tbinding,\n\t\t\t\t\tread ?? (() => props),\n\t\t\t\t\tcapability.namespace,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (previousStyle !== undefined) binding.update(values, previousStyle)\n\t\t\telse binding.update(values)\n\t\t}\n\t\tfor (const [capability, binding] of bindings)\n\t\t\tif (!groups.has(capability)) {\n\t\t\t\tbindings.delete(capability)\n\t\t\t\troot._presence?.unbind(binding)\n\t\t\t\tbinding.dispose()\n\t\t\t}\n\t\treturn native\n\t}\n}\n","import type { Canonical } from \"atom.io/foundations/canonical\"\nimport { packCanonical } from \"atom.io/foundations/canonical\"\n\nimport type { Children, SpaElement } from \"./core.ts\"\n\ntype Props = SpaElement[`props`]\ntype Key = Canonical | undefined\ntype Identity = string | number\n\nfunction childProps(value: Children): Props | undefined {\n\treturn (value as SpaElement | null)?.props\n}\n\nfunction hasKey(value: Children): boolean {\n\tif (Array.isArray(value)) return value.some(hasKey)\n\tconst props = childProps(value)\n\treturn props !== undefined && Object.hasOwn(props, `key`)\n}\n\n/** Direct output opts into key tracking when it first mounts. */\nexport function trackKeys(value: Children): Children {\n\treturn hasKey(value) ? () => value : value\n}\n\nexport function identifyChildren(\n\toutput: Children,\n\tduplicate = `spa: duplicate key`,\n): { value: Children; key: Key; id: Identity }[] {\n\tconst values = ([output] as unknown[]).flat(Infinity) as Children[]\n\tconst seen = new Set<string>()\n\treturn values.map((value, index) => {\n\t\tconst key: Key = childProps(value)?.[`key`]\n\t\tif (key === undefined) return { value, key, id: index }\n\t\tconst id = packCanonical(key)\n\t\tif (seen.has(id)) throw new Error(duplicate)\n\t\tseen.add(id)\n\t\treturn { value, key, id }\n\t})\n}\n"],"mappings":";;;AA+BA,SAAgB,oBAAoB,KAAiC;CACpE,MAAM,QAAQ,IAAI,QAAQ,GAAG;CAC7B,IAAI,QAAQ,GAAG,OAAO,KAAA;CACtB,MAAM,YAAY,IAAI,MAAM,GAAG,KAAK;CACpC,OAAO,sBAAsB,KAAK,SAAS,IAAI,KAAA,IAAY;AAC5D;AACA,SAAS,kBACR,cACA,WACC;CACD,MAAM,aAAa,aAAa,IAAI,SAAS;CAC7C,IAAI,CAAC,YACJ,MAAM,IAAI,MACT,oBAAoB,UAAU,kCAC/B;CACD,OAAO;AACR;AACA,SAAgB,qBACf,OACA,OACO;CACP,MAAM,eAAe,kBAAkB,KAAK;CAC5C,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACrC,MAAM,YAAY,oBAAoB,GAAG;EACzC,IAAI,WAAW,kBAAkB,cAAc,SAAS;CACzD;AACD;;AAGA,SAAgB,gBACf,OACA,QACA,MACA,aACsD;CACtD,MAAM,OAAO,MAAM;CACnB,MAA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KAAK,IAAI,EAAE;EACX,OAAO;GAAE;GAAO;GAAK;EAAG;CACzB,CAAC;AACF"}
@@ -1,7 +1,7 @@
1
- import { a as Children, i as Accessor, s as RootOptions } from "./capabilities-DNcnGRv_.js";
2
- import "./jsx-runtime-DQnpyT_g.js";
3
- import { Loadable, ReadableFamilyToken, ReadableToken, ViewOf } from "atom.io";
1
+ import { a as Children, i as Accessor, l as RootOptions } from "./capabilities-ChgSs6bp.js";
2
+ import "./jsx-runtime-CCvcEosg.js";
4
3
  import { Canonical } from "atom.io/foundations/canonical";
4
+ import { Loadable, ReadableFamilyToken, ReadableToken, ViewOf } from "atom.io";
5
5
  interface SpaRoot {
6
6
  dispose(): void;
7
7
  flush(): void;
@@ -21,4 +21,4 @@ declare function useLoadable<T, K extends Canonical, E>(token: ReadableFamilyTok
21
21
  error?: E;
22
22
  }>;
23
23
  export { render as a, hydrate as i, useLoadable as n, SpaRoot as r, LoadableValue as t };
24
- //# sourceMappingURL=index-BFnXIfOj.d.ts.map
24
+ //# sourceMappingURL=index-DdA39aMv.d.ts.map