@getforma/core 0.9.0 → 0.9.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.
package/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkYMIMKO4W_cjs = require('./chunk-YMIMKO4W.cjs');
3
+ var chunkGDULJFJO_cjs = require('./chunk-GDULJFJO.cjs');
4
4
  var chunk3U57L2TY_cjs = require('./chunk-3U57L2TY.cjs');
5
5
 
6
6
  // src/dom/text.ts
7
7
  function createText(value) {
8
8
  if (typeof value === "function") {
9
9
  const node = new Text("");
10
- chunkYMIMKO4W_cjs.internalEffect(() => {
10
+ chunkGDULJFJO_cjs.internalEffect(() => {
11
11
  node.data = value();
12
12
  });
13
13
  return node;
@@ -23,12 +23,12 @@ function mount(component, container) {
23
23
  }
24
24
  let disposeRoot;
25
25
  if (target.hasAttribute("data-forma-ssr")) {
26
- chunkYMIMKO4W_cjs.createRoot((dispose) => {
26
+ chunkGDULJFJO_cjs.createRoot((dispose) => {
27
27
  disposeRoot = dispose;
28
- chunkYMIMKO4W_cjs.hydrateIsland(component, target);
28
+ chunkGDULJFJO_cjs.hydrateIsland(component, target);
29
29
  });
30
30
  } else {
31
- const dom = chunkYMIMKO4W_cjs.createRoot((dispose) => {
31
+ const dom = chunkGDULJFJO_cjs.createRoot((dispose) => {
32
32
  disposeRoot = dispose;
33
33
  return component();
34
34
  });
@@ -54,7 +54,7 @@ function createSwitch(value, cases, fallback) {
54
54
  const cache = /* @__PURE__ */ new Map();
55
55
  let currentNode = null;
56
56
  let currentMatch = UNSET;
57
- const switchDispose = chunkYMIMKO4W_cjs.internalEffect(() => {
57
+ const switchDispose = chunkGDULJFJO_cjs.internalEffect(() => {
58
58
  const val = value();
59
59
  if (val === currentMatch) return;
60
60
  const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
@@ -89,9 +89,9 @@ function createSwitch(value, cases, fallback) {
89
89
  let entry = cache.get(val);
90
90
  if (!entry) {
91
91
  let branchDispose;
92
- const node = chunkYMIMKO4W_cjs.createRoot((dispose) => {
92
+ const node = chunkGDULJFJO_cjs.createRoot((dispose) => {
93
93
  branchDispose = dispose;
94
- return chunkYMIMKO4W_cjs.untrack(() => matchedCase.render());
94
+ return chunkGDULJFJO_cjs.untrack(() => matchedCase.render());
95
95
  });
96
96
  entry = { node, dispose: branchDispose };
97
97
  cache.set(val, entry);
@@ -134,7 +134,7 @@ function createPortal(children2, target) {
134
134
  }
135
135
  mountedNode = null;
136
136
  };
137
- chunkYMIMKO4W_cjs.createEffect(() => {
137
+ chunkGDULJFJO_cjs.createEffect(() => {
138
138
  const node = children2();
139
139
  removeMountedNode();
140
140
  mountedNode = node;
@@ -155,7 +155,7 @@ function createErrorBoundary(tryFn, catchFn) {
155
155
  fragment2.appendChild(endMarker);
156
156
  const [retryCount, setRetryCount] = chunk3U57L2TY_cjs.createSignal(0);
157
157
  let currentNode = null;
158
- chunkYMIMKO4W_cjs.internalEffect(() => {
158
+ chunkGDULJFJO_cjs.internalEffect(() => {
159
159
  retryCount();
160
160
  const parent2 = startMarker.parentNode;
161
161
  if (!parent2) return;
@@ -195,13 +195,13 @@ function createSuspense(fallback, children2) {
195
195
  setPending((p) => Math.max(0, p - 1));
196
196
  }
197
197
  };
198
- chunkYMIMKO4W_cjs.pushSuspenseContext(ctx);
198
+ chunkGDULJFJO_cjs.pushSuspenseContext(ctx);
199
199
  try {
200
200
  resolvedNode = children2();
201
201
  } finally {
202
- chunkYMIMKO4W_cjs.popSuspenseContext();
202
+ chunkGDULJFJO_cjs.popSuspenseContext();
203
203
  }
204
- chunkYMIMKO4W_cjs.internalEffect(() => {
204
+ chunkGDULJFJO_cjs.internalEffect(() => {
205
205
  const parent2 = startMarker.parentNode;
206
206
  if (!parent2) return;
207
207
  const isPending = pending() > 0;
@@ -245,7 +245,7 @@ function activateIslands(registry2) {
245
245
  const componentName = root.getAttribute("data-forma-component");
246
246
  const hydrateFn = registry2[componentName];
247
247
  if (!hydrateFn) {
248
- if (chunkYMIMKO4W_cjs.__DEV__) console.warn(`[forma] No hydrate function for island "${componentName}" (id=${id})`);
248
+ if (chunkGDULJFJO_cjs.__DEV__) console.warn(`[forma] No hydrate function for island "${componentName}" (id=${id})`);
249
249
  root.setAttribute("data-forma-status", "error");
250
250
  continue;
251
251
  }
@@ -301,13 +301,13 @@ function hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps) {
301
301
  const props = loadIslandProps(root, id, sharedProps);
302
302
  root.setAttribute("data-forma-status", "hydrating");
303
303
  let activeRoot = root;
304
- chunkYMIMKO4W_cjs.createRoot((dispose) => {
305
- activeRoot = chunkYMIMKO4W_cjs.hydrateIsland(() => hydrateFn(root, props), root);
304
+ chunkGDULJFJO_cjs.createRoot((dispose) => {
305
+ activeRoot = chunkGDULJFJO_cjs.hydrateIsland(() => hydrateFn(root, props), root);
306
306
  activeRoot.__formaDispose = dispose;
307
307
  });
308
308
  activeRoot.setAttribute("data-forma-status", "active");
309
309
  } catch (err) {
310
- if (chunkYMIMKO4W_cjs.__DEV__) console.error(`[forma] Island "${componentName}" (id=${id}) failed:`, err);
310
+ if (chunkGDULJFJO_cjs.__DEV__) console.error(`[forma] Island "${componentName}" (id=${id}) failed:`, err);
311
311
  root.setAttribute("data-forma-status", "error");
312
312
  }
313
313
  }
@@ -356,14 +356,14 @@ function defineComponent(setupOrDef) {
356
356
  try {
357
357
  cb();
358
358
  } catch (e) {
359
- chunkYMIMKO4W_cjs.reportError(e, "onUnmount");
359
+ chunkGDULJFJO_cjs.reportError(e, "onUnmount");
360
360
  }
361
361
  }
362
362
  for (const d of ctx.disposers) {
363
363
  try {
364
364
  d();
365
365
  } catch (e) {
366
- chunkYMIMKO4W_cjs.reportError(e, "component disposer");
366
+ chunkGDULJFJO_cjs.reportError(e, "component disposer");
367
367
  }
368
368
  }
369
369
  ctx.disposers.length = 0;
@@ -378,7 +378,7 @@ function defineComponent(setupOrDef) {
378
378
  ctx.unmountCallbacks.push(cleanup2);
379
379
  }
380
380
  } catch (e) {
381
- chunkYMIMKO4W_cjs.reportError(e, "onMount");
381
+ chunkGDULJFJO_cjs.reportError(e, "onMount");
382
382
  }
383
383
  }
384
384
  return dom;
@@ -521,7 +521,7 @@ function createStore(initial) {
521
521
  if (isArr && ARRAY_MUTATORS.has(key)) {
522
522
  return (...args) => {
523
523
  let result;
524
- chunkYMIMKO4W_cjs.batch(() => {
524
+ chunkGDULJFJO_cjs.batch(() => {
525
525
  const rawArgs = args.map(
526
526
  (a) => a != null && typeof a === "object" && a[RAW] ? a[RAW] : a
527
527
  );
@@ -635,11 +635,11 @@ function createStore(initial) {
635
635
  }
636
636
  const rootProxy = wrap(initial, "");
637
637
  function getCurrentSnapshot() {
638
- return chunkYMIMKO4W_cjs.untrack(() => deepClone(initial));
638
+ return chunkGDULJFJO_cjs.untrack(() => deepClone(initial));
639
639
  }
640
640
  const setter = (partial) => {
641
641
  const updates = typeof partial === "function" ? partial(getCurrentSnapshot()) : partial;
642
- chunkYMIMKO4W_cjs.batch(() => {
642
+ chunkGDULJFJO_cjs.batch(() => {
643
643
  for (const key of Object.keys(updates)) {
644
644
  rootProxy[key] = updates[key];
645
645
  }
@@ -658,7 +658,7 @@ function createHistory(source, options) {
658
658
  const [cursorSignal, setCursorSignal] = chunk3U57L2TY_cjs.createSignal(_cursor);
659
659
  const [stackLenSignal, setStackLenSignal] = chunk3U57L2TY_cjs.createSignal(_stack.length);
660
660
  function syncSignals() {
661
- chunkYMIMKO4W_cjs.batch(() => {
661
+ chunkGDULJFJO_cjs.batch(() => {
662
662
  setStackSignal([..._stack]);
663
663
  setCursorSignal(_cursor);
664
664
  setStackLenSignal(_stack.length);
@@ -666,7 +666,7 @@ function createHistory(source, options) {
666
666
  }
667
667
  let ignoreNext = false;
668
668
  let isFirstRun = true;
669
- chunkYMIMKO4W_cjs.internalEffect(() => {
669
+ chunkGDULJFJO_cjs.internalEffect(() => {
670
670
  const value = sourceGet();
671
671
  if (isFirstRun) {
672
672
  isFirstRun = false;
@@ -734,7 +734,7 @@ function persist(source, key, options) {
734
734
  }
735
735
  } catch {
736
736
  }
737
- chunkYMIMKO4W_cjs.internalEffect(() => {
737
+ chunkGDULJFJO_cjs.internalEffect(() => {
738
738
  const value = sourceGet();
739
739
  try {
740
740
  const serialized = serialize(value);
@@ -1191,7 +1191,7 @@ function createFetch(url, options) {
1191
1191
  }
1192
1192
  }
1193
1193
  if (typeof url === "function") {
1194
- chunkYMIMKO4W_cjs.internalEffect(() => {
1194
+ chunkGDULJFJO_cjs.internalEffect(() => {
1195
1195
  url();
1196
1196
  execute();
1197
1197
  });
@@ -1360,14 +1360,14 @@ function createAction(serverFn, options) {
1360
1360
  setError(void 0);
1361
1361
  if (options?.optimistic) {
1362
1362
  try {
1363
- chunkYMIMKO4W_cjs.batch(() => options.optimistic(...args));
1363
+ chunkGDULJFJO_cjs.batch(() => options.optimistic(...args));
1364
1364
  } catch {
1365
1365
  }
1366
1366
  }
1367
1367
  try {
1368
1368
  const result = await serverFn(...args);
1369
1369
  if (options?.onSuccess) {
1370
- chunkYMIMKO4W_cjs.batch(() => options.onSuccess(result, ...args));
1370
+ chunkGDULJFJO_cjs.batch(() => options.onSuccess(result, ...args));
1371
1371
  }
1372
1372
  if (options?.invalidates) {
1373
1373
  for (const resource of options.invalidates) {
@@ -1379,7 +1379,7 @@ function createAction(serverFn, options) {
1379
1379
  } catch (err) {
1380
1380
  if (options?.onError) {
1381
1381
  try {
1382
- chunkYMIMKO4W_cjs.batch(() => options.onError(err, ...args));
1382
+ chunkGDULJFJO_cjs.batch(() => options.onError(err, ...args));
1383
1383
  } catch {
1384
1384
  }
1385
1385
  }
@@ -1513,103 +1513,103 @@ function createRPCMiddleware() {
1513
1513
 
1514
1514
  Object.defineProperty(exports, "Fragment", {
1515
1515
  enumerable: true,
1516
- get: function () { return chunkYMIMKO4W_cjs.Fragment; }
1516
+ get: function () { return chunkGDULJFJO_cjs.Fragment; }
1517
1517
  });
1518
1518
  Object.defineProperty(exports, "batch", {
1519
1519
  enumerable: true,
1520
- get: function () { return chunkYMIMKO4W_cjs.batch; }
1520
+ get: function () { return chunkGDULJFJO_cjs.batch; }
1521
1521
  });
1522
1522
  Object.defineProperty(exports, "cleanup", {
1523
1523
  enumerable: true,
1524
- get: function () { return chunkYMIMKO4W_cjs.cleanup; }
1524
+ get: function () { return chunkGDULJFJO_cjs.cleanup; }
1525
1525
  });
1526
1526
  Object.defineProperty(exports, "createEffect", {
1527
1527
  enumerable: true,
1528
- get: function () { return chunkYMIMKO4W_cjs.createEffect; }
1528
+ get: function () { return chunkGDULJFJO_cjs.createEffect; }
1529
1529
  });
1530
1530
  Object.defineProperty(exports, "createList", {
1531
1531
  enumerable: true,
1532
- get: function () { return chunkYMIMKO4W_cjs.createList; }
1532
+ get: function () { return chunkGDULJFJO_cjs.createList; }
1533
1533
  });
1534
1534
  Object.defineProperty(exports, "createMemo", {
1535
1535
  enumerable: true,
1536
- get: function () { return chunkYMIMKO4W_cjs.createMemo; }
1536
+ get: function () { return chunkGDULJFJO_cjs.createMemo; }
1537
1537
  });
1538
1538
  Object.defineProperty(exports, "createReducer", {
1539
1539
  enumerable: true,
1540
- get: function () { return chunkYMIMKO4W_cjs.createReducer; }
1540
+ get: function () { return chunkGDULJFJO_cjs.createReducer; }
1541
1541
  });
1542
1542
  Object.defineProperty(exports, "createRef", {
1543
1543
  enumerable: true,
1544
- get: function () { return chunkYMIMKO4W_cjs.createRef; }
1544
+ get: function () { return chunkGDULJFJO_cjs.createRef; }
1545
1545
  });
1546
1546
  Object.defineProperty(exports, "createResource", {
1547
1547
  enumerable: true,
1548
- get: function () { return chunkYMIMKO4W_cjs.createResource; }
1548
+ get: function () { return chunkGDULJFJO_cjs.createResource; }
1549
1549
  });
1550
1550
  Object.defineProperty(exports, "createRoot", {
1551
1551
  enumerable: true,
1552
- get: function () { return chunkYMIMKO4W_cjs.createRoot; }
1552
+ get: function () { return chunkGDULJFJO_cjs.createRoot; }
1553
1553
  });
1554
1554
  Object.defineProperty(exports, "createShow", {
1555
1555
  enumerable: true,
1556
- get: function () { return chunkYMIMKO4W_cjs.createShow; }
1556
+ get: function () { return chunkGDULJFJO_cjs.createShow; }
1557
1557
  });
1558
1558
  Object.defineProperty(exports, "fragment", {
1559
1559
  enumerable: true,
1560
- get: function () { return chunkYMIMKO4W_cjs.fragment; }
1560
+ get: function () { return chunkGDULJFJO_cjs.fragment; }
1561
1561
  });
1562
1562
  Object.defineProperty(exports, "getBatchDepth", {
1563
1563
  enumerable: true,
1564
- get: function () { return chunkYMIMKO4W_cjs.getBatchDepth; }
1564
+ get: function () { return chunkGDULJFJO_cjs.getBatchDepth; }
1565
1565
  });
1566
1566
  Object.defineProperty(exports, "h", {
1567
1567
  enumerable: true,
1568
- get: function () { return chunkYMIMKO4W_cjs.h; }
1568
+ get: function () { return chunkGDULJFJO_cjs.h; }
1569
1569
  });
1570
1570
  Object.defineProperty(exports, "hydrateIsland", {
1571
1571
  enumerable: true,
1572
- get: function () { return chunkYMIMKO4W_cjs.hydrateIsland; }
1572
+ get: function () { return chunkGDULJFJO_cjs.hydrateIsland; }
1573
1573
  });
1574
1574
  Object.defineProperty(exports, "isComputed", {
1575
1575
  enumerable: true,
1576
- get: function () { return chunkYMIMKO4W_cjs.isComputed; }
1576
+ get: function () { return chunkGDULJFJO_cjs.isComputed; }
1577
1577
  });
1578
1578
  Object.defineProperty(exports, "isEffect", {
1579
1579
  enumerable: true,
1580
- get: function () { return chunkYMIMKO4W_cjs.isEffect; }
1580
+ get: function () { return chunkGDULJFJO_cjs.isEffect; }
1581
1581
  });
1582
1582
  Object.defineProperty(exports, "isEffectScope", {
1583
1583
  enumerable: true,
1584
- get: function () { return chunkYMIMKO4W_cjs.isEffectScope; }
1584
+ get: function () { return chunkGDULJFJO_cjs.isEffectScope; }
1585
1585
  });
1586
1586
  Object.defineProperty(exports, "isSignal", {
1587
1587
  enumerable: true,
1588
- get: function () { return chunkYMIMKO4W_cjs.isSignal; }
1588
+ get: function () { return chunkGDULJFJO_cjs.isSignal; }
1589
1589
  });
1590
1590
  Object.defineProperty(exports, "on", {
1591
1591
  enumerable: true,
1592
- get: function () { return chunkYMIMKO4W_cjs.on; }
1592
+ get: function () { return chunkGDULJFJO_cjs.on; }
1593
1593
  });
1594
1594
  Object.defineProperty(exports, "onCleanup", {
1595
1595
  enumerable: true,
1596
- get: function () { return chunkYMIMKO4W_cjs.onCleanup; }
1596
+ get: function () { return chunkGDULJFJO_cjs.onCleanup; }
1597
1597
  });
1598
1598
  Object.defineProperty(exports, "onError", {
1599
1599
  enumerable: true,
1600
- get: function () { return chunkYMIMKO4W_cjs.onError; }
1600
+ get: function () { return chunkGDULJFJO_cjs.onError; }
1601
1601
  });
1602
1602
  Object.defineProperty(exports, "reconcileList", {
1603
1603
  enumerable: true,
1604
- get: function () { return chunkYMIMKO4W_cjs.reconcileList; }
1604
+ get: function () { return chunkGDULJFJO_cjs.reconcileList; }
1605
1605
  });
1606
1606
  Object.defineProperty(exports, "trigger", {
1607
1607
  enumerable: true,
1608
- get: function () { return chunkYMIMKO4W_cjs.trigger; }
1608
+ get: function () { return chunkGDULJFJO_cjs.trigger; }
1609
1609
  });
1610
1610
  Object.defineProperty(exports, "untrack", {
1611
1611
  enumerable: true,
1612
- get: function () { return chunkYMIMKO4W_cjs.untrack; }
1612
+ get: function () { return chunkGDULJFJO_cjs.untrack; }
1613
1613
  });
1614
1614
  Object.defineProperty(exports, "createComputed", {
1615
1615
  enumerable: true,