@getforma/core 0.6.1 → 0.8.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 +93 -8
- package/dist/chunk-3U57L2TY.cjs +38 -0
- package/dist/chunk-3U57L2TY.cjs.map +1 -0
- package/dist/{chunk-TKGUHASG.js → chunk-N522P3G6.js} +20 -12
- package/dist/chunk-N522P3G6.js.map +1 -0
- package/dist/chunk-OZCHIVAZ.js +35 -0
- package/dist/chunk-OZCHIVAZ.js.map +1 -0
- package/dist/{chunk-YSKF3VRA.cjs → chunk-YMIMKO4W.cjs} +51 -20
- package/dist/chunk-YMIMKO4W.cjs.map +1 -0
- package/dist/forma-runtime-csp.js +1 -1
- package/dist/forma-runtime.js +1 -1
- package/dist/formajs-runtime-hardened.global.js +1 -1
- package/dist/formajs-runtime-hardened.global.js.map +1 -1
- package/dist/formajs-runtime.global.js +1 -1
- package/dist/formajs-runtime.global.js.map +1 -1
- package/dist/formajs.global.js +1 -1
- package/dist/formajs.global.js.map +1 -1
- package/dist/index.cjs +112 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -21
- package/dist/index.d.ts +30 -21
- package/dist/index.js +25 -50
- package/dist/index.js.map +1 -1
- package/dist/runtime-hardened.cjs +106 -27
- package/dist/runtime-hardened.cjs.map +1 -1
- package/dist/runtime-hardened.js +107 -28
- package/dist/runtime-hardened.js.map +1 -1
- package/dist/runtime.cjs +128 -50
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +102 -24
- package/dist/runtime.js.map +1 -1
- package/dist/signal-B4_wQJHs.d.cts +53 -0
- package/dist/signal-B4_wQJHs.d.ts +53 -0
- package/dist/ssr/index.cjs +19 -2
- package/dist/ssr/index.cjs.map +1 -1
- package/dist/ssr/index.js +19 -2
- package/dist/ssr/index.js.map +1 -1
- package/dist/tc39-compat.cjs +4 -12
- package/dist/tc39-compat.cjs.map +1 -1
- package/dist/tc39-compat.d.cts +1 -1
- package/dist/tc39-compat.d.ts +1 -1
- package/dist/tc39-compat.js +3 -11
- package/dist/tc39-compat.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-DPSAVBCP.js +0 -26
- package/dist/chunk-DPSAVBCP.js.map +0 -1
- package/dist/chunk-KH3F5NRU.cjs +0 -29
- package/dist/chunk-KH3F5NRU.cjs.map +0 -1
- package/dist/chunk-TKGUHASG.js.map +0 -1
- package/dist/chunk-YSKF3VRA.cjs.map +0 -1
- package/dist/signal-CfLDwMyg.d.cts +0 -29
- package/dist/signal-CfLDwMyg.d.ts +0 -29
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkYMIMKO4W_cjs = require('./chunk-YMIMKO4W.cjs');
|
|
4
|
+
var chunk3U57L2TY_cjs = require('./chunk-3U57L2TY.cjs');
|
|
5
5
|
|
|
6
6
|
// src/dom/text.ts
|
|
7
7
|
function createText(value) {
|
|
8
8
|
if (typeof value === "function") {
|
|
9
9
|
const node = new Text("");
|
|
10
|
-
|
|
10
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
11
11
|
node.data = value();
|
|
12
12
|
});
|
|
13
13
|
return node;
|
|
@@ -23,12 +23,12 @@ function mount(component, container) {
|
|
|
23
23
|
}
|
|
24
24
|
let disposeRoot;
|
|
25
25
|
if (target.hasAttribute("data-forma-ssr")) {
|
|
26
|
-
|
|
26
|
+
chunkYMIMKO4W_cjs.createRoot((dispose) => {
|
|
27
27
|
disposeRoot = dispose;
|
|
28
|
-
|
|
28
|
+
chunkYMIMKO4W_cjs.hydrateIsland(component, target);
|
|
29
29
|
});
|
|
30
30
|
} else {
|
|
31
|
-
const dom =
|
|
31
|
+
const dom = chunkYMIMKO4W_cjs.createRoot((dispose) => {
|
|
32
32
|
disposeRoot = dispose;
|
|
33
33
|
return component();
|
|
34
34
|
});
|
|
@@ -54,7 +54,7 @@ function createSwitch(value, cases, fallback) {
|
|
|
54
54
|
const cache = /* @__PURE__ */ new Map();
|
|
55
55
|
let currentNode = null;
|
|
56
56
|
let currentMatch = UNSET;
|
|
57
|
-
const switchDispose =
|
|
57
|
+
const switchDispose = chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
58
58
|
const val = value();
|
|
59
59
|
if (val === currentMatch) return;
|
|
60
60
|
const DEBUG = typeof globalThis.__FORMA_DEBUG__ !== "undefined";
|
|
@@ -89,9 +89,9 @@ function createSwitch(value, cases, fallback) {
|
|
|
89
89
|
let entry = cache.get(val);
|
|
90
90
|
if (!entry) {
|
|
91
91
|
let branchDispose;
|
|
92
|
-
const node =
|
|
92
|
+
const node = chunkYMIMKO4W_cjs.createRoot((dispose) => {
|
|
93
93
|
branchDispose = dispose;
|
|
94
|
-
return
|
|
94
|
+
return chunkYMIMKO4W_cjs.untrack(() => matchedCase.render());
|
|
95
95
|
});
|
|
96
96
|
entry = { node, dispose: branchDispose };
|
|
97
97
|
cache.set(val, entry);
|
|
@@ -134,7 +134,7 @@ function createPortal(children2, target) {
|
|
|
134
134
|
}
|
|
135
135
|
mountedNode = null;
|
|
136
136
|
};
|
|
137
|
-
|
|
137
|
+
chunkYMIMKO4W_cjs.createEffect(() => {
|
|
138
138
|
const node = children2();
|
|
139
139
|
removeMountedNode();
|
|
140
140
|
mountedNode = node;
|
|
@@ -153,9 +153,9 @@ function createErrorBoundary(tryFn, catchFn) {
|
|
|
153
153
|
const fragment2 = document.createDocumentFragment();
|
|
154
154
|
fragment2.appendChild(startMarker);
|
|
155
155
|
fragment2.appendChild(endMarker);
|
|
156
|
-
const [retryCount, setRetryCount] =
|
|
156
|
+
const [retryCount, setRetryCount] = chunk3U57L2TY_cjs.createSignal(0);
|
|
157
157
|
let currentNode = null;
|
|
158
|
-
|
|
158
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
159
159
|
retryCount();
|
|
160
160
|
const parent2 = startMarker.parentNode;
|
|
161
161
|
if (!parent2) return;
|
|
@@ -183,7 +183,7 @@ function createSuspense(fallback, children2) {
|
|
|
183
183
|
const fragment2 = document.createDocumentFragment();
|
|
184
184
|
fragment2.appendChild(startMarker);
|
|
185
185
|
fragment2.appendChild(endMarker);
|
|
186
|
-
const [pending, setPending] =
|
|
186
|
+
const [pending, setPending] = chunk3U57L2TY_cjs.createSignal(0);
|
|
187
187
|
let currentNode = null;
|
|
188
188
|
let resolvedNode = null;
|
|
189
189
|
let fallbackNode = null;
|
|
@@ -195,13 +195,13 @@ function createSuspense(fallback, children2) {
|
|
|
195
195
|
setPending((p) => Math.max(0, p - 1));
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
|
-
|
|
198
|
+
chunkYMIMKO4W_cjs.pushSuspenseContext(ctx);
|
|
199
199
|
try {
|
|
200
200
|
resolvedNode = children2();
|
|
201
201
|
} finally {
|
|
202
|
-
|
|
202
|
+
chunkYMIMKO4W_cjs.popSuspenseContext();
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
205
205
|
const parent2 = startMarker.parentNode;
|
|
206
206
|
if (!parent2) return;
|
|
207
207
|
const isPending = pending() > 0;
|
|
@@ -219,13 +219,20 @@ function createSuspense(fallback, children2) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// src/dom/activate.ts
|
|
222
|
+
var FORBIDDEN_PROP_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
223
|
+
function sanitizeProps(obj) {
|
|
224
|
+
for (const key of FORBIDDEN_PROP_KEYS) {
|
|
225
|
+
if (key in obj) delete obj[key];
|
|
226
|
+
}
|
|
227
|
+
return obj;
|
|
228
|
+
}
|
|
222
229
|
function loadIslandProps(root, id, sharedProps) {
|
|
223
230
|
const inline = root.getAttribute("data-forma-props");
|
|
224
231
|
if (inline) {
|
|
225
|
-
return JSON.parse(inline);
|
|
232
|
+
return sanitizeProps(JSON.parse(inline));
|
|
226
233
|
}
|
|
227
234
|
if (sharedProps && String(id) in sharedProps) {
|
|
228
|
-
return sharedProps[String(id)];
|
|
235
|
+
return sanitizeProps(sharedProps[String(id)]);
|
|
229
236
|
}
|
|
230
237
|
return null;
|
|
231
238
|
}
|
|
@@ -238,12 +245,12 @@ function activateIslands(registry2) {
|
|
|
238
245
|
const componentName = root.getAttribute("data-forma-component");
|
|
239
246
|
const hydrateFn = registry2[componentName];
|
|
240
247
|
if (!hydrateFn) {
|
|
241
|
-
if (
|
|
248
|
+
if (chunkYMIMKO4W_cjs.__DEV__) console.warn(`[forma] No hydrate function for island "${componentName}" (id=${id})`);
|
|
242
249
|
root.setAttribute("data-forma-status", "error");
|
|
243
250
|
continue;
|
|
244
251
|
}
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
252
|
+
const trigger2 = root.getAttribute("data-forma-hydrate") || "load";
|
|
253
|
+
if (trigger2 === "visible") {
|
|
247
254
|
const observer = new IntersectionObserver(
|
|
248
255
|
(entries) => {
|
|
249
256
|
for (const entry of entries) {
|
|
@@ -255,14 +262,14 @@ function activateIslands(registry2) {
|
|
|
255
262
|
{ rootMargin: "200px" }
|
|
256
263
|
);
|
|
257
264
|
observer.observe(root);
|
|
258
|
-
} else if (
|
|
265
|
+
} else if (trigger2 === "idle") {
|
|
259
266
|
const hydrate = () => hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps);
|
|
260
267
|
if (typeof requestIdleCallback === "function") {
|
|
261
268
|
requestIdleCallback(hydrate);
|
|
262
269
|
} else {
|
|
263
270
|
setTimeout(hydrate, 200);
|
|
264
271
|
}
|
|
265
|
-
} else if (
|
|
272
|
+
} else if (trigger2 === "interaction") {
|
|
266
273
|
const hydrate = () => {
|
|
267
274
|
root.removeEventListener("pointerdown", hydrate, true);
|
|
268
275
|
root.removeEventListener("focusin", hydrate, true);
|
|
@@ -294,13 +301,13 @@ function hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps) {
|
|
|
294
301
|
const props = loadIslandProps(root, id, sharedProps);
|
|
295
302
|
root.setAttribute("data-forma-status", "hydrating");
|
|
296
303
|
let activeRoot = root;
|
|
297
|
-
|
|
298
|
-
activeRoot =
|
|
304
|
+
chunkYMIMKO4W_cjs.createRoot((dispose) => {
|
|
305
|
+
activeRoot = chunkYMIMKO4W_cjs.hydrateIsland(() => hydrateFn(root, props), root);
|
|
299
306
|
activeRoot.__formaDispose = dispose;
|
|
300
307
|
});
|
|
301
308
|
activeRoot.setAttribute("data-forma-status", "active");
|
|
302
309
|
} catch (err) {
|
|
303
|
-
if (
|
|
310
|
+
if (chunkYMIMKO4W_cjs.__DEV__) console.error(`[forma] Island "${componentName}" (id=${id}) failed:`, err);
|
|
304
311
|
root.setAttribute("data-forma-status", "error");
|
|
305
312
|
}
|
|
306
313
|
}
|
|
@@ -349,14 +356,14 @@ function defineComponent(setupOrDef) {
|
|
|
349
356
|
try {
|
|
350
357
|
cb();
|
|
351
358
|
} catch (e) {
|
|
352
|
-
|
|
359
|
+
chunkYMIMKO4W_cjs.reportError(e, "onUnmount");
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
362
|
for (const d of ctx.disposers) {
|
|
356
363
|
try {
|
|
357
364
|
d();
|
|
358
365
|
} catch (e) {
|
|
359
|
-
|
|
366
|
+
chunkYMIMKO4W_cjs.reportError(e, "component disposer");
|
|
360
367
|
}
|
|
361
368
|
}
|
|
362
369
|
ctx.disposers.length = 0;
|
|
@@ -371,7 +378,7 @@ function defineComponent(setupOrDef) {
|
|
|
371
378
|
ctx.unmountCallbacks.push(cleanup2);
|
|
372
379
|
}
|
|
373
380
|
} catch (e) {
|
|
374
|
-
|
|
381
|
+
chunkYMIMKO4W_cjs.reportError(e, "onMount");
|
|
375
382
|
}
|
|
376
383
|
}
|
|
377
384
|
return dom;
|
|
@@ -445,13 +452,15 @@ function shouldWrap(v) {
|
|
|
445
452
|
if (v[PROXY]) return false;
|
|
446
453
|
return true;
|
|
447
454
|
}
|
|
448
|
-
function deepClone(obj) {
|
|
449
|
-
if (obj
|
|
450
|
-
if (
|
|
451
|
-
if (obj
|
|
455
|
+
function deepClone(obj, seen) {
|
|
456
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
457
|
+
if (!seen) seen = /* @__PURE__ */ new WeakSet();
|
|
458
|
+
if (seen.has(obj)) return obj;
|
|
459
|
+
seen.add(obj);
|
|
460
|
+
if (Array.isArray(obj)) return obj.map((item) => deepClone(item, seen));
|
|
452
461
|
const out = {};
|
|
453
462
|
for (const key of Object.keys(obj)) {
|
|
454
|
-
out[key] = deepClone(obj[key]);
|
|
463
|
+
out[key] = deepClone(obj[key], seen);
|
|
455
464
|
}
|
|
456
465
|
return out;
|
|
457
466
|
}
|
|
@@ -472,7 +481,7 @@ function createStore(initial) {
|
|
|
472
481
|
function getSignal(path, initialValue) {
|
|
473
482
|
let pair = signals.get(path);
|
|
474
483
|
if (!pair) {
|
|
475
|
-
pair =
|
|
484
|
+
pair = chunk3U57L2TY_cjs.createSignal(initialValue);
|
|
476
485
|
signals.set(path, pair);
|
|
477
486
|
registerChild(path);
|
|
478
487
|
}
|
|
@@ -512,7 +521,7 @@ function createStore(initial) {
|
|
|
512
521
|
if (isArr && ARRAY_MUTATORS.has(key)) {
|
|
513
522
|
return (...args) => {
|
|
514
523
|
let result;
|
|
515
|
-
|
|
524
|
+
chunkYMIMKO4W_cjs.batch(() => {
|
|
516
525
|
const rawArgs = args.map(
|
|
517
526
|
(a) => a != null && typeof a === "object" && a[RAW] ? a[RAW] : a
|
|
518
527
|
);
|
|
@@ -626,11 +635,11 @@ function createStore(initial) {
|
|
|
626
635
|
}
|
|
627
636
|
const rootProxy = wrap(initial, "");
|
|
628
637
|
function getCurrentSnapshot() {
|
|
629
|
-
return
|
|
638
|
+
return chunkYMIMKO4W_cjs.untrack(() => deepClone(initial));
|
|
630
639
|
}
|
|
631
640
|
const setter = (partial) => {
|
|
632
641
|
const updates = typeof partial === "function" ? partial(getCurrentSnapshot()) : partial;
|
|
633
|
-
|
|
642
|
+
chunkYMIMKO4W_cjs.batch(() => {
|
|
634
643
|
for (const key of Object.keys(updates)) {
|
|
635
644
|
rootProxy[key] = updates[key];
|
|
636
645
|
}
|
|
@@ -645,11 +654,11 @@ function createHistory(source, options) {
|
|
|
645
654
|
const maxLength = options?.maxLength ?? 100;
|
|
646
655
|
let _stack = [sourceGet()];
|
|
647
656
|
let _cursor = 0;
|
|
648
|
-
const [stackSignal, setStackSignal] =
|
|
649
|
-
const [cursorSignal, setCursorSignal] =
|
|
650
|
-
const [stackLenSignal, setStackLenSignal] =
|
|
657
|
+
const [stackSignal, setStackSignal] = chunk3U57L2TY_cjs.createSignal([..._stack]);
|
|
658
|
+
const [cursorSignal, setCursorSignal] = chunk3U57L2TY_cjs.createSignal(_cursor);
|
|
659
|
+
const [stackLenSignal, setStackLenSignal] = chunk3U57L2TY_cjs.createSignal(_stack.length);
|
|
651
660
|
function syncSignals() {
|
|
652
|
-
|
|
661
|
+
chunkYMIMKO4W_cjs.batch(() => {
|
|
653
662
|
setStackSignal([..._stack]);
|
|
654
663
|
setCursorSignal(_cursor);
|
|
655
664
|
setStackLenSignal(_stack.length);
|
|
@@ -657,7 +666,7 @@ function createHistory(source, options) {
|
|
|
657
666
|
}
|
|
658
667
|
let ignoreNext = false;
|
|
659
668
|
let isFirstRun = true;
|
|
660
|
-
|
|
669
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
661
670
|
const value = sourceGet();
|
|
662
671
|
if (isFirstRun) {
|
|
663
672
|
isFirstRun = false;
|
|
@@ -725,7 +734,7 @@ function persist(source, key, options) {
|
|
|
725
734
|
}
|
|
726
735
|
} catch {
|
|
727
736
|
}
|
|
728
|
-
|
|
737
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
729
738
|
const value = sourceGet();
|
|
730
739
|
try {
|
|
731
740
|
const serialized = serialize(value);
|
|
@@ -1130,9 +1139,9 @@ function createIndexedDB(dbName, storeName = "default") {
|
|
|
1130
1139
|
|
|
1131
1140
|
// src/http/fetch.ts
|
|
1132
1141
|
function createFetch(url, options) {
|
|
1133
|
-
const [data, setData] =
|
|
1134
|
-
const [error, setError] =
|
|
1135
|
-
const [loading, setLoading] =
|
|
1142
|
+
const [data, setData] = chunk3U57L2TY_cjs.createSignal(null);
|
|
1143
|
+
const [error, setError] = chunk3U57L2TY_cjs.createSignal(null);
|
|
1144
|
+
const [loading, setLoading] = chunk3U57L2TY_cjs.createSignal(false);
|
|
1136
1145
|
let currentController = null;
|
|
1137
1146
|
function resolveURL() {
|
|
1138
1147
|
const raw = typeof url === "function" ? url() : url;
|
|
@@ -1182,7 +1191,7 @@ function createFetch(url, options) {
|
|
|
1182
1191
|
}
|
|
1183
1192
|
}
|
|
1184
1193
|
if (typeof url === "function") {
|
|
1185
|
-
|
|
1194
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
1186
1195
|
url();
|
|
1187
1196
|
execute();
|
|
1188
1197
|
});
|
|
@@ -1211,9 +1220,9 @@ async function fetchJSON(url, options) {
|
|
|
1211
1220
|
|
|
1212
1221
|
// src/http/sse.ts
|
|
1213
1222
|
function createSSE(url, options) {
|
|
1214
|
-
const [data, setData] =
|
|
1215
|
-
const [error, setError] =
|
|
1216
|
-
const [connected, setConnected] =
|
|
1223
|
+
const [data, setData] = chunk3U57L2TY_cjs.createSignal(null);
|
|
1224
|
+
const [error, setError] = chunk3U57L2TY_cjs.createSignal(null);
|
|
1225
|
+
const [connected, setConnected] = chunk3U57L2TY_cjs.createSignal(false);
|
|
1217
1226
|
const source = new EventSource(url, {
|
|
1218
1227
|
withCredentials: options?.withCredentials ?? false
|
|
1219
1228
|
});
|
|
@@ -1267,8 +1276,8 @@ function createWebSocket(url, options) {
|
|
|
1267
1276
|
const shouldReconnect = options?.reconnect ?? true;
|
|
1268
1277
|
const baseInterval = options?.reconnectInterval ?? 1e3;
|
|
1269
1278
|
const maxReconnects = options?.maxReconnects ?? 5;
|
|
1270
|
-
const [data, setData] =
|
|
1271
|
-
const [status, setStatus] =
|
|
1279
|
+
const [data, setData] = chunk3U57L2TY_cjs.createSignal(null);
|
|
1280
|
+
const [status, setStatus] = chunk3U57L2TY_cjs.createSignal("connecting");
|
|
1272
1281
|
const handlers = /* @__PURE__ */ new Set();
|
|
1273
1282
|
let socket = null;
|
|
1274
1283
|
let reconnectCount = 0;
|
|
@@ -1344,21 +1353,21 @@ function createWebSocket(url, options) {
|
|
|
1344
1353
|
|
|
1345
1354
|
// src/server/action.ts
|
|
1346
1355
|
function createAction(serverFn, options) {
|
|
1347
|
-
const [pending, setPending] =
|
|
1348
|
-
const [error, setError] =
|
|
1356
|
+
const [pending, setPending] = chunk3U57L2TY_cjs.createSignal(false);
|
|
1357
|
+
const [error, setError] = chunk3U57L2TY_cjs.createSignal(void 0);
|
|
1349
1358
|
const action = async (...args) => {
|
|
1350
1359
|
setPending(true);
|
|
1351
1360
|
setError(void 0);
|
|
1352
1361
|
if (options?.optimistic) {
|
|
1353
1362
|
try {
|
|
1354
|
-
|
|
1363
|
+
chunkYMIMKO4W_cjs.batch(() => options.optimistic(...args));
|
|
1355
1364
|
} catch {
|
|
1356
1365
|
}
|
|
1357
1366
|
}
|
|
1358
1367
|
try {
|
|
1359
1368
|
const result = await serverFn(...args);
|
|
1360
1369
|
if (options?.onSuccess) {
|
|
1361
|
-
|
|
1370
|
+
chunkYMIMKO4W_cjs.batch(() => options.onSuccess(result, ...args));
|
|
1362
1371
|
}
|
|
1363
1372
|
if (options?.invalidates) {
|
|
1364
1373
|
for (const resource of options.invalidates) {
|
|
@@ -1370,7 +1379,7 @@ function createAction(serverFn, options) {
|
|
|
1370
1379
|
} catch (err) {
|
|
1371
1380
|
if (options?.onError) {
|
|
1372
1381
|
try {
|
|
1373
|
-
|
|
1382
|
+
chunkYMIMKO4W_cjs.batch(() => options.onError(err, ...args));
|
|
1374
1383
|
} catch {
|
|
1375
1384
|
}
|
|
1376
1385
|
}
|
|
@@ -1502,123 +1511,113 @@ function createRPCMiddleware() {
|
|
|
1502
1511
|
};
|
|
1503
1512
|
}
|
|
1504
1513
|
|
|
1505
|
-
// src/wasm/forma-wasm.ts
|
|
1506
|
-
var wasmModule = null;
|
|
1507
|
-
var irCache = /* @__PURE__ */ new Map();
|
|
1508
|
-
async function ensureWasm() {
|
|
1509
|
-
if (wasmModule) return wasmModule;
|
|
1510
|
-
const config = window.__FORMA_WASM__;
|
|
1511
|
-
if (!config) throw new Error("No __FORMA_WASM__ config");
|
|
1512
|
-
const mod = await import(
|
|
1513
|
-
/* @vite-ignore */
|
|
1514
|
-
config.loader
|
|
1515
|
-
);
|
|
1516
|
-
await mod.default(config.binary);
|
|
1517
|
-
wasmModule = mod;
|
|
1518
|
-
return wasmModule;
|
|
1519
|
-
}
|
|
1520
|
-
async function getIR() {
|
|
1521
|
-
const config = window.__FORMA_WASM__;
|
|
1522
|
-
if (!config) throw new Error("No __FORMA_WASM__ config");
|
|
1523
|
-
const cached = irCache.get(config.ir);
|
|
1524
|
-
if (cached) return cached;
|
|
1525
|
-
const response = await fetch(config.ir);
|
|
1526
|
-
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
1527
|
-
irCache.set(config.ir, bytes);
|
|
1528
|
-
return bytes;
|
|
1529
|
-
}
|
|
1530
|
-
async function renderLocal(slotsJson) {
|
|
1531
|
-
const [wasm, ir] = await Promise.all([ensureWasm(), getIR()]);
|
|
1532
|
-
return wasm.render(ir, slotsJson);
|
|
1533
|
-
}
|
|
1534
|
-
async function renderIsland(slotsJson, islandId) {
|
|
1535
|
-
const [wasm, ir] = await Promise.all([ensureWasm(), getIR()]);
|
|
1536
|
-
return wasm.render_island(ir, slotsJson, islandId);
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
1514
|
Object.defineProperty(exports, "Fragment", {
|
|
1540
1515
|
enumerable: true,
|
|
1541
|
-
get: function () { return
|
|
1516
|
+
get: function () { return chunkYMIMKO4W_cjs.Fragment; }
|
|
1542
1517
|
});
|
|
1543
1518
|
Object.defineProperty(exports, "batch", {
|
|
1544
1519
|
enumerable: true,
|
|
1545
|
-
get: function () { return
|
|
1520
|
+
get: function () { return chunkYMIMKO4W_cjs.batch; }
|
|
1546
1521
|
});
|
|
1547
1522
|
Object.defineProperty(exports, "cleanup", {
|
|
1548
1523
|
enumerable: true,
|
|
1549
|
-
get: function () { return
|
|
1524
|
+
get: function () { return chunkYMIMKO4W_cjs.cleanup; }
|
|
1550
1525
|
});
|
|
1551
1526
|
Object.defineProperty(exports, "createEffect", {
|
|
1552
1527
|
enumerable: true,
|
|
1553
|
-
get: function () { return
|
|
1528
|
+
get: function () { return chunkYMIMKO4W_cjs.createEffect; }
|
|
1554
1529
|
});
|
|
1555
1530
|
Object.defineProperty(exports, "createList", {
|
|
1556
1531
|
enumerable: true,
|
|
1557
|
-
get: function () { return
|
|
1532
|
+
get: function () { return chunkYMIMKO4W_cjs.createList; }
|
|
1558
1533
|
});
|
|
1559
1534
|
Object.defineProperty(exports, "createMemo", {
|
|
1560
1535
|
enumerable: true,
|
|
1561
|
-
get: function () { return
|
|
1536
|
+
get: function () { return chunkYMIMKO4W_cjs.createMemo; }
|
|
1562
1537
|
});
|
|
1563
1538
|
Object.defineProperty(exports, "createReducer", {
|
|
1564
1539
|
enumerable: true,
|
|
1565
|
-
get: function () { return
|
|
1540
|
+
get: function () { return chunkYMIMKO4W_cjs.createReducer; }
|
|
1566
1541
|
});
|
|
1567
1542
|
Object.defineProperty(exports, "createRef", {
|
|
1568
1543
|
enumerable: true,
|
|
1569
|
-
get: function () { return
|
|
1544
|
+
get: function () { return chunkYMIMKO4W_cjs.createRef; }
|
|
1570
1545
|
});
|
|
1571
1546
|
Object.defineProperty(exports, "createResource", {
|
|
1572
1547
|
enumerable: true,
|
|
1573
|
-
get: function () { return
|
|
1548
|
+
get: function () { return chunkYMIMKO4W_cjs.createResource; }
|
|
1574
1549
|
});
|
|
1575
1550
|
Object.defineProperty(exports, "createRoot", {
|
|
1576
1551
|
enumerable: true,
|
|
1577
|
-
get: function () { return
|
|
1552
|
+
get: function () { return chunkYMIMKO4W_cjs.createRoot; }
|
|
1578
1553
|
});
|
|
1579
1554
|
Object.defineProperty(exports, "createShow", {
|
|
1580
1555
|
enumerable: true,
|
|
1581
|
-
get: function () { return
|
|
1556
|
+
get: function () { return chunkYMIMKO4W_cjs.createShow; }
|
|
1582
1557
|
});
|
|
1583
1558
|
Object.defineProperty(exports, "fragment", {
|
|
1584
1559
|
enumerable: true,
|
|
1585
|
-
get: function () { return
|
|
1560
|
+
get: function () { return chunkYMIMKO4W_cjs.fragment; }
|
|
1561
|
+
});
|
|
1562
|
+
Object.defineProperty(exports, "getBatchDepth", {
|
|
1563
|
+
enumerable: true,
|
|
1564
|
+
get: function () { return chunkYMIMKO4W_cjs.getBatchDepth; }
|
|
1586
1565
|
});
|
|
1587
1566
|
Object.defineProperty(exports, "h", {
|
|
1588
1567
|
enumerable: true,
|
|
1589
|
-
get: function () { return
|
|
1568
|
+
get: function () { return chunkYMIMKO4W_cjs.h; }
|
|
1590
1569
|
});
|
|
1591
1570
|
Object.defineProperty(exports, "hydrateIsland", {
|
|
1592
1571
|
enumerable: true,
|
|
1593
|
-
get: function () { return
|
|
1572
|
+
get: function () { return chunkYMIMKO4W_cjs.hydrateIsland; }
|
|
1573
|
+
});
|
|
1574
|
+
Object.defineProperty(exports, "isComputed", {
|
|
1575
|
+
enumerable: true,
|
|
1576
|
+
get: function () { return chunkYMIMKO4W_cjs.isComputed; }
|
|
1577
|
+
});
|
|
1578
|
+
Object.defineProperty(exports, "isEffect", {
|
|
1579
|
+
enumerable: true,
|
|
1580
|
+
get: function () { return chunkYMIMKO4W_cjs.isEffect; }
|
|
1581
|
+
});
|
|
1582
|
+
Object.defineProperty(exports, "isEffectScope", {
|
|
1583
|
+
enumerable: true,
|
|
1584
|
+
get: function () { return chunkYMIMKO4W_cjs.isEffectScope; }
|
|
1585
|
+
});
|
|
1586
|
+
Object.defineProperty(exports, "isSignal", {
|
|
1587
|
+
enumerable: true,
|
|
1588
|
+
get: function () { return chunkYMIMKO4W_cjs.isSignal; }
|
|
1594
1589
|
});
|
|
1595
1590
|
Object.defineProperty(exports, "on", {
|
|
1596
1591
|
enumerable: true,
|
|
1597
|
-
get: function () { return
|
|
1592
|
+
get: function () { return chunkYMIMKO4W_cjs.on; }
|
|
1598
1593
|
});
|
|
1599
1594
|
Object.defineProperty(exports, "onCleanup", {
|
|
1600
1595
|
enumerable: true,
|
|
1601
|
-
get: function () { return
|
|
1596
|
+
get: function () { return chunkYMIMKO4W_cjs.onCleanup; }
|
|
1602
1597
|
});
|
|
1603
1598
|
Object.defineProperty(exports, "onError", {
|
|
1604
1599
|
enumerable: true,
|
|
1605
|
-
get: function () { return
|
|
1600
|
+
get: function () { return chunkYMIMKO4W_cjs.onError; }
|
|
1606
1601
|
});
|
|
1607
1602
|
Object.defineProperty(exports, "reconcileList", {
|
|
1608
1603
|
enumerable: true,
|
|
1609
|
-
get: function () { return
|
|
1604
|
+
get: function () { return chunkYMIMKO4W_cjs.reconcileList; }
|
|
1605
|
+
});
|
|
1606
|
+
Object.defineProperty(exports, "trigger", {
|
|
1607
|
+
enumerable: true,
|
|
1608
|
+
get: function () { return chunkYMIMKO4W_cjs.trigger; }
|
|
1610
1609
|
});
|
|
1611
1610
|
Object.defineProperty(exports, "untrack", {
|
|
1612
1611
|
enumerable: true,
|
|
1613
|
-
get: function () { return
|
|
1612
|
+
get: function () { return chunkYMIMKO4W_cjs.untrack; }
|
|
1614
1613
|
});
|
|
1615
1614
|
Object.defineProperty(exports, "createComputed", {
|
|
1616
1615
|
enumerable: true,
|
|
1617
|
-
get: function () { return
|
|
1616
|
+
get: function () { return chunk3U57L2TY_cjs.createComputed; }
|
|
1618
1617
|
});
|
|
1619
1618
|
Object.defineProperty(exports, "createSignal", {
|
|
1620
1619
|
enumerable: true,
|
|
1621
|
-
get: function () { return
|
|
1620
|
+
get: function () { return chunk3U57L2TY_cjs.createSignal; }
|
|
1622
1621
|
});
|
|
1623
1622
|
exports.$ = $;
|
|
1624
1623
|
exports.$$ = $$;
|
|
@@ -1671,8 +1670,6 @@ exports.provide = provide;
|
|
|
1671
1670
|
exports.registerResource = registerResource;
|
|
1672
1671
|
exports.registerServerFunction = registerServerFunction;
|
|
1673
1672
|
exports.removeClass = removeClass;
|
|
1674
|
-
exports.renderIsland = renderIsland;
|
|
1675
|
-
exports.renderLocal = renderLocal;
|
|
1676
1673
|
exports.setAttr = setAttr;
|
|
1677
1674
|
exports.setHTML = setHTML;
|
|
1678
1675
|
exports.setHTMLUnsafe = setHTMLUnsafe;
|