@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/runtime.cjs CHANGED
@@ -1,6 +1,6 @@
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/reconcile.ts
@@ -967,7 +967,7 @@ function parseIfHandler(expr, scope) {
967
967
  }
968
968
  if (rest.length > 0) return null;
969
969
  return (e) => {
970
- chunkYMIMKO4W_cjs.batch(() => {
970
+ chunkGDULJFJO_cjs.batch(() => {
971
971
  if (condExpr()) thenHandler(e);
972
972
  else elseHandler?.(e);
973
973
  });
@@ -1716,7 +1716,7 @@ function parseHandler(expr, scope) {
1716
1716
  const handlers = stmts.map((s) => parseHandler(s, scope));
1717
1717
  if (handlers.every((h) => h !== null)) {
1718
1718
  return (e) => {
1719
- chunkYMIMKO4W_cjs.batch(() => {
1719
+ chunkGDULJFJO_cjs.batch(() => {
1720
1720
  for (const h of handlers) h(e);
1721
1721
  });
1722
1722
  };
@@ -1729,7 +1729,7 @@ function parseHandler(expr, scope) {
1729
1729
  const name = incrMatch[1];
1730
1730
  const op = incrMatch[2];
1731
1731
  return () => {
1732
- chunkYMIMKO4W_cjs.batch(() => {
1732
+ chunkGDULJFJO_cjs.batch(() => {
1733
1733
  const val = scope.getters[name]?.() ?? 0;
1734
1734
  scope.setters[name]?.(op === "++" ? val + 1 : val - 1);
1735
1735
  });
@@ -1740,7 +1740,7 @@ function parseHandler(expr, scope) {
1740
1740
  const op = preIncrMatch[1];
1741
1741
  const name = preIncrMatch[2];
1742
1742
  return () => {
1743
- chunkYMIMKO4W_cjs.batch(() => {
1743
+ chunkGDULJFJO_cjs.batch(() => {
1744
1744
  const val = scope.getters[name]?.() ?? 0;
1745
1745
  scope.setters[name]?.(op === "++" ? val + 1 : val - 1);
1746
1746
  });
@@ -1750,7 +1750,7 @@ function parseHandler(expr, scope) {
1750
1750
  if (toggleMatch && toggleMatch[1] === toggleMatch[2]) {
1751
1751
  const name = toggleMatch[1];
1752
1752
  return () => {
1753
- chunkYMIMKO4W_cjs.batch(() => {
1753
+ chunkGDULJFJO_cjs.batch(() => {
1754
1754
  scope.setters[name]?.(!scope.getters[name]?.());
1755
1755
  });
1756
1756
  };
@@ -1762,7 +1762,7 @@ function parseHandler(expr, scope) {
1762
1762
  if (valExpr) {
1763
1763
  if (_debug) dbg(`parseHandler: assignment "${name} = ..." \u2014 setter exists:`, !!scope.setters[name], ", getter exists:", !!scope.getters[name]);
1764
1764
  return () => {
1765
- chunkYMIMKO4W_cjs.batch(() => {
1765
+ chunkGDULJFJO_cjs.batch(() => {
1766
1766
  const val = valExpr();
1767
1767
  if (_debug) dbg(`SETTER: ${name} = ${val} (was: ${scope.getters[name]?.()})`);
1768
1768
  scope.setters[name]?.(val);
@@ -1777,7 +1777,7 @@ function parseHandler(expr, scope) {
1777
1777
  const valExpr = parseExpression(compoundMatch[3].trim(), scope);
1778
1778
  if (valExpr) {
1779
1779
  return () => {
1780
- chunkYMIMKO4W_cjs.batch(() => {
1780
+ chunkGDULJFJO_cjs.batch(() => {
1781
1781
  const current = scope.getters[name]?.() ?? 0;
1782
1782
  const val = valExpr();
1783
1783
  switch (op) {
@@ -1858,7 +1858,7 @@ function buildHandler(expr, scope) {
1858
1858
  }
1859
1859
  });
1860
1860
  const unsafeHandler = (e) => {
1861
- chunkYMIMKO4W_cjs.batch(() => fn(proxy, e, e));
1861
+ chunkGDULJFJO_cjs.batch(() => fn(proxy, e, e));
1862
1862
  };
1863
1863
  const result = {
1864
1864
  handler: unsafeHandler,
@@ -2029,7 +2029,7 @@ function bindElement(el, scope, disposers) {
2029
2029
  const textExpr = !known || known.has("data-text") ? el.getAttribute("data-text") : null;
2030
2030
  if (textExpr) {
2031
2031
  const evaluate = buildEvaluator(textExpr, scope);
2032
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2032
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2033
2033
  setElementTextFast(el, toTextValue(evaluate()));
2034
2034
  });
2035
2035
  disposers.push(dispose);
@@ -2044,7 +2044,7 @@ function bindElement(el, scope, disposers) {
2044
2044
  dbg(`bindElement: data-show="${showExpr}" on <${tag}${cls}>`);
2045
2045
  }
2046
2046
  let initialized = false;
2047
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2047
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2048
2048
  const visible = !!evaluate();
2049
2049
  if (_debug) dbg(`data-show effect: "${showExpr}" \u2192 ${visible}`);
2050
2050
  applyShowVisibility(el, visible, transition, !initialized);
@@ -2063,7 +2063,7 @@ function bindElement(el, scope, disposers) {
2063
2063
  const parent = el.parentNode;
2064
2064
  let inserted = true;
2065
2065
  let initialized = false;
2066
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2066
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2067
2067
  const show = !!evaluate();
2068
2068
  if (show && !inserted) {
2069
2069
  clearTransitionState(el);
@@ -2102,7 +2102,7 @@ function bindElement(el, scope, disposers) {
2102
2102
  const setter = scope.setters[prop];
2103
2103
  if (getter && setter) {
2104
2104
  const input = el;
2105
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2105
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2106
2106
  const val = getter();
2107
2107
  if (input.type === "checkbox") {
2108
2108
  input.checked = !!val;
@@ -2166,14 +2166,14 @@ function bindElement(el, scope, disposers) {
2166
2166
  } else if (name.startsWith("data-class:")) {
2167
2167
  const cls = name.slice(11);
2168
2168
  const evaluate = buildEvaluator(attr.value, scope);
2169
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2169
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2170
2170
  el.classList.toggle(cls, !!evaluate());
2171
2171
  });
2172
2172
  disposers.push(dispose);
2173
2173
  } else if (name.startsWith("data-bind:")) {
2174
2174
  const attrName = name.slice(10);
2175
2175
  const evaluate = buildEvaluator(attr.value, scope);
2176
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2176
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2177
2177
  const val = evaluate();
2178
2178
  if (val == null || val === false) {
2179
2179
  el.removeAttribute(attrName);
@@ -2196,7 +2196,7 @@ function bindElement(el, scope, disposers) {
2196
2196
  if (saved !== null) setter(JSON.parse(saved));
2197
2197
  } catch {
2198
2198
  }
2199
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2199
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2200
2200
  try {
2201
2201
  localStorage.setItem(key, JSON.stringify(getter()));
2202
2202
  } catch {
@@ -2283,7 +2283,7 @@ function bindElement(el, scope, disposers) {
2283
2283
  });
2284
2284
  }
2285
2285
  } : void 0;
2286
- const dispose = chunkYMIMKO4W_cjs.internalEffect(() => {
2286
+ const dispose = chunkGDULJFJO_cjs.internalEffect(() => {
2287
2287
  const rawItems = evaluate();
2288
2288
  if (!Array.isArray(rawItems)) {
2289
2289
  for (const n of oldNodes) {
@@ -2304,7 +2304,7 @@ function bindElement(el, scope, disposers) {
2304
2304
  }
2305
2305
  const prevNodes = new Set(oldNodes);
2306
2306
  if (keyProp) {
2307
- const result = chunkYMIMKO4W_cjs.reconcileList(
2307
+ const result = chunkGDULJFJO_cjs.reconcileList(
2308
2308
  el,
2309
2309
  oldItems,
2310
2310
  rawItems,
@@ -2334,7 +2334,7 @@ function bindElement(el, scope, disposers) {
2334
2334
  } else {
2335
2335
  const wrapped = rawItems.map((item, i) => ({ __idx: i, __item: item }));
2336
2336
  const oldWrapped = oldItems;
2337
- const result = chunkYMIMKO4W_cjs.reconcileList(
2337
+ const result = chunkGDULJFJO_cjs.reconcileList(
2338
2338
  el,
2339
2339
  oldWrapped,
2340
2340
  wrapped,
@@ -2721,7 +2721,7 @@ function getScopes() {
2721
2721
  function setScopeValue(element, key, value) {
2722
2722
  const scope = element.__formaScope;
2723
2723
  if (!scope?.setters[key]) return;
2724
- chunkYMIMKO4W_cjs.batch(() => {
2724
+ chunkGDULJFJO_cjs.batch(() => {
2725
2725
  scope.setters[key](value);
2726
2726
  });
2727
2727
  }
@@ -2730,7 +2730,7 @@ function resetScope(element) {
2730
2730
  const initialJSON = element.__formaInitialState;
2731
2731
  if (!scope || !initialJSON) return;
2732
2732
  const initial = parseState(initialJSON);
2733
- chunkYMIMKO4W_cjs.batch(() => {
2733
+ chunkGDULJFJO_cjs.batch(() => {
2734
2734
  for (const [key, val] of Object.entries(initial)) {
2735
2735
  scope.setters[key]?.(val);
2736
2736
  }
@@ -2760,7 +2760,7 @@ function getReconciler() {
2760
2760
  }
2761
2761
  }
2762
2762
  },
2763
- batch: chunkYMIMKO4W_cjs.batch
2763
+ batch: chunkGDULJFJO_cjs.batch
2764
2764
  });
2765
2765
  }
2766
2766
  return _reconciler;