@getforma/core 1.4.0 → 1.5.0

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 (43) hide show
  1. package/dist/{chunk-AJP4OVCN.js → chunk-3U2IQIKB.js} +4 -4
  2. package/dist/{chunk-AJP4OVCN.js.map → chunk-3U2IQIKB.js.map} +1 -1
  3. package/dist/{chunk-FBM7V4NE.cjs → chunk-D46EJ3VS.cjs} +43 -43
  4. package/dist/{chunk-FBM7V4NE.cjs.map → chunk-D46EJ3VS.cjs.map} +1 -1
  5. package/dist/{chunk-Y3A2EVVS.js → chunk-F5QUU76U.js} +4 -4
  6. package/dist/{chunk-Y3A2EVVS.js.map → chunk-F5QUU76U.js.map} +1 -1
  7. package/dist/{chunk-ETPJTPYD.js → chunk-FAIWRZKJ.js} +6 -3
  8. package/dist/chunk-FAIWRZKJ.js.map +1 -0
  9. package/dist/{chunk-H7MDUHS5.cjs → chunk-HAULTMNX.cjs} +6 -2
  10. package/dist/chunk-HAULTMNX.cjs.map +1 -0
  11. package/dist/{chunk-KUXNZ5MG.cjs → chunk-PAKPQRVE.cjs} +14 -12
  12. package/dist/{chunk-KUXNZ5MG.cjs.map → chunk-PAKPQRVE.cjs.map} +1 -1
  13. package/dist/formajs.global.js +69 -11
  14. package/dist/formajs.global.js.map +1 -1
  15. package/dist/http.cjs +11 -11
  16. package/dist/http.js +2 -2
  17. package/dist/index.cjs +143 -76
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +39 -5
  20. package/dist/index.d.ts +39 -5
  21. package/dist/index.js +67 -16
  22. package/dist/index.js.map +1 -1
  23. package/dist/{resource-D6HfVgiA.d.cts → resource-CBTcorBJ.d.ts} +2 -2
  24. package/dist/{resource-ljs2X5NM.d.ts → resource-CaFfIB5i.d.cts} +2 -2
  25. package/dist/runtime.cjs +28 -28
  26. package/dist/runtime.js +3 -3
  27. package/dist/server.cjs +7 -7
  28. package/dist/server.d.cts +2 -2
  29. package/dist/server.d.ts +2 -2
  30. package/dist/server.js +2 -2
  31. package/dist/{signal-CRBJYQ6B.d.cts → signal-CIXTR4Qz.d.cts} +29 -1
  32. package/dist/{signal-CRBJYQ6B.d.ts → signal-CIXTR4Qz.d.ts} +29 -1
  33. package/dist/storage.cjs +66 -16
  34. package/dist/storage.cjs.map +1 -1
  35. package/dist/storage.js +66 -16
  36. package/dist/storage.js.map +1 -1
  37. package/dist/tc39-compat.cjs +3 -3
  38. package/dist/tc39-compat.d.cts +1 -1
  39. package/dist/tc39-compat.d.ts +1 -1
  40. package/dist/tc39-compat.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-ETPJTPYD.js.map +0 -1
  43. package/dist/chunk-H7MDUHS5.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkKUXNZ5MG_cjs = require('./chunk-KUXNZ5MG.cjs');
4
- var chunkH7MDUHS5_cjs = require('./chunk-H7MDUHS5.cjs');
3
+ var chunkPAKPQRVE_cjs = require('./chunk-PAKPQRVE.cjs');
4
+ var chunkHAULTMNX_cjs = require('./chunk-HAULTMNX.cjs');
5
5
 
6
6
  // src/dom/element.ts
7
7
  var Fragment = /* @__PURE__ */ Symbol.for("forma.fragment");
@@ -167,7 +167,7 @@ function getCache(el) {
167
167
  }
168
168
  function handleClass(el, _key, value) {
169
169
  if (typeof value === "function") {
170
- chunkKUXNZ5MG_cjs.internalEffect(() => {
170
+ chunkPAKPQRVE_cjs.internalEffect(() => {
171
171
  const v = value();
172
172
  const cache = getCache(el);
173
173
  if (cache["class"] === v) return;
@@ -217,7 +217,7 @@ function applyStyleObj(el, obj, prevKeys) {
217
217
  function handleStyle(el, _key, value) {
218
218
  if (typeof value === "function") {
219
219
  let prevKeys = [];
220
- chunkKUXNZ5MG_cjs.internalEffect(() => {
220
+ chunkPAKPQRVE_cjs.internalEffect(() => {
221
221
  const v = value();
222
222
  if (typeof v === "string") {
223
223
  const cache = getCache(el);
@@ -247,7 +247,7 @@ function handleEvent(el, key, value) {
247
247
  }
248
248
  function handleInnerHTML(el, _key, value) {
249
249
  if (typeof value === "function") {
250
- chunkKUXNZ5MG_cjs.internalEffect(() => {
250
+ chunkPAKPQRVE_cjs.internalEffect(() => {
251
251
  const resolved = value();
252
252
  if (resolved == null) {
253
253
  el.innerHTML = "";
@@ -291,7 +291,7 @@ function handleInnerHTML(el, _key, value) {
291
291
  function handleXLink(el, key, value) {
292
292
  const localName = key.slice(6);
293
293
  if (typeof value === "function") {
294
- chunkKUXNZ5MG_cjs.internalEffect(() => {
294
+ chunkPAKPQRVE_cjs.internalEffect(() => {
295
295
  const v = value();
296
296
  if (v == null || v === false) {
297
297
  el.removeAttributeNS(XLINK_NS, localName);
@@ -309,7 +309,7 @@ function handleXLink(el, key, value) {
309
309
  }
310
310
  function handleBooleanAttr(el, key, value) {
311
311
  if (typeof value === "function") {
312
- chunkKUXNZ5MG_cjs.internalEffect(() => {
312
+ chunkPAKPQRVE_cjs.internalEffect(() => {
313
313
  const v = value();
314
314
  const cache = getCache(el);
315
315
  if (cache[key] === v) return;
@@ -333,7 +333,7 @@ function handleBooleanAttr(el, key, value) {
333
333
  }
334
334
  function handleGenericAttr(el, key, value) {
335
335
  if (typeof value === "function") {
336
- chunkKUXNZ5MG_cjs.internalEffect(() => {
336
+ chunkPAKPQRVE_cjs.internalEffect(() => {
337
337
  const v = value();
338
338
  if (v == null || v === false) {
339
339
  const cache = getCache(el);
@@ -476,7 +476,7 @@ function appendChild(parent, child) {
476
476
  }
477
477
  currentNode = null;
478
478
  };
479
- chunkKUXNZ5MG_cjs.internalEffect(() => {
479
+ chunkPAKPQRVE_cjs.internalEffect(() => {
480
480
  const v = child();
481
481
  let resolved = v;
482
482
  if (Array.isArray(v)) {
@@ -631,7 +631,7 @@ function createShow(when, thenFn, elseFn = () => null) {
631
631
  let currentNode = null;
632
632
  let lastTruthy = null;
633
633
  let currentDispose = null;
634
- const showDispose = chunkKUXNZ5MG_cjs.internalEffect(() => {
634
+ const showDispose = chunkPAKPQRVE_cjs.internalEffect(() => {
635
635
  const truthy = !!when();
636
636
  const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
637
637
  const DEBUG_LABEL = DEBUG ? thenFn.toString().slice(0, 60) : "";
@@ -663,9 +663,9 @@ function createShow(when, thenFn, elseFn = () => null) {
663
663
  const branchFn = truthy ? thenFn : elseFn;
664
664
  if (branchFn) {
665
665
  let branchDispose;
666
- currentNode = chunkKUXNZ5MG_cjs.createRoot((dispose) => {
666
+ currentNode = chunkPAKPQRVE_cjs.createRoot((dispose) => {
667
667
  branchDispose = dispose;
668
- return chunkKUXNZ5MG_cjs.untrack(() => branchFn());
668
+ return chunkPAKPQRVE_cjs.untrack(() => branchFn());
669
669
  });
670
670
  currentDispose = branchDispose;
671
671
  } else {
@@ -675,7 +675,7 @@ function createShow(when, thenFn, elseFn = () => null) {
675
675
  parent.insertBefore(currentNode, endMarker);
676
676
  }
677
677
  });
678
- chunkKUXNZ5MG_cjs.registerDisposer(() => {
678
+ chunkPAKPQRVE_cjs.registerDisposer(() => {
679
679
  if (currentDispose) {
680
680
  currentDispose();
681
681
  currentDispose = null;
@@ -723,7 +723,7 @@ function applyDynamicProps(el, props) {
723
723
  }
724
724
  const fn = value;
725
725
  const attrKey = key;
726
- chunkKUXNZ5MG_cjs.internalEffect(() => {
726
+ chunkPAKPQRVE_cjs.internalEffect(() => {
727
727
  const v = fn();
728
728
  if (v === false || v == null) {
729
729
  el.removeAttribute(attrKey);
@@ -835,13 +835,13 @@ function setupShowEffect(desc, marker) {
835
835
  let elseFragment = null;
836
836
  const hasSSRContent = marker.start.nextSibling !== marker.end;
837
837
  if (!hasSSRContent && currentCondition) {
838
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
838
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
839
839
  const trueBranch = desc.whenTrue();
840
840
  if (trueBranch instanceof Node) {
841
841
  marker.start.parentNode.insertBefore(trueBranch, marker.end);
842
842
  }
843
843
  }
844
- chunkKUXNZ5MG_cjs.internalEffect(() => {
844
+ chunkPAKPQRVE_cjs.internalEffect(() => {
845
845
  const next = !!desc.condition();
846
846
  if (next === currentCondition) return;
847
847
  currentCondition = next;
@@ -888,7 +888,7 @@ function adoptBranchContent(desc, regionStart, regionEnd) {
888
888
  }
889
889
  function adoptNode(desc, ssrEl) {
890
890
  if (!ssrEl || ssrEl.tagName !== desc.tag.toUpperCase()) {
891
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
891
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
892
892
  const fresh = descriptorToElement(desc);
893
893
  if (ssrEl) ssrEl.replaceWith(fresh);
894
894
  return;
@@ -962,7 +962,7 @@ function adoptNode(desc, ssrEl) {
962
962
  }
963
963
  node = node.nextSibling;
964
964
  }
965
- const currentItems = chunkKUXNZ5MG_cjs.untrack(() => child.items());
965
+ const currentItems = chunkPAKPQRVE_cjs.untrack(() => child.items());
966
966
  const listKeyFn = child.keyFn;
967
967
  const listRenderFn = child.renderFn;
968
968
  const useIndexFallback = ssrKeyMap.size === 0 && ssrElements.length > 0;
@@ -986,11 +986,11 @@ function adoptNode(desc, ssrEl) {
986
986
  adoptedNodes.push(ssrNode);
987
987
  adoptedItems.push(item);
988
988
  } else {
989
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
989
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
990
990
  const prevHydrating = hydrating;
991
991
  hydrating = false;
992
992
  try {
993
- const [getIndex] = chunkH7MDUHS5_cjs.createSignal(i);
993
+ const [getIndex] = chunkHAULTMNX_cjs.createSignal(i);
994
994
  const fresh = listRenderFn(item, getIndex);
995
995
  end.parentNode.insertBefore(fresh, end);
996
996
  adoptedNodes.push(fresh);
@@ -1008,7 +1008,7 @@ function adoptNode(desc, ssrEl) {
1008
1008
  }
1009
1009
  } else {
1010
1010
  for (const [unusedKey, unusedNode] of ssrKeyMap) {
1011
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
1011
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
1012
1012
  if (unusedNode.parentNode) {
1013
1013
  unusedNode.parentNode.removeChild(unusedNode);
1014
1014
  }
@@ -1022,7 +1022,7 @@ function adoptNode(desc, ssrEl) {
1022
1022
  for (let i = 0; i < adoptedItems.length; i++) {
1023
1023
  const item = adoptedItems[i];
1024
1024
  const key = listKeyFn(item);
1025
- const [getIndex, setIndex] = chunkH7MDUHS5_cjs.createSignal(i);
1025
+ const [getIndex, setIndex] = chunkHAULTMNX_cjs.createSignal(i);
1026
1026
  cache.set(key, {
1027
1027
  element: adoptedNodes[i],
1028
1028
  item,
@@ -1032,7 +1032,7 @@ function adoptNode(desc, ssrEl) {
1032
1032
  }
1033
1033
  let reconcileNodes = adoptedNodes.slice();
1034
1034
  let reconcileItems = adoptedItems.slice();
1035
- chunkKUXNZ5MG_cjs.internalEffect(() => {
1035
+ chunkPAKPQRVE_cjs.internalEffect(() => {
1036
1036
  const newItems = child.items();
1037
1037
  const parent2 = start.parentNode;
1038
1038
  if (!parent2) return;
@@ -1047,8 +1047,8 @@ function adoptNode(desc, ssrEl) {
1047
1047
  hydrating = false;
1048
1048
  try {
1049
1049
  const key = listKeyFn(item);
1050
- const [getIndex, setIndex] = chunkH7MDUHS5_cjs.createSignal(0);
1051
- const element = chunkKUXNZ5MG_cjs.untrack(() => listRenderFn(item, getIndex));
1050
+ const [getIndex, setIndex] = chunkHAULTMNX_cjs.createSignal(0);
1051
+ const element = chunkPAKPQRVE_cjs.untrack(() => listRenderFn(item, getIndex));
1052
1052
  cache.set(key, { element, item, getIndex, setIndex });
1053
1053
  return element;
1054
1054
  } finally {
@@ -1097,12 +1097,12 @@ function adoptNode(desc, ssrEl) {
1097
1097
  const endMarker = findClosingMarker(cursor);
1098
1098
  let textNode = cursor.nextSibling;
1099
1099
  if (!textNode || textNode.nodeType !== 3) {
1100
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1100
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1101
1101
  const created = document.createTextNode("");
1102
1102
  cursor.parentNode.insertBefore(created, endMarker || cursor.nextSibling);
1103
1103
  textNode = created;
1104
1104
  }
1105
- chunkKUXNZ5MG_cjs.internalEffect(() => {
1105
+ chunkPAKPQRVE_cjs.internalEffect(() => {
1106
1106
  textNode.data = String(child());
1107
1107
  });
1108
1108
  cursor = endMarker ? endMarker.nextSibling : textNode.nextSibling;
@@ -1112,11 +1112,11 @@ function adoptNode(desc, ssrEl) {
1112
1112
  if (end) {
1113
1113
  let textNode = findTextBetween(start, end);
1114
1114
  if (!textNode) {
1115
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1115
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1116
1116
  textNode = document.createTextNode("");
1117
1117
  start.parentNode.insertBefore(textNode, end);
1118
1118
  }
1119
- chunkKUXNZ5MG_cjs.internalEffect(() => {
1119
+ chunkPAKPQRVE_cjs.internalEffect(() => {
1120
1120
  textNode.data = String(child());
1121
1121
  });
1122
1122
  cursor = end.nextSibling;
@@ -1129,14 +1129,14 @@ function adoptNode(desc, ssrEl) {
1129
1129
  } else if (cursor && cursor.nodeType === 3) {
1130
1130
  const textNode = cursor;
1131
1131
  cursor = cursor.nextSibling;
1132
- chunkKUXNZ5MG_cjs.internalEffect(() => {
1132
+ chunkPAKPQRVE_cjs.internalEffect(() => {
1133
1133
  textNode.data = String(child());
1134
1134
  });
1135
1135
  } else {
1136
- if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1136
+ if (chunkHAULTMNX_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1137
1137
  const textNode = document.createTextNode("");
1138
1138
  ssrEl.appendChild(textNode);
1139
- chunkKUXNZ5MG_cjs.internalEffect(() => {
1139
+ chunkPAKPQRVE_cjs.internalEffect(() => {
1140
1140
  textNode.data = String(child());
1141
1141
  });
1142
1142
  }
@@ -1150,7 +1150,7 @@ function adoptNode(desc, ssrEl) {
1150
1150
  function hydrateIsland(component, target) {
1151
1151
  const hasSSRContent = target.childElementCount > 0 || target.childNodes.length > 0 && Array.from(target.childNodes).some((n) => n.nodeType === 1 || n.nodeType === 3 && n.data.trim());
1152
1152
  if (!hasSSRContent) {
1153
- if (chunkH7MDUHS5_cjs.__DEV__) {
1153
+ if (chunkHAULTMNX_cjs.__DEV__) {
1154
1154
  const name = target.getAttribute("data-forma-component") || "unknown";
1155
1155
  console.warn(
1156
1156
  `[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.`
@@ -1470,14 +1470,14 @@ function createList(items, keyFn, renderFn, options) {
1470
1470
  let currentNodes = [];
1471
1471
  let currentItems = [];
1472
1472
  const updateOnItemChange = options?.updateOnItemChange ?? "none";
1473
- chunkKUXNZ5MG_cjs.internalEffect(() => {
1473
+ chunkPAKPQRVE_cjs.internalEffect(() => {
1474
1474
  const newItems = items();
1475
1475
  const parent = startMarker.parentNode;
1476
1476
  if (!parent) {
1477
1477
  return;
1478
1478
  }
1479
1479
  if (!Array.isArray(newItems)) {
1480
- if (chunkH7MDUHS5_cjs.__DEV__) {
1480
+ if (chunkHAULTMNX_cjs.__DEV__) {
1481
1481
  console.warn("[forma] createList: value is not an array, treating as empty");
1482
1482
  }
1483
1483
  for (const node of currentNodes) {
@@ -1495,7 +1495,7 @@ function createList(items, keyFn, renderFn, options) {
1495
1495
  break;
1496
1496
  }
1497
1497
  }
1498
- if (chunkH7MDUHS5_cjs.__DEV__) {
1498
+ if (chunkHAULTMNX_cjs.__DEV__) {
1499
1499
  const seen = /* @__PURE__ */ new Set();
1500
1500
  for (const item of cleanItems) {
1501
1501
  const key = keyFn(item);
@@ -1515,7 +1515,7 @@ function createList(items, keyFn, renderFn, options) {
1515
1515
  if (node[ABORT_SYM3] || node[CACHE_SYM2] || node[DYNAMIC_CHILD_SYM2]) {
1516
1516
  return;
1517
1517
  }
1518
- const next = chunkKUXNZ5MG_cjs.untrack(() => renderFn(item, cached.getIndex));
1518
+ const next = chunkPAKPQRVE_cjs.untrack(() => renderFn(item, cached.getIndex));
1519
1519
  if (canPatchStaticElement(node, next)) {
1520
1520
  patchStaticElement(node, next);
1521
1521
  cached.element = node;
@@ -1538,11 +1538,11 @@ function createList(items, keyFn, renderFn, options) {
1538
1538
  // disposed when the item is removed from the list.
1539
1539
  (item) => {
1540
1540
  const key = keyFn(item);
1541
- const [getIndex, setIndex] = chunkH7MDUHS5_cjs.createSignal(0);
1541
+ const [getIndex, setIndex] = chunkHAULTMNX_cjs.createSignal(0);
1542
1542
  let itemDispose;
1543
- const element = chunkKUXNZ5MG_cjs.createRoot((dispose) => {
1543
+ const element = chunkPAKPQRVE_cjs.createRoot((dispose) => {
1544
1544
  itemDispose = dispose;
1545
- return chunkKUXNZ5MG_cjs.untrack(() => renderFn(item, getIndex));
1545
+ return chunkPAKPQRVE_cjs.untrack(() => renderFn(item, getIndex));
1546
1546
  });
1547
1547
  cache.set(key, { element, item, getIndex, setIndex, dispose: itemDispose });
1548
1548
  return element;
@@ -1569,7 +1569,7 @@ function createList(items, keyFn, renderFn, options) {
1569
1569
  currentNodes = result.nodes;
1570
1570
  currentItems = result.items;
1571
1571
  });
1572
- chunkKUXNZ5MG_cjs.registerDisposer(() => {
1572
+ chunkPAKPQRVE_cjs.registerDisposer(() => {
1573
1573
  for (const cached of cache.values()) {
1574
1574
  cached.dispose();
1575
1575
  }
@@ -1589,5 +1589,5 @@ exports.h = h;
1589
1589
  exports.hydrateIsland = hydrateIsland;
1590
1590
  exports.reconcileList = reconcileList;
1591
1591
  exports.svg = svg;
1592
- //# sourceMappingURL=chunk-FBM7V4NE.cjs.map
1593
- //# sourceMappingURL=chunk-FBM7V4NE.cjs.map
1592
+ //# sourceMappingURL=chunk-D46EJ3VS.cjs.map
1593
+ //# sourceMappingURL=chunk-D46EJ3VS.cjs.map