@getforma/core 0.9.1 → 1.0.1

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 (52) hide show
  1. package/README.md +24 -5
  2. package/dist/chunk-DCTOXHPF.cjs +399 -0
  3. package/dist/chunk-DCTOXHPF.cjs.map +1 -0
  4. package/dist/chunk-OUVOAYIO.js +359 -0
  5. package/dist/chunk-OUVOAYIO.js.map +1 -0
  6. package/dist/{chunk-GDULJFJO.cjs → chunk-V732ZBCU.cjs} +119 -511
  7. package/dist/chunk-V732ZBCU.cjs.map +1 -0
  8. package/dist/{chunk-CN56FSDT.js → chunk-VTPFK5TJ.js} +89 -442
  9. package/dist/chunk-VTPFK5TJ.js.map +1 -0
  10. package/dist/forma-runtime-csp.js +3400 -1
  11. package/dist/forma-runtime.js +3572 -1
  12. package/dist/formajs-runtime-hardened.global.js +3400 -1
  13. package/dist/formajs-runtime-hardened.global.js.map +1 -1
  14. package/dist/formajs-runtime.global.js +3572 -1
  15. package/dist/formajs-runtime.global.js.map +1 -1
  16. package/dist/formajs.global.js +3443 -1
  17. package/dist/formajs.global.js.map +1 -1
  18. package/dist/http.cjs +225 -0
  19. package/dist/http.cjs.map +1 -0
  20. package/dist/http.d.cts +108 -0
  21. package/dist/http.d.ts +108 -0
  22. package/dist/http.js +220 -0
  23. package/dist/http.js.map +1 -0
  24. package/dist/index.cjs +71 -607
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +2 -456
  27. package/dist/index.d.ts +2 -456
  28. package/dist/index.js +7 -523
  29. package/dist/index.js.map +1 -1
  30. package/dist/resource-Cd0cGOxS.d.ts +62 -0
  31. package/dist/resource-DK98lW5e.d.cts +62 -0
  32. package/dist/runtime-hardened.cjs.map +1 -1
  33. package/dist/runtime-hardened.js.map +1 -1
  34. package/dist/runtime.cjs +23 -22
  35. package/dist/runtime.cjs.map +1 -1
  36. package/dist/runtime.js +2 -1
  37. package/dist/runtime.js.map +1 -1
  38. package/dist/server.cjs +179 -0
  39. package/dist/server.cjs.map +1 -0
  40. package/dist/server.d.cts +217 -0
  41. package/dist/server.d.ts +217 -0
  42. package/dist/server.js +166 -0
  43. package/dist/server.js.map +1 -0
  44. package/dist/storage.cjs +151 -0
  45. package/dist/storage.cjs.map +1 -0
  46. package/dist/storage.d.cts +77 -0
  47. package/dist/storage.d.ts +77 -0
  48. package/dist/storage.js +147 -0
  49. package/dist/storage.js.map +1 -0
  50. package/package.json +31 -1
  51. package/dist/chunk-CN56FSDT.js.map +0 -1
  52. package/dist/chunk-GDULJFJO.cjs.map +0 -1
@@ -1,359 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ var chunkDCTOXHPF_cjs = require('./chunk-DCTOXHPF.cjs');
3
4
  var chunk3U57L2TY_cjs = require('./chunk-3U57L2TY.cjs');
4
- var alienSignals = require('alien-signals');
5
-
6
- var currentRoot = null;
7
- var rootStack = [];
8
- function createRoot(fn) {
9
- const scope = { disposers: [], scopeDispose: null };
10
- rootStack.push(currentRoot);
11
- currentRoot = scope;
12
- const dispose = () => {
13
- if (scope.scopeDispose) {
14
- try {
15
- scope.scopeDispose();
16
- } catch {
17
- }
18
- scope.scopeDispose = null;
19
- }
20
- for (const d of scope.disposers) {
21
- try {
22
- d();
23
- } catch {
24
- }
25
- }
26
- scope.disposers.length = 0;
27
- };
28
- let result;
29
- try {
30
- scope.scopeDispose = alienSignals.effectScope(() => {
31
- result = fn(dispose);
32
- });
33
- } finally {
34
- currentRoot = rootStack.pop() ?? null;
35
- }
36
- return result;
37
- }
38
- function registerDisposer(dispose) {
39
- if (currentRoot) {
40
- currentRoot.disposers.push(dispose);
41
- }
42
- }
43
- function hasActiveRoot() {
44
- return currentRoot !== null;
45
- }
46
-
47
- // src/reactive/cleanup.ts
48
- var currentCleanupCollector = null;
49
- function onCleanup(fn) {
50
- currentCleanupCollector?.(fn);
51
- }
52
- function setCleanupCollector(collector) {
53
- const prev = currentCleanupCollector;
54
- currentCleanupCollector = collector;
55
- return prev;
56
- }
57
-
58
- // src/reactive/dev.ts
59
- var __DEV__ = typeof process !== "undefined" ? process.env?.NODE_ENV !== "production" : true;
60
- var _errorHandler = null;
61
- function onError(handler) {
62
- _errorHandler = handler;
63
- }
64
- function reportError(error, source) {
65
- if (_errorHandler) {
66
- try {
67
- _errorHandler(error, source ? { source } : {});
68
- } catch {
69
- }
70
- }
71
- if (__DEV__) {
72
- console.error(`[forma] ${source ?? "Unknown"} error:`, error);
73
- }
74
- }
75
- var POOL_SIZE = 32;
76
- var MAX_REENTRANT_RUNS = 100;
77
- var pool = [];
78
- for (let i = 0; i < POOL_SIZE; i++) pool.push([]);
79
- var poolIdx = POOL_SIZE;
80
- function acquireArray() {
81
- if (poolIdx > 0) {
82
- const arr = pool[--poolIdx];
83
- arr.length = 0;
84
- return arr;
85
- }
86
- return [];
87
- }
88
- function releaseArray(arr) {
89
- arr.length = 0;
90
- if (poolIdx < POOL_SIZE) {
91
- pool[poolIdx++] = arr;
92
- }
93
- }
94
- function runCleanup(fn) {
95
- if (fn === void 0) return;
96
- try {
97
- fn();
98
- } catch (e) {
99
- reportError(e, "effect cleanup");
100
- }
101
- }
102
- function runCleanups(bag) {
103
- if (bag === void 0) return;
104
- for (let i = 0; i < bag.length; i++) {
105
- try {
106
- bag[i]();
107
- } catch (e) {
108
- reportError(e, "effect cleanup");
109
- }
110
- }
111
- }
112
- function internalEffect(fn) {
113
- const dispose = alienSignals.effect(fn);
114
- if (hasActiveRoot()) {
115
- registerDisposer(dispose);
116
- }
117
- return dispose;
118
- }
119
- function createEffect(fn) {
120
- const shouldRegister = hasActiveRoot();
121
- let cleanup2;
122
- let cleanupBag;
123
- let nextCleanup;
124
- let nextCleanupBag;
125
- const addCleanup = (cb) => {
126
- if (nextCleanupBag !== void 0) {
127
- nextCleanupBag.push(cb);
128
- return;
129
- }
130
- if (nextCleanup !== void 0) {
131
- const bag = acquireArray();
132
- bag.push(nextCleanup, cb);
133
- nextCleanup = void 0;
134
- nextCleanupBag = bag;
135
- return;
136
- }
137
- nextCleanup = cb;
138
- };
139
- let skipCleanupInfra = false;
140
- let firstRun = true;
141
- let running = false;
142
- let rerunRequested = false;
143
- const runOnce = () => {
144
- if (cleanup2 !== void 0) {
145
- runCleanup(cleanup2);
146
- cleanup2 = void 0;
147
- }
148
- if (cleanupBag !== void 0) {
149
- runCleanups(cleanupBag);
150
- releaseArray(cleanupBag);
151
- cleanupBag = void 0;
152
- }
153
- if (skipCleanupInfra) {
154
- try {
155
- fn();
156
- } catch (e) {
157
- reportError(e, "effect");
158
- }
159
- return;
160
- }
161
- nextCleanup = void 0;
162
- nextCleanupBag = void 0;
163
- const prevCollector = setCleanupCollector(addCleanup);
164
- try {
165
- const result = fn();
166
- if (typeof result === "function") {
167
- addCleanup(result);
168
- }
169
- if (nextCleanup === void 0 && nextCleanupBag === void 0) {
170
- if (firstRun) skipCleanupInfra = true;
171
- return;
172
- }
173
- if (nextCleanupBag !== void 0) {
174
- cleanupBag = nextCleanupBag;
175
- } else {
176
- cleanup2 = nextCleanup;
177
- }
178
- } catch (e) {
179
- reportError(e, "effect");
180
- if (nextCleanupBag !== void 0) {
181
- cleanupBag = nextCleanupBag;
182
- } else {
183
- cleanup2 = nextCleanup;
184
- }
185
- } finally {
186
- setCleanupCollector(prevCollector);
187
- firstRun = false;
188
- }
189
- };
190
- const safeFn = () => {
191
- if (running) {
192
- rerunRequested = true;
193
- return;
194
- }
195
- running = true;
196
- try {
197
- let reentrantRuns = 0;
198
- do {
199
- rerunRequested = false;
200
- runOnce();
201
- if (rerunRequested) {
202
- reentrantRuns++;
203
- if (reentrantRuns >= MAX_REENTRANT_RUNS) {
204
- reportError(
205
- new Error(`createEffect exceeded ${MAX_REENTRANT_RUNS} re-entrant runs`),
206
- "effect"
207
- );
208
- rerunRequested = false;
209
- }
210
- }
211
- } while (rerunRequested);
212
- } finally {
213
- running = false;
214
- }
215
- };
216
- const dispose = alienSignals.effect(safeFn);
217
- let disposed = false;
218
- const wrappedDispose = () => {
219
- if (disposed) return;
220
- disposed = true;
221
- dispose();
222
- if (cleanup2 !== void 0) {
223
- runCleanup(cleanup2);
224
- cleanup2 = void 0;
225
- }
226
- if (cleanupBag !== void 0) {
227
- runCleanups(cleanupBag);
228
- releaseArray(cleanupBag);
229
- cleanupBag = void 0;
230
- }
231
- };
232
- if (shouldRegister) {
233
- registerDisposer(wrappedDispose);
234
- }
235
- return wrappedDispose;
236
- }
237
-
238
- // src/reactive/memo.ts
239
- var createMemo = chunk3U57L2TY_cjs.createComputed;
240
- function batch(fn) {
241
- alienSignals.startBatch();
242
- try {
243
- fn();
244
- } finally {
245
- alienSignals.endBatch();
246
- }
247
- }
248
- function untrack(fn) {
249
- const prev = alienSignals.setActiveSub(void 0);
250
- try {
251
- return fn();
252
- } finally {
253
- alienSignals.setActiveSub(prev);
254
- }
255
- }
256
-
257
- // src/reactive/on.ts
258
- function on(deps, fn, options) {
259
- let prev;
260
- let isFirst = true;
261
- return () => {
262
- const value2 = deps();
263
- if (options?.defer && isFirst) {
264
- isFirst = false;
265
- prev = value2;
266
- return void 0;
267
- }
268
- const result = untrack(() => fn(value2, prev));
269
- prev = value2;
270
- return result;
271
- };
272
- }
273
-
274
- // src/reactive/ref.ts
275
- function createRef(initialValue) {
276
- return { current: initialValue };
277
- }
278
-
279
- // src/reactive/reducer.ts
280
- function createReducer(reducer, initialState) {
281
- const [state, setState] = chunk3U57L2TY_cjs.createSignal(initialState);
282
- const dispatch = (action) => {
283
- setState((prev) => reducer(prev, action));
284
- };
285
- return [state, dispatch];
286
- }
287
-
288
- // src/reactive/suspense-context.ts
289
- var currentSuspenseContext = null;
290
- var suspenseStack = [];
291
- function pushSuspenseContext(ctx) {
292
- suspenseStack.push(currentSuspenseContext);
293
- currentSuspenseContext = ctx;
294
- }
295
- function popSuspenseContext() {
296
- currentSuspenseContext = suspenseStack.pop() ?? null;
297
- }
298
- function getSuspenseContext() {
299
- return currentSuspenseContext;
300
- }
301
-
302
- // src/reactive/resource.ts
303
- function createResource(source, fetcher, options) {
304
- const [data, setData] = chunk3U57L2TY_cjs.createSignal(options?.initialValue);
305
- const [loading, setLoading] = chunk3U57L2TY_cjs.createSignal(false);
306
- const [error, setError] = chunk3U57L2TY_cjs.createSignal(void 0);
307
- const suspenseCtx = getSuspenseContext();
308
- let abortController = null;
309
- let fetchVersion = 0;
310
- const doFetch = () => {
311
- const sourceValue = untrack(source);
312
- if (abortController) {
313
- abortController.abort();
314
- }
315
- const controller = new AbortController();
316
- abortController = controller;
317
- const version = ++fetchVersion;
318
- const isLatest = () => version === fetchVersion;
319
- let suspensePending = false;
320
- if (suspenseCtx) {
321
- suspenseCtx.increment();
322
- suspensePending = true;
323
- }
324
- setLoading(true);
325
- setError(void 0);
326
- Promise.resolve(fetcher(sourceValue)).then((result) => {
327
- if (isLatest() && !controller.signal.aborted) {
328
- setData(() => result);
329
- }
330
- }).catch((err) => {
331
- if (isLatest() && !controller.signal.aborted) {
332
- if (err?.name !== "AbortError") {
333
- setError(err);
334
- }
335
- }
336
- }).finally(() => {
337
- if (suspensePending) suspenseCtx?.decrement();
338
- if (isLatest()) {
339
- setLoading(false);
340
- if (abortController === controller) {
341
- abortController = null;
342
- }
343
- }
344
- });
345
- };
346
- internalEffect(() => {
347
- source();
348
- doFetch();
349
- });
350
- const resource = (() => data());
351
- resource.loading = loading;
352
- resource.error = error;
353
- resource.refetch = doFetch;
354
- resource.mutate = (value2) => setData(() => value2);
355
- return resource;
356
- }
357
5
 
358
6
  // src/dom/element.ts
359
7
  var Fragment = /* @__PURE__ */ Symbol.for("forma.fragment");
@@ -506,10 +154,10 @@ var DYNAMIC_CHILD_SYM = /* @__PURE__ */ Symbol.for("forma-dynamic-child");
506
154
  function getCache(el) {
507
155
  return el[CACHE_SYM] ?? (el[CACHE_SYM] = /* @__PURE__ */ Object.create(null));
508
156
  }
509
- function handleClass(el, _key, value2) {
510
- if (typeof value2 === "function") {
511
- internalEffect(() => {
512
- const v = value2();
157
+ function handleClass(el, _key, value) {
158
+ if (typeof value === "function") {
159
+ chunkDCTOXHPF_cjs.internalEffect(() => {
160
+ const v = value();
513
161
  const cache = getCache(el);
514
162
  if (cache["class"] === v) return;
515
163
  cache["class"] = v;
@@ -521,20 +169,20 @@ function handleClass(el, _key, value2) {
521
169
  });
522
170
  } else {
523
171
  const cache = getCache(el);
524
- if (cache["class"] === value2) return;
525
- cache["class"] = value2;
172
+ if (cache["class"] === value) return;
173
+ cache["class"] = value;
526
174
  if (el instanceof HTMLElement) {
527
- el.className = value2;
175
+ el.className = value;
528
176
  } else {
529
- el.setAttribute("class", value2);
177
+ el.setAttribute("class", value);
530
178
  }
531
179
  }
532
180
  }
533
- function handleStyle(el, _key, value2) {
534
- if (typeof value2 === "function") {
181
+ function handleStyle(el, _key, value) {
182
+ if (typeof value === "function") {
535
183
  let prevKeys = [];
536
- internalEffect(() => {
537
- const v = value2();
184
+ chunkDCTOXHPF_cjs.internalEffect(() => {
185
+ const v = value();
538
186
  if (typeof v === "string") {
539
187
  const cache = getCache(el);
540
188
  if (cache["style"] === v) return;
@@ -553,27 +201,27 @@ function handleStyle(el, _key, value2) {
553
201
  prevKeys = nextKeys;
554
202
  }
555
203
  });
556
- } else if (typeof value2 === "string") {
204
+ } else if (typeof value === "string") {
557
205
  const cache = getCache(el);
558
- if (cache["style"] === value2) return;
559
- cache["style"] = value2;
560
- el.style.cssText = value2;
561
- } else if (value2 && typeof value2 === "object") {
562
- Object.assign(el.style, value2);
206
+ if (cache["style"] === value) return;
207
+ cache["style"] = value;
208
+ el.style.cssText = value;
209
+ } else if (value && typeof value === "object") {
210
+ Object.assign(el.style, value);
563
211
  }
564
212
  }
565
- function handleEvent(el, key, value2) {
213
+ function handleEvent(el, key, value) {
566
214
  const controller = getAbortController(el);
567
215
  el.addEventListener(
568
216
  eventName(key),
569
- value2,
217
+ value,
570
218
  { signal: controller.signal }
571
219
  );
572
220
  }
573
- function handleInnerHTML(el, _key, value2) {
574
- if (typeof value2 === "function") {
575
- internalEffect(() => {
576
- const resolved = value2();
221
+ function handleInnerHTML(el, _key, value) {
222
+ if (typeof value === "function") {
223
+ chunkDCTOXHPF_cjs.internalEffect(() => {
224
+ const resolved = value();
577
225
  if (resolved == null) {
578
226
  el.innerHTML = "";
579
227
  return;
@@ -595,16 +243,16 @@ function handleInnerHTML(el, _key, value2) {
595
243
  el.innerHTML = html;
596
244
  });
597
245
  } else {
598
- if (value2 == null) {
246
+ if (value == null) {
599
247
  el.innerHTML = "";
600
248
  return;
601
249
  }
602
- if (typeof value2 !== "object" || !("__html" in value2)) {
250
+ if (typeof value !== "object" || !("__html" in value)) {
603
251
  throw new TypeError(
604
- "dangerouslySetInnerHTML: expected { __html: string }, got " + typeof value2
252
+ "dangerouslySetInnerHTML: expected { __html: string }, got " + typeof value
605
253
  );
606
254
  }
607
- const html = value2.__html;
255
+ const html = value.__html;
608
256
  if (typeof html !== "string") {
609
257
  throw new TypeError(
610
258
  "dangerouslySetInnerHTML: __html must be a string, got " + typeof html
@@ -613,11 +261,11 @@ function handleInnerHTML(el, _key, value2) {
613
261
  el.innerHTML = html;
614
262
  }
615
263
  }
616
- function handleXLink(el, key, value2) {
264
+ function handleXLink(el, key, value) {
617
265
  const localName = key.slice(6);
618
- if (typeof value2 === "function") {
619
- internalEffect(() => {
620
- const v = value2();
266
+ if (typeof value === "function") {
267
+ chunkDCTOXHPF_cjs.internalEffect(() => {
268
+ const v = value();
621
269
  if (v == null || v === false) {
622
270
  el.removeAttributeNS(XLINK_NS, localName);
623
271
  } else {
@@ -625,17 +273,17 @@ function handleXLink(el, key, value2) {
625
273
  }
626
274
  });
627
275
  } else {
628
- if (value2 == null || value2 === false) {
276
+ if (value == null || value === false) {
629
277
  el.removeAttributeNS(XLINK_NS, localName);
630
278
  } else {
631
- el.setAttributeNS(XLINK_NS, key, String(value2));
279
+ el.setAttributeNS(XLINK_NS, key, String(value));
632
280
  }
633
281
  }
634
282
  }
635
- function handleBooleanAttr(el, key, value2) {
636
- if (typeof value2 === "function") {
637
- internalEffect(() => {
638
- const v = value2();
283
+ function handleBooleanAttr(el, key, value) {
284
+ if (typeof value === "function") {
285
+ chunkDCTOXHPF_cjs.internalEffect(() => {
286
+ const v = value();
639
287
  const cache = getCache(el);
640
288
  if (cache[key] === v) return;
641
289
  cache[key] = v;
@@ -647,19 +295,19 @@ function handleBooleanAttr(el, key, value2) {
647
295
  });
648
296
  } else {
649
297
  const cache = getCache(el);
650
- if (cache[key] === value2) return;
651
- cache[key] = value2;
652
- if (value2) {
298
+ if (cache[key] === value) return;
299
+ cache[key] = value;
300
+ if (value) {
653
301
  el.setAttribute(key, "");
654
302
  } else {
655
303
  el.removeAttribute(key);
656
304
  }
657
305
  }
658
306
  }
659
- function handleGenericAttr(el, key, value2) {
660
- if (typeof value2 === "function") {
661
- internalEffect(() => {
662
- const v = value2();
307
+ function handleGenericAttr(el, key, value) {
308
+ if (typeof value === "function") {
309
+ chunkDCTOXHPF_cjs.internalEffect(() => {
310
+ const v = value();
663
311
  if (v == null || v === false) {
664
312
  const cache = getCache(el);
665
313
  if (cache[key] === null) return;
@@ -674,13 +322,13 @@ function handleGenericAttr(el, key, value2) {
674
322
  }
675
323
  });
676
324
  } else {
677
- if (value2 == null || value2 === false) {
325
+ if (value == null || value === false) {
678
326
  const cache = getCache(el);
679
327
  if (cache[key] === null) return;
680
328
  cache[key] = null;
681
329
  el.removeAttribute(key);
682
330
  } else {
683
- const strVal = String(value2);
331
+ const strVal = String(value);
684
332
  const cache = getCache(el);
685
333
  if (cache[key] === strVal) return;
686
334
  cache[key] = strVal;
@@ -698,47 +346,47 @@ PROP_HANDLERS.set("dangerouslySetInnerHTML", handleInnerHTML);
698
346
  for (const attr of BOOLEAN_ATTRS) {
699
347
  PROP_HANDLERS.set(attr, handleBooleanAttr);
700
348
  }
701
- function applyProp(el, key, value2) {
349
+ function applyProp(el, key, value) {
702
350
  if (key === "class") {
703
- handleClass(el, key, value2);
351
+ handleClass(el, key, value);
704
352
  return;
705
353
  }
706
354
  if (key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.length > 2) {
707
- handleEvent(el, key, value2);
355
+ handleEvent(el, key, value);
708
356
  return;
709
357
  }
710
358
  const handler = PROP_HANDLERS.get(key);
711
359
  if (handler) {
712
- handler(el, key, value2);
360
+ handler(el, key, value);
713
361
  return;
714
362
  }
715
363
  if (key.charCodeAt(0) === 120 && key.startsWith("xlink:")) {
716
- handleXLink(el, key, value2);
364
+ handleXLink(el, key, value);
717
365
  return;
718
366
  }
719
- handleGenericAttr(el, key, value2);
367
+ handleGenericAttr(el, key, value);
720
368
  }
721
- function applyStaticProp(el, key, value2) {
722
- if (value2 == null || value2 === false) return;
369
+ function applyStaticProp(el, key, value) {
370
+ if (value == null || value === false) return;
723
371
  if (key === "class" || key === "className") {
724
- el.className = value2;
372
+ el.className = value;
725
373
  return;
726
374
  }
727
375
  if (key === "style") {
728
- if (typeof value2 === "string") {
729
- el.style.cssText = value2;
730
- } else if (value2 && typeof value2 === "object") {
731
- Object.assign(el.style, value2);
376
+ if (typeof value === "string") {
377
+ el.style.cssText = value;
378
+ } else if (value && typeof value === "object") {
379
+ Object.assign(el.style, value);
732
380
  }
733
381
  return;
734
382
  }
735
383
  if (key === "dangerouslySetInnerHTML") {
736
- if (typeof value2 !== "object" || !("__html" in value2)) {
384
+ if (typeof value !== "object" || !("__html" in value)) {
737
385
  throw new TypeError(
738
- "dangerouslySetInnerHTML: expected { __html: string }, got " + typeof value2
386
+ "dangerouslySetInnerHTML: expected { __html: string }, got " + typeof value
739
387
  );
740
388
  }
741
- const html = value2.__html;
389
+ const html = value.__html;
742
390
  if (typeof html !== "string") {
743
391
  throw new TypeError(
744
392
  "dangerouslySetInnerHTML: __html must be a string, got " + typeof html
@@ -748,17 +396,17 @@ function applyStaticProp(el, key, value2) {
748
396
  return;
749
397
  }
750
398
  if (key.charCodeAt(0) === 120 && key.startsWith("xlink:")) {
751
- el.setAttributeNS(XLINK_NS, key, String(value2));
399
+ el.setAttributeNS(XLINK_NS, key, String(value));
752
400
  return;
753
401
  }
754
402
  if (BOOLEAN_ATTRS.has(key)) {
755
- if (value2) el.setAttribute(key, "");
403
+ if (value) el.setAttribute(key, "");
756
404
  return;
757
405
  }
758
- if (value2 === true) {
406
+ if (value === true) {
759
407
  el.setAttribute(key, "");
760
408
  } else {
761
- el.setAttribute(key, String(value2));
409
+ el.setAttribute(key, String(value));
762
410
  }
763
411
  }
764
412
  function appendChild(parent, child) {
@@ -782,7 +430,7 @@ function appendChild(parent, child) {
782
430
  parent[DYNAMIC_CHILD_SYM] = true;
783
431
  }
784
432
  let currentNode = null;
785
- internalEffect(() => {
433
+ chunkDCTOXHPF_cjs.internalEffect(() => {
786
434
  const v = child();
787
435
  if (v instanceof Node) {
788
436
  if (currentNode) {
@@ -842,20 +490,20 @@ function h(tag, props, ...children) {
842
490
  let hasDynamic = false;
843
491
  for (const key in props) {
844
492
  if (key === "ref") continue;
845
- const value2 = props[key];
493
+ const value = props[key];
846
494
  if (key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.length > 2) {
847
- handleEvent(el, key, value2);
495
+ handleEvent(el, key, value);
848
496
  continue;
849
497
  }
850
- if (typeof value2 === "function") {
498
+ if (typeof value === "function") {
851
499
  if (!hasDynamic) {
852
500
  el[CACHE_SYM] = /* @__PURE__ */ Object.create(null);
853
501
  hasDynamic = true;
854
502
  }
855
- applyProp(el, key, value2);
503
+ applyProp(el, key, value);
856
504
  continue;
857
505
  }
858
- applyStaticProp(el, key, value2);
506
+ applyStaticProp(el, key, value);
859
507
  }
860
508
  }
861
509
  const childLen = children.length;
@@ -906,7 +554,7 @@ function createShow(when, thenFn, elseFn) {
906
554
  let currentNode = null;
907
555
  let lastTruthy = null;
908
556
  let currentDispose = null;
909
- const showDispose = internalEffect(() => {
557
+ const showDispose = chunkDCTOXHPF_cjs.internalEffect(() => {
910
558
  const truthy = !!when();
911
559
  const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
912
560
  const DEBUG_LABEL = DEBUG ? thenFn.toString().slice(0, 60) : "";
@@ -938,9 +586,9 @@ function createShow(when, thenFn, elseFn) {
938
586
  const branchFn = truthy ? thenFn : elseFn;
939
587
  if (branchFn) {
940
588
  let branchDispose;
941
- currentNode = createRoot((dispose) => {
589
+ currentNode = chunkDCTOXHPF_cjs.createRoot((dispose) => {
942
590
  branchDispose = dispose;
943
- return untrack(() => branchFn());
591
+ return chunkDCTOXHPF_cjs.untrack(() => branchFn());
944
592
  });
945
593
  currentDispose = branchDispose;
946
594
  } else {
@@ -963,8 +611,8 @@ function createShow(when, thenFn, elseFn) {
963
611
  // src/dom/hydrate.ts
964
612
  var ABORT_SYM2 = /* @__PURE__ */ Symbol.for("forma-abort");
965
613
  var hydrating = false;
966
- function setHydrating(value2) {
967
- hydrating = value2;
614
+ function setHydrating(value) {
615
+ hydrating = value;
968
616
  }
969
617
  function isDescriptor(v) {
970
618
  return v != null && typeof v === "object" && "type" in v && v.type === "element";
@@ -978,20 +626,20 @@ function isListDescriptor(v) {
978
626
  function applyDynamicProps(el, props) {
979
627
  if (!props) return;
980
628
  for (const key in props) {
981
- const value2 = props[key];
982
- if (typeof value2 !== "function") continue;
629
+ const value = props[key];
630
+ if (typeof value !== "function") continue;
983
631
  if (key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key.length > 2) {
984
632
  let ac = el[ABORT_SYM2];
985
633
  if (!ac) {
986
634
  ac = new AbortController();
987
635
  el[ABORT_SYM2] = ac;
988
636
  }
989
- el.addEventListener(key.slice(2).toLowerCase(), value2, { signal: ac.signal });
637
+ el.addEventListener(key.slice(2).toLowerCase(), value, { signal: ac.signal });
990
638
  continue;
991
639
  }
992
- const fn = value2;
640
+ const fn = value;
993
641
  const attrKey = key;
994
- internalEffect(() => {
642
+ chunkDCTOXHPF_cjs.internalEffect(() => {
995
643
  const v = fn();
996
644
  if (v === false || v == null) {
997
645
  el.removeAttribute(attrKey);
@@ -1003,30 +651,30 @@ function applyDynamicProps(el, props) {
1003
651
  });
1004
652
  }
1005
653
  }
1006
- function ensureNode(value2) {
1007
- if (value2 instanceof Node) return value2;
1008
- if (value2 == null || value2 === false || value2 === true) return null;
1009
- if (typeof value2 === "string") return new Text(value2);
1010
- if (typeof value2 === "number") return new Text(String(value2));
1011
- if (isDescriptor(value2)) return descriptorToElement(value2);
1012
- if (isShowDescriptor(value2)) {
654
+ function ensureNode(value) {
655
+ if (value instanceof Node) return value;
656
+ if (value == null || value === false || value === true) return null;
657
+ if (typeof value === "string") return new Text(value);
658
+ if (typeof value === "number") return new Text(String(value));
659
+ if (isDescriptor(value)) return descriptorToElement(value);
660
+ if (isShowDescriptor(value)) {
1013
661
  const prevH = hydrating;
1014
662
  hydrating = false;
1015
663
  try {
1016
664
  return createShow(
1017
- value2.condition,
1018
- () => ensureNode(value2.whenTrue()) ?? document.createComment("empty"),
1019
- value2.whenFalse ? () => ensureNode(value2.whenFalse()) ?? document.createComment("empty") : void 0
665
+ value.condition,
666
+ () => ensureNode(value.whenTrue()) ?? document.createComment("empty"),
667
+ value.whenFalse ? () => ensureNode(value.whenFalse()) ?? document.createComment("empty") : void 0
1020
668
  );
1021
669
  } finally {
1022
670
  hydrating = prevH;
1023
671
  }
1024
672
  }
1025
- if (isListDescriptor(value2)) {
673
+ if (isListDescriptor(value)) {
1026
674
  const prevH = hydrating;
1027
675
  hydrating = false;
1028
676
  try {
1029
- return createList(value2.items, value2.keyFn, value2.renderFn, value2.options);
677
+ return createList(value.items, value.keyFn, value.renderFn, value.options);
1030
678
  } finally {
1031
679
  hydrating = prevH;
1032
680
  }
@@ -1103,13 +751,13 @@ function setupShowEffect(desc, marker) {
1103
751
  let elseFragment = null;
1104
752
  const hasSSRContent = marker.start.nextSibling !== marker.end;
1105
753
  if (!hasSSRContent && currentCondition) {
1106
- if (__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
754
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
1107
755
  const trueBranch = desc.whenTrue();
1108
756
  if (trueBranch instanceof Node) {
1109
757
  marker.start.parentNode.insertBefore(trueBranch, marker.end);
1110
758
  }
1111
759
  }
1112
- internalEffect(() => {
760
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1113
761
  const next = !!desc.condition();
1114
762
  if (next === currentCondition) return;
1115
763
  currentCondition = next;
@@ -1156,7 +804,7 @@ function adoptBranchContent(desc, regionStart, regionEnd) {
1156
804
  }
1157
805
  function adoptNode(desc, ssrEl) {
1158
806
  if (!ssrEl || ssrEl.tagName !== desc.tag.toUpperCase()) {
1159
- if (__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
807
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
1160
808
  const fresh = descriptorToElement(desc);
1161
809
  if (ssrEl) ssrEl.replaceWith(fresh);
1162
810
  return;
@@ -1230,7 +878,7 @@ function adoptNode(desc, ssrEl) {
1230
878
  }
1231
879
  node = node.nextSibling;
1232
880
  }
1233
- const currentItems = untrack(() => child.items());
881
+ const currentItems = chunkDCTOXHPF_cjs.untrack(() => child.items());
1234
882
  const listKeyFn = child.keyFn;
1235
883
  const listRenderFn = child.renderFn;
1236
884
  const useIndexFallback = ssrKeyMap.size === 0 && ssrElements.length > 0;
@@ -1254,7 +902,7 @@ function adoptNode(desc, ssrEl) {
1254
902
  adoptedNodes.push(ssrNode);
1255
903
  adoptedItems.push(item);
1256
904
  } else {
1257
- if (__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
905
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
1258
906
  const prevHydrating = hydrating;
1259
907
  hydrating = false;
1260
908
  try {
@@ -1276,7 +924,7 @@ function adoptNode(desc, ssrEl) {
1276
924
  }
1277
925
  } else {
1278
926
  for (const [unusedKey, unusedNode] of ssrKeyMap) {
1279
- if (__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
927
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
1280
928
  if (unusedNode.parentNode) {
1281
929
  unusedNode.parentNode.removeChild(unusedNode);
1282
930
  }
@@ -1300,7 +948,7 @@ function adoptNode(desc, ssrEl) {
1300
948
  }
1301
949
  let reconcileNodes = adoptedNodes.slice();
1302
950
  let reconcileItems = adoptedItems.slice();
1303
- internalEffect(() => {
951
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1304
952
  const newItems = child.items();
1305
953
  const parent2 = start.parentNode;
1306
954
  if (!parent2) return;
@@ -1316,7 +964,7 @@ function adoptNode(desc, ssrEl) {
1316
964
  try {
1317
965
  const key = listKeyFn(item);
1318
966
  const [getIndex, setIndex] = chunk3U57L2TY_cjs.createSignal(0);
1319
- const element = untrack(() => listRenderFn(item, getIndex));
967
+ const element = chunkDCTOXHPF_cjs.untrack(() => listRenderFn(item, getIndex));
1320
968
  cache.set(key, { element, item, getIndex, setIndex });
1321
969
  return element;
1322
970
  } finally {
@@ -1365,12 +1013,12 @@ function adoptNode(desc, ssrEl) {
1365
1013
  const endMarker = findClosingMarker(cursor);
1366
1014
  let textNode = cursor.nextSibling;
1367
1015
  if (!textNode || textNode.nodeType !== 3) {
1368
- if (__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1016
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1369
1017
  const created = document.createTextNode("");
1370
1018
  cursor.parentNode.insertBefore(created, endMarker || cursor.nextSibling);
1371
1019
  textNode = created;
1372
1020
  }
1373
- internalEffect(() => {
1021
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1374
1022
  textNode.data = String(child());
1375
1023
  });
1376
1024
  cursor = endMarker ? endMarker.nextSibling : textNode.nextSibling;
@@ -1380,11 +1028,11 @@ function adoptNode(desc, ssrEl) {
1380
1028
  if (end) {
1381
1029
  let textNode = findTextBetween(start, end);
1382
1030
  if (!textNode) {
1383
- if (__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1031
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1384
1032
  textNode = document.createTextNode("");
1385
1033
  start.parentNode.insertBefore(textNode, end);
1386
1034
  }
1387
- internalEffect(() => {
1035
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1388
1036
  textNode.data = String(child());
1389
1037
  });
1390
1038
  cursor = end.nextSibling;
@@ -1397,14 +1045,14 @@ function adoptNode(desc, ssrEl) {
1397
1045
  } else if (cursor && cursor.nodeType === 3) {
1398
1046
  const textNode = cursor;
1399
1047
  cursor = cursor.nextSibling;
1400
- internalEffect(() => {
1048
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1401
1049
  textNode.data = String(child());
1402
1050
  });
1403
1051
  } else {
1404
- if (__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1052
+ if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1405
1053
  const textNode = document.createTextNode("");
1406
1054
  ssrEl.appendChild(textNode);
1407
- internalEffect(() => {
1055
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1408
1056
  textNode.data = String(child());
1409
1057
  });
1410
1058
  }
@@ -1418,7 +1066,7 @@ function adoptNode(desc, ssrEl) {
1418
1066
  function hydrateIsland(component, target) {
1419
1067
  const hasSSRContent = target.childElementCount > 0 || target.childNodes.length > 0 && Array.from(target.childNodes).some((n) => n.nodeType === 1 || n.nodeType === 3 && n.data.trim());
1420
1068
  if (!hasSSRContent) {
1421
- if (__DEV__) {
1069
+ if (chunkDCTOXHPF_cjs.__DEV__) {
1422
1070
  const name = target.getAttribute("data-forma-component") || "unknown";
1423
1071
  console.warn(
1424
1072
  `[forma] Island "${name}" has no SSR content \u2014 falling back to CSR. This means the IR walker did not render content between ISLAND_START and ISLAND_END.`
@@ -1734,14 +1382,14 @@ function createList(items, keyFn, renderFn, options) {
1734
1382
  let currentNodes = [];
1735
1383
  let currentItems = [];
1736
1384
  const updateOnItemChange = options?.updateOnItemChange ?? "none";
1737
- internalEffect(() => {
1385
+ chunkDCTOXHPF_cjs.internalEffect(() => {
1738
1386
  const newItems = items();
1739
1387
  const parent = startMarker.parentNode;
1740
1388
  if (!parent) {
1741
1389
  return;
1742
1390
  }
1743
1391
  if (!Array.isArray(newItems)) {
1744
- if (__DEV__) {
1392
+ if (chunkDCTOXHPF_cjs.__DEV__) {
1745
1393
  console.warn("[forma] createList: value is not an array, treating as empty");
1746
1394
  }
1747
1395
  for (const node of currentNodes) {
@@ -1759,7 +1407,7 @@ function createList(items, keyFn, renderFn, options) {
1759
1407
  break;
1760
1408
  }
1761
1409
  }
1762
- if (__DEV__) {
1410
+ if (chunkDCTOXHPF_cjs.__DEV__) {
1763
1411
  const seen = /* @__PURE__ */ new Set();
1764
1412
  for (const item of cleanItems) {
1765
1413
  const key = keyFn(item);
@@ -1779,7 +1427,7 @@ function createList(items, keyFn, renderFn, options) {
1779
1427
  if (node[ABORT_SYM3] || node[CACHE_SYM2] || node[DYNAMIC_CHILD_SYM2]) {
1780
1428
  return;
1781
1429
  }
1782
- const next = untrack(() => renderFn(item, cached.getIndex));
1430
+ const next = chunkDCTOXHPF_cjs.untrack(() => renderFn(item, cached.getIndex));
1783
1431
  if (canPatchStaticElement(node, next)) {
1784
1432
  patchStaticElement(node, next);
1785
1433
  cached.element = node;
@@ -1799,7 +1447,7 @@ function createList(items, keyFn, renderFn, options) {
1799
1447
  (item) => {
1800
1448
  const key = keyFn(item);
1801
1449
  const [getIndex, setIndex] = chunk3U57L2TY_cjs.createSignal(0);
1802
- const element = untrack(() => renderFn(item, getIndex));
1450
+ const element = chunkDCTOXHPF_cjs.untrack(() => renderFn(item, getIndex));
1803
1451
  cache.set(key, { element, item, getIndex, setIndex });
1804
1452
  return element;
1805
1453
  },
@@ -1823,53 +1471,13 @@ function createList(items, keyFn, renderFn, options) {
1823
1471
  return fragment2;
1824
1472
  }
1825
1473
 
1826
- Object.defineProperty(exports, "getBatchDepth", {
1827
- enumerable: true,
1828
- get: function () { return alienSignals.getBatchDepth; }
1829
- });
1830
- Object.defineProperty(exports, "isComputed", {
1831
- enumerable: true,
1832
- get: function () { return alienSignals.isComputed; }
1833
- });
1834
- Object.defineProperty(exports, "isEffect", {
1835
- enumerable: true,
1836
- get: function () { return alienSignals.isEffect; }
1837
- });
1838
- Object.defineProperty(exports, "isEffectScope", {
1839
- enumerable: true,
1840
- get: function () { return alienSignals.isEffectScope; }
1841
- });
1842
- Object.defineProperty(exports, "isSignal", {
1843
- enumerable: true,
1844
- get: function () { return alienSignals.isSignal; }
1845
- });
1846
- Object.defineProperty(exports, "trigger", {
1847
- enumerable: true,
1848
- get: function () { return alienSignals.trigger; }
1849
- });
1850
1474
  exports.Fragment = Fragment;
1851
- exports.__DEV__ = __DEV__;
1852
- exports.batch = batch;
1853
1475
  exports.cleanup = cleanup;
1854
- exports.createEffect = createEffect;
1855
1476
  exports.createList = createList;
1856
- exports.createMemo = createMemo;
1857
- exports.createReducer = createReducer;
1858
- exports.createRef = createRef;
1859
- exports.createResource = createResource;
1860
- exports.createRoot = createRoot;
1861
1477
  exports.createShow = createShow;
1862
1478
  exports.fragment = fragment;
1863
1479
  exports.h = h;
1864
1480
  exports.hydrateIsland = hydrateIsland;
1865
- exports.internalEffect = internalEffect;
1866
- exports.on = on;
1867
- exports.onCleanup = onCleanup;
1868
- exports.onError = onError;
1869
- exports.popSuspenseContext = popSuspenseContext;
1870
- exports.pushSuspenseContext = pushSuspenseContext;
1871
1481
  exports.reconcileList = reconcileList;
1872
- exports.reportError = reportError;
1873
- exports.untrack = untrack;
1874
- //# sourceMappingURL=chunk-GDULJFJO.cjs.map
1875
- //# sourceMappingURL=chunk-GDULJFJO.cjs.map
1482
+ //# sourceMappingURL=chunk-V732ZBCU.cjs.map
1483
+ //# sourceMappingURL=chunk-V732ZBCU.cjs.map