@getforma/core 0.3.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 +279 -20
- package/dist/chunk-3U57L2TY.cjs +38 -0
- package/dist/chunk-3U57L2TY.cjs.map +1 -0
- package/dist/{chunk-5H52PKGF.js → chunk-N522P3G6.js} +37 -19
- 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-TSQ7AKFT.cjs → chunk-YMIMKO4W.cjs} +66 -25
- 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 +142 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -29
- package/dist/index.d.ts +70 -29
- package/dist/index.js +64 -60
- package/dist/index.js.map +1 -1
- package/dist/runtime-hardened.cjs +166 -39
- package/dist/runtime-hardened.cjs.map +1 -1
- package/dist/runtime-hardened.js +167 -40
- package/dist/runtime-hardened.js.map +1 -1
- package/dist/runtime.cjs +184 -57
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.js +162 -35
- 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 +37 -12
- package/dist/ssr/index.cjs.map +1 -1
- package/dist/ssr/index.js +37 -12
- 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-5H52PKGF.js.map +0 -1
- package/dist/chunk-FPSLC62A.cjs +0 -31
- package/dist/chunk-FPSLC62A.cjs.map +0 -1
- package/dist/chunk-KX5WRZH7.js +0 -27
- package/dist/chunk-KX5WRZH7.js.map +0 -1
- package/dist/chunk-TSQ7AKFT.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,15 +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 (
|
|
247
|
-
if (chunkTSQ7AKFT_cjs.__DEV__) console.warn(`[forma] Trigger "${trigger}" not yet implemented for island "${componentName}" (id=${id}), falling back to load`);
|
|
248
|
-
}
|
|
249
|
-
if (trigger === "visible") {
|
|
252
|
+
const trigger2 = root.getAttribute("data-forma-hydrate") || "load";
|
|
253
|
+
if (trigger2 === "visible") {
|
|
250
254
|
const observer = new IntersectionObserver(
|
|
251
255
|
(entries) => {
|
|
252
256
|
for (const entry of entries) {
|
|
@@ -258,23 +262,52 @@ function activateIslands(registry2) {
|
|
|
258
262
|
{ rootMargin: "200px" }
|
|
259
263
|
);
|
|
260
264
|
observer.observe(root);
|
|
265
|
+
} else if (trigger2 === "idle") {
|
|
266
|
+
const hydrate = () => hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps);
|
|
267
|
+
if (typeof requestIdleCallback === "function") {
|
|
268
|
+
requestIdleCallback(hydrate);
|
|
269
|
+
} else {
|
|
270
|
+
setTimeout(hydrate, 200);
|
|
271
|
+
}
|
|
272
|
+
} else if (trigger2 === "interaction") {
|
|
273
|
+
const hydrate = () => {
|
|
274
|
+
root.removeEventListener("pointerdown", hydrate, true);
|
|
275
|
+
root.removeEventListener("focusin", hydrate, true);
|
|
276
|
+
hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps);
|
|
277
|
+
};
|
|
278
|
+
root.addEventListener("pointerdown", hydrate, { capture: true, once: true });
|
|
279
|
+
root.addEventListener("focusin", hydrate, { capture: true, once: true });
|
|
261
280
|
} else {
|
|
262
281
|
hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps);
|
|
263
282
|
}
|
|
264
283
|
}
|
|
265
284
|
}
|
|
285
|
+
function deactivateIsland(el) {
|
|
286
|
+
const dispose = el.__formaDispose;
|
|
287
|
+
if (typeof dispose === "function") {
|
|
288
|
+
dispose();
|
|
289
|
+
delete el.__formaDispose;
|
|
290
|
+
el.setAttribute("data-forma-status", "disposed");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function deactivateAllIslands(root = document) {
|
|
294
|
+
const islands = root.querySelectorAll('[data-forma-status="active"]');
|
|
295
|
+
for (const island of islands) {
|
|
296
|
+
deactivateIsland(island);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
266
299
|
function hydrateIslandRoot(root, id, componentName, hydrateFn, sharedProps) {
|
|
267
300
|
try {
|
|
268
301
|
const props = loadIslandProps(root, id, sharedProps);
|
|
269
302
|
root.setAttribute("data-forma-status", "hydrating");
|
|
270
303
|
let activeRoot = root;
|
|
271
|
-
|
|
272
|
-
activeRoot =
|
|
304
|
+
chunkYMIMKO4W_cjs.createRoot((dispose) => {
|
|
305
|
+
activeRoot = chunkYMIMKO4W_cjs.hydrateIsland(() => hydrateFn(root, props), root);
|
|
273
306
|
activeRoot.__formaDispose = dispose;
|
|
274
307
|
});
|
|
275
308
|
activeRoot.setAttribute("data-forma-status", "active");
|
|
276
309
|
} catch (err) {
|
|
277
|
-
if (
|
|
310
|
+
if (chunkYMIMKO4W_cjs.__DEV__) console.error(`[forma] Island "${componentName}" (id=${id}) failed:`, err);
|
|
278
311
|
root.setAttribute("data-forma-status", "error");
|
|
279
312
|
}
|
|
280
313
|
}
|
|
@@ -322,13 +355,15 @@ function defineComponent(setupOrDef) {
|
|
|
322
355
|
for (const cb of ctx.unmountCallbacks) {
|
|
323
356
|
try {
|
|
324
357
|
cb();
|
|
325
|
-
} catch {
|
|
358
|
+
} catch (e) {
|
|
359
|
+
chunkYMIMKO4W_cjs.reportError(e, "onUnmount");
|
|
326
360
|
}
|
|
327
361
|
}
|
|
328
362
|
for (const d of ctx.disposers) {
|
|
329
363
|
try {
|
|
330
364
|
d();
|
|
331
|
-
} catch {
|
|
365
|
+
} catch (e) {
|
|
366
|
+
chunkYMIMKO4W_cjs.reportError(e, "component disposer");
|
|
332
367
|
}
|
|
333
368
|
}
|
|
334
369
|
ctx.disposers.length = 0;
|
|
@@ -342,7 +377,8 @@ function defineComponent(setupOrDef) {
|
|
|
342
377
|
if (typeof cleanup2 === "function") {
|
|
343
378
|
ctx.unmountCallbacks.push(cleanup2);
|
|
344
379
|
}
|
|
345
|
-
} catch {
|
|
380
|
+
} catch (e) {
|
|
381
|
+
chunkYMIMKO4W_cjs.reportError(e, "onMount");
|
|
346
382
|
}
|
|
347
383
|
}
|
|
348
384
|
return dom;
|
|
@@ -416,13 +452,15 @@ function shouldWrap(v) {
|
|
|
416
452
|
if (v[PROXY]) return false;
|
|
417
453
|
return true;
|
|
418
454
|
}
|
|
419
|
-
function deepClone(obj) {
|
|
420
|
-
if (obj
|
|
421
|
-
if (
|
|
422
|
-
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));
|
|
423
461
|
const out = {};
|
|
424
462
|
for (const key of Object.keys(obj)) {
|
|
425
|
-
out[key] = deepClone(obj[key]);
|
|
463
|
+
out[key] = deepClone(obj[key], seen);
|
|
426
464
|
}
|
|
427
465
|
return out;
|
|
428
466
|
}
|
|
@@ -443,7 +481,7 @@ function createStore(initial) {
|
|
|
443
481
|
function getSignal(path, initialValue) {
|
|
444
482
|
let pair = signals.get(path);
|
|
445
483
|
if (!pair) {
|
|
446
|
-
pair =
|
|
484
|
+
pair = chunk3U57L2TY_cjs.createSignal(initialValue);
|
|
447
485
|
signals.set(path, pair);
|
|
448
486
|
registerChild(path);
|
|
449
487
|
}
|
|
@@ -483,7 +521,7 @@ function createStore(initial) {
|
|
|
483
521
|
if (isArr && ARRAY_MUTATORS.has(key)) {
|
|
484
522
|
return (...args) => {
|
|
485
523
|
let result;
|
|
486
|
-
|
|
524
|
+
chunkYMIMKO4W_cjs.batch(() => {
|
|
487
525
|
const rawArgs = args.map(
|
|
488
526
|
(a) => a != null && typeof a === "object" && a[RAW] ? a[RAW] : a
|
|
489
527
|
);
|
|
@@ -597,11 +635,11 @@ function createStore(initial) {
|
|
|
597
635
|
}
|
|
598
636
|
const rootProxy = wrap(initial, "");
|
|
599
637
|
function getCurrentSnapshot() {
|
|
600
|
-
return
|
|
638
|
+
return chunkYMIMKO4W_cjs.untrack(() => deepClone(initial));
|
|
601
639
|
}
|
|
602
640
|
const setter = (partial) => {
|
|
603
641
|
const updates = typeof partial === "function" ? partial(getCurrentSnapshot()) : partial;
|
|
604
|
-
|
|
642
|
+
chunkYMIMKO4W_cjs.batch(() => {
|
|
605
643
|
for (const key of Object.keys(updates)) {
|
|
606
644
|
rootProxy[key] = updates[key];
|
|
607
645
|
}
|
|
@@ -616,11 +654,11 @@ function createHistory(source, options) {
|
|
|
616
654
|
const maxLength = options?.maxLength ?? 100;
|
|
617
655
|
let _stack = [sourceGet()];
|
|
618
656
|
let _cursor = 0;
|
|
619
|
-
const [stackSignal, setStackSignal] =
|
|
620
|
-
const [cursorSignal, setCursorSignal] =
|
|
621
|
-
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);
|
|
622
660
|
function syncSignals() {
|
|
623
|
-
|
|
661
|
+
chunkYMIMKO4W_cjs.batch(() => {
|
|
624
662
|
setStackSignal([..._stack]);
|
|
625
663
|
setCursorSignal(_cursor);
|
|
626
664
|
setStackLenSignal(_stack.length);
|
|
@@ -628,7 +666,7 @@ function createHistory(source, options) {
|
|
|
628
666
|
}
|
|
629
667
|
let ignoreNext = false;
|
|
630
668
|
let isFirstRun = true;
|
|
631
|
-
|
|
669
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
632
670
|
const value = sourceGet();
|
|
633
671
|
if (isFirstRun) {
|
|
634
672
|
isFirstRun = false;
|
|
@@ -696,7 +734,7 @@ function persist(source, key, options) {
|
|
|
696
734
|
}
|
|
697
735
|
} catch {
|
|
698
736
|
}
|
|
699
|
-
|
|
737
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
700
738
|
const value = sourceGet();
|
|
701
739
|
try {
|
|
702
740
|
const serialized = serialize(value);
|
|
@@ -1101,9 +1139,9 @@ function createIndexedDB(dbName, storeName = "default") {
|
|
|
1101
1139
|
|
|
1102
1140
|
// src/http/fetch.ts
|
|
1103
1141
|
function createFetch(url, options) {
|
|
1104
|
-
const [data, setData] =
|
|
1105
|
-
const [error, setError] =
|
|
1106
|
-
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);
|
|
1107
1145
|
let currentController = null;
|
|
1108
1146
|
function resolveURL() {
|
|
1109
1147
|
const raw = typeof url === "function" ? url() : url;
|
|
@@ -1153,7 +1191,7 @@ function createFetch(url, options) {
|
|
|
1153
1191
|
}
|
|
1154
1192
|
}
|
|
1155
1193
|
if (typeof url === "function") {
|
|
1156
|
-
|
|
1194
|
+
chunkYMIMKO4W_cjs.internalEffect(() => {
|
|
1157
1195
|
url();
|
|
1158
1196
|
execute();
|
|
1159
1197
|
});
|
|
@@ -1182,9 +1220,9 @@ async function fetchJSON(url, options) {
|
|
|
1182
1220
|
|
|
1183
1221
|
// src/http/sse.ts
|
|
1184
1222
|
function createSSE(url, options) {
|
|
1185
|
-
const [data, setData] =
|
|
1186
|
-
const [error, setError] =
|
|
1187
|
-
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);
|
|
1188
1226
|
const source = new EventSource(url, {
|
|
1189
1227
|
withCredentials: options?.withCredentials ?? false
|
|
1190
1228
|
});
|
|
@@ -1238,8 +1276,8 @@ function createWebSocket(url, options) {
|
|
|
1238
1276
|
const shouldReconnect = options?.reconnect ?? true;
|
|
1239
1277
|
const baseInterval = options?.reconnectInterval ?? 1e3;
|
|
1240
1278
|
const maxReconnects = options?.maxReconnects ?? 5;
|
|
1241
|
-
const [data, setData] =
|
|
1242
|
-
const [status, setStatus] =
|
|
1279
|
+
const [data, setData] = chunk3U57L2TY_cjs.createSignal(null);
|
|
1280
|
+
const [status, setStatus] = chunk3U57L2TY_cjs.createSignal("connecting");
|
|
1243
1281
|
const handlers = /* @__PURE__ */ new Set();
|
|
1244
1282
|
let socket = null;
|
|
1245
1283
|
let reconnectCount = 0;
|
|
@@ -1315,21 +1353,21 @@ function createWebSocket(url, options) {
|
|
|
1315
1353
|
|
|
1316
1354
|
// src/server/action.ts
|
|
1317
1355
|
function createAction(serverFn, options) {
|
|
1318
|
-
const [pending, setPending] =
|
|
1319
|
-
const [error, setError] =
|
|
1356
|
+
const [pending, setPending] = chunk3U57L2TY_cjs.createSignal(false);
|
|
1357
|
+
const [error, setError] = chunk3U57L2TY_cjs.createSignal(void 0);
|
|
1320
1358
|
const action = async (...args) => {
|
|
1321
1359
|
setPending(true);
|
|
1322
1360
|
setError(void 0);
|
|
1323
1361
|
if (options?.optimistic) {
|
|
1324
1362
|
try {
|
|
1325
|
-
|
|
1363
|
+
chunkYMIMKO4W_cjs.batch(() => options.optimistic(...args));
|
|
1326
1364
|
} catch {
|
|
1327
1365
|
}
|
|
1328
1366
|
}
|
|
1329
1367
|
try {
|
|
1330
1368
|
const result = await serverFn(...args);
|
|
1331
1369
|
if (options?.onSuccess) {
|
|
1332
|
-
|
|
1370
|
+
chunkYMIMKO4W_cjs.batch(() => options.onSuccess(result, ...args));
|
|
1333
1371
|
}
|
|
1334
1372
|
if (options?.invalidates) {
|
|
1335
1373
|
for (const resource of options.invalidates) {
|
|
@@ -1341,7 +1379,7 @@ function createAction(serverFn, options) {
|
|
|
1341
1379
|
} catch (err) {
|
|
1342
1380
|
if (options?.onError) {
|
|
1343
1381
|
try {
|
|
1344
|
-
|
|
1382
|
+
chunkYMIMKO4W_cjs.batch(() => options.onError(err, ...args));
|
|
1345
1383
|
} catch {
|
|
1346
1384
|
}
|
|
1347
1385
|
}
|
|
@@ -1473,127 +1511,113 @@ function createRPCMiddleware() {
|
|
|
1473
1511
|
};
|
|
1474
1512
|
}
|
|
1475
1513
|
|
|
1476
|
-
// src/wasm/forma-wasm.ts
|
|
1477
|
-
var wasmModule = null;
|
|
1478
|
-
var irCache = /* @__PURE__ */ new Map();
|
|
1479
|
-
async function ensureWasm() {
|
|
1480
|
-
if (wasmModule) return wasmModule;
|
|
1481
|
-
const config = window.__FORMA_WASM__;
|
|
1482
|
-
if (!config) throw new Error("No __FORMA_WASM__ config");
|
|
1483
|
-
const mod = await import(
|
|
1484
|
-
/* @vite-ignore */
|
|
1485
|
-
config.loader
|
|
1486
|
-
);
|
|
1487
|
-
await mod.default(config.binary);
|
|
1488
|
-
wasmModule = mod;
|
|
1489
|
-
return wasmModule;
|
|
1490
|
-
}
|
|
1491
|
-
async function getIR() {
|
|
1492
|
-
const config = window.__FORMA_WASM__;
|
|
1493
|
-
if (!config) throw new Error("No __FORMA_WASM__ config");
|
|
1494
|
-
const cached = irCache.get(config.ir);
|
|
1495
|
-
if (cached) return cached;
|
|
1496
|
-
const response = await fetch(config.ir);
|
|
1497
|
-
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
1498
|
-
irCache.set(config.ir, bytes);
|
|
1499
|
-
return bytes;
|
|
1500
|
-
}
|
|
1501
|
-
async function renderLocal(slotsJson) {
|
|
1502
|
-
const [wasm, ir] = await Promise.all([ensureWasm(), getIR()]);
|
|
1503
|
-
return wasm.render(ir, slotsJson);
|
|
1504
|
-
}
|
|
1505
|
-
async function renderIsland(slotsJson, islandId) {
|
|
1506
|
-
const [wasm, ir] = await Promise.all([ensureWasm(), getIR()]);
|
|
1507
|
-
return wasm.render_island(ir, slotsJson, islandId);
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
1514
|
Object.defineProperty(exports, "Fragment", {
|
|
1511
1515
|
enumerable: true,
|
|
1512
|
-
get: function () { return
|
|
1516
|
+
get: function () { return chunkYMIMKO4W_cjs.Fragment; }
|
|
1513
1517
|
});
|
|
1514
1518
|
Object.defineProperty(exports, "batch", {
|
|
1515
1519
|
enumerable: true,
|
|
1516
|
-
get: function () { return
|
|
1520
|
+
get: function () { return chunkYMIMKO4W_cjs.batch; }
|
|
1517
1521
|
});
|
|
1518
1522
|
Object.defineProperty(exports, "cleanup", {
|
|
1519
1523
|
enumerable: true,
|
|
1520
|
-
get: function () { return
|
|
1524
|
+
get: function () { return chunkYMIMKO4W_cjs.cleanup; }
|
|
1521
1525
|
});
|
|
1522
1526
|
Object.defineProperty(exports, "createEffect", {
|
|
1523
1527
|
enumerable: true,
|
|
1524
|
-
get: function () { return
|
|
1528
|
+
get: function () { return chunkYMIMKO4W_cjs.createEffect; }
|
|
1525
1529
|
});
|
|
1526
1530
|
Object.defineProperty(exports, "createList", {
|
|
1527
1531
|
enumerable: true,
|
|
1528
|
-
get: function () { return
|
|
1532
|
+
get: function () { return chunkYMIMKO4W_cjs.createList; }
|
|
1529
1533
|
});
|
|
1530
1534
|
Object.defineProperty(exports, "createMemo", {
|
|
1531
1535
|
enumerable: true,
|
|
1532
|
-
get: function () { return
|
|
1536
|
+
get: function () { return chunkYMIMKO4W_cjs.createMemo; }
|
|
1533
1537
|
});
|
|
1534
1538
|
Object.defineProperty(exports, "createReducer", {
|
|
1535
1539
|
enumerable: true,
|
|
1536
|
-
get: function () { return
|
|
1540
|
+
get: function () { return chunkYMIMKO4W_cjs.createReducer; }
|
|
1537
1541
|
});
|
|
1538
1542
|
Object.defineProperty(exports, "createRef", {
|
|
1539
1543
|
enumerable: true,
|
|
1540
|
-
get: function () { return
|
|
1544
|
+
get: function () { return chunkYMIMKO4W_cjs.createRef; }
|
|
1541
1545
|
});
|
|
1542
1546
|
Object.defineProperty(exports, "createResource", {
|
|
1543
1547
|
enumerable: true,
|
|
1544
|
-
get: function () { return
|
|
1548
|
+
get: function () { return chunkYMIMKO4W_cjs.createResource; }
|
|
1545
1549
|
});
|
|
1546
1550
|
Object.defineProperty(exports, "createRoot", {
|
|
1547
1551
|
enumerable: true,
|
|
1548
|
-
get: function () { return
|
|
1552
|
+
get: function () { return chunkYMIMKO4W_cjs.createRoot; }
|
|
1549
1553
|
});
|
|
1550
1554
|
Object.defineProperty(exports, "createShow", {
|
|
1551
1555
|
enumerable: true,
|
|
1552
|
-
get: function () { return
|
|
1556
|
+
get: function () { return chunkYMIMKO4W_cjs.createShow; }
|
|
1553
1557
|
});
|
|
1554
1558
|
Object.defineProperty(exports, "fragment", {
|
|
1555
1559
|
enumerable: true,
|
|
1556
|
-
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; }
|
|
1557
1565
|
});
|
|
1558
1566
|
Object.defineProperty(exports, "h", {
|
|
1559
1567
|
enumerable: true,
|
|
1560
|
-
get: function () { return
|
|
1568
|
+
get: function () { return chunkYMIMKO4W_cjs.h; }
|
|
1561
1569
|
});
|
|
1562
1570
|
Object.defineProperty(exports, "hydrateIsland", {
|
|
1563
1571
|
enumerable: true,
|
|
1564
|
-
get: function () { return
|
|
1572
|
+
get: function () { return chunkYMIMKO4W_cjs.hydrateIsland; }
|
|
1565
1573
|
});
|
|
1566
|
-
Object.defineProperty(exports, "
|
|
1574
|
+
Object.defineProperty(exports, "isComputed", {
|
|
1567
1575
|
enumerable: true,
|
|
1568
|
-
get: function () { return
|
|
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; }
|
|
1569
1589
|
});
|
|
1570
1590
|
Object.defineProperty(exports, "on", {
|
|
1571
1591
|
enumerable: true,
|
|
1572
|
-
get: function () { return
|
|
1592
|
+
get: function () { return chunkYMIMKO4W_cjs.on; }
|
|
1573
1593
|
});
|
|
1574
1594
|
Object.defineProperty(exports, "onCleanup", {
|
|
1575
1595
|
enumerable: true,
|
|
1576
|
-
get: function () { return
|
|
1596
|
+
get: function () { return chunkYMIMKO4W_cjs.onCleanup; }
|
|
1577
1597
|
});
|
|
1578
1598
|
Object.defineProperty(exports, "onError", {
|
|
1579
1599
|
enumerable: true,
|
|
1580
|
-
get: function () { return
|
|
1600
|
+
get: function () { return chunkYMIMKO4W_cjs.onError; }
|
|
1581
1601
|
});
|
|
1582
1602
|
Object.defineProperty(exports, "reconcileList", {
|
|
1583
1603
|
enumerable: true,
|
|
1584
|
-
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; }
|
|
1585
1609
|
});
|
|
1586
1610
|
Object.defineProperty(exports, "untrack", {
|
|
1587
1611
|
enumerable: true,
|
|
1588
|
-
get: function () { return
|
|
1612
|
+
get: function () { return chunkYMIMKO4W_cjs.untrack; }
|
|
1589
1613
|
});
|
|
1590
1614
|
Object.defineProperty(exports, "createComputed", {
|
|
1591
1615
|
enumerable: true,
|
|
1592
|
-
get: function () { return
|
|
1616
|
+
get: function () { return chunk3U57L2TY_cjs.createComputed; }
|
|
1593
1617
|
});
|
|
1594
1618
|
Object.defineProperty(exports, "createSignal", {
|
|
1595
1619
|
enumerable: true,
|
|
1596
|
-
get: function () { return
|
|
1620
|
+
get: function () { return chunk3U57L2TY_cjs.createSignal; }
|
|
1597
1621
|
});
|
|
1598
1622
|
exports.$ = $;
|
|
1599
1623
|
exports.$$ = $$;
|
|
@@ -1620,6 +1644,8 @@ exports.createSuspense = createSuspense;
|
|
|
1620
1644
|
exports.createSwitch = createSwitch;
|
|
1621
1645
|
exports.createText = createText;
|
|
1622
1646
|
exports.createWebSocket = createWebSocket;
|
|
1647
|
+
exports.deactivateAllIslands = deactivateAllIslands;
|
|
1648
|
+
exports.deactivateIsland = deactivateIsland;
|
|
1623
1649
|
exports.defineComponent = defineComponent;
|
|
1624
1650
|
exports.delegate = delegate;
|
|
1625
1651
|
exports.disposeComponent = disposeComponent;
|
|
@@ -1644,8 +1670,6 @@ exports.provide = provide;
|
|
|
1644
1670
|
exports.registerResource = registerResource;
|
|
1645
1671
|
exports.registerServerFunction = registerServerFunction;
|
|
1646
1672
|
exports.removeClass = removeClass;
|
|
1647
|
-
exports.renderIsland = renderIsland;
|
|
1648
|
-
exports.renderLocal = renderLocal;
|
|
1649
1673
|
exports.setAttr = setAttr;
|
|
1650
1674
|
exports.setHTML = setHTML;
|
|
1651
1675
|
exports.setHTMLUnsafe = setHTMLUnsafe;
|