@getforma/core 1.0.10 → 1.2.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 (55) hide show
  1. package/dist/{chunk-T33QUD2Y.cjs → chunk-E3FV2VSU.cjs} +43 -43
  2. package/dist/{chunk-T33QUD2Y.cjs.map → chunk-E3FV2VSU.cjs.map} +1 -1
  3. package/dist/chunk-ETPJTPYD.js +103 -0
  4. package/dist/chunk-ETPJTPYD.js.map +1 -0
  5. package/dist/chunk-H7MDUHS5.cjs +110 -0
  6. package/dist/chunk-H7MDUHS5.cjs.map +1 -0
  7. package/dist/{chunk-6FW5E54W.cjs → chunk-KUXNZ5MG.cjs} +127 -103
  8. package/dist/chunk-KUXNZ5MG.cjs.map +1 -0
  9. package/dist/{chunk-3G7ET4O5.js → chunk-Y3A2EVVS.js} +121 -94
  10. package/dist/chunk-Y3A2EVVS.js.map +1 -0
  11. package/dist/{chunk-AFRFF7XL.js → chunk-YRNYOZF3.js} +4 -4
  12. package/dist/{chunk-AFRFF7XL.js.map → chunk-YRNYOZF3.js.map} +1 -1
  13. package/dist/forma-runtime-csp.js +52 -4
  14. package/dist/forma-runtime.js +98 -10
  15. package/dist/formajs-runtime-hardened.global.js +52 -4
  16. package/dist/formajs-runtime-hardened.global.js.map +1 -1
  17. package/dist/formajs-runtime.global.js +98 -10
  18. package/dist/formajs-runtime.global.js.map +1 -1
  19. package/dist/formajs.global.js +368 -147
  20. package/dist/formajs.global.js.map +1 -1
  21. package/dist/http.cjs +11 -11
  22. package/dist/http.js +2 -2
  23. package/dist/index.cjs +262 -141
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +32 -27
  26. package/dist/index.d.ts +32 -27
  27. package/dist/index.js +204 -83
  28. package/dist/index.js.map +1 -1
  29. package/dist/{resource-DeEzxUz6.d.cts → resource-D6HfVgiA.d.cts} +7 -2
  30. package/dist/{resource-BHsgURy0.d.ts → resource-ljs2X5NM.d.ts} +7 -2
  31. package/dist/runtime-hardened.cjs +53 -3
  32. package/dist/runtime-hardened.cjs.map +1 -1
  33. package/dist/runtime-hardened.js +53 -3
  34. package/dist/runtime-hardened.js.map +1 -1
  35. package/dist/runtime.cjs +29 -29
  36. package/dist/runtime.js +3 -3
  37. package/dist/server.cjs +7 -7
  38. package/dist/server.d.cts +2 -2
  39. package/dist/server.d.ts +2 -2
  40. package/dist/server.js +2 -2
  41. package/dist/{signal-C9v4akyJ.d.cts → signal-CRBJYQ6B.d.cts} +0 -8
  42. package/dist/{signal-C9v4akyJ.d.ts → signal-CRBJYQ6B.d.ts} +0 -8
  43. package/dist/tc39-compat.cjs +3 -6
  44. package/dist/tc39-compat.cjs.map +1 -1
  45. package/dist/tc39-compat.d.cts +1 -1
  46. package/dist/tc39-compat.d.ts +1 -1
  47. package/dist/tc39-compat.js +1 -4
  48. package/dist/tc39-compat.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-3G7ET4O5.js.map +0 -1
  51. package/dist/chunk-6FW5E54W.cjs.map +0 -1
  52. package/dist/chunk-HLM5BZZQ.js +0 -35
  53. package/dist/chunk-HLM5BZZQ.js.map +0 -1
  54. package/dist/chunk-QLPCVK7C.cjs +0 -38
  55. package/dist/chunk-QLPCVK7C.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk6FW5E54W_cjs = require('./chunk-6FW5E54W.cjs');
4
- var chunkQLPCVK7C_cjs = require('./chunk-QLPCVK7C.cjs');
3
+ var chunkKUXNZ5MG_cjs = require('./chunk-KUXNZ5MG.cjs');
4
+ var chunkH7MDUHS5_cjs = require('./chunk-H7MDUHS5.cjs');
5
5
 
6
6
  // src/dom/element.ts
7
7
  var Fragment = /* @__PURE__ */ Symbol.for("forma.fragment");
@@ -156,7 +156,7 @@ function getCache(el) {
156
156
  }
157
157
  function handleClass(el, _key, value) {
158
158
  if (typeof value === "function") {
159
- chunk6FW5E54W_cjs.internalEffect(() => {
159
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
160
160
  const v = value();
161
161
  const cache = getCache(el);
162
162
  if (cache["class"] === v) return;
@@ -206,7 +206,7 @@ function applyStyleObj(el, obj, prevKeys) {
206
206
  function handleStyle(el, _key, value) {
207
207
  if (typeof value === "function") {
208
208
  let prevKeys = [];
209
- chunk6FW5E54W_cjs.internalEffect(() => {
209
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
210
210
  const v = value();
211
211
  if (typeof v === "string") {
212
212
  const cache = getCache(el);
@@ -236,7 +236,7 @@ function handleEvent(el, key, value) {
236
236
  }
237
237
  function handleInnerHTML(el, _key, value) {
238
238
  if (typeof value === "function") {
239
- chunk6FW5E54W_cjs.internalEffect(() => {
239
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
240
240
  const resolved = value();
241
241
  if (resolved == null) {
242
242
  el.innerHTML = "";
@@ -280,7 +280,7 @@ function handleInnerHTML(el, _key, value) {
280
280
  function handleXLink(el, key, value) {
281
281
  const localName = key.slice(6);
282
282
  if (typeof value === "function") {
283
- chunk6FW5E54W_cjs.internalEffect(() => {
283
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
284
284
  const v = value();
285
285
  if (v == null || v === false) {
286
286
  el.removeAttributeNS(XLINK_NS, localName);
@@ -298,7 +298,7 @@ function handleXLink(el, key, value) {
298
298
  }
299
299
  function handleBooleanAttr(el, key, value) {
300
300
  if (typeof value === "function") {
301
- chunk6FW5E54W_cjs.internalEffect(() => {
301
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
302
302
  const v = value();
303
303
  const cache = getCache(el);
304
304
  if (cache[key] === v) return;
@@ -322,7 +322,7 @@ function handleBooleanAttr(el, key, value) {
322
322
  }
323
323
  function handleGenericAttr(el, key, value) {
324
324
  if (typeof value === "function") {
325
- chunk6FW5E54W_cjs.internalEffect(() => {
325
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
326
326
  const v = value();
327
327
  if (v == null || v === false) {
328
328
  const cache = getCache(el);
@@ -465,7 +465,7 @@ function appendChild(parent, child) {
465
465
  }
466
466
  currentNode = null;
467
467
  };
468
- chunk6FW5E54W_cjs.internalEffect(() => {
468
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
469
469
  const v = child();
470
470
  let resolved = v;
471
471
  if (Array.isArray(v)) {
@@ -615,7 +615,7 @@ function createShow(when, thenFn, elseFn = () => null) {
615
615
  let currentNode = null;
616
616
  let lastTruthy = null;
617
617
  let currentDispose = null;
618
- const showDispose = chunk6FW5E54W_cjs.internalEffect(() => {
618
+ const showDispose = chunkKUXNZ5MG_cjs.internalEffect(() => {
619
619
  const truthy = !!when();
620
620
  const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
621
621
  const DEBUG_LABEL = DEBUG ? thenFn.toString().slice(0, 60) : "";
@@ -647,9 +647,9 @@ function createShow(when, thenFn, elseFn = () => null) {
647
647
  const branchFn = truthy ? thenFn : elseFn;
648
648
  if (branchFn) {
649
649
  let branchDispose;
650
- currentNode = chunk6FW5E54W_cjs.createRoot((dispose) => {
650
+ currentNode = chunkKUXNZ5MG_cjs.createRoot((dispose) => {
651
651
  branchDispose = dispose;
652
- return chunk6FW5E54W_cjs.untrack(() => branchFn());
652
+ return chunkKUXNZ5MG_cjs.untrack(() => branchFn());
653
653
  });
654
654
  currentDispose = branchDispose;
655
655
  } else {
@@ -659,7 +659,7 @@ function createShow(when, thenFn, elseFn = () => null) {
659
659
  parent.insertBefore(currentNode, endMarker);
660
660
  }
661
661
  });
662
- chunk6FW5E54W_cjs.registerDisposer(() => {
662
+ chunkKUXNZ5MG_cjs.registerDisposer(() => {
663
663
  if (currentDispose) {
664
664
  currentDispose();
665
665
  currentDispose = null;
@@ -707,7 +707,7 @@ function applyDynamicProps(el, props) {
707
707
  }
708
708
  const fn = value;
709
709
  const attrKey = key;
710
- chunk6FW5E54W_cjs.internalEffect(() => {
710
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
711
711
  const v = fn();
712
712
  if (v === false || v == null) {
713
713
  el.removeAttribute(attrKey);
@@ -819,13 +819,13 @@ function setupShowEffect(desc, marker) {
819
819
  let elseFragment = null;
820
820
  const hasSSRContent = marker.start.nextSibling !== marker.end;
821
821
  if (!hasSSRContent && currentCondition) {
822
- if (chunk6FW5E54W_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
822
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
823
823
  const trueBranch = desc.whenTrue();
824
824
  if (trueBranch instanceof Node) {
825
825
  marker.start.parentNode.insertBefore(trueBranch, marker.end);
826
826
  }
827
827
  }
828
- chunk6FW5E54W_cjs.internalEffect(() => {
828
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
829
829
  const next = !!desc.condition();
830
830
  if (next === currentCondition) return;
831
831
  currentCondition = next;
@@ -872,7 +872,7 @@ function adoptBranchContent(desc, regionStart, regionEnd) {
872
872
  }
873
873
  function adoptNode(desc, ssrEl) {
874
874
  if (!ssrEl || ssrEl.tagName !== desc.tag.toUpperCase()) {
875
- if (chunk6FW5E54W_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
875
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
876
876
  const fresh = descriptorToElement(desc);
877
877
  if (ssrEl) ssrEl.replaceWith(fresh);
878
878
  return;
@@ -946,7 +946,7 @@ function adoptNode(desc, ssrEl) {
946
946
  }
947
947
  node = node.nextSibling;
948
948
  }
949
- const currentItems = chunk6FW5E54W_cjs.untrack(() => child.items());
949
+ const currentItems = chunkKUXNZ5MG_cjs.untrack(() => child.items());
950
950
  const listKeyFn = child.keyFn;
951
951
  const listRenderFn = child.renderFn;
952
952
  const useIndexFallback = ssrKeyMap.size === 0 && ssrElements.length > 0;
@@ -970,11 +970,11 @@ function adoptNode(desc, ssrEl) {
970
970
  adoptedNodes.push(ssrNode);
971
971
  adoptedItems.push(item);
972
972
  } else {
973
- if (chunk6FW5E54W_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
973
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
974
974
  const prevHydrating = hydrating;
975
975
  hydrating = false;
976
976
  try {
977
- const [getIndex] = chunkQLPCVK7C_cjs.createSignal(i);
977
+ const [getIndex] = chunkH7MDUHS5_cjs.createSignal(i);
978
978
  const fresh = listRenderFn(item, getIndex);
979
979
  end.parentNode.insertBefore(fresh, end);
980
980
  adoptedNodes.push(fresh);
@@ -992,7 +992,7 @@ function adoptNode(desc, ssrEl) {
992
992
  }
993
993
  } else {
994
994
  for (const [unusedKey, unusedNode] of ssrKeyMap) {
995
- if (chunk6FW5E54W_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
995
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
996
996
  if (unusedNode.parentNode) {
997
997
  unusedNode.parentNode.removeChild(unusedNode);
998
998
  }
@@ -1006,7 +1006,7 @@ function adoptNode(desc, ssrEl) {
1006
1006
  for (let i = 0; i < adoptedItems.length; i++) {
1007
1007
  const item = adoptedItems[i];
1008
1008
  const key = listKeyFn(item);
1009
- const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(i);
1009
+ const [getIndex, setIndex] = chunkH7MDUHS5_cjs.createSignal(i);
1010
1010
  cache.set(key, {
1011
1011
  element: adoptedNodes[i],
1012
1012
  item,
@@ -1016,7 +1016,7 @@ function adoptNode(desc, ssrEl) {
1016
1016
  }
1017
1017
  let reconcileNodes = adoptedNodes.slice();
1018
1018
  let reconcileItems = adoptedItems.slice();
1019
- chunk6FW5E54W_cjs.internalEffect(() => {
1019
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
1020
1020
  const newItems = child.items();
1021
1021
  const parent2 = start.parentNode;
1022
1022
  if (!parent2) return;
@@ -1031,8 +1031,8 @@ function adoptNode(desc, ssrEl) {
1031
1031
  hydrating = false;
1032
1032
  try {
1033
1033
  const key = listKeyFn(item);
1034
- const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(0);
1035
- const element = chunk6FW5E54W_cjs.untrack(() => listRenderFn(item, getIndex));
1034
+ const [getIndex, setIndex] = chunkH7MDUHS5_cjs.createSignal(0);
1035
+ const element = chunkKUXNZ5MG_cjs.untrack(() => listRenderFn(item, getIndex));
1036
1036
  cache.set(key, { element, item, getIndex, setIndex });
1037
1037
  return element;
1038
1038
  } finally {
@@ -1081,12 +1081,12 @@ function adoptNode(desc, ssrEl) {
1081
1081
  const endMarker = findClosingMarker(cursor);
1082
1082
  let textNode = cursor.nextSibling;
1083
1083
  if (!textNode || textNode.nodeType !== 3) {
1084
- if (chunk6FW5E54W_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1084
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1085
1085
  const created = document.createTextNode("");
1086
1086
  cursor.parentNode.insertBefore(created, endMarker || cursor.nextSibling);
1087
1087
  textNode = created;
1088
1088
  }
1089
- chunk6FW5E54W_cjs.internalEffect(() => {
1089
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
1090
1090
  textNode.data = String(child());
1091
1091
  });
1092
1092
  cursor = endMarker ? endMarker.nextSibling : textNode.nextSibling;
@@ -1096,11 +1096,11 @@ function adoptNode(desc, ssrEl) {
1096
1096
  if (end) {
1097
1097
  let textNode = findTextBetween(start, end);
1098
1098
  if (!textNode) {
1099
- if (chunk6FW5E54W_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1099
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1100
1100
  textNode = document.createTextNode("");
1101
1101
  start.parentNode.insertBefore(textNode, end);
1102
1102
  }
1103
- chunk6FW5E54W_cjs.internalEffect(() => {
1103
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
1104
1104
  textNode.data = String(child());
1105
1105
  });
1106
1106
  cursor = end.nextSibling;
@@ -1113,14 +1113,14 @@ function adoptNode(desc, ssrEl) {
1113
1113
  } else if (cursor && cursor.nodeType === 3) {
1114
1114
  const textNode = cursor;
1115
1115
  cursor = cursor.nextSibling;
1116
- chunk6FW5E54W_cjs.internalEffect(() => {
1116
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
1117
1117
  textNode.data = String(child());
1118
1118
  });
1119
1119
  } else {
1120
- if (chunk6FW5E54W_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1120
+ if (chunkH7MDUHS5_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1121
1121
  const textNode = document.createTextNode("");
1122
1122
  ssrEl.appendChild(textNode);
1123
- chunk6FW5E54W_cjs.internalEffect(() => {
1123
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
1124
1124
  textNode.data = String(child());
1125
1125
  });
1126
1126
  }
@@ -1134,7 +1134,7 @@ function adoptNode(desc, ssrEl) {
1134
1134
  function hydrateIsland(component, target) {
1135
1135
  const hasSSRContent = target.childElementCount > 0 || target.childNodes.length > 0 && Array.from(target.childNodes).some((n) => n.nodeType === 1 || n.nodeType === 3 && n.data.trim());
1136
1136
  if (!hasSSRContent) {
1137
- if (chunk6FW5E54W_cjs.__DEV__) {
1137
+ if (chunkH7MDUHS5_cjs.__DEV__) {
1138
1138
  const name = target.getAttribute("data-forma-component") || "unknown";
1139
1139
  console.warn(
1140
1140
  `[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.`
@@ -1450,14 +1450,14 @@ function createList(items, keyFn, renderFn, options) {
1450
1450
  let currentNodes = [];
1451
1451
  let currentItems = [];
1452
1452
  const updateOnItemChange = options?.updateOnItemChange ?? "none";
1453
- chunk6FW5E54W_cjs.internalEffect(() => {
1453
+ chunkKUXNZ5MG_cjs.internalEffect(() => {
1454
1454
  const newItems = items();
1455
1455
  const parent = startMarker.parentNode;
1456
1456
  if (!parent) {
1457
1457
  return;
1458
1458
  }
1459
1459
  if (!Array.isArray(newItems)) {
1460
- if (chunk6FW5E54W_cjs.__DEV__) {
1460
+ if (chunkH7MDUHS5_cjs.__DEV__) {
1461
1461
  console.warn("[forma] createList: value is not an array, treating as empty");
1462
1462
  }
1463
1463
  for (const node of currentNodes) {
@@ -1475,7 +1475,7 @@ function createList(items, keyFn, renderFn, options) {
1475
1475
  break;
1476
1476
  }
1477
1477
  }
1478
- if (chunk6FW5E54W_cjs.__DEV__) {
1478
+ if (chunkH7MDUHS5_cjs.__DEV__) {
1479
1479
  const seen = /* @__PURE__ */ new Set();
1480
1480
  for (const item of cleanItems) {
1481
1481
  const key = keyFn(item);
@@ -1495,7 +1495,7 @@ function createList(items, keyFn, renderFn, options) {
1495
1495
  if (node[ABORT_SYM3] || node[CACHE_SYM2] || node[DYNAMIC_CHILD_SYM2]) {
1496
1496
  return;
1497
1497
  }
1498
- const next = chunk6FW5E54W_cjs.untrack(() => renderFn(item, cached.getIndex));
1498
+ const next = chunkKUXNZ5MG_cjs.untrack(() => renderFn(item, cached.getIndex));
1499
1499
  if (canPatchStaticElement(node, next)) {
1500
1500
  patchStaticElement(node, next);
1501
1501
  cached.element = node;
@@ -1518,11 +1518,11 @@ function createList(items, keyFn, renderFn, options) {
1518
1518
  // disposed when the item is removed from the list.
1519
1519
  (item) => {
1520
1520
  const key = keyFn(item);
1521
- const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(0);
1521
+ const [getIndex, setIndex] = chunkH7MDUHS5_cjs.createSignal(0);
1522
1522
  let itemDispose;
1523
- const element = chunk6FW5E54W_cjs.createRoot((dispose) => {
1523
+ const element = chunkKUXNZ5MG_cjs.createRoot((dispose) => {
1524
1524
  itemDispose = dispose;
1525
- return chunk6FW5E54W_cjs.untrack(() => renderFn(item, getIndex));
1525
+ return chunkKUXNZ5MG_cjs.untrack(() => renderFn(item, getIndex));
1526
1526
  });
1527
1527
  cache.set(key, { element, item, getIndex, setIndex, dispose: itemDispose });
1528
1528
  return element;
@@ -1549,7 +1549,7 @@ function createList(items, keyFn, renderFn, options) {
1549
1549
  currentNodes = result.nodes;
1550
1550
  currentItems = result.items;
1551
1551
  });
1552
- chunk6FW5E54W_cjs.registerDisposer(() => {
1552
+ chunkKUXNZ5MG_cjs.registerDisposer(() => {
1553
1553
  for (const cached of cache.values()) {
1554
1554
  cached.dispose();
1555
1555
  }
@@ -1568,5 +1568,5 @@ exports.fragment = fragment;
1568
1568
  exports.h = h;
1569
1569
  exports.hydrateIsland = hydrateIsland;
1570
1570
  exports.reconcileList = reconcileList;
1571
- //# sourceMappingURL=chunk-T33QUD2Y.cjs.map
1572
- //# sourceMappingURL=chunk-T33QUD2Y.cjs.map
1571
+ //# sourceMappingURL=chunk-E3FV2VSU.cjs.map
1572
+ //# sourceMappingURL=chunk-E3FV2VSU.cjs.map