@getforma/core 0.9.1 → 1.0.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/README.md +24 -5
- package/dist/chunk-DCTOXHPF.cjs +399 -0
- package/dist/chunk-DCTOXHPF.cjs.map +1 -0
- package/dist/chunk-OUVOAYIO.js +359 -0
- package/dist/chunk-OUVOAYIO.js.map +1 -0
- package/dist/{chunk-GDULJFJO.cjs → chunk-V732ZBCU.cjs} +119 -511
- package/dist/chunk-V732ZBCU.cjs.map +1 -0
- package/dist/{chunk-CN56FSDT.js → chunk-VTPFK5TJ.js} +89 -442
- package/dist/chunk-VTPFK5TJ.js.map +1 -0
- package/dist/forma-runtime-csp.js +3400 -1
- package/dist/forma-runtime.js +3572 -1
- package/dist/formajs-runtime-hardened.global.js +3400 -1
- package/dist/formajs-runtime-hardened.global.js.map +1 -1
- package/dist/formajs-runtime.global.js +3572 -1
- package/dist/formajs-runtime.global.js.map +1 -1
- package/dist/formajs.global.js +3443 -1
- package/dist/formajs.global.js.map +1 -1
- package/dist/http.cjs +225 -0
- package/dist/http.cjs.map +1 -0
- package/dist/http.d.cts +108 -0
- package/dist/http.d.ts +108 -0
- package/dist/http.js +220 -0
- package/dist/http.js.map +1 -0
- package/dist/index.cjs +71 -607
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -456
- package/dist/index.d.ts +2 -456
- package/dist/index.js +7 -523
- package/dist/index.js.map +1 -1
- package/dist/resource-Cd0cGOxS.d.ts +62 -0
- package/dist/resource-DK98lW5e.d.cts +62 -0
- package/dist/runtime-hardened.cjs.map +1 -1
- package/dist/runtime-hardened.js.map +1 -1
- package/dist/runtime.cjs +23 -22
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +2 -1
- package/dist/runtime.js.map +1 -1
- package/dist/server.cjs +179 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +217 -0
- package/dist/server.d.ts +217 -0
- package/dist/server.js +166 -0
- package/dist/server.js.map +1 -0
- package/dist/storage.cjs +151 -0
- package/dist/storage.cjs.map +1 -0
- package/dist/storage.d.cts +77 -0
- package/dist/storage.d.ts +77 -0
- package/dist/storage.js +147 -0
- package/dist/storage.js.map +1 -0
- package/package.json +31 -1
- package/dist/chunk-CN56FSDT.js.map +0 -1
- package/dist/chunk-GDULJFJO.cjs.map +0 -1
package/dist/runtime.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkV732ZBCU_cjs = require('./chunk-V732ZBCU.cjs');
|
|
4
|
+
var chunkDCTOXHPF_cjs = require('./chunk-DCTOXHPF.cjs');
|
|
4
5
|
var chunk3U57L2TY_cjs = require('./chunk-3U57L2TY.cjs');
|
|
5
6
|
|
|
6
7
|
// src/dom/reconcile.ts
|
|
@@ -967,7 +968,7 @@ function parseIfHandler(expr, scope) {
|
|
|
967
968
|
}
|
|
968
969
|
if (rest.length > 0) return null;
|
|
969
970
|
return (e) => {
|
|
970
|
-
|
|
971
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
971
972
|
if (condExpr()) thenHandler(e);
|
|
972
973
|
else elseHandler?.(e);
|
|
973
974
|
});
|
|
@@ -1716,7 +1717,7 @@ function parseHandler(expr, scope) {
|
|
|
1716
1717
|
const handlers = stmts.map((s) => parseHandler(s, scope));
|
|
1717
1718
|
if (handlers.every((h) => h !== null)) {
|
|
1718
1719
|
return (e) => {
|
|
1719
|
-
|
|
1720
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
1720
1721
|
for (const h of handlers) h(e);
|
|
1721
1722
|
});
|
|
1722
1723
|
};
|
|
@@ -1729,7 +1730,7 @@ function parseHandler(expr, scope) {
|
|
|
1729
1730
|
const name = incrMatch[1];
|
|
1730
1731
|
const op = incrMatch[2];
|
|
1731
1732
|
return () => {
|
|
1732
|
-
|
|
1733
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
1733
1734
|
const val = scope.getters[name]?.() ?? 0;
|
|
1734
1735
|
scope.setters[name]?.(op === "++" ? val + 1 : val - 1);
|
|
1735
1736
|
});
|
|
@@ -1740,7 +1741,7 @@ function parseHandler(expr, scope) {
|
|
|
1740
1741
|
const op = preIncrMatch[1];
|
|
1741
1742
|
const name = preIncrMatch[2];
|
|
1742
1743
|
return () => {
|
|
1743
|
-
|
|
1744
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
1744
1745
|
const val = scope.getters[name]?.() ?? 0;
|
|
1745
1746
|
scope.setters[name]?.(op === "++" ? val + 1 : val - 1);
|
|
1746
1747
|
});
|
|
@@ -1750,7 +1751,7 @@ function parseHandler(expr, scope) {
|
|
|
1750
1751
|
if (toggleMatch && toggleMatch[1] === toggleMatch[2]) {
|
|
1751
1752
|
const name = toggleMatch[1];
|
|
1752
1753
|
return () => {
|
|
1753
|
-
|
|
1754
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
1754
1755
|
scope.setters[name]?.(!scope.getters[name]?.());
|
|
1755
1756
|
});
|
|
1756
1757
|
};
|
|
@@ -1762,7 +1763,7 @@ function parseHandler(expr, scope) {
|
|
|
1762
1763
|
if (valExpr) {
|
|
1763
1764
|
if (_debug) dbg(`parseHandler: assignment "${name} = ..." \u2014 setter exists:`, !!scope.setters[name], ", getter exists:", !!scope.getters[name]);
|
|
1764
1765
|
return () => {
|
|
1765
|
-
|
|
1766
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
1766
1767
|
const val = valExpr();
|
|
1767
1768
|
if (_debug) dbg(`SETTER: ${name} = ${val} (was: ${scope.getters[name]?.()})`);
|
|
1768
1769
|
scope.setters[name]?.(val);
|
|
@@ -1777,7 +1778,7 @@ function parseHandler(expr, scope) {
|
|
|
1777
1778
|
const valExpr = parseExpression(compoundMatch[3].trim(), scope);
|
|
1778
1779
|
if (valExpr) {
|
|
1779
1780
|
return () => {
|
|
1780
|
-
|
|
1781
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
1781
1782
|
const current = scope.getters[name]?.() ?? 0;
|
|
1782
1783
|
const val = valExpr();
|
|
1783
1784
|
switch (op) {
|
|
@@ -1858,7 +1859,7 @@ function buildHandler(expr, scope) {
|
|
|
1858
1859
|
}
|
|
1859
1860
|
});
|
|
1860
1861
|
const unsafeHandler = (e) => {
|
|
1861
|
-
|
|
1862
|
+
chunkDCTOXHPF_cjs.batch(() => fn(proxy, e, e));
|
|
1862
1863
|
};
|
|
1863
1864
|
const result = {
|
|
1864
1865
|
handler: unsafeHandler,
|
|
@@ -2029,7 +2030,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2029
2030
|
const textExpr = !known || known.has("data-text") ? el.getAttribute("data-text") : null;
|
|
2030
2031
|
if (textExpr) {
|
|
2031
2032
|
const evaluate = buildEvaluator(textExpr, scope);
|
|
2032
|
-
const dispose =
|
|
2033
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2033
2034
|
setElementTextFast(el, toTextValue(evaluate()));
|
|
2034
2035
|
});
|
|
2035
2036
|
disposers.push(dispose);
|
|
@@ -2044,7 +2045,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2044
2045
|
dbg(`bindElement: data-show="${showExpr}" on <${tag}${cls}>`);
|
|
2045
2046
|
}
|
|
2046
2047
|
let initialized = false;
|
|
2047
|
-
const dispose =
|
|
2048
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2048
2049
|
const visible = !!evaluate();
|
|
2049
2050
|
if (_debug) dbg(`data-show effect: "${showExpr}" \u2192 ${visible}`);
|
|
2050
2051
|
applyShowVisibility(el, visible, transition, !initialized);
|
|
@@ -2063,7 +2064,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2063
2064
|
const parent = el.parentNode;
|
|
2064
2065
|
let inserted = true;
|
|
2065
2066
|
let initialized = false;
|
|
2066
|
-
const dispose =
|
|
2067
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2067
2068
|
const show = !!evaluate();
|
|
2068
2069
|
if (show && !inserted) {
|
|
2069
2070
|
clearTransitionState(el);
|
|
@@ -2102,7 +2103,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2102
2103
|
const setter = scope.setters[prop];
|
|
2103
2104
|
if (getter && setter) {
|
|
2104
2105
|
const input = el;
|
|
2105
|
-
const dispose =
|
|
2106
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2106
2107
|
const val = getter();
|
|
2107
2108
|
if (input.type === "checkbox") {
|
|
2108
2109
|
input.checked = !!val;
|
|
@@ -2166,14 +2167,14 @@ function bindElement(el, scope, disposers) {
|
|
|
2166
2167
|
} else if (name.startsWith("data-class:")) {
|
|
2167
2168
|
const cls = name.slice(11);
|
|
2168
2169
|
const evaluate = buildEvaluator(attr.value, scope);
|
|
2169
|
-
const dispose =
|
|
2170
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2170
2171
|
el.classList.toggle(cls, !!evaluate());
|
|
2171
2172
|
});
|
|
2172
2173
|
disposers.push(dispose);
|
|
2173
2174
|
} else if (name.startsWith("data-bind:")) {
|
|
2174
2175
|
const attrName = name.slice(10);
|
|
2175
2176
|
const evaluate = buildEvaluator(attr.value, scope);
|
|
2176
|
-
const dispose =
|
|
2177
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2177
2178
|
const val = evaluate();
|
|
2178
2179
|
if (val == null || val === false) {
|
|
2179
2180
|
el.removeAttribute(attrName);
|
|
@@ -2196,7 +2197,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2196
2197
|
if (saved !== null) setter(JSON.parse(saved));
|
|
2197
2198
|
} catch {
|
|
2198
2199
|
}
|
|
2199
|
-
const dispose =
|
|
2200
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2200
2201
|
try {
|
|
2201
2202
|
localStorage.setItem(key, JSON.stringify(getter()));
|
|
2202
2203
|
} catch {
|
|
@@ -2283,7 +2284,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2283
2284
|
});
|
|
2284
2285
|
}
|
|
2285
2286
|
} : void 0;
|
|
2286
|
-
const dispose =
|
|
2287
|
+
const dispose = chunkDCTOXHPF_cjs.internalEffect(() => {
|
|
2287
2288
|
const rawItems = evaluate();
|
|
2288
2289
|
if (!Array.isArray(rawItems)) {
|
|
2289
2290
|
for (const n of oldNodes) {
|
|
@@ -2304,7 +2305,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2304
2305
|
}
|
|
2305
2306
|
const prevNodes = new Set(oldNodes);
|
|
2306
2307
|
if (keyProp) {
|
|
2307
|
-
const result =
|
|
2308
|
+
const result = chunkV732ZBCU_cjs.reconcileList(
|
|
2308
2309
|
el,
|
|
2309
2310
|
oldItems,
|
|
2310
2311
|
rawItems,
|
|
@@ -2334,7 +2335,7 @@ function bindElement(el, scope, disposers) {
|
|
|
2334
2335
|
} else {
|
|
2335
2336
|
const wrapped = rawItems.map((item, i) => ({ __idx: i, __item: item }));
|
|
2336
2337
|
const oldWrapped = oldItems;
|
|
2337
|
-
const result =
|
|
2338
|
+
const result = chunkV732ZBCU_cjs.reconcileList(
|
|
2338
2339
|
el,
|
|
2339
2340
|
oldWrapped,
|
|
2340
2341
|
wrapped,
|
|
@@ -2721,7 +2722,7 @@ function getScopes() {
|
|
|
2721
2722
|
function setScopeValue(element, key, value) {
|
|
2722
2723
|
const scope = element.__formaScope;
|
|
2723
2724
|
if (!scope?.setters[key]) return;
|
|
2724
|
-
|
|
2725
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
2725
2726
|
scope.setters[key](value);
|
|
2726
2727
|
});
|
|
2727
2728
|
}
|
|
@@ -2730,7 +2731,7 @@ function resetScope(element) {
|
|
|
2730
2731
|
const initialJSON = element.__formaInitialState;
|
|
2731
2732
|
if (!scope || !initialJSON) return;
|
|
2732
2733
|
const initial = parseState(initialJSON);
|
|
2733
|
-
|
|
2734
|
+
chunkDCTOXHPF_cjs.batch(() => {
|
|
2734
2735
|
for (const [key, val] of Object.entries(initial)) {
|
|
2735
2736
|
scope.setters[key]?.(val);
|
|
2736
2737
|
}
|
|
@@ -2760,7 +2761,7 @@ function getReconciler() {
|
|
|
2760
2761
|
}
|
|
2761
2762
|
}
|
|
2762
2763
|
},
|
|
2763
|
-
batch:
|
|
2764
|
+
batch: chunkDCTOXHPF_cjs.batch
|
|
2764
2765
|
});
|
|
2765
2766
|
}
|
|
2766
2767
|
return _reconciler;
|