solid-js 2.0.0-beta.6 → 2.0.0-beta.7
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/dev.cjs +56 -74
- package/dist/dev.js +56 -74
- package/dist/server.cjs +209 -95
- package/dist/server.js +209 -95
- package/dist/solid.cjs +56 -74
- package/dist/solid.js +56 -74
- package/package.json +78 -30
- package/types/client/hydration.d.ts +4 -3
- package/types/jsx-properties.d.ts +95 -0
- package/types/jsx.d.ts +282 -237
- package/types/server/signals.d.ts +8 -10
- package/types-cjs/client/component.d.cts +75 -0
- package/types-cjs/client/core.d.cts +58 -0
- package/types-cjs/client/flow.d.cts +142 -0
- package/types-cjs/client/hydration.d.cts +96 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/jsx-properties.d.cts +95 -0
- package/types-cjs/jsx.d.cts +4263 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server/component.d.cts +67 -0
- package/types-cjs/server/core.d.cts +44 -0
- package/types-cjs/server/flow.d.cts +82 -0
- package/types-cjs/server/hydration.d.cts +46 -0
- package/types-cjs/server/index.d.cts +12 -0
- package/types-cjs/server/shared.d.cts +50 -0
- package/types-cjs/server/signals.d.cts +67 -0
package/dist/dev.cjs
CHANGED
|
@@ -19,10 +19,10 @@ function useContext(context) {
|
|
|
19
19
|
return signals.getContext(context);
|
|
20
20
|
}
|
|
21
21
|
function children(fn) {
|
|
22
|
-
const c = signals.createMemo(fn,
|
|
22
|
+
const c = signals.createMemo(fn, {
|
|
23
23
|
lazy: true
|
|
24
24
|
});
|
|
25
|
-
const memo = signals.createMemo(() => signals.flatten(c()),
|
|
25
|
+
const memo = signals.createMemo(() => signals.flatten(c()), {
|
|
26
26
|
name: "children",
|
|
27
27
|
lazy: true
|
|
28
28
|
} );
|
|
@@ -282,7 +282,7 @@ function wrapFirstYield(iterable, activate) {
|
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
|
-
function hydrateSignalFromAsyncIterable(coreFn, compute,
|
|
285
|
+
function hydrateSignalFromAsyncIterable(coreFn, compute, options) {
|
|
286
286
|
const parent = signals.getOwner();
|
|
287
287
|
const expectedId = signals.peekNextChildId(parent);
|
|
288
288
|
if (!sharedConfig.has(expectedId)) return null;
|
|
@@ -294,7 +294,7 @@ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
|
|
|
294
294
|
return it;
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
|
-
return coreFn(() => iterable,
|
|
297
|
+
return coreFn(() => iterable, options);
|
|
298
298
|
}
|
|
299
299
|
function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
300
300
|
const parent = signals.getOwner();
|
|
@@ -369,20 +369,20 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
|
369
369
|
};
|
|
370
370
|
}, initialValue, options);
|
|
371
371
|
}
|
|
372
|
-
function hydratedCreateMemo(compute,
|
|
372
|
+
function hydratedCreateMemo(compute, options) {
|
|
373
373
|
if (!sharedConfig.hydrating || options?.transparent) {
|
|
374
|
-
return signals.createMemo(compute,
|
|
374
|
+
return signals.createMemo(compute, options);
|
|
375
375
|
}
|
|
376
376
|
markTopLevelSnapshotScope();
|
|
377
377
|
const ssrSource = options?.ssrSource;
|
|
378
378
|
if (ssrSource === "client") {
|
|
379
379
|
const [hydrated, setHydrated] = signals.createSignal(false, {
|
|
380
|
-
|
|
380
|
+
ownedWrite: true
|
|
381
381
|
});
|
|
382
382
|
const memo = signals.createMemo(prev => {
|
|
383
|
-
if (!hydrated()) return prev
|
|
383
|
+
if (!hydrated()) return prev;
|
|
384
384
|
return compute(prev);
|
|
385
|
-
},
|
|
385
|
+
}, options);
|
|
386
386
|
setHydrated(true);
|
|
387
387
|
return memo;
|
|
388
388
|
}
|
|
@@ -390,25 +390,25 @@ function hydratedCreateMemo(compute, value, options) {
|
|
|
390
390
|
return signals.createMemo(prev => {
|
|
391
391
|
if (!sharedConfig.hydrating) return compute(prev);
|
|
392
392
|
subFetch(compute, prev);
|
|
393
|
-
return prev
|
|
394
|
-
},
|
|
393
|
+
return prev;
|
|
394
|
+
}, options);
|
|
395
395
|
}
|
|
396
|
-
const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute,
|
|
396
|
+
const aiResult = hydrateSignalFromAsyncIterable(signals.createMemo, compute, options);
|
|
397
397
|
if (aiResult !== null) return aiResult;
|
|
398
|
-
return signals.createMemo(prev => readSerializedOrCompute(compute, prev),
|
|
398
|
+
return signals.createMemo(prev => readSerializedOrCompute(compute, prev), options);
|
|
399
399
|
}
|
|
400
|
-
function hydratedCreateSignal(fn, second
|
|
401
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second
|
|
400
|
+
function hydratedCreateSignal(fn, second) {
|
|
401
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createSignal(fn, second);
|
|
402
402
|
markTopLevelSnapshotScope();
|
|
403
|
-
const ssrSource =
|
|
403
|
+
const ssrSource = second?.ssrSource;
|
|
404
404
|
if (ssrSource === "client") {
|
|
405
405
|
const [hydrated, setHydrated] = signals.createSignal(false, {
|
|
406
|
-
|
|
406
|
+
ownedWrite: true
|
|
407
407
|
});
|
|
408
408
|
const sig = signals.createSignal(prev => {
|
|
409
|
-
if (!hydrated()) return prev
|
|
409
|
+
if (!hydrated()) return prev;
|
|
410
410
|
return fn(prev);
|
|
411
|
-
}, second
|
|
411
|
+
}, second);
|
|
412
412
|
setHydrated(true);
|
|
413
413
|
return sig;
|
|
414
414
|
}
|
|
@@ -416,12 +416,12 @@ function hydratedCreateSignal(fn, second, third) {
|
|
|
416
416
|
return signals.createSignal(prev => {
|
|
417
417
|
if (!sharedConfig.hydrating) return fn(prev);
|
|
418
418
|
subFetch(fn, prev);
|
|
419
|
-
return prev
|
|
420
|
-
}, second
|
|
419
|
+
return prev;
|
|
420
|
+
}, second);
|
|
421
421
|
}
|
|
422
|
-
const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second
|
|
422
|
+
const aiResult = hydrateSignalFromAsyncIterable(signals.createSignal, fn, second);
|
|
423
423
|
if (aiResult !== null) return aiResult;
|
|
424
|
-
return signals.createSignal(prev => readSerializedOrCompute(fn, prev), second
|
|
424
|
+
return signals.createSignal(prev => readSerializedOrCompute(fn, prev), second);
|
|
425
425
|
}
|
|
426
426
|
function hydratedCreateErrorBoundary(fn, fallback) {
|
|
427
427
|
if (!sharedConfig.hydrating) return signals.createErrorBoundary(fn, fallback);
|
|
@@ -443,18 +443,18 @@ function hydratedCreateErrorBoundary(fn, fallback) {
|
|
|
443
443
|
}
|
|
444
444
|
return signals.createErrorBoundary(fn, fallback);
|
|
445
445
|
}
|
|
446
|
-
function hydratedCreateOptimistic(fn, second
|
|
447
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second
|
|
446
|
+
function hydratedCreateOptimistic(fn, second) {
|
|
447
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return signals.createOptimistic(fn, second);
|
|
448
448
|
markTopLevelSnapshotScope();
|
|
449
|
-
const ssrSource =
|
|
449
|
+
const ssrSource = second?.ssrSource;
|
|
450
450
|
if (ssrSource === "client") {
|
|
451
451
|
const [hydrated, setHydrated] = signals.createSignal(false, {
|
|
452
|
-
|
|
452
|
+
ownedWrite: true
|
|
453
453
|
});
|
|
454
454
|
const sig = signals.createOptimistic(prev => {
|
|
455
|
-
if (!hydrated()) return prev
|
|
455
|
+
if (!hydrated()) return prev;
|
|
456
456
|
return fn(prev);
|
|
457
|
-
}, second
|
|
457
|
+
}, second);
|
|
458
458
|
setHydrated(true);
|
|
459
459
|
return sig;
|
|
460
460
|
}
|
|
@@ -462,12 +462,12 @@ function hydratedCreateOptimistic(fn, second, third) {
|
|
|
462
462
|
return signals.createOptimistic(prev => {
|
|
463
463
|
if (!sharedConfig.hydrating) return fn(prev);
|
|
464
464
|
subFetch(fn, prev);
|
|
465
|
-
return prev
|
|
466
|
-
}, second
|
|
465
|
+
return prev;
|
|
466
|
+
}, second);
|
|
467
467
|
}
|
|
468
|
-
const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second
|
|
468
|
+
const aiResult = hydrateSignalFromAsyncIterable(signals.createOptimistic, fn, second);
|
|
469
469
|
if (aiResult !== null) return aiResult;
|
|
470
|
-
return signals.createOptimistic(prev => readSerializedOrCompute(fn, prev), second
|
|
470
|
+
return signals.createOptimistic(prev => readSerializedOrCompute(fn, prev), second);
|
|
471
471
|
}
|
|
472
472
|
function wrapStoreFn(fn) {
|
|
473
473
|
return draft => readSerializedOrCompute(() => fn(draft), draft);
|
|
@@ -475,7 +475,7 @@ function wrapStoreFn(fn) {
|
|
|
475
475
|
function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
476
476
|
if (ssrSource === "client") {
|
|
477
477
|
const [hydrated, setHydrated] = signals.createSignal(false, {
|
|
478
|
-
|
|
478
|
+
ownedWrite: true
|
|
479
479
|
});
|
|
480
480
|
const result = coreFn(draft => {
|
|
481
481
|
if (!hydrated()) return;
|
|
@@ -486,7 +486,7 @@ function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
|
486
486
|
}
|
|
487
487
|
if (ssrSource === "hybrid") {
|
|
488
488
|
const [hydrated, setHydrated] = signals.createSignal(false, {
|
|
489
|
-
|
|
489
|
+
ownedWrite: true
|
|
490
490
|
});
|
|
491
491
|
const result = coreFn(draft => {
|
|
492
492
|
const o = signals.getOwner();
|
|
@@ -516,14 +516,14 @@ function hydratedCreateStore(first, second, third) {
|
|
|
516
516
|
if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createStore(first, second, third);
|
|
517
517
|
markTopLevelSnapshotScope();
|
|
518
518
|
const ssrSource = third?.ssrSource;
|
|
519
|
-
if (ssrSource === "initial") return signals.createStore(second ?? {}
|
|
519
|
+
if (ssrSource === "initial") return signals.createStore(second ?? {});
|
|
520
520
|
return hydrateStoreLikeFn(signals.createStore, first, second ?? {}, third, ssrSource);
|
|
521
521
|
}
|
|
522
522
|
function hydratedCreateOptimisticStore(first, second, third) {
|
|
523
523
|
if (typeof first !== "function" || !sharedConfig.hydrating) return signals.createOptimisticStore(first, second, third);
|
|
524
524
|
markTopLevelSnapshotScope();
|
|
525
525
|
const ssrSource = third?.ssrSource;
|
|
526
|
-
if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {}
|
|
526
|
+
if (ssrSource === "initial") return signals.createOptimisticStore(second ?? {});
|
|
527
527
|
return hydrateStoreLikeFn(signals.createOptimisticStore, first, second ?? {}, third, ssrSource);
|
|
528
528
|
}
|
|
529
529
|
function hydratedCreateProjection(fn, initialValue, options) {
|
|
@@ -533,22 +533,22 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
533
533
|
if (ssrSource === "initial") return signals.createProjection(draft => draft, initialValue, options);
|
|
534
534
|
return hydrateStoreLikeFn(signals.createProjection, fn, initialValue, options, ssrSource);
|
|
535
535
|
}
|
|
536
|
-
function hydratedEffect(coreFn, compute, effectFn,
|
|
537
|
-
if (!sharedConfig.hydrating) return coreFn(compute, effectFn,
|
|
536
|
+
function hydratedEffect(coreFn, compute, effectFn, options) {
|
|
537
|
+
if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options);
|
|
538
538
|
const ssrSource = options?.ssrSource;
|
|
539
539
|
if (ssrSource === "client") {
|
|
540
540
|
const [hydrated, setHydrated] = signals.createSignal(false, {
|
|
541
|
-
|
|
541
|
+
ownedWrite: true
|
|
542
542
|
});
|
|
543
543
|
let active = false;
|
|
544
544
|
coreFn(prev => {
|
|
545
|
-
if (!hydrated()) return
|
|
545
|
+
if (!hydrated()) return prev;
|
|
546
546
|
active = true;
|
|
547
547
|
return compute(prev);
|
|
548
548
|
}, (next, prev) => {
|
|
549
549
|
if (!active) return;
|
|
550
550
|
return effectFn(next, prev);
|
|
551
|
-
},
|
|
551
|
+
}, options);
|
|
552
552
|
setHydrated(true);
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
@@ -556,18 +556,18 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
|
556
556
|
coreFn(prev => {
|
|
557
557
|
if (!sharedConfig.hydrating) return compute(prev);
|
|
558
558
|
subFetch(compute, prev);
|
|
559
|
-
return prev
|
|
560
|
-
}, effectFn,
|
|
559
|
+
return prev;
|
|
560
|
+
}, effectFn, options);
|
|
561
561
|
return;
|
|
562
562
|
}
|
|
563
563
|
markTopLevelSnapshotScope();
|
|
564
|
-
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn,
|
|
564
|
+
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options);
|
|
565
565
|
}
|
|
566
|
-
function hydratedCreateRenderEffect(compute, effectFn,
|
|
567
|
-
return hydratedEffect(signals.createRenderEffect, compute, effectFn,
|
|
566
|
+
function hydratedCreateRenderEffect(compute, effectFn, options) {
|
|
567
|
+
return hydratedEffect(signals.createRenderEffect, compute, effectFn, options);
|
|
568
568
|
}
|
|
569
|
-
function hydratedCreateEffect(compute, effectFn,
|
|
570
|
-
return hydratedEffect(signals.createEffect, compute, effectFn,
|
|
569
|
+
function hydratedCreateEffect(compute, effectFn, options) {
|
|
570
|
+
return hydratedEffect(signals.createEffect, compute, effectFn, options);
|
|
571
571
|
}
|
|
572
572
|
function enableHydration() {
|
|
573
573
|
_createMemo = hydratedCreateMemo;
|
|
@@ -626,24 +626,6 @@ const createStore = (...args) => (_createStore || signals.createStore)(...args);
|
|
|
626
626
|
const createOptimisticStore = (...args) => (_createOptimisticStore || signals.createOptimisticStore)(...args);
|
|
627
627
|
const createRenderEffect = (...args) => (_createRenderEffect || signals.createRenderEffect)(...args);
|
|
628
628
|
const createEffect = (...args) => (_createEffect || signals.createEffect)(...args);
|
|
629
|
-
function loadModuleAssets(mapping) {
|
|
630
|
-
const hy = globalThis._$HY;
|
|
631
|
-
if (!hy) return;
|
|
632
|
-
if (!hy.modules) hy.modules = {};
|
|
633
|
-
if (!hy.loading) hy.loading = {};
|
|
634
|
-
const pending = [];
|
|
635
|
-
for (const moduleUrl in mapping) {
|
|
636
|
-
if (hy.modules[moduleUrl]) continue;
|
|
637
|
-
const entryUrl = mapping[moduleUrl];
|
|
638
|
-
if (!hy.loading[moduleUrl]) {
|
|
639
|
-
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
640
|
-
hy.modules[moduleUrl] = mod;
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
pending.push(hy.loading[moduleUrl]);
|
|
644
|
-
}
|
|
645
|
-
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
646
|
-
}
|
|
647
629
|
function createBoundaryTrigger() {
|
|
648
630
|
signals.setSnapshotCapture(false);
|
|
649
631
|
const [s, set] = signals.createSignal(undefined, {
|
|
@@ -712,7 +694,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
712
694
|
let assetPromise;
|
|
713
695
|
if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
|
|
714
696
|
const mapping = sharedConfig.load(id + "_assets");
|
|
715
|
-
if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
|
|
697
|
+
if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping);
|
|
716
698
|
}
|
|
717
699
|
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
718
700
|
const ref = sharedConfig.load(id);
|
|
@@ -831,10 +813,10 @@ function Repeat(props) {
|
|
|
831
813
|
}
|
|
832
814
|
function Show(props) {
|
|
833
815
|
const keyed = props.keyed;
|
|
834
|
-
const conditionValue = signals.createMemo(() => props.when,
|
|
816
|
+
const conditionValue = signals.createMemo(() => props.when, {
|
|
835
817
|
name: "condition value"
|
|
836
818
|
} );
|
|
837
|
-
const condition = keyed ? conditionValue : signals.createMemo(conditionValue,
|
|
819
|
+
const condition = keyed ? conditionValue : signals.createMemo(conditionValue, {
|
|
838
820
|
equals: (a, b) => !a === !b,
|
|
839
821
|
name: "condition"
|
|
840
822
|
} );
|
|
@@ -849,7 +831,7 @@ function Show(props) {
|
|
|
849
831
|
}), "<Show>") : child;
|
|
850
832
|
}
|
|
851
833
|
return props.fallback;
|
|
852
|
-
},
|
|
834
|
+
}, {
|
|
853
835
|
name: "value"
|
|
854
836
|
} );
|
|
855
837
|
}
|
|
@@ -862,10 +844,10 @@ function Switch(props) {
|
|
|
862
844
|
const index = i;
|
|
863
845
|
const mp = mps[i];
|
|
864
846
|
const prevFunc = func;
|
|
865
|
-
const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when,
|
|
847
|
+
const conditionValue = signals.createMemo(() => prevFunc() ? undefined : mp.when, {
|
|
866
848
|
name: "condition value"
|
|
867
849
|
} );
|
|
868
|
-
const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue,
|
|
850
|
+
const condition = mp.keyed ? conditionValue : signals.createMemo(conditionValue, {
|
|
869
851
|
equals: (a, b) => !a === !b,
|
|
870
852
|
name: "condition"
|
|
871
853
|
} );
|
|
@@ -883,7 +865,7 @@ function Switch(props) {
|
|
|
883
865
|
if (signals.untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
884
866
|
return conditionValue();
|
|
885
867
|
}), "<Match>") : child;
|
|
886
|
-
},
|
|
868
|
+
}, {
|
|
887
869
|
name: "eval conditions"
|
|
888
870
|
} );
|
|
889
871
|
}
|
package/dist/dev.js
CHANGED
|
@@ -18,10 +18,10 @@ function useContext(context) {
|
|
|
18
18
|
return getContext(context);
|
|
19
19
|
}
|
|
20
20
|
function children(fn) {
|
|
21
|
-
const c = createMemo$1(fn,
|
|
21
|
+
const c = createMemo$1(fn, {
|
|
22
22
|
lazy: true
|
|
23
23
|
});
|
|
24
|
-
const memo = createMemo$1(() => flatten(c()),
|
|
24
|
+
const memo = createMemo$1(() => flatten(c()), {
|
|
25
25
|
name: "children",
|
|
26
26
|
lazy: true
|
|
27
27
|
} );
|
|
@@ -281,7 +281,7 @@ function wrapFirstYield(iterable, activate) {
|
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
-
function hydrateSignalFromAsyncIterable(coreFn, compute,
|
|
284
|
+
function hydrateSignalFromAsyncIterable(coreFn, compute, options) {
|
|
285
285
|
const parent = getOwner();
|
|
286
286
|
const expectedId = peekNextChildId(parent);
|
|
287
287
|
if (!sharedConfig.has(expectedId)) return null;
|
|
@@ -293,7 +293,7 @@ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
|
|
|
293
293
|
return it;
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
return coreFn(() => iterable,
|
|
296
|
+
return coreFn(() => iterable, options);
|
|
297
297
|
}
|
|
298
298
|
function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
299
299
|
const parent = getOwner();
|
|
@@ -368,20 +368,20 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
|
368
368
|
};
|
|
369
369
|
}, initialValue, options);
|
|
370
370
|
}
|
|
371
|
-
function hydratedCreateMemo(compute,
|
|
371
|
+
function hydratedCreateMemo(compute, options) {
|
|
372
372
|
if (!sharedConfig.hydrating || options?.transparent) {
|
|
373
|
-
return createMemo$1(compute,
|
|
373
|
+
return createMemo$1(compute, options);
|
|
374
374
|
}
|
|
375
375
|
markTopLevelSnapshotScope();
|
|
376
376
|
const ssrSource = options?.ssrSource;
|
|
377
377
|
if (ssrSource === "client") {
|
|
378
378
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
379
|
-
|
|
379
|
+
ownedWrite: true
|
|
380
380
|
});
|
|
381
381
|
const memo = createMemo$1(prev => {
|
|
382
|
-
if (!hydrated()) return prev
|
|
382
|
+
if (!hydrated()) return prev;
|
|
383
383
|
return compute(prev);
|
|
384
|
-
},
|
|
384
|
+
}, options);
|
|
385
385
|
setHydrated(true);
|
|
386
386
|
return memo;
|
|
387
387
|
}
|
|
@@ -389,25 +389,25 @@ function hydratedCreateMemo(compute, value, options) {
|
|
|
389
389
|
return createMemo$1(prev => {
|
|
390
390
|
if (!sharedConfig.hydrating) return compute(prev);
|
|
391
391
|
subFetch(compute, prev);
|
|
392
|
-
return prev
|
|
393
|
-
},
|
|
392
|
+
return prev;
|
|
393
|
+
}, options);
|
|
394
394
|
}
|
|
395
|
-
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute,
|
|
395
|
+
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, options);
|
|
396
396
|
if (aiResult !== null) return aiResult;
|
|
397
|
-
return createMemo$1(prev => readSerializedOrCompute(compute, prev),
|
|
397
|
+
return createMemo$1(prev => readSerializedOrCompute(compute, prev), options);
|
|
398
398
|
}
|
|
399
|
-
function hydratedCreateSignal(fn, second
|
|
400
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second
|
|
399
|
+
function hydratedCreateSignal(fn, second) {
|
|
400
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second);
|
|
401
401
|
markTopLevelSnapshotScope();
|
|
402
|
-
const ssrSource =
|
|
402
|
+
const ssrSource = second?.ssrSource;
|
|
403
403
|
if (ssrSource === "client") {
|
|
404
404
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
405
|
-
|
|
405
|
+
ownedWrite: true
|
|
406
406
|
});
|
|
407
407
|
const sig = createSignal$1(prev => {
|
|
408
|
-
if (!hydrated()) return prev
|
|
408
|
+
if (!hydrated()) return prev;
|
|
409
409
|
return fn(prev);
|
|
410
|
-
}, second
|
|
410
|
+
}, second);
|
|
411
411
|
setHydrated(true);
|
|
412
412
|
return sig;
|
|
413
413
|
}
|
|
@@ -415,12 +415,12 @@ function hydratedCreateSignal(fn, second, third) {
|
|
|
415
415
|
return createSignal$1(prev => {
|
|
416
416
|
if (!sharedConfig.hydrating) return fn(prev);
|
|
417
417
|
subFetch(fn, prev);
|
|
418
|
-
return prev
|
|
419
|
-
}, second
|
|
418
|
+
return prev;
|
|
419
|
+
}, second);
|
|
420
420
|
}
|
|
421
|
-
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second
|
|
421
|
+
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second);
|
|
422
422
|
if (aiResult !== null) return aiResult;
|
|
423
|
-
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second
|
|
423
|
+
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
424
424
|
}
|
|
425
425
|
function hydratedCreateErrorBoundary(fn, fallback) {
|
|
426
426
|
if (!sharedConfig.hydrating) return createErrorBoundary$1(fn, fallback);
|
|
@@ -442,18 +442,18 @@ function hydratedCreateErrorBoundary(fn, fallback) {
|
|
|
442
442
|
}
|
|
443
443
|
return createErrorBoundary$1(fn, fallback);
|
|
444
444
|
}
|
|
445
|
-
function hydratedCreateOptimistic(fn, second
|
|
446
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second
|
|
445
|
+
function hydratedCreateOptimistic(fn, second) {
|
|
446
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second);
|
|
447
447
|
markTopLevelSnapshotScope();
|
|
448
|
-
const ssrSource =
|
|
448
|
+
const ssrSource = second?.ssrSource;
|
|
449
449
|
if (ssrSource === "client") {
|
|
450
450
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
451
|
-
|
|
451
|
+
ownedWrite: true
|
|
452
452
|
});
|
|
453
453
|
const sig = createOptimistic$1(prev => {
|
|
454
|
-
if (!hydrated()) return prev
|
|
454
|
+
if (!hydrated()) return prev;
|
|
455
455
|
return fn(prev);
|
|
456
|
-
}, second
|
|
456
|
+
}, second);
|
|
457
457
|
setHydrated(true);
|
|
458
458
|
return sig;
|
|
459
459
|
}
|
|
@@ -461,12 +461,12 @@ function hydratedCreateOptimistic(fn, second, third) {
|
|
|
461
461
|
return createOptimistic$1(prev => {
|
|
462
462
|
if (!sharedConfig.hydrating) return fn(prev);
|
|
463
463
|
subFetch(fn, prev);
|
|
464
|
-
return prev
|
|
465
|
-
}, second
|
|
464
|
+
return prev;
|
|
465
|
+
}, second);
|
|
466
466
|
}
|
|
467
|
-
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second
|
|
467
|
+
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second);
|
|
468
468
|
if (aiResult !== null) return aiResult;
|
|
469
|
-
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second
|
|
469
|
+
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
470
470
|
}
|
|
471
471
|
function wrapStoreFn(fn) {
|
|
472
472
|
return draft => readSerializedOrCompute(() => fn(draft), draft);
|
|
@@ -474,7 +474,7 @@ function wrapStoreFn(fn) {
|
|
|
474
474
|
function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
475
475
|
if (ssrSource === "client") {
|
|
476
476
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
477
|
-
|
|
477
|
+
ownedWrite: true
|
|
478
478
|
});
|
|
479
479
|
const result = coreFn(draft => {
|
|
480
480
|
if (!hydrated()) return;
|
|
@@ -485,7 +485,7 @@ function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
|
485
485
|
}
|
|
486
486
|
if (ssrSource === "hybrid") {
|
|
487
487
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
488
|
-
|
|
488
|
+
ownedWrite: true
|
|
489
489
|
});
|
|
490
490
|
const result = coreFn(draft => {
|
|
491
491
|
const o = getOwner();
|
|
@@ -515,14 +515,14 @@ function hydratedCreateStore(first, second, third) {
|
|
|
515
515
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createStore$1(first, second, third);
|
|
516
516
|
markTopLevelSnapshotScope();
|
|
517
517
|
const ssrSource = third?.ssrSource;
|
|
518
|
-
if (ssrSource === "initial") return createStore$1(second ?? {}
|
|
518
|
+
if (ssrSource === "initial") return createStore$1(second ?? {});
|
|
519
519
|
return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource);
|
|
520
520
|
}
|
|
521
521
|
function hydratedCreateOptimisticStore(first, second, third) {
|
|
522
522
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createOptimisticStore$1(first, second, third);
|
|
523
523
|
markTopLevelSnapshotScope();
|
|
524
524
|
const ssrSource = third?.ssrSource;
|
|
525
|
-
if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}
|
|
525
|
+
if (ssrSource === "initial") return createOptimisticStore$1(second ?? {});
|
|
526
526
|
return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource);
|
|
527
527
|
}
|
|
528
528
|
function hydratedCreateProjection(fn, initialValue, options) {
|
|
@@ -532,22 +532,22 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
532
532
|
if (ssrSource === "initial") return createProjection$1(draft => draft, initialValue, options);
|
|
533
533
|
return hydrateStoreLikeFn(createProjection$1, fn, initialValue, options, ssrSource);
|
|
534
534
|
}
|
|
535
|
-
function hydratedEffect(coreFn, compute, effectFn,
|
|
536
|
-
if (!sharedConfig.hydrating) return coreFn(compute, effectFn,
|
|
535
|
+
function hydratedEffect(coreFn, compute, effectFn, options) {
|
|
536
|
+
if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options);
|
|
537
537
|
const ssrSource = options?.ssrSource;
|
|
538
538
|
if (ssrSource === "client") {
|
|
539
539
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
540
|
-
|
|
540
|
+
ownedWrite: true
|
|
541
541
|
});
|
|
542
542
|
let active = false;
|
|
543
543
|
coreFn(prev => {
|
|
544
|
-
if (!hydrated()) return
|
|
544
|
+
if (!hydrated()) return prev;
|
|
545
545
|
active = true;
|
|
546
546
|
return compute(prev);
|
|
547
547
|
}, (next, prev) => {
|
|
548
548
|
if (!active) return;
|
|
549
549
|
return effectFn(next, prev);
|
|
550
|
-
},
|
|
550
|
+
}, options);
|
|
551
551
|
setHydrated(true);
|
|
552
552
|
return;
|
|
553
553
|
}
|
|
@@ -555,18 +555,18 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
|
555
555
|
coreFn(prev => {
|
|
556
556
|
if (!sharedConfig.hydrating) return compute(prev);
|
|
557
557
|
subFetch(compute, prev);
|
|
558
|
-
return prev
|
|
559
|
-
}, effectFn,
|
|
558
|
+
return prev;
|
|
559
|
+
}, effectFn, options);
|
|
560
560
|
return;
|
|
561
561
|
}
|
|
562
562
|
markTopLevelSnapshotScope();
|
|
563
|
-
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn,
|
|
563
|
+
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options);
|
|
564
564
|
}
|
|
565
|
-
function hydratedCreateRenderEffect(compute, effectFn,
|
|
566
|
-
return hydratedEffect(createRenderEffect$1, compute, effectFn,
|
|
565
|
+
function hydratedCreateRenderEffect(compute, effectFn, options) {
|
|
566
|
+
return hydratedEffect(createRenderEffect$1, compute, effectFn, options);
|
|
567
567
|
}
|
|
568
|
-
function hydratedCreateEffect(compute, effectFn,
|
|
569
|
-
return hydratedEffect(createEffect$1, compute, effectFn,
|
|
568
|
+
function hydratedCreateEffect(compute, effectFn, options) {
|
|
569
|
+
return hydratedEffect(createEffect$1, compute, effectFn, options);
|
|
570
570
|
}
|
|
571
571
|
function enableHydration() {
|
|
572
572
|
_createMemo = hydratedCreateMemo;
|
|
@@ -625,24 +625,6 @@ const createStore = (...args) => (_createStore || createStore$1)(...args);
|
|
|
625
625
|
const createOptimisticStore = (...args) => (_createOptimisticStore || createOptimisticStore$1)(...args);
|
|
626
626
|
const createRenderEffect = (...args) => (_createRenderEffect || createRenderEffect$1)(...args);
|
|
627
627
|
const createEffect = (...args) => (_createEffect || createEffect$1)(...args);
|
|
628
|
-
function loadModuleAssets(mapping) {
|
|
629
|
-
const hy = globalThis._$HY;
|
|
630
|
-
if (!hy) return;
|
|
631
|
-
if (!hy.modules) hy.modules = {};
|
|
632
|
-
if (!hy.loading) hy.loading = {};
|
|
633
|
-
const pending = [];
|
|
634
|
-
for (const moduleUrl in mapping) {
|
|
635
|
-
if (hy.modules[moduleUrl]) continue;
|
|
636
|
-
const entryUrl = mapping[moduleUrl];
|
|
637
|
-
if (!hy.loading[moduleUrl]) {
|
|
638
|
-
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
639
|
-
hy.modules[moduleUrl] = mod;
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
pending.push(hy.loading[moduleUrl]);
|
|
643
|
-
}
|
|
644
|
-
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
645
|
-
}
|
|
646
628
|
function createBoundaryTrigger() {
|
|
647
629
|
setSnapshotCapture(false);
|
|
648
630
|
const [s, set] = createSignal$1(undefined, {
|
|
@@ -711,7 +693,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
711
693
|
let assetPromise;
|
|
712
694
|
if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
|
|
713
695
|
const mapping = sharedConfig.load(id + "_assets");
|
|
714
|
-
if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
|
|
696
|
+
if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping);
|
|
715
697
|
}
|
|
716
698
|
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
717
699
|
const ref = sharedConfig.load(id);
|
|
@@ -830,10 +812,10 @@ function Repeat(props) {
|
|
|
830
812
|
}
|
|
831
813
|
function Show(props) {
|
|
832
814
|
const keyed = props.keyed;
|
|
833
|
-
const conditionValue = createMemo$1(() => props.when,
|
|
815
|
+
const conditionValue = createMemo$1(() => props.when, {
|
|
834
816
|
name: "condition value"
|
|
835
817
|
} );
|
|
836
|
-
const condition = keyed ? conditionValue : createMemo$1(conditionValue,
|
|
818
|
+
const condition = keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
837
819
|
equals: (a, b) => !a === !b,
|
|
838
820
|
name: "condition"
|
|
839
821
|
} );
|
|
@@ -848,7 +830,7 @@ function Show(props) {
|
|
|
848
830
|
}), "<Show>") : child;
|
|
849
831
|
}
|
|
850
832
|
return props.fallback;
|
|
851
|
-
},
|
|
833
|
+
}, {
|
|
852
834
|
name: "value"
|
|
853
835
|
} );
|
|
854
836
|
}
|
|
@@ -861,10 +843,10 @@ function Switch(props) {
|
|
|
861
843
|
const index = i;
|
|
862
844
|
const mp = mps[i];
|
|
863
845
|
const prevFunc = func;
|
|
864
|
-
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when,
|
|
846
|
+
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, {
|
|
865
847
|
name: "condition value"
|
|
866
848
|
} );
|
|
867
|
-
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue,
|
|
849
|
+
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
868
850
|
equals: (a, b) => !a === !b,
|
|
869
851
|
name: "condition"
|
|
870
852
|
} );
|
|
@@ -882,7 +864,7 @@ function Switch(props) {
|
|
|
882
864
|
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
883
865
|
return conditionValue();
|
|
884
866
|
}), "<Match>") : child;
|
|
885
|
-
},
|
|
867
|
+
}, {
|
|
886
868
|
name: "eval conditions"
|
|
887
869
|
} );
|
|
888
870
|
}
|