@geajs/ui 0.2.4 → 0.2.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 (170) hide show
  1. package/dist/accordion.d.mts +2 -2
  2. package/dist/accordion.mjs +92 -122
  3. package/dist/accordion.mjs.map +1 -1
  4. package/dist/alert.d.mts +3 -3
  5. package/dist/alert.mjs +45 -107
  6. package/dist/alert.mjs.map +1 -1
  7. package/dist/avatar.d.mts +2 -2
  8. package/dist/avatar.mjs +38 -62
  9. package/dist/avatar.mjs.map +1 -1
  10. package/dist/badge.d.mts +1 -1
  11. package/dist/badge.mjs +18 -43
  12. package/dist/badge.mjs.map +1 -1
  13. package/dist/bind.mjs +169 -0
  14. package/dist/bind.mjs.map +1 -0
  15. package/dist/button.d.mts +3 -2
  16. package/dist/button.mjs +30 -85
  17. package/dist/button.mjs.map +1 -1
  18. package/dist/card.d.mts +6 -6
  19. package/dist/card.mjs +82 -194
  20. package/dist/card.mjs.map +1 -1
  21. package/dist/checkbox.d.mts +2 -2
  22. package/dist/checkbox.mjs +30 -31
  23. package/dist/checkbox.mjs.map +1 -1
  24. package/dist/clipboard.d.mts +2 -2
  25. package/dist/clipboard.mjs +49 -55
  26. package/dist/clipboard.mjs.map +1 -1
  27. package/dist/collapsible.d.mts +2 -2
  28. package/dist/collapsible.mjs +18 -45
  29. package/dist/collapsible.mjs.map +1 -1
  30. package/dist/combobox.d.mts +2 -2
  31. package/dist/combobox.mjs +390 -261
  32. package/dist/combobox.mjs.map +1 -1
  33. package/dist/compiled-component.mjs +121 -0
  34. package/dist/compiled-component.mjs.map +1 -0
  35. package/dist/compiled-reactive-component.mjs +435 -0
  36. package/dist/compiled-reactive-component.mjs.map +1 -0
  37. package/dist/component-id.mjs +21 -0
  38. package/dist/component-id.mjs.map +1 -0
  39. package/dist/conditional-truthy.mjs +48 -0
  40. package/dist/conditional-truthy.mjs.map +1 -0
  41. package/dist/conditional.mjs +54 -0
  42. package/dist/conditional.mjs.map +1 -0
  43. package/dist/delegate-event.mjs +53 -0
  44. package/dist/delegate-event.mjs.map +1 -0
  45. package/dist/dialog.d.mts +4 -3
  46. package/dist/dialog.mjs +57 -70
  47. package/dist/dialog.mjs.map +1 -1
  48. package/dist/dirty-symbols.mjs +7 -0
  49. package/dist/dirty-symbols.mjs.map +1 -0
  50. package/dist/disposer.mjs +65 -0
  51. package/dist/disposer.mjs.map +1 -0
  52. package/dist/dnd-manager.d.mts +9 -1
  53. package/dist/dnd-manager.mjs +67 -29
  54. package/dist/dnd-manager.mjs.map +1 -1
  55. package/dist/drag-drop-context.d.mts +1 -1
  56. package/dist/drag-drop-context.mjs +17 -33
  57. package/dist/drag-drop-context.mjs.map +1 -1
  58. package/dist/draggable.d.mts +1 -1
  59. package/dist/draggable.mjs +2 -91
  60. package/dist/draggable2.mjs +424 -0
  61. package/dist/draggable2.mjs.map +1 -0
  62. package/dist/droppable.d.mts +1 -1
  63. package/dist/droppable.mjs +20 -44
  64. package/dist/droppable.mjs.map +1 -1
  65. package/dist/file-upload.d.mts +2 -2
  66. package/dist/file-upload.mjs +405 -122
  67. package/dist/file-upload.mjs.map +1 -1
  68. package/dist/hover-card.d.mts +2 -2
  69. package/dist/hover-card.mjs +24 -59
  70. package/dist/hover-card.mjs.map +1 -1
  71. package/dist/index.mjs +3 -3
  72. package/dist/input.d.mts +1 -1
  73. package/dist/input.mjs +1 -93
  74. package/dist/input2.mjs +56 -0
  75. package/dist/input2.mjs.map +1 -0
  76. package/dist/internal-symbols.mjs +9 -0
  77. package/dist/internal-symbols.mjs.map +1 -0
  78. package/dist/item-obs.mjs +31 -0
  79. package/dist/item-obs.mjs.map +1 -0
  80. package/dist/keyed-list-symbols.mjs +6 -0
  81. package/dist/keyed-list-symbols.mjs.map +1 -0
  82. package/dist/keyed-list.mjs +538 -0
  83. package/dist/keyed-list.mjs.map +1 -0
  84. package/dist/label.d.mts +1 -1
  85. package/dist/label.mjs +20 -45
  86. package/dist/label.mjs.map +1 -1
  87. package/dist/menu.d.mts +2 -2
  88. package/dist/menu.mjs +87 -41
  89. package/dist/menu.mjs.map +1 -1
  90. package/dist/number-input.d.mts +2 -2
  91. package/dist/number-input.mjs +28 -32
  92. package/dist/number-input.mjs.map +1 -1
  93. package/dist/pagination.d.mts +2 -2
  94. package/dist/pagination.mjs +12 -35
  95. package/dist/pagination.mjs.map +1 -1
  96. package/dist/patch.mjs +21 -0
  97. package/dist/patch.mjs.map +1 -0
  98. package/dist/pin-input.d.mts +2 -2
  99. package/dist/pin-input.mjs +88 -87
  100. package/dist/pin-input.mjs.map +1 -1
  101. package/dist/popover.d.mts +2 -2
  102. package/dist/popover.mjs +45 -67
  103. package/dist/popover.mjs.map +1 -1
  104. package/dist/progress.d.mts +2 -2
  105. package/dist/progress.mjs +37 -43
  106. package/dist/progress.mjs.map +1 -1
  107. package/dist/radio-group.d.mts +2 -2
  108. package/dist/radio-group.mjs +99 -140
  109. package/dist/radio-group.mjs.map +1 -1
  110. package/dist/rating-group.d.mts +2 -2
  111. package/dist/rating-group.mjs +91 -99
  112. package/dist/rating-group.mjs.map +1 -1
  113. package/dist/reactive-attr.mjs +13 -0
  114. package/dist/reactive-attr.mjs.map +1 -0
  115. package/dist/reactive-bool.mjs +13 -0
  116. package/dist/reactive-bool.mjs.map +1 -0
  117. package/dist/reactive-class-name.mjs +15 -0
  118. package/dist/reactive-class-name.mjs.map +1 -0
  119. package/dist/reactive-class.mjs +54 -0
  120. package/dist/reactive-class.mjs.map +1 -0
  121. package/dist/reactive-style.mjs +24 -0
  122. package/dist/reactive-style.mjs.map +1 -0
  123. package/dist/reactive-text.mjs +62 -0
  124. package/dist/reactive-text.mjs.map +1 -0
  125. package/dist/select.d.mts +2 -2
  126. package/dist/select.mjs +106 -186
  127. package/dist/select.mjs.map +1 -1
  128. package/dist/separator.d.mts +1 -1
  129. package/dist/separator.mjs +19 -45
  130. package/dist/separator.mjs.map +1 -1
  131. package/dist/skeleton.d.mts +1 -1
  132. package/dist/skeleton.mjs +11 -35
  133. package/dist/skeleton.mjs.map +1 -1
  134. package/dist/slider.d.mts +2 -2
  135. package/dist/slider.mjs +31 -32
  136. package/dist/slider.mjs.map +1 -1
  137. package/dist/switch.d.mts +2 -2
  138. package/dist/switch.mjs +30 -31
  139. package/dist/switch.mjs.map +1 -1
  140. package/dist/tabs.d.mts +7 -2
  141. package/dist/tabs.mjs +180 -147
  142. package/dist/tabs.mjs.map +1 -1
  143. package/dist/tags-input.d.mts +2 -2
  144. package/dist/tags-input.mjs +102 -188
  145. package/dist/tags-input.mjs.map +1 -1
  146. package/dist/textarea.d.mts +1 -1
  147. package/dist/textarea.mjs +32 -75
  148. package/dist/textarea.mjs.map +1 -1
  149. package/dist/theme.css +4 -5
  150. package/dist/toast.d.mts +1 -1
  151. package/dist/toast.mjs +14 -34
  152. package/dist/toast.mjs.map +1 -1
  153. package/dist/toggle-group.d.mts +2 -2
  154. package/dist/toggle-group.mjs +78 -85
  155. package/dist/toggle-group.mjs.map +1 -1
  156. package/dist/tooltip.d.mts +2 -2
  157. package/dist/tooltip.mjs +23 -43
  158. package/dist/tooltip.mjs.map +1 -1
  159. package/dist/tree-view.d.mts +2 -2
  160. package/dist/tree-view.mjs +32 -50
  161. package/dist/tree-view.mjs.map +1 -1
  162. package/dist/types.d.mts +9 -0
  163. package/dist/zag-component.d.mts +26 -3
  164. package/dist/zag-component.mjs +73 -17
  165. package/dist/zag-component.mjs.map +1 -1
  166. package/package.json +4 -3
  167. package/dist/cn.mjs +0 -10
  168. package/dist/cn.mjs.map +0 -1
  169. package/dist/draggable.mjs.map +0 -1
  170. package/dist/input.mjs.map +0 -1
@@ -0,0 +1,435 @@
1
+ import { n as createDisposer } from "./disposer.mjs";
2
+ import { c as GEA_ELEMENT, d as GEA_STORE_ROOT, l as GEA_ON_PROP_CHANGE, n as trackRead, o as GEA_CREATE_TEMPLATE, s as GEA_DOM_COMPONENT, u as GEA_PROXY_RAW } from "./bind.mjs";
3
+ import { i as GEA_SET_PROPS, n as GEA_DISPOSER, r as GEA_OBSERVE_DIRECT, t as GEA_CREATED_CALLED } from "./internal-symbols.mjs";
4
+ import { t as getComponentId } from "./component-id.mjs";
5
+ import { n as _DIRTY_PROPS, t as _DIRTY } from "./dirty-symbols.mjs";
6
+ //#region ../gea/src/runtime/compiled-store.ts
7
+ const _PRIV = Symbol("gea.store.priv");
8
+ const _NESTED = Symbol("gea.store.nested");
9
+ /**
10
+ * `O`/`V` are generic (not `object`/`any`) — this helper hides a value under
11
+ * a symbol key on WHATEVER object it's called with (the raw store, its
12
+ * proxy, a Map cache, ...), so its own declaration can't pin a single
13
+ * concrete shape; each call site supplies its own concrete `O`/`V`.
14
+ */
15
+ function _hidden(target, key, value) {
16
+ Object.defineProperty(target, key, {
17
+ value,
18
+ writable: true,
19
+ configurable: true,
20
+ enumerable: false
21
+ });
22
+ }
23
+ /** Same shape as `_hidden`: a generic reflection probe, not tied to one type. */
24
+ function _isPlain(v) {
25
+ if (!v || typeof v !== "object") return false;
26
+ const p = Object.getPrototypeOf(v);
27
+ return p === Object.prototype || p === null || Array.isArray(v);
28
+ }
29
+ /** Unwrap a proxy value to its raw target, preserving whatever type it was. */
30
+ function _unwrap(v) {
31
+ return v && v[GEA_PROXY_RAW] || v;
32
+ }
33
+ function _fireBucket(bucket, value, changes) {
34
+ if (bucket.size === 0) return;
35
+ if (bucket.size === 1) for (const h of bucket) {
36
+ h(value, changes);
37
+ return;
38
+ }
39
+ const snapshot = [];
40
+ for (const h of bucket) snapshot.push(h);
41
+ for (let i = 0; i < snapshot.length; i++) try {
42
+ snapshot[i](value, changes);
43
+ } catch {}
44
+ }
45
+ function _flush(raw, state) {
46
+ state.scheduled = false;
47
+ const pending = state.pending;
48
+ if (!pending || pending.size === 0) return;
49
+ state.pending = void 0;
50
+ let allChanges = null;
51
+ for (const entry of pending) {
52
+ const prop = entry[0];
53
+ const changes = entry[1];
54
+ if (state.rootObservers || state.derived) {
55
+ allChanges ??= [];
56
+ for (let i = 0; i < changes.length; i++) allChanges.push(changes[i]);
57
+ }
58
+ const bucket = state.observers?.get(prop);
59
+ if (!bucket || bucket.size === 0) continue;
60
+ _fireBucket(bucket, raw[prop], changes);
61
+ }
62
+ if (allChanges && state.rootObservers) _fireBucket(state.rootObservers, raw, allChanges);
63
+ if (allChanges && state.derived) for (const entry of state.derived) {
64
+ const prop = entry[0];
65
+ const bucket = entry[1];
66
+ if (bucket.size === 0) continue;
67
+ let value;
68
+ try {
69
+ value = raw[prop];
70
+ } catch {
71
+ continue;
72
+ }
73
+ _fireBucket(bucket, value, allChanges);
74
+ }
75
+ }
76
+ function _hasQueuedConsumers(state, prop) {
77
+ const bucket = state.observers?.get(prop);
78
+ return !!(bucket && bucket.size > 0 || state.rootObservers && state.rootObservers.size > 0 || state.derived && state.derived.size > 0);
79
+ }
80
+ function _queue(raw, state, prop, change = {}) {
81
+ if (!state.ready || !_hasQueuedConsumers(state, prop)) return;
82
+ const rec = {
83
+ prop,
84
+ pathParts: [prop],
85
+ type: "update",
86
+ target: raw,
87
+ ...change
88
+ };
89
+ const pending = state.pending ?? (state.pending = /* @__PURE__ */ new Map());
90
+ const arr = pending.get(prop);
91
+ if (arr) arr.push(rec);
92
+ else pending.set(prop, [rec]);
93
+ if (!state.scheduled) {
94
+ state.scheduled = true;
95
+ queueMicrotask(() => _flush(raw, state));
96
+ }
97
+ }
98
+ /**
99
+ * Nested object/array traversal INSIDE one of `S`'s own fields (e.g.
100
+ * `store.list[0].name`): once inside a field's own substructure, the shape
101
+ * is no longer described by `S` (a field's element/property types aren't
102
+ * modeled recursively here) — `V` is a genuinely open per-call type at this
103
+ * depth, kept as a type parameter rather than `any` so it's at least
104
+ * threaded through instead of erased, but this is the one spot in this file
105
+ * that's honestly a dynamic-JS-object-graph boundary: how deep a nested
106
+ * value's shape goes isn't knowable without walking `S` structurally.
107
+ */
108
+ function _wrapNested(raw, state, target, rootProp) {
109
+ if (!_isPlain(target)) return target;
110
+ const targetObj = target;
111
+ let perTarget = targetObj[_NESTED];
112
+ if (perTarget) {
113
+ const cached = perTarget.get(rootProp);
114
+ if (cached) return cached;
115
+ }
116
+ const proxy = new Proxy(targetObj, {
117
+ get(obj, prop) {
118
+ if (prop === GEA_PROXY_RAW) return obj;
119
+ if (typeof prop === "symbol") return obj[prop];
120
+ trackRead(raw, rootProp);
121
+ const val = obj[prop];
122
+ if (Array.isArray(obj) && typeof val === "function") {
123
+ if (prop === "push") return (...args) => {
124
+ const start = obj.length;
125
+ const result = Array.prototype.push.apply(obj, args.map(_unwrap));
126
+ if (obj === raw[rootProp] && obj.length > start) _queue(raw, state, rootProp, {
127
+ type: "append",
128
+ start,
129
+ count: obj.length - start
130
+ });
131
+ else _queue(raw, state, rootProp);
132
+ return result;
133
+ };
134
+ if (prop === "splice") return (...args) => {
135
+ const before = obj.length;
136
+ const start = args[0] | 0;
137
+ const result = Array.prototype.splice.apply(obj, args.length > 2 ? [
138
+ args[0],
139
+ args[1],
140
+ ...args.slice(2).map(_unwrap)
141
+ ] : args);
142
+ if (obj === raw[rootProp]) {
143
+ const after = obj.length;
144
+ if (after < before) _queue(raw, state, rootProp, {
145
+ type: "remove",
146
+ start,
147
+ count: before - after
148
+ });
149
+ else _queue(raw, state, rootProp, { type: "reorder" });
150
+ } else _queue(raw, state, rootProp);
151
+ return result;
152
+ };
153
+ if (prop === "pop" || prop === "shift") return (...args) => {
154
+ const before = obj.length;
155
+ const result = Array.prototype[prop].apply(obj, args);
156
+ const after = obj.length;
157
+ if (obj === raw[rootProp] && after < before) _queue(raw, state, rootProp, {
158
+ type: "remove",
159
+ start: prop === "pop" ? after : 0,
160
+ count: 1
161
+ });
162
+ else _queue(raw, state, rootProp);
163
+ return result;
164
+ };
165
+ if (prop === "unshift" || prop === "sort" || prop === "reverse") return (...args) => {
166
+ const callArgs = prop === "unshift" ? args.map(_unwrap) : args;
167
+ const result = Array.prototype[prop].apply(obj, callArgs);
168
+ if (obj === raw[rootProp]) _queue(raw, state, rootProp, { type: "reorder" });
169
+ else _queue(raw, state, rootProp);
170
+ return result;
171
+ };
172
+ }
173
+ return _isPlain(val) ? _wrapNested(raw, state, val, rootProp) : val;
174
+ },
175
+ set(obj, prop, value) {
176
+ if (typeof prop === "symbol") {
177
+ obj[prop] = value;
178
+ return true;
179
+ }
180
+ value = _unwrap(value);
181
+ const old = obj[prop];
182
+ if (old === value) return true;
183
+ obj[prop] = value;
184
+ if (Array.isArray(obj)) {
185
+ if (value && typeof value === "object") value[_DIRTY] = true;
186
+ const idx = +prop;
187
+ if (Number.isInteger(idx) && obj === raw[rootProp]) {
188
+ _queue(raw, state, rootProp, {
189
+ aipu: true,
190
+ arix: idx,
191
+ previousValue: old,
192
+ newValue: value
193
+ });
194
+ return true;
195
+ }
196
+ } else {
197
+ obj[_DIRTY] = true;
198
+ (obj[_DIRTY_PROPS] ??= /* @__PURE__ */ new Set()).add(prop);
199
+ }
200
+ _queue(raw, state, rootProp, {
201
+ previousValue: old,
202
+ newValue: value
203
+ });
204
+ return true;
205
+ },
206
+ deleteProperty(obj, prop) {
207
+ if (typeof prop === "symbol") {
208
+ delete obj[prop];
209
+ return true;
210
+ }
211
+ const old = obj[prop];
212
+ delete obj[prop];
213
+ if (!Array.isArray(obj)) obj[_DIRTY] = true;
214
+ _queue(raw, state, rootProp, {
215
+ previousValue: old,
216
+ type: "delete"
217
+ });
218
+ return true;
219
+ }
220
+ });
221
+ if (!perTarget) {
222
+ perTarget = /* @__PURE__ */ new Map();
223
+ _hidden(targetObj, _NESTED, perTarget);
224
+ }
225
+ perTarget.set(rootProp, proxy);
226
+ return proxy;
227
+ }
228
+ var CompiledStore = class {
229
+ constructor() {
230
+ const state = { ready: false };
231
+ _hidden(this, _PRIV, state);
232
+ const proxy = new Proxy(this, {
233
+ get(target, prop, receiver) {
234
+ if (prop === GEA_PROXY_RAW) return target;
235
+ if (typeof prop === "symbol") return target[prop];
236
+ trackRead(receiver ?? target, prop);
237
+ const value = target[prop];
238
+ if (typeof value === "function") return value.bind(receiver);
239
+ return _isPlain(value) ? _wrapNested(target, state, value, prop) : value;
240
+ },
241
+ set(target, prop, value) {
242
+ if (typeof prop === "symbol") {
243
+ target[prop] = value;
244
+ return true;
245
+ }
246
+ value = _unwrap(value);
247
+ const old = target[prop];
248
+ if (old === value && prop in target) {
249
+ if (Array.isArray(value)) _queue(target, state, prop, {
250
+ previousValue: old,
251
+ newValue: value
252
+ });
253
+ return true;
254
+ }
255
+ if (old && typeof old === "object") delete old[_NESTED];
256
+ target[prop] = value;
257
+ const direct = state.direct?.get(prop);
258
+ if (direct) for (const h of direct) h(value);
259
+ _queue(target, state, prop, {
260
+ previousValue: old,
261
+ newValue: value
262
+ });
263
+ return true;
264
+ }
265
+ });
266
+ _hidden(proxy, _PRIV, state);
267
+ this[GEA_STORE_ROOT] = proxy;
268
+ return proxy;
269
+ }
270
+ observe(pathOrProp, handler) {
271
+ const state = this[_PRIV];
272
+ if (!state) return () => {};
273
+ state.ready = true;
274
+ const isArr = Array.isArray(pathOrProp);
275
+ let path = [];
276
+ let text = "";
277
+ if (typeof pathOrProp === "string") text = pathOrProp;
278
+ else path = pathOrProp;
279
+ if (isArr && path.length === 0 || !isArr && text === "") {
280
+ const bucket = state.rootObservers ?? (state.rootObservers = /* @__PURE__ */ new Set());
281
+ bucket.add(handler);
282
+ return () => {
283
+ bucket.delete(handler);
284
+ };
285
+ }
286
+ const prop = isArr ? path[0] ?? "" : text;
287
+ const tail = isArr && path.length > 1 ? path.slice(1) : null;
288
+ const finalHandler = tail ? (value, changes) => {
289
+ let next = value;
290
+ for (let i = 0; i < tail.length; i++) {
291
+ if (next == null) return;
292
+ next = next[tail[i]];
293
+ }
294
+ handler(next, changes);
295
+ } : handler;
296
+ let isDerived = false;
297
+ if (!Object.prototype.hasOwnProperty.call(this, prop)) for (let proto = Object.getPrototypeOf(this); proto && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {
298
+ const descriptor = Object.getOwnPropertyDescriptor(proto, prop);
299
+ if (descriptor) {
300
+ isDerived = !!descriptor.get;
301
+ break;
302
+ }
303
+ }
304
+ const observers = isDerived ? state.derived ?? (state.derived = /* @__PURE__ */ new Map()) : state.observers ?? (state.observers = /* @__PURE__ */ new Map());
305
+ let bucket = observers.get(prop);
306
+ if (!bucket) observers.set(prop, bucket = /* @__PURE__ */ new Set());
307
+ bucket.add(finalHandler);
308
+ return () => {
309
+ bucket.delete(finalHandler);
310
+ };
311
+ }
312
+ [GEA_OBSERVE_DIRECT](prop, handler) {
313
+ const state = this[_PRIV];
314
+ if (!state) return () => {};
315
+ state.ready = true;
316
+ const direct = state.direct ?? (state.direct = /* @__PURE__ */ new Map());
317
+ let bucket = direct.get(prop);
318
+ if (!bucket) direct.set(prop, bucket = /* @__PURE__ */ new Set());
319
+ bucket.add(handler);
320
+ return () => {
321
+ bucket.delete(handler);
322
+ };
323
+ }
324
+ };
325
+ //#endregion
326
+ //#region ../gea/src/runtime/compiled-reactive-component.ts
327
+ const GEA_COMPONENT_ID = Symbol();
328
+ const GEA_LAST_PROP_VALUES = Symbol();
329
+ var CompiledReactiveComponent = class CompiledReactiveComponent extends CompiledStore {
330
+ constructor(..._args) {
331
+ super(..._args);
332
+ this.rendered = false;
333
+ this.props = {};
334
+ this[GEA_ELEMENT] = null;
335
+ this[GEA_DISPOSER] = createDisposer();
336
+ this[GEA_CREATED_CALLED] = false;
337
+ }
338
+ get id() {
339
+ return this[GEA_COMPONENT_ID] ??= getComponentId();
340
+ }
341
+ set id(value) {
342
+ this[GEA_COMPONENT_ID] = value;
343
+ }
344
+ get el() {
345
+ return this[GEA_ELEMENT] ?? null;
346
+ }
347
+ [GEA_SET_PROPS](thunks) {
348
+ const createdCalled = this[GEA_CREATED_CALLED];
349
+ const notifyPropChange = createdCalled ? this[GEA_ON_PROP_CHANGE] : void 0;
350
+ const prevValues = typeof notifyPropChange === "function" ? this[GEA_LAST_PROP_VALUES] : void 0;
351
+ const out = {};
352
+ for (const k in thunks) Object.defineProperty(out, k, {
353
+ enumerable: true,
354
+ configurable: true,
355
+ get: () => thunks[k]()
356
+ });
357
+ const childrenThunk = thunks.children;
358
+ if (typeof childrenThunk === "function") {
359
+ let cached = void 0;
360
+ let cacheNode = false;
361
+ Object.defineProperty(out, "children", {
362
+ enumerable: true,
363
+ configurable: true,
364
+ get: () => {
365
+ if (cacheNode) return cached;
366
+ const v = childrenThunk();
367
+ if (v !== null && typeof v === "object" && typeof v.nodeType === "number") {
368
+ cached = v;
369
+ cacheNode = true;
370
+ }
371
+ return v;
372
+ }
373
+ });
374
+ }
375
+ this.props = out;
376
+ const nextValues = {};
377
+ for (const key in thunks) nextValues[key] = this.props?.[key];
378
+ this[GEA_LAST_PROP_VALUES] = nextValues;
379
+ if (!createdCalled) {
380
+ this[GEA_CREATED_CALLED] = true;
381
+ if (this.created !== CompiledReactiveComponent.prototype.created) this.created(this.props);
382
+ } else if (typeof notifyPropChange === "function") for (const key in thunks) {
383
+ const prev = prevValues?.[key];
384
+ const next = this.props?.[key];
385
+ if (next !== prev || prev !== null && typeof prev === "object") notifyPropChange.call(this, key, next);
386
+ }
387
+ }
388
+ [GEA_CREATE_TEMPLATE](_disposer) {
389
+ return document.createDocumentFragment();
390
+ }
391
+ render(parent, _index) {
392
+ if (!this[GEA_CREATED_CALLED]) {
393
+ this[GEA_CREATED_CALLED] = true;
394
+ if (this.created !== CompiledReactiveComponent.prototype.created) this.created(this.props);
395
+ }
396
+ let node = this[GEA_CREATE_TEMPLATE](this[GEA_DISPOSER]);
397
+ if (node == null) node = document.createComment("");
398
+ if (typeof node.nodeType !== "number") if (Array.isArray(node)) {
399
+ const frag = document.createDocumentFragment();
400
+ for (const n of node) {
401
+ if (n == null) continue;
402
+ if (typeof n.nodeType === "number") frag.appendChild(n);
403
+ else frag.appendChild(document.createTextNode(String(n)));
404
+ }
405
+ node = frag;
406
+ } else node = document.createTextNode(String(node));
407
+ parent.appendChild(node);
408
+ if (node.nodeType === 11) this[GEA_ELEMENT] = parent.lastElementChild ?? null;
409
+ else if (node.nodeType === 1) this[GEA_ELEMENT] = node;
410
+ const el = this[GEA_ELEMENT];
411
+ if (el) el[GEA_DOM_COMPONENT] = this;
412
+ this.rendered = true;
413
+ this.onAfterRender();
414
+ }
415
+ onAfterRender() {}
416
+ created(_props) {}
417
+ dispose() {
418
+ this[GEA_DISPOSER].dispose();
419
+ const e = this[GEA_ELEMENT];
420
+ if (e && e.parentNode) e.parentNode.removeChild(e);
421
+ this[GEA_ELEMENT] = null;
422
+ }
423
+ $(sel) {
424
+ const e = this[GEA_ELEMENT];
425
+ return e ? e.querySelector(sel) : null;
426
+ }
427
+ $$(sel) {
428
+ const e = this[GEA_ELEMENT];
429
+ return e ? Array.from(e.querySelectorAll(sel)) : [];
430
+ }
431
+ };
432
+ //#endregion
433
+ export { CompiledReactiveComponent as t };
434
+
435
+ //# sourceMappingURL=compiled-reactive-component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiled-reactive-component.mjs","names":["GEA_DIRTY","GEA_DIRTY_PROPS"],"sources":["../../gea/src/runtime/compiled-store.ts","../../gea/src/runtime/compiled-reactive-component.ts"],"sourcesContent":["import { GEA_PROXY_RAW, GEA_STORE_ROOT } from './symbols'\nimport { GEA_OBSERVE_DIRECT } from './internal-symbols'\nimport { GEA_DIRTY, GEA_DIRTY_PROPS } from './dirty-symbols'\nimport { trackRead } from './with-tracking'\nimport type { Change } from '../store'\n\n/**\n * A store observer: the changed value, and the batch of changes that\n * produced it. `S` is `CompiledStore<S>`'s own type parameter — the\n * concrete store subclass's field shape, resolved once per subclass exactly\n * the way `CompiledComponent<P>` resolves `P` for a component's props. A\n * single `Map<string, Set<Handler<S>>>` holds observers across every field\n * of `S` at once, so the exact field a given handler fires for isn't known\n * at this layer — but the closed set of types it could possibly be (every\n * member of `S`) is, which is why `value` is `S[keyof S]` rather than\n * `any`/`unknown`.\n */\ntype Handler<S> = (value: S[keyof S], changes: Change[]) => void\n\ninterface StoreState<S> {\n observers?: Map<string, Set<Handler<S>>>\n rootObservers?: Set<Handler<S>>\n derived?: Map<string, Set<Handler<S>>>\n direct?: Map<string, Set<(value: S[keyof S]) => void>>\n /** Queued change records, keyed by the prop they were recorded against —\n * each entry is `Change`-shaped (built by `_queue` below), not a raw\n * store value, so `Change[]` is exact rather than `any[]`. */\n pending?: Map<string, Change[]>\n scheduled?: boolean\n ready?: boolean\n}\n\n// Symbol properties, not `WeakMap`s keyed by the store object. See the same\n// change in `compiled-lean-store`: geatsc marks any value reaching a weak-key\n// position as a weak-handle ownership subject and then rejects it for carrying a\n// dynamic representation, which every store value does. A non-enumerable symbol\n// property has the same lifetime, stays out of `Object.keys` / `for...in` /\n// `JSON.stringify`, and passes through the proxy traps' existing symbol\n// short-circuit.\nconst _PRIV = Symbol('gea.store.priv')\nconst _NESTED = Symbol('gea.store.nested')\n\n/**\n * `O`/`V` are generic (not `object`/`any`) — this helper hides a value under\n * a symbol key on WHATEVER object it's called with (the raw store, its\n * proxy, a Map cache, ...), so its own declaration can't pin a single\n * concrete shape; each call site supplies its own concrete `O`/`V`.\n */\nfunction _hidden<O extends object, V>(target: O, key: symbol, value: V): void {\n Object.defineProperty(target, key, { value, writable: true, configurable: true, enumerable: false })\n}\n\n/** Same shape as `_hidden`: a generic reflection probe, not tied to one type. */\nfunction _isPlain<V>(v: V): boolean {\n if (!v || typeof v !== 'object') return false\n const p = Object.getPrototypeOf(v)\n return p === Object.prototype || p === null || Array.isArray(v)\n}\n\n/** Unwrap a proxy value to its raw target, preserving whatever type it was. */\nfunction _unwrap<V>(v: V): V {\n const rawTarget = v && (v as unknown as Record<symbol, unknown>)[GEA_PROXY_RAW]\n return (rawTarget as V) || v\n}\n\nfunction _fireBucket<S>(bucket: Set<Handler<S>>, value: S[keyof S], changes: Change[]): void {\n if (bucket.size === 0) return\n if (bucket.size === 1) {\n for (const h of bucket) {\n h(value, changes)\n return\n }\n }\n const snapshot: Handler<S>[] = []\n for (const h of bucket) snapshot.push(h)\n for (let i = 0; i < snapshot.length; i++) {\n try {\n snapshot[i](value, changes)\n } catch {\n /* isolate sibling observers */\n }\n }\n}\n\nfunction _flush<S>(raw: S, state: StoreState<S>): void {\n state.scheduled = false\n const pending = state.pending\n if (!pending || pending.size === 0) return\n state.pending = undefined\n let allChanges: Change[] | null = null\n for (const entry of pending) {\n const prop = entry[0]\n const changes = entry[1]\n if (state.rootObservers || state.derived) {\n allChanges ??= []\n for (let i = 0; i < changes.length; i++) allChanges.push(changes[i])\n }\n const bucket = state.observers?.get(prop)\n if (!bucket || bucket.size === 0) continue\n _fireBucket(bucket, raw[prop as keyof S], changes)\n }\n if (allChanges && state.rootObservers) {\n _fireBucket(state.rootObservers, raw as S[keyof S], allChanges)\n }\n if (allChanges && state.derived) {\n for (const entry of state.derived) {\n const prop = entry[0]\n const bucket = entry[1]\n if (bucket.size === 0) continue\n let value: S[keyof S]\n try {\n value = raw[prop as keyof S]\n } catch {\n continue\n }\n _fireBucket(bucket, value, allChanges)\n }\n }\n}\n\nfunction _hasQueuedConsumers<S>(state: StoreState<S>, prop: string): boolean {\n const bucket = state.observers?.get(prop)\n return !!(\n (bucket && bucket.size > 0) ||\n (state.rootObservers && state.rootObservers.size > 0) ||\n (state.derived && state.derived.size > 0)\n )\n}\n\nfunction _queue<S>(raw: S, state: StoreState<S>, prop: string, change: Partial<Change> = {}): void {\n if (!state.ready || !_hasQueuedConsumers(state, prop)) return\n const rec: Change = { prop, pathParts: [prop], type: 'update', target: raw, ...change }\n const pending = state.pending ?? (state.pending = new Map())\n const arr = pending.get(prop)\n if (arr) arr.push(rec)\n else pending.set(prop, [rec])\n if (!state.scheduled) {\n state.scheduled = true\n queueMicrotask(() => _flush(raw, state))\n }\n}\n\n/**\n * Nested object/array traversal INSIDE one of `S`'s own fields (e.g.\n * `store.list[0].name`): once inside a field's own substructure, the shape\n * is no longer described by `S` (a field's element/property types aren't\n * modeled recursively here) — `V` is a genuinely open per-call type at this\n * depth, kept as a type parameter rather than `any` so it's at least\n * threaded through instead of erased, but this is the one spot in this file\n * that's honestly a dynamic-JS-object-graph boundary: how deep a nested\n * value's shape goes isn't knowable without walking `S` structurally.\n */\nfunction _wrapNested<S, V>(raw: S, state: StoreState<S>, target: V, rootProp: string): V {\n if (!_isPlain(target)) return target\n const targetObj = target as unknown as Record<PropertyKey, unknown>\n let perTarget: Map<string, unknown> | undefined = (targetObj as unknown as Record<symbol, Map<string, unknown>>)[\n _NESTED\n ]\n if (perTarget) {\n const cached = perTarget.get(rootProp)\n if (cached) return cached as V\n }\n const proxy = new Proxy(targetObj, {\n get(obj, prop) {\n if (prop === GEA_PROXY_RAW) return obj\n if (typeof prop === 'symbol') return obj[prop]\n trackRead(raw as object, rootProp)\n const val = obj[prop]\n if (Array.isArray(obj) && typeof val === 'function') {\n if (prop === 'push') {\n return (...args: unknown[]) => {\n const start = (obj as unknown[]).length\n const result = Array.prototype.push.apply(obj, args.map(_unwrap))\n if (obj === (raw as Record<string, unknown>)[rootProp] && (obj as unknown[]).length > start) {\n _queue(raw, state, rootProp, { type: 'append', start, count: (obj as unknown[]).length - start })\n } else {\n _queue(raw, state, rootProp)\n }\n return result\n }\n }\n if (prop === 'splice') {\n return (...args: unknown[]) => {\n const before = (obj as unknown[]).length\n const start = (args[0] as number) | 0\n const result = Array.prototype.splice.apply(\n obj,\n args.length > 2\n ? ([args[0], args[1], ...args.slice(2).map(_unwrap)] as [number, number, ...unknown[]])\n : (args as [number, number]),\n )\n if (obj === (raw as Record<string, unknown>)[rootProp]) {\n const after = (obj as unknown[]).length\n if (after < before) _queue(raw, state, rootProp, { type: 'remove', start, count: before - after })\n else _queue(raw, state, rootProp, { type: 'reorder' })\n } else {\n _queue(raw, state, rootProp)\n }\n return result\n }\n }\n if (prop === 'pop' || prop === 'shift') {\n return (...args: unknown[]) => {\n const before = (obj as unknown[]).length\n const result = (Array.prototype as unknown as Record<string, (...a: unknown[]) => unknown>)[prop].apply(\n obj,\n args,\n )\n const after = (obj as unknown[]).length\n if (obj === (raw as Record<string, unknown>)[rootProp] && after < before) {\n _queue(raw, state, rootProp, { type: 'remove', start: prop === 'pop' ? after : 0, count: 1 })\n } else {\n _queue(raw, state, rootProp)\n }\n return result\n }\n }\n if (prop === 'unshift' || prop === 'sort' || prop === 'reverse') {\n return (...args: unknown[]) => {\n const callArgs = prop === 'unshift' ? args.map(_unwrap) : args\n const result = (Array.prototype as unknown as Record<string, (...a: unknown[]) => unknown>)[prop].apply(\n obj,\n callArgs,\n )\n if (obj === (raw as Record<string, unknown>)[rootProp]) {\n _queue(raw, state, rootProp, { type: 'reorder' })\n } else {\n _queue(raw, state, rootProp)\n }\n return result\n }\n }\n }\n return _isPlain(val) ? _wrapNested(raw, state, val, rootProp) : val\n },\n set(obj, prop, value) {\n if (typeof prop === 'symbol') {\n obj[prop] = value\n return true\n }\n value = _unwrap(value)\n const old = obj[prop]\n if (old === value) return true\n obj[prop] = value\n if (Array.isArray(obj)) {\n if (value && typeof value === 'object') (value as Record<symbol, unknown>)[GEA_DIRTY] = true\n const idx = +prop\n if (Number.isInteger(idx) && obj === (raw as Record<string, unknown>)[rootProp]) {\n _queue(raw, state, rootProp, { aipu: true, arix: idx, previousValue: old, newValue: value })\n return true\n }\n } else {\n ;(obj as Record<symbol, unknown>)[GEA_DIRTY] = true\n const dirtyProps = ((obj as Record<symbol, unknown>)[GEA_DIRTY_PROPS] ??= new Set()) as Set<string>\n dirtyProps.add(prop)\n }\n _queue(raw, state, rootProp, { previousValue: old, newValue: value })\n return true\n },\n deleteProperty(obj, prop) {\n if (typeof prop === 'symbol') {\n delete obj[prop]\n return true\n }\n const old = obj[prop]\n delete obj[prop]\n if (!Array.isArray(obj)) (obj as Record<symbol, unknown>)[GEA_DIRTY] = true\n _queue(raw, state, rootProp, { previousValue: old, type: 'delete' })\n return true\n },\n })\n if (!perTarget) {\n perTarget = new Map()\n _hidden(targetObj, _NESTED, perTarget)\n }\n perTarget.set(rootProp, proxy)\n return proxy as V\n}\n\nexport class CompiledStore<S extends Record<string, any> = Record<string, any>> {\n constructor() {\n const state: StoreState<S> = { ready: false }\n _hidden(this, _PRIV, state)\n const proxy = new Proxy(this as unknown as S, {\n get(target: S, prop: string | symbol, receiver: object) {\n if (prop === GEA_PROXY_RAW) return target\n if (typeof prop === 'symbol') return (target as Record<symbol, unknown>)[prop]\n trackRead(receiver ?? target, prop)\n const value = target[prop as keyof S]\n if (typeof value === 'function') return (value as (...args: unknown[]) => unknown).bind(receiver)\n return _isPlain(value) ? _wrapNested(target, state, value, prop) : value\n },\n set(target: S, prop: string | symbol, value: unknown) {\n if (typeof prop === 'symbol') {\n ;(target as Record<symbol, unknown>)[prop] = value\n return true\n }\n value = _unwrap(value)\n const old = target[prop as keyof S]\n if (old === value && prop in target) {\n if (Array.isArray(value)) _queue(target, state, prop, { previousValue: old, newValue: value })\n return true\n }\n if (old && typeof old === 'object') delete (old as Record<symbol, unknown>)[_NESTED]\n ;(target as Record<string, unknown>)[prop] = value\n const direct = state.direct?.get(prop)\n if (direct) for (const h of direct) h(value as S[keyof S])\n _queue(target, state, prop, { previousValue: old, newValue: value })\n return true\n },\n })\n _hidden(proxy as unknown as object, _PRIV, state)\n ;(this as unknown as Record<symbol, unknown>)[GEA_STORE_ROOT] = proxy\n return proxy as unknown as this\n }\n\n observe(pathOrProp: string | readonly string[], handler: Handler<S>): () => void {\n const state: StoreState<S> | undefined = (this as unknown as Record<symbol, StoreState<S>>)[_PRIV]\n if (!state) return () => {}\n state.ready = true\n const isArr = Array.isArray(pathOrProp)\n // `path` / `text` carry the two alternatives in their own exact slots so\n // `.length` / `[0]` / `.slice` have a `readonly string[]` receiver: called on\n // `pathOrProp` — declared `string | readonly string[]` — the intrinsic has no\n // single receiver carrier and `pathOrProp.slice(1)` fail-closed with\n // `representation-plan coverage gap for CallExpression`. Each read is already\n // guarded by `isArr`, so neither default is ever observed.\n let path: readonly string[] = []\n let text = ''\n if (typeof pathOrProp === 'string') text = pathOrProp\n else path = pathOrProp\n if ((isArr && path.length === 0) || (!isArr && text === '')) {\n const bucket = state.rootObservers ?? (state.rootObservers = new Set())\n bucket.add(handler)\n return () => {\n bucket.delete(handler)\n }\n }\n const prop = isArr ? (path[0] ?? '') : text\n const tail = isArr && path.length > 1 ? path.slice(1) : null\n const finalHandler: Handler<S> = tail\n ? (value, changes) => {\n let next: unknown = value\n for (let i = 0; i < tail.length; i++) {\n if (next == null) return\n next = (next as Record<string, unknown>)[tail[i]]\n }\n handler(next as S[keyof S], changes)\n }\n : handler\n let isDerived = false\n if (!Object.prototype.hasOwnProperty.call(this, prop)) {\n for (\n let proto = Object.getPrototypeOf(this);\n proto && proto !== Object.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n const descriptor = Object.getOwnPropertyDescriptor(proto, prop)\n if (descriptor) {\n isDerived = !!descriptor.get\n break\n }\n }\n }\n const observers = isDerived\n ? (state.derived ?? (state.derived = new Map()))\n : (state.observers ?? (state.observers = new Map()))\n let bucket = observers.get(prop)\n if (!bucket) observers.set(prop, (bucket = new Set()))\n bucket.add(finalHandler)\n return () => {\n bucket!.delete(finalHandler)\n }\n }\n\n [GEA_OBSERVE_DIRECT](prop: string, handler: (value: S[keyof S]) => void): () => void {\n const state: StoreState<S> | undefined = (this as unknown as Record<symbol, StoreState<S>>)[_PRIV]\n if (!state) return () => {}\n state.ready = true\n const direct = state.direct ?? (state.direct = new Map())\n let bucket = direct.get(prop)\n if (!bucket) direct.set(prop, (bucket = new Set()))\n bucket.add(handler)\n return () => {\n bucket!.delete(handler)\n }\n }\n}\n\nexport default CompiledStore\n","import { GEA_CREATE_TEMPLATE, GEA_DOM_COMPONENT, GEA_ELEMENT, GEA_ON_PROP_CHANGE } from './symbols'\nimport { GEA_CREATED_CALLED, GEA_DISPOSER, GEA_SET_PROPS } from './internal-symbols'\nimport { createDisposer, type Disposer } from './disposer'\nimport { CompiledStore } from './compiled-store'\nimport { getComponentId } from './component-id'\nimport type { Renderable } from './renderable'\n\n/**\n * One thunk per prop of `P`, each returning that prop's own type.\n *\n * Generic rather than a flat dictionary so a component's props keep their\n * declared types all the way through `GEA_SET_PROPS` — the compiler emits one\n * thunk per JSX attribute, so the mapping is exact at every instantiation.\n *\n * `children` is intersected in separately (not folded into the mapped part)\n * because JSX always permits a childless invocation regardless of whether\n * `P` declares a `children` field — the compiler attaches a children thunk\n * whenever the call site has JSX children, independent of `P`'s own shape.\n */\ntype PropThunks<P> = { [K in keyof P]: () => P[K] } & { children?: () => Renderable }\nconst GEA_COMPONENT_ID = Symbol()\nconst GEA_LAST_PROP_VALUES = Symbol()\n\nexport class CompiledReactiveComponent<P extends Record<string, any> = Record<string, any>> extends CompiledStore {\n rendered = false\n props: P = {} as P;\n\n [GEA_ELEMENT] = null as HTMLElement | null;\n [GEA_DISPOSER] = createDisposer() as Disposer;\n [GEA_CREATED_CALLED] = false\n\n get id(): string {\n return ((this as any)[GEA_COMPONENT_ID] ??= getComponentId())\n }\n\n set id(value: string) {\n ;(this as any)[GEA_COMPONENT_ID] = value\n }\n\n get el(): HTMLElement | null {\n return this[GEA_ELEMENT] ?? null\n }\n\n [GEA_SET_PROPS](thunks: PropThunks<P>): void {\n const createdCalled = this[GEA_CREATED_CALLED]\n const notifyPropChange = createdCalled ? (this as any)[GEA_ON_PROP_CHANGE] : undefined\n const prevValues: Record<string, any> | undefined =\n typeof notifyPropChange === 'function' ? (this as any)[GEA_LAST_PROP_VALUES] : undefined\n const out: Record<string, any> = {}\n for (const k in thunks) {\n Object.defineProperty(out, k, {\n enumerable: true,\n configurable: true,\n get: () => thunks[k](),\n })\n }\n const childrenThunk = thunks.children\n if (typeof childrenThunk === 'function') {\n let cached: Renderable = undefined\n let cacheNode = false\n Object.defineProperty(out, 'children', {\n enumerable: true,\n configurable: true,\n get: () => {\n if (cacheNode) return cached\n const v = childrenThunk()\n if (v !== null && typeof v === 'object' && typeof (v as Node).nodeType === 'number') {\n cached = v\n cacheNode = true\n }\n return v\n },\n })\n }\n this.props = out as P\n const nextValues: Record<string, any> = {}\n for (const key in thunks) nextValues[key] = this.props?.[key]\n ;(this as any)[GEA_LAST_PROP_VALUES] = nextValues\n if (!createdCalled) {\n this[GEA_CREATED_CALLED] = true\n if (this.created !== CompiledReactiveComponent.prototype.created) this.created(this.props)\n } else if (typeof notifyPropChange === 'function') {\n for (const key in thunks) {\n const prev = prevValues?.[key]\n const next = this.props?.[key]\n if (next !== prev || (prev !== null && typeof prev === 'object')) notifyPropChange.call(this, key, next)\n }\n }\n }\n\n [GEA_CREATE_TEMPLATE](_disposer: Disposer): Node {\n return document.createDocumentFragment()\n }\n\n render(parent: Node, _index?: number): void {\n if (!this[GEA_CREATED_CALLED]) {\n this[GEA_CREATED_CALLED] = true\n if (this.created !== CompiledReactiveComponent.prototype.created) this.created(this.props)\n }\n let node = this[GEA_CREATE_TEMPLATE](this[GEA_DISPOSER])\n if (node == null) node = document.createComment('')\n if (typeof (node as any).nodeType !== 'number') {\n if (Array.isArray(node)) {\n const frag = document.createDocumentFragment()\n for (const n of node) {\n if (n == null) continue\n if (typeof (n as any).nodeType === 'number') frag.appendChild(n as Node)\n else frag.appendChild(document.createTextNode(String(n)))\n }\n node = frag\n } else {\n node = document.createTextNode(String(node))\n }\n }\n parent.appendChild(node)\n if (node.nodeType === 11) {\n this[GEA_ELEMENT] = ((parent as Element).lastElementChild as HTMLElement | null) ?? null\n } else if (node.nodeType === 1) {\n this[GEA_ELEMENT] = node as HTMLElement\n }\n const el = this[GEA_ELEMENT] as any\n if (el) el[GEA_DOM_COMPONENT] = this\n this.rendered = true\n this.onAfterRender()\n }\n\n onAfterRender(): void {\n /* no-op */\n }\n\n created(_props?: P): void {\n /* no-op */\n }\n\n dispose(): void {\n this[GEA_DISPOSER].dispose()\n const e = this[GEA_ELEMENT] as HTMLElement | null\n if (e && e.parentNode) e.parentNode.removeChild(e)\n this[GEA_ELEMENT] = null\n }\n\n $(sel: string): Element | null {\n const e = this[GEA_ELEMENT] as HTMLElement | null\n return e ? e.querySelector(sel) : null\n }\n\n $$(sel: string): Element[] {\n const e = this[GEA_ELE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GACvB,MAAM,OAAO,SAAS,wBAAwB;AAC9C,QAAK,MAAM,KAAK,MAAM;AACpB,QAAI,KAAK,KAAM;AACf,QAAI,OAAQ,EAAU,aAAa,SAAU,MAAK,YAAY,EAAU;QACnE,MAAK,YAAY,SAAS,eAAe,OAAO,EAAE,CAAC,CAAC;;AAE3D,UAAO;QAEP,QAAO,SAAS,eAAe,OAAO,KAAK,CAAC;AAGhD,SAAO,YAAY,KAAK;AACxB,MAAI,KAAK,aAAa,GACpB,MAAK,eAAiB,OAAmB,oBAA2C;WAC3E,KAAK,aAAa,EAC3B,MAAK,eAAe;EAEtB,MAAM,KAAK,KAAK;AAChB,MAAI,GAAI,IAAG,qBAAqB;AAChC,OAAK,WAAW;AAChB,OAAK,eAAe;;CAGtB,gBAAsB;CAItB,QAAQ,QAAkB;CAI1B,UAAgB;AACd,OAAK,cAAc,SAAS;EAC5B,MAAM,IAAI,KAAK;AACf,MAAI,KAAK,EAAE,WAAY,GAAE,WAAW,YAAY,EAAE;AAClD,OAAK,eAAe;;CAGtB,EAAE,KAA6B;EAC7B,MAAM,IAAI,KAAK;AACf,SAAO,IAAI,EAAE,cAAc,IAAI,GAAG;;CAGpC,GAAG,KAAwB;EACzB,MAAM,IAAI,KAAK;AACf,SAAO,IAAI,MAAM,KAAK,EAAE,iBAAiB,IAAI,CAAC,GAAG,EAAE"}
@@ -0,0 +1,21 @@
1
+ //#region ../gea/src/runtime/component-id.ts
2
+ let counter = null;
3
+ /**
4
+ * A process-unique component id.
5
+ *
6
+ * Deliberately base 10, not base 36. `Number.prototype.toString(radix)` is only
7
+ * exactly specified for a receiver that is a safe integer, and a compiler that
8
+ * proves its output rather than trusting it cannot establish that for a runtime
9
+ * counter without an integer-domain analysis — so the radix form is refused on
10
+ * the embedded target, where this module is compiled ahead of time.
11
+ *
12
+ * The radix only ever bought a shorter string. Ids stay just as unique.
13
+ */
14
+ function getComponentId() {
15
+ counter ??= Math.floor(Math.random() * 2147483648);
16
+ return (counter++).toString();
17
+ }
18
+ //#endregion
19
+ export { getComponentId as t };
20
+
21
+ //# sourceMappingURL=component-id.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-id.mjs","names":[],"sources":["../../gea/src/runtime/component-id.ts"],"sourcesContent":["let counter: number | null = null\n\n/**\n * A process-unique component id.\n *\n * Deliberately base 10, not base 36. `Number.prototype.toString(radix)` is only\n * exactly specified for a receiver that is a safe integer, and a compiler that\n * proves its output rather than trusting it cannot establish that for a runtime\n * counter without an integer-domain analysis — so the radix form is refused on\n * the embedded target, where this module is compiled ahead of time.\n *\n * The radix only ever bought a shorter string. Ids stay just as unique.\n */\nexport function getComponentId(): string {\n counter ??= Math.floor(Math.random() * 2147483648)\n return (counter++).toString()\n}\n"],"mappings":";AAAA,IAAI,UAAyB;;;;;;;;;;;;AAa7B,SAAgB,iBAAyB;AACvC,aAAY,KAAK,MAAM,KAAK,QAAQ,GAAG,WAAW;AAClD,SAAQ,WAAW,UAAU"}
@@ -0,0 +1,48 @@
1
+ import { i as withTracking, r as untrack } from "./bind.mjs";
2
+ //#region ../gea/src/runtime/conditional-truthy.ts
3
+ function conditionalTruthy(parent, anchor, disposer, root, cond, mkTrue) {
4
+ let currentNodes = null;
5
+ let currentChild = null;
6
+ let active = false;
7
+ const sentinel = document.createComment("");
8
+ const p0 = anchor.parentNode ?? parent;
9
+ p0.insertBefore(sentinel, anchor);
10
+ p0.removeChild(anchor);
11
+ function clear() {
12
+ if (currentChild) {
13
+ currentChild.dispose();
14
+ currentChild = null;
15
+ }
16
+ if (currentNodes) {
17
+ for (let i = 0; i < currentNodes.length; i++) {
18
+ const n = currentNodes[i];
19
+ const p = n.parentNode;
20
+ if (p) p.removeChild(n);
21
+ }
22
+ currentNodes = null;
23
+ }
24
+ }
25
+ function mount() {
26
+ const childD = disposer.child();
27
+ const node = untrack(() => mkTrue(childD));
28
+ currentNodes = node.nodeType === 11 ? Array.from(node.childNodes) : [node];
29
+ (sentinel.parentNode ?? parent).insertBefore(node, sentinel);
30
+ currentChild = childD;
31
+ }
32
+ withTracking(disposer, root, () => {
33
+ const next = !!cond();
34
+ if (next === active) return;
35
+ clear();
36
+ active = next;
37
+ if (next) mount();
38
+ });
39
+ disposer.add(() => {
40
+ clear();
41
+ if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel);
42
+ active = false;
43
+ });
44
+ }
45
+ //#endregion
46
+ export { conditionalTruthy as t };
47
+
48
+ //# sourceMappingURL=conditional-truthy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional-truthy.mjs","names":[],"sources":["../../gea/src/runtime/conditional-truthy.ts"],"sourcesContent":["import type { Disposer } from './disposer'\nimport { withTracking, untrack } from './with-tracking'\n\ntype BranchFactory = (d: Disposer) => Node\n\nexport function conditionalTruthy(\n parent: Node,\n anchor: Comment,\n disposer: Disposer,\n root: any,\n cond: () => boolean,\n mkTrue: BranchFactory,\n): void {\n let currentNodes: Node[] | null = null\n let currentChild: Disposer | null = null\n let active = false\n\n const sentinel = document.createComment('')\n const p0 = anchor.parentNode ?? parent\n p0.insertBefore(sentinel, anchor)\n p0.removeChild(anchor)\n\n function clear(): void {\n if (currentChild) {\n currentChild.dispose()\n currentChild = null\n }\n if (currentNodes) {\n for (let i = 0; i < currentNodes.length; i++) {\n const n = currentNodes[i]\n const p = n.parentNode\n if (p) p.removeChild(n)\n }\n currentNodes = null\n }\n }\n\n function mount(): void {\n const childD = disposer.child()\n const node = untrack(() => mkTrue(childD))\n currentNodes = node.nodeType === 11 ? Array.from(node.childNodes) : [node]\n const p = sentinel.parentNode ?? parent\n p.insertBefore(node, sentinel)\n currentChild = childD\n }\n\n withTracking(disposer, root, () => {\n const next = !!cond()\n if (next === active) return\n clear()\n active = next\n if (next) mount()\n })\n\n disposer.add(() => {\n clear()\n if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel)\n active = false\n })\n}\n"],"mappings":";;AAKA,SAAgB,kBACd,QACA,QACA,UACA,MACA,MACA,QACM;CACN,IAAI,eAA8B;CAClC,IAAI,eAAgC;CACpC,IAAI,SAAS;CAEb,MAAM,WAAW,SAAS,cAAc,GAAG;CAC3C,MAAM,KAAK,OAAO,cAAc;AAChC,IAAG,aAAa,UAAU,OAAO;AACjC,IAAG,YAAY,OAAO;CAEtB,SAAS,QAAc;AACrB,MAAI,cAAc;AAChB,gBAAa,SAAS;AACtB,kBAAe;;AAEjB,MAAI,cAAc;AAChB,QAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;IAC5C,MAAM,IAAI,aAAa;IACvB,MAAM,IAAI,EAAE;AACZ,QAAI,EAAG,GAAE,YAAY,EAAE;;AAEzB,kBAAe;;;CAInB,SAAS,QAAc;EACrB,MAAM,SAAS,SAAS,OAAO;EAC/B,MAAM,OAAO,cAAc,OAAO,OAAO,CAAC;AAC1C,iBAAe,KAAK,aAAa,KAAK,MAAM,KAAK,KAAK,WAAW,GAAG,CAAC,KAAK;AAE1E,GADU,SAAS,cAAc,QAC/B,aAAa,MAAM,SAAS;AAC9B,iBAAe;;AAGjB,cAAa,UAAU,YAAY;EACjC,MAAM,OAAO,CAAC,CAAC,MAAM;AACrB,MAAI,SAAS,OAAQ;AACrB,SAAO;AACP,WAAS;AACT,MAAI,KAAM,QAAO;GACjB;AAEF,UAAS,UAAU;AACjB,SAAO;AACP,MAAI,SAAS,WAAY,UAAS,WAAW,YAAY,SAAS;AAClE,WAAS;GACT"}
@@ -0,0 +1,54 @@
1
+ import { i as withTracking, r as untrack } from "./bind.mjs";
2
+ //#region ../gea/src/runtime/conditional.ts
3
+ function conditional(parent, anchor, disposer, root, cond, mkTrue, mkFalse) {
4
+ let currentValue = null;
5
+ let currentNodes = null;
6
+ let currentChild = null;
7
+ const sentinel = document.createComment("");
8
+ const p0 = anchor.parentNode ?? parent;
9
+ p0.insertBefore(sentinel, anchor);
10
+ p0.removeChild(anchor);
11
+ const placeholder = () => document.createComment("");
12
+ const elseFactory = mkFalse ?? placeholder;
13
+ function unmount() {
14
+ if (currentChild) {
15
+ currentChild.dispose();
16
+ currentChild = null;
17
+ }
18
+ if (currentNodes) {
19
+ for (let i = 0; i < currentNodes.length; i++) {
20
+ const n = currentNodes[i];
21
+ const p = n.parentNode;
22
+ if (p) p.removeChild(n);
23
+ }
24
+ currentNodes = null;
25
+ }
26
+ }
27
+ function mount(v) {
28
+ const childD = disposer.child();
29
+ const factory = v ? mkTrue : elseFactory;
30
+ const node = untrack(() => factory(childD));
31
+ const nodes = node.nodeType === 11 ? Array.from(node.childNodes) : [node];
32
+ (sentinel.parentNode ?? parent).insertBefore(node, sentinel);
33
+ currentChild = childD;
34
+ currentNodes = nodes;
35
+ }
36
+ function swap(v) {
37
+ if (v === currentValue) return;
38
+ unmount();
39
+ currentValue = v;
40
+ mount(v);
41
+ }
42
+ withTracking(disposer, root, () => {
43
+ swap(!!cond());
44
+ });
45
+ disposer.add(() => {
46
+ unmount();
47
+ if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel);
48
+ currentValue = null;
49
+ });
50
+ }
51
+ //#endregion
52
+ export { conditional as t };
53
+
54
+ //# sourceMappingURL=conditional.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditional.mjs","names":[],"sources":["../../gea/src/runtime/conditional.ts"],"sourcesContent":["/**\n * conditional(parent, anchor, disposer, root, cond, mkTrue, mkFalse?)\n *\n * Closure-compiled reactive conditional: mounts one of two branches into\n * `parent` immediately before `anchor`, and swaps when `cond()` changes.\n *\n * - Each branch gets its own child disposer scope (`disposer.child()`), so\n * anything the branch sets up (subscriptions, nested conditionals, keyed\n * lists, mounted components) tears down when the branch unmounts.\n * - Dep tracking on `cond` is done lexically via `withTracking(disposer, root, ...)`.\n * `root` is the enclosing component's store proxy — proxy gets during `cond()`\n * push paths into the active scope; on any notified path, the scope re-runs.\n * - `mkFalse` is optional; if omitted, the falsy branch renders a placeholder\n * comment so the anchor position stays well-defined.\n * - DocumentFragment returns are handled: `insertBefore` moves a fragment's\n * children into `parent`, so we capture `childNodes` BEFORE insertion to\n * later remove the exact set of inserted nodes.\n */\n\nimport type { Disposer } from './disposer'\nimport { withTracking, untrack } from './with-tracking'\n\ntype BranchFactory = (d: Disposer) => Node\n\nexport function conditional(\n parent: Node,\n anchor: Comment,\n disposer: Disposer,\n root: object,\n cond: () => boolean,\n mkTrue: BranchFactory,\n mkFalse?: BranchFactory,\n): void {\n let currentValue: boolean | null = null\n let currentNodes: Node[] | null = null\n let currentChild: Disposer | null = null\n\n // Install a persistent sentinel at the compiler anchor's position. The\n // original anchor is removed so downstream compiler walk indices (which\n // treat the conditional slot as a single node position) stay correct. The\n // sentinel stays in the DOM for the lifetime of this conditional and serves\n // as a stable insertion point for every swap.\n const sentinel = document.createComment('')\n const p0 = anchor.parentNode ?? parent\n p0.insertBefore(sentinel, anchor)\n p0.removeChild(anchor)\n\n const placeholder: BranchFactory = () => document.createComment('')\n const elseFactory = mkFalse ?? placeholder\n\n function unmount(): void {\n if (currentChild) {\n currentChild.dispose()\n currentChild = null\n }\n if (currentNodes) {\n for (let i = 0; i < currentNodes.length; i++) {\n const n = currentNodes[i]\n const p = n.parentNode\n if (p) p.removeChild(n)\n }\n currentNodes = null\n }\n }\n\n function mount(v: boolean): void {\n const childD = disposer.child()\n const factory = v ? mkTrue : elseFactory\n // Build the branch's DOM without leaking eager reads into the enclosing\n // withTracking scope. Fine-grained reactive primitives inside the branch\n // (reactiveText, reactiveAttr, keyedList, etc.) set up their own tracking\n // scopes via bind/withTracking — they don't need the outer scope.\n const node = untrack(() => factory(childD))\n // Capture child list BEFORE insertion — DocumentFragment children are\n // moved out of the fragment into `parent` on insertBefore. Use nodeType\n // (11 = DOCUMENT_FRAGMENT_NODE) so the check works regardless of whether\n // `DocumentFragment` is a global in the host environment.\n const isFragment = node.nodeType === 11\n const nodes: Node[] = isFragment ? Array.from(node.childNodes) : [node]\n const p = sentinel.parentNode ?? parent\n p.insertBefore(node, sentinel)\n currentChild = childD\n currentNodes = nodes\n }\n\n function swap(v: boolean): void {\n if (v === currentValue) return\n unmount()\n currentValue = v\n mount(v)\n }\n\n withTracking(disposer, root, () => {\n const v = !!cond()\n swap(v)\n })\n\n // Ensure final teardown when the parent scope disposes. `withTracking`\n // already registers its own teardown for subscriptions; we additionally\n // remove the live branch nodes + dispose the active branch scope.\n disposer.add(() => {\n unmount()\n if (sentinel.parentNode) sentinel.parentNode.removeChild(sentinel)\n currentValue = null\n })\n}\n"],"mappings":";;AAwBA,SAAgB,YACd,QACA,QACA,UACA,MACA,MACA,QACA,SACM;CACN,IAAI,eAA+B;CACnC,IAAI,eAA8B;CAClC,IAAI,eAAgC;CAOpC,MAAM,WAAW,SAAS,cAAc,GAAG;CAC3C,MAAM,KAAK,OAAO,cAAc;AAChC,IAAG,aAAa,UAAU,OAAO;AACjC,IAAG,YAAY,OAAO;CAEtB,MAAM,oBAAmC,SAAS,cAAc,GAAG;CACnE,MAAM,cAAc,WAAW;CAE/B,SAAS,UAAgB;AACvB,MAAI,cAAc;AAChB,gBAAa,SAAS;AACtB,kBAAe;;AAEjB,MAAI,cAAc;AAChB,QAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;IAC5C,MAAM,IAAI,aAAa;IACvB,MAAM,IAAI,EAAE;AACZ,QAAI,EAAG,GAAE,YAAY,EAAE;;AAEzB,kBAAe;;;CAInB,SAAS,MAAM,GAAkB;EAC/B,MAAM,SAAS,SAAS,OAAO;EAC/B,MAAM,UAAU,IAAI,SAAS;EAK7B,MAAM,OAAO,cAAc,QAAQ,OAAO,CAAC;EAM3C,MAAM,QADa,KAAK,aAAa,KACF,MAAM,KAAK,KAAK,WAAW,GAAG,CAAC,KAAK;AAEvE,GADU,SAAS,cAAc,QAC/B,aAAa,MAAM,SAAS;AAC9B,iBAAe;AACf,iBAAe;;CAGjB,SAAS,KAAK,GAAkB;AAC9B,MAAI,MAAM,aAAc;AACxB,WAAS;AACT,iBAAe;AACf,QAAM,EAAE;;AAGV,cAAa,UAAU,YAAY;AAEjC,OAAK,CADM,CAAC,MAAM,CACX;GACP;AAKF,UAAS,UAAU;AACjB,WAAS;AACT,MAAI,SAAS,WAAY,UAAS,WAAW,YAAY,SAAS;AAClE,iBAAe;GACf"}