@getforma/core 1.0.7 → 1.0.8

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 (48) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-SZSKW57A.cjs → chunk-7L3KHGEA.cjs} +42 -42
  3. package/dist/chunk-7L3KHGEA.cjs.map +1 -0
  4. package/dist/{chunk-FJGTMWKY.js → chunk-7Q7LIV23.js} +6 -6
  5. package/dist/chunk-7Q7LIV23.js.map +1 -0
  6. package/dist/{chunk-DCTOXHPF.cjs → chunk-BARF67I6.cjs} +8 -8
  7. package/dist/chunk-BARF67I6.cjs.map +1 -0
  8. package/dist/{chunk-OZCHIVAZ.js → chunk-HLM5BZZQ.js} +2 -2
  9. package/dist/chunk-HLM5BZZQ.js.map +1 -0
  10. package/dist/{chunk-3U57L2TY.cjs → chunk-QLPCVK7C.cjs} +2 -2
  11. package/dist/chunk-QLPCVK7C.cjs.map +1 -0
  12. package/dist/{chunk-OUVOAYIO.js → chunk-TBWZZ3SI.js} +3 -3
  13. package/dist/chunk-TBWZZ3SI.js.map +1 -0
  14. package/dist/formajs-runtime-hardened.global.js.map +1 -1
  15. package/dist/formajs-runtime.global.js.map +1 -1
  16. package/dist/formajs.global.js +2 -2
  17. package/dist/formajs.global.js.map +1 -1
  18. package/dist/http.cjs +11 -11
  19. package/dist/http.js +2 -2
  20. package/dist/index.cjs +61 -61
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +141 -10
  23. package/dist/index.d.ts +141 -10
  24. package/dist/index.js +6 -6
  25. package/dist/index.js.map +1 -1
  26. package/dist/{resource-Cd0cGOxS.d.ts → resource-BHsgURy0.d.ts} +3 -1
  27. package/dist/{resource-DK98lW5e.d.cts → resource-DeEzxUz6.d.cts} +3 -1
  28. package/dist/runtime-hardened.cjs.map +1 -1
  29. package/dist/runtime-hardened.js.map +1 -1
  30. package/dist/runtime.cjs +29 -29
  31. package/dist/runtime.js +3 -3
  32. package/dist/server.cjs +7 -7
  33. package/dist/server.d.cts +2 -2
  34. package/dist/server.d.ts +2 -2
  35. package/dist/server.js +2 -2
  36. package/dist/{signal-YlS1kgfh.d.cts → signal-C9v4akyJ.d.cts} +2 -0
  37. package/dist/{signal-YlS1kgfh.d.ts → signal-C9v4akyJ.d.ts} +2 -0
  38. package/dist/tc39-compat.cjs +3 -3
  39. package/dist/tc39-compat.d.cts +1 -1
  40. package/dist/tc39-compat.d.ts +1 -1
  41. package/dist/tc39-compat.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-3U57L2TY.cjs.map +0 -1
  44. package/dist/chunk-DCTOXHPF.cjs.map +0 -1
  45. package/dist/chunk-FJGTMWKY.js.map +0 -1
  46. package/dist/chunk-OUVOAYIO.js.map +0 -1
  47. package/dist/chunk-OZCHIVAZ.js.map +0 -1
  48. package/dist/chunk-SZSKW57A.cjs.map +0 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ Or use a CDN — no build step, no bundler:
43
43
  <script src="https://unpkg.com/@getforma/core/dist/formajs-runtime.global.js"></script>
44
44
  ```
45
45
 
46
- > **Production:** Pin the version (e.g., `@getforma/core@1.0.1`) instead of `@latest`.
46
+ > **Production:** Pin the version (e.g., `@getforma/core@1.0.7`) instead of `@latest`.
47
47
 
48
48
  ---
49
49
 
@@ -701,17 +701,17 @@ deactivateIsland(islandElement);
701
701
 
702
702
  ```html
703
703
  <!-- jsDelivr (recommended) -->
704
- <script src="https://cdn.jsdelivr.net/npm/@getforma/core@1.0.1/dist/formajs-runtime.global.js"></script>
704
+ <script src="https://cdn.jsdelivr.net/npm/@getforma/core@1.0.7/dist/formajs-runtime.global.js"></script>
705
705
 
706
706
  <!-- unpkg -->
707
- <script src="https://unpkg.com/@getforma/core@1.0.1/dist/formajs-runtime.global.js"></script>
707
+ <script src="https://unpkg.com/@getforma/core@1.0.7/dist/formajs-runtime.global.js"></script>
708
708
  ```
709
709
 
710
710
  ### ESM import (modern browsers, no bundler)
711
711
 
712
712
  ```html
713
713
  <script type="module">
714
- import { createSignal, h, mount } from "https://cdn.jsdelivr.net/npm/@getforma/core@1.0.1/dist/index.js";
714
+ import { createSignal, h, mount } from "https://cdn.jsdelivr.net/npm/@getforma/core@1.0.7/dist/index.js";
715
715
 
716
716
  const [count, setCount] = createSignal(0);
717
717
  mount(() => h("button", { onClick: () => setCount((c) => c + 1) }, () => `${count()}`), "#app");
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkDCTOXHPF_cjs = require('./chunk-DCTOXHPF.cjs');
4
- var chunk3U57L2TY_cjs = require('./chunk-3U57L2TY.cjs');
3
+ var chunkBARF67I6_cjs = require('./chunk-BARF67I6.cjs');
4
+ var chunkQLPCVK7C_cjs = require('./chunk-QLPCVK7C.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
- chunkDCTOXHPF_cjs.internalEffect(() => {
159
+ chunkBARF67I6_cjs.internalEffect(() => {
160
160
  const v = value();
161
161
  const cache = getCache(el);
162
162
  if (cache["class"] === v) return;
@@ -181,7 +181,7 @@ function handleClass(el, _key, value) {
181
181
  function handleStyle(el, _key, value) {
182
182
  if (typeof value === "function") {
183
183
  let prevKeys = [];
184
- chunkDCTOXHPF_cjs.internalEffect(() => {
184
+ chunkBARF67I6_cjs.internalEffect(() => {
185
185
  const v = value();
186
186
  if (typeof v === "string") {
187
187
  const cache = getCache(el);
@@ -220,7 +220,7 @@ function handleEvent(el, key, value) {
220
220
  }
221
221
  function handleInnerHTML(el, _key, value) {
222
222
  if (typeof value === "function") {
223
- chunkDCTOXHPF_cjs.internalEffect(() => {
223
+ chunkBARF67I6_cjs.internalEffect(() => {
224
224
  const resolved = value();
225
225
  if (resolved == null) {
226
226
  el.innerHTML = "";
@@ -264,7 +264,7 @@ function handleInnerHTML(el, _key, value) {
264
264
  function handleXLink(el, key, value) {
265
265
  const localName = key.slice(6);
266
266
  if (typeof value === "function") {
267
- chunkDCTOXHPF_cjs.internalEffect(() => {
267
+ chunkBARF67I6_cjs.internalEffect(() => {
268
268
  const v = value();
269
269
  if (v == null || v === false) {
270
270
  el.removeAttributeNS(XLINK_NS, localName);
@@ -282,7 +282,7 @@ function handleXLink(el, key, value) {
282
282
  }
283
283
  function handleBooleanAttr(el, key, value) {
284
284
  if (typeof value === "function") {
285
- chunkDCTOXHPF_cjs.internalEffect(() => {
285
+ chunkBARF67I6_cjs.internalEffect(() => {
286
286
  const v = value();
287
287
  const cache = getCache(el);
288
288
  if (cache[key] === v) return;
@@ -306,7 +306,7 @@ function handleBooleanAttr(el, key, value) {
306
306
  }
307
307
  function handleGenericAttr(el, key, value) {
308
308
  if (typeof value === "function") {
309
- chunkDCTOXHPF_cjs.internalEffect(() => {
309
+ chunkBARF67I6_cjs.internalEffect(() => {
310
310
  const v = value();
311
311
  if (v == null || v === false) {
312
312
  const cache = getCache(el);
@@ -449,7 +449,7 @@ function appendChild(parent, child) {
449
449
  }
450
450
  currentNode = null;
451
451
  };
452
- chunkDCTOXHPF_cjs.internalEffect(() => {
452
+ chunkBARF67I6_cjs.internalEffect(() => {
453
453
  const v = child();
454
454
  let resolved = v;
455
455
  if (Array.isArray(v)) {
@@ -580,9 +580,9 @@ function fragment(...children) {
580
580
  }
581
581
 
582
582
  // src/dom/show.ts
583
- function createShow(when, thenFn, elseFn) {
583
+ function createShow(when, thenFn, elseFn = () => null) {
584
584
  if (hydrating) {
585
- const branch = when() ? thenFn() : elseFn?.() ?? null;
585
+ const branch = when() ? thenFn() : elseFn();
586
586
  return {
587
587
  type: "show",
588
588
  condition: when,
@@ -599,7 +599,7 @@ function createShow(when, thenFn, elseFn) {
599
599
  let currentNode = null;
600
600
  let lastTruthy = null;
601
601
  let currentDispose = null;
602
- const showDispose = chunkDCTOXHPF_cjs.internalEffect(() => {
602
+ const showDispose = chunkBARF67I6_cjs.internalEffect(() => {
603
603
  const truthy = !!when();
604
604
  const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
605
605
  const DEBUG_LABEL = DEBUG ? thenFn.toString().slice(0, 60) : "";
@@ -631,9 +631,9 @@ function createShow(when, thenFn, elseFn) {
631
631
  const branchFn = truthy ? thenFn : elseFn;
632
632
  if (branchFn) {
633
633
  let branchDispose;
634
- currentNode = chunkDCTOXHPF_cjs.createRoot((dispose) => {
634
+ currentNode = chunkBARF67I6_cjs.createRoot((dispose) => {
635
635
  branchDispose = dispose;
636
- return chunkDCTOXHPF_cjs.untrack(() => branchFn());
636
+ return chunkBARF67I6_cjs.untrack(() => branchFn());
637
637
  });
638
638
  currentDispose = branchDispose;
639
639
  } else {
@@ -684,7 +684,7 @@ function applyDynamicProps(el, props) {
684
684
  }
685
685
  const fn = value;
686
686
  const attrKey = key;
687
- chunkDCTOXHPF_cjs.internalEffect(() => {
687
+ chunkBARF67I6_cjs.internalEffect(() => {
688
688
  const v = fn();
689
689
  if (v === false || v == null) {
690
690
  el.removeAttribute(attrKey);
@@ -796,13 +796,13 @@ function setupShowEffect(desc, marker) {
796
796
  let elseFragment = null;
797
797
  const hasSSRContent = marker.start.nextSibling !== marker.end;
798
798
  if (!hasSSRContent && currentCondition) {
799
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
799
+ if (chunkBARF67I6_cjs.__DEV__) console.warn("[forma] Hydration: show condition mismatch \u2014 SSR empty but client condition is true");
800
800
  const trueBranch = desc.whenTrue();
801
801
  if (trueBranch instanceof Node) {
802
802
  marker.start.parentNode.insertBefore(trueBranch, marker.end);
803
803
  }
804
804
  }
805
- chunkDCTOXHPF_cjs.internalEffect(() => {
805
+ chunkBARF67I6_cjs.internalEffect(() => {
806
806
  const next = !!desc.condition();
807
807
  if (next === currentCondition) return;
808
808
  currentCondition = next;
@@ -849,7 +849,7 @@ function adoptBranchContent(desc, regionStart, regionEnd) {
849
849
  }
850
850
  function adoptNode(desc, ssrEl) {
851
851
  if (!ssrEl || ssrEl.tagName !== desc.tag.toUpperCase()) {
852
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
852
+ if (chunkBARF67I6_cjs.__DEV__) console.warn(`Hydration mismatch: expected <${desc.tag}>, got <${ssrEl?.tagName?.toLowerCase() ?? "nothing"}>`);
853
853
  const fresh = descriptorToElement(desc);
854
854
  if (ssrEl) ssrEl.replaceWith(fresh);
855
855
  return;
@@ -923,7 +923,7 @@ function adoptNode(desc, ssrEl) {
923
923
  }
924
924
  node = node.nextSibling;
925
925
  }
926
- const currentItems = chunkDCTOXHPF_cjs.untrack(() => child.items());
926
+ const currentItems = chunkBARF67I6_cjs.untrack(() => child.items());
927
927
  const listKeyFn = child.keyFn;
928
928
  const listRenderFn = child.renderFn;
929
929
  const useIndexFallback = ssrKeyMap.size === 0 && ssrElements.length > 0;
@@ -947,11 +947,11 @@ function adoptNode(desc, ssrEl) {
947
947
  adoptedNodes.push(ssrNode);
948
948
  adoptedItems.push(item);
949
949
  } else {
950
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
950
+ if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: list item key "${key}" not found in SSR \u2014 rendering fresh`);
951
951
  const prevHydrating = hydrating;
952
952
  hydrating = false;
953
953
  try {
954
- const [getIndex] = chunk3U57L2TY_cjs.createSignal(i);
954
+ const [getIndex] = chunkQLPCVK7C_cjs.createSignal(i);
955
955
  const fresh = listRenderFn(item, getIndex);
956
956
  end.parentNode.insertBefore(fresh, end);
957
957
  adoptedNodes.push(fresh);
@@ -969,7 +969,7 @@ function adoptNode(desc, ssrEl) {
969
969
  }
970
970
  } else {
971
971
  for (const [unusedKey, unusedNode] of ssrKeyMap) {
972
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
972
+ if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: removing extra SSR list item with key "${unusedKey}"`);
973
973
  if (unusedNode.parentNode) {
974
974
  unusedNode.parentNode.removeChild(unusedNode);
975
975
  }
@@ -983,7 +983,7 @@ function adoptNode(desc, ssrEl) {
983
983
  for (let i = 0; i < adoptedItems.length; i++) {
984
984
  const item = adoptedItems[i];
985
985
  const key = listKeyFn(item);
986
- const [getIndex, setIndex] = chunk3U57L2TY_cjs.createSignal(i);
986
+ const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(i);
987
987
  cache.set(key, {
988
988
  element: adoptedNodes[i],
989
989
  item,
@@ -993,7 +993,7 @@ function adoptNode(desc, ssrEl) {
993
993
  }
994
994
  let reconcileNodes = adoptedNodes.slice();
995
995
  let reconcileItems = adoptedItems.slice();
996
- chunkDCTOXHPF_cjs.internalEffect(() => {
996
+ chunkBARF67I6_cjs.internalEffect(() => {
997
997
  const newItems = child.items();
998
998
  const parent2 = start.parentNode;
999
999
  if (!parent2) return;
@@ -1008,8 +1008,8 @@ function adoptNode(desc, ssrEl) {
1008
1008
  hydrating = false;
1009
1009
  try {
1010
1010
  const key = listKeyFn(item);
1011
- const [getIndex, setIndex] = chunk3U57L2TY_cjs.createSignal(0);
1012
- const element = chunkDCTOXHPF_cjs.untrack(() => listRenderFn(item, getIndex));
1011
+ const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(0);
1012
+ const element = chunkBARF67I6_cjs.untrack(() => listRenderFn(item, getIndex));
1013
1013
  cache.set(key, { element, item, getIndex, setIndex });
1014
1014
  return element;
1015
1015
  } finally {
@@ -1058,12 +1058,12 @@ function adoptNode(desc, ssrEl) {
1058
1058
  const endMarker = findClosingMarker(cursor);
1059
1059
  let textNode = cursor.nextSibling;
1060
1060
  if (!textNode || textNode.nodeType !== 3) {
1061
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1061
+ if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for marker ${data} \u2014 SSR walker should emit content between markers`);
1062
1062
  const created = document.createTextNode("");
1063
1063
  cursor.parentNode.insertBefore(created, endMarker || cursor.nextSibling);
1064
1064
  textNode = created;
1065
1065
  }
1066
- chunkDCTOXHPF_cjs.internalEffect(() => {
1066
+ chunkBARF67I6_cjs.internalEffect(() => {
1067
1067
  textNode.data = String(child());
1068
1068
  });
1069
1069
  cursor = endMarker ? endMarker.nextSibling : textNode.nextSibling;
@@ -1073,11 +1073,11 @@ function adoptNode(desc, ssrEl) {
1073
1073
  if (end) {
1074
1074
  let textNode = findTextBetween(start, end);
1075
1075
  if (!textNode) {
1076
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1076
+ if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node for show marker ${start.data} \u2014 SSR walker should emit content between markers`);
1077
1077
  textNode = document.createTextNode("");
1078
1078
  start.parentNode.insertBefore(textNode, end);
1079
1079
  }
1080
- chunkDCTOXHPF_cjs.internalEffect(() => {
1080
+ chunkBARF67I6_cjs.internalEffect(() => {
1081
1081
  textNode.data = String(child());
1082
1082
  });
1083
1083
  cursor = end.nextSibling;
@@ -1090,14 +1090,14 @@ function adoptNode(desc, ssrEl) {
1090
1090
  } else if (cursor && cursor.nodeType === 3) {
1091
1091
  const textNode = cursor;
1092
1092
  cursor = cursor.nextSibling;
1093
- chunkDCTOXHPF_cjs.internalEffect(() => {
1093
+ chunkBARF67I6_cjs.internalEffect(() => {
1094
1094
  textNode.data = String(child());
1095
1095
  });
1096
1096
  } else {
1097
- if (chunkDCTOXHPF_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1097
+ if (chunkBARF67I6_cjs.__DEV__) console.warn(`[FormaJS] Hydration: created text node in empty <${ssrEl.tagName.toLowerCase()}> \u2014 IR may not cover this component`);
1098
1098
  const textNode = document.createTextNode("");
1099
1099
  ssrEl.appendChild(textNode);
1100
- chunkDCTOXHPF_cjs.internalEffect(() => {
1100
+ chunkBARF67I6_cjs.internalEffect(() => {
1101
1101
  textNode.data = String(child());
1102
1102
  });
1103
1103
  }
@@ -1111,7 +1111,7 @@ function adoptNode(desc, ssrEl) {
1111
1111
  function hydrateIsland(component, target) {
1112
1112
  const hasSSRContent = target.childElementCount > 0 || target.childNodes.length > 0 && Array.from(target.childNodes).some((n) => n.nodeType === 1 || n.nodeType === 3 && n.data.trim());
1113
1113
  if (!hasSSRContent) {
1114
- if (chunkDCTOXHPF_cjs.__DEV__) {
1114
+ if (chunkBARF67I6_cjs.__DEV__) {
1115
1115
  const name = target.getAttribute("data-forma-component") || "unknown";
1116
1116
  console.warn(
1117
1117
  `[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.`
@@ -1427,14 +1427,14 @@ function createList(items, keyFn, renderFn, options) {
1427
1427
  let currentNodes = [];
1428
1428
  let currentItems = [];
1429
1429
  const updateOnItemChange = options?.updateOnItemChange ?? "none";
1430
- chunkDCTOXHPF_cjs.internalEffect(() => {
1430
+ chunkBARF67I6_cjs.internalEffect(() => {
1431
1431
  const newItems = items();
1432
1432
  const parent = startMarker.parentNode;
1433
1433
  if (!parent) {
1434
1434
  return;
1435
1435
  }
1436
1436
  if (!Array.isArray(newItems)) {
1437
- if (chunkDCTOXHPF_cjs.__DEV__) {
1437
+ if (chunkBARF67I6_cjs.__DEV__) {
1438
1438
  console.warn("[forma] createList: value is not an array, treating as empty");
1439
1439
  }
1440
1440
  for (const node of currentNodes) {
@@ -1452,7 +1452,7 @@ function createList(items, keyFn, renderFn, options) {
1452
1452
  break;
1453
1453
  }
1454
1454
  }
1455
- if (chunkDCTOXHPF_cjs.__DEV__) {
1455
+ if (chunkBARF67I6_cjs.__DEV__) {
1456
1456
  const seen = /* @__PURE__ */ new Set();
1457
1457
  for (const item of cleanItems) {
1458
1458
  const key = keyFn(item);
@@ -1472,7 +1472,7 @@ function createList(items, keyFn, renderFn, options) {
1472
1472
  if (node[ABORT_SYM3] || node[CACHE_SYM2] || node[DYNAMIC_CHILD_SYM2]) {
1473
1473
  return;
1474
1474
  }
1475
- const next = chunkDCTOXHPF_cjs.untrack(() => renderFn(item, cached.getIndex));
1475
+ const next = chunkBARF67I6_cjs.untrack(() => renderFn(item, cached.getIndex));
1476
1476
  if (canPatchStaticElement(node, next)) {
1477
1477
  patchStaticElement(node, next);
1478
1478
  cached.element = node;
@@ -1491,8 +1491,8 @@ function createList(items, keyFn, renderFn, options) {
1491
1491
  // createFn: create element + cache entry
1492
1492
  (item) => {
1493
1493
  const key = keyFn(item);
1494
- const [getIndex, setIndex] = chunk3U57L2TY_cjs.createSignal(0);
1495
- const element = chunkDCTOXHPF_cjs.untrack(() => renderFn(item, getIndex));
1494
+ const [getIndex, setIndex] = chunkQLPCVK7C_cjs.createSignal(0);
1495
+ const element = chunkBARF67I6_cjs.untrack(() => renderFn(item, getIndex));
1496
1496
  cache.set(key, { element, item, getIndex, setIndex });
1497
1497
  return element;
1498
1498
  },
@@ -1524,5 +1524,5 @@ exports.fragment = fragment;
1524
1524
  exports.h = h;
1525
1525
  exports.hydrateIsland = hydrateIsland;
1526
1526
  exports.reconcileList = reconcileList;
1527
- //# sourceMappingURL=chunk-SZSKW57A.cjs.map
1528
- //# sourceMappingURL=chunk-SZSKW57A.cjs.map
1527
+ //# sourceMappingURL=chunk-7L3KHGEA.cjs.map
1528
+ //# sourceMappingURL=chunk-7L3KHGEA.cjs.map