solid-js 2.0.0-beta.5 → 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 +126 -122
- package/dist/dev.js +120 -125
- package/dist/server.cjs +332 -97
- package/dist/server.js +328 -99
- package/dist/solid.cjs +120 -108
- package/dist/solid.js +114 -111
- package/package.json +78 -30
- package/types/client/core.d.ts +1 -8
- package/types/client/flow.d.ts +22 -0
- package/types/client/hydration.d.ts +4 -3
- package/types/index.d.ts +3 -6
- package/types/jsx-properties.d.ts +95 -0
- package/types/jsx.d.ts +438 -359
- package/types/server/flow.d.ts +9 -0
- package/types/server/hydration.d.ts +9 -0
- package/types/server/index.d.ts +1 -1
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +13 -11
- 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/solid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, getOwner,
|
|
2
|
-
export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals';
|
|
1
|
+
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createOwner, runWithOwner, createEffect as createEffect$1, createErrorBoundary as createErrorBoundary$1, createLoadingBoundary as createLoadingBoundary$1, getOwner, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createRenderEffect as createRenderEffect$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, onCleanup, isDisposed, peekNextChildId, clearSnapshots, flush, markSnapshotScope, untrack, mapArray, repeat, createRevealOrder } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $REFRESH, $TRACK, NotReadyError, action, createOwner, createReaction, createRevealOrder, createRoot, createTrackedEffect, deep, enableExternalSource, enforceLoadingBoundary, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isPending, isRefreshing, isWrappable, latest, mapArray, merge, omit, onCleanup, onSettled, reconcile, refresh, repeat, resolve, runWithOwner, snapshot, storePath, untrack } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const IS_DEV = false;
|
|
5
5
|
const $DEVCOMP = Symbol(0);
|
|
@@ -19,10 +19,10 @@ function useContext(context) {
|
|
|
19
19
|
return getContext(context);
|
|
20
20
|
}
|
|
21
21
|
function children(fn) {
|
|
22
|
-
const c = createMemo$1(fn,
|
|
22
|
+
const c = createMemo$1(fn, {
|
|
23
23
|
lazy: true
|
|
24
24
|
});
|
|
25
|
-
const memo = createMemo$1(() => flatten(c()),
|
|
25
|
+
const memo = createMemo$1(() => flatten(c()), {
|
|
26
26
|
lazy: true
|
|
27
27
|
});
|
|
28
28
|
memo.toArray = () => {
|
|
@@ -264,7 +264,7 @@ function wrapFirstYield(iterable, activate) {
|
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
function hydrateSignalFromAsyncIterable(coreFn, compute,
|
|
267
|
+
function hydrateSignalFromAsyncIterable(coreFn, compute, options) {
|
|
268
268
|
const parent = getOwner();
|
|
269
269
|
const expectedId = peekNextChildId(parent);
|
|
270
270
|
if (!sharedConfig.has(expectedId)) return null;
|
|
@@ -276,7 +276,7 @@ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
|
|
|
276
276
|
return it;
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
|
-
return coreFn(() => iterable,
|
|
279
|
+
return coreFn(() => iterable, options);
|
|
280
280
|
}
|
|
281
281
|
function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
282
282
|
const parent = getOwner();
|
|
@@ -351,20 +351,20 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
|
351
351
|
};
|
|
352
352
|
}, initialValue, options);
|
|
353
353
|
}
|
|
354
|
-
function hydratedCreateMemo(compute,
|
|
354
|
+
function hydratedCreateMemo(compute, options) {
|
|
355
355
|
if (!sharedConfig.hydrating || options?.transparent) {
|
|
356
|
-
return createMemo$1(compute,
|
|
356
|
+
return createMemo$1(compute, options);
|
|
357
357
|
}
|
|
358
358
|
markTopLevelSnapshotScope();
|
|
359
359
|
const ssrSource = options?.ssrSource;
|
|
360
360
|
if (ssrSource === "client") {
|
|
361
361
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
362
|
-
|
|
362
|
+
ownedWrite: true
|
|
363
363
|
});
|
|
364
364
|
const memo = createMemo$1(prev => {
|
|
365
|
-
if (!hydrated()) return prev
|
|
365
|
+
if (!hydrated()) return prev;
|
|
366
366
|
return compute(prev);
|
|
367
|
-
},
|
|
367
|
+
}, options);
|
|
368
368
|
setHydrated(true);
|
|
369
369
|
return memo;
|
|
370
370
|
}
|
|
@@ -372,25 +372,25 @@ function hydratedCreateMemo(compute, value, options) {
|
|
|
372
372
|
return createMemo$1(prev => {
|
|
373
373
|
if (!sharedConfig.hydrating) return compute(prev);
|
|
374
374
|
subFetch(compute, prev);
|
|
375
|
-
return prev
|
|
376
|
-
},
|
|
375
|
+
return prev;
|
|
376
|
+
}, options);
|
|
377
377
|
}
|
|
378
|
-
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute,
|
|
378
|
+
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, options);
|
|
379
379
|
if (aiResult !== null) return aiResult;
|
|
380
|
-
return createMemo$1(prev => readSerializedOrCompute(compute, prev),
|
|
380
|
+
return createMemo$1(prev => readSerializedOrCompute(compute, prev), options);
|
|
381
381
|
}
|
|
382
|
-
function hydratedCreateSignal(fn, second
|
|
383
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second
|
|
382
|
+
function hydratedCreateSignal(fn, second) {
|
|
383
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second);
|
|
384
384
|
markTopLevelSnapshotScope();
|
|
385
|
-
const ssrSource =
|
|
385
|
+
const ssrSource = second?.ssrSource;
|
|
386
386
|
if (ssrSource === "client") {
|
|
387
387
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
388
|
-
|
|
388
|
+
ownedWrite: true
|
|
389
389
|
});
|
|
390
390
|
const sig = createSignal$1(prev => {
|
|
391
|
-
if (!hydrated()) return prev
|
|
391
|
+
if (!hydrated()) return prev;
|
|
392
392
|
return fn(prev);
|
|
393
|
-
}, second
|
|
393
|
+
}, second);
|
|
394
394
|
setHydrated(true);
|
|
395
395
|
return sig;
|
|
396
396
|
}
|
|
@@ -398,12 +398,12 @@ function hydratedCreateSignal(fn, second, third) {
|
|
|
398
398
|
return createSignal$1(prev => {
|
|
399
399
|
if (!sharedConfig.hydrating) return fn(prev);
|
|
400
400
|
subFetch(fn, prev);
|
|
401
|
-
return prev
|
|
402
|
-
}, second
|
|
401
|
+
return prev;
|
|
402
|
+
}, second);
|
|
403
403
|
}
|
|
404
|
-
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second
|
|
404
|
+
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second);
|
|
405
405
|
if (aiResult !== null) return aiResult;
|
|
406
|
-
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second
|
|
406
|
+
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
407
407
|
}
|
|
408
408
|
function hydratedCreateErrorBoundary(fn, fallback) {
|
|
409
409
|
if (!sharedConfig.hydrating) return createErrorBoundary$1(fn, fallback);
|
|
@@ -425,18 +425,18 @@ function hydratedCreateErrorBoundary(fn, fallback) {
|
|
|
425
425
|
}
|
|
426
426
|
return createErrorBoundary$1(fn, fallback);
|
|
427
427
|
}
|
|
428
|
-
function hydratedCreateOptimistic(fn, second
|
|
429
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second
|
|
428
|
+
function hydratedCreateOptimistic(fn, second) {
|
|
429
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second);
|
|
430
430
|
markTopLevelSnapshotScope();
|
|
431
|
-
const ssrSource =
|
|
431
|
+
const ssrSource = second?.ssrSource;
|
|
432
432
|
if (ssrSource === "client") {
|
|
433
433
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
434
|
-
|
|
434
|
+
ownedWrite: true
|
|
435
435
|
});
|
|
436
436
|
const sig = createOptimistic$1(prev => {
|
|
437
|
-
if (!hydrated()) return prev
|
|
437
|
+
if (!hydrated()) return prev;
|
|
438
438
|
return fn(prev);
|
|
439
|
-
}, second
|
|
439
|
+
}, second);
|
|
440
440
|
setHydrated(true);
|
|
441
441
|
return sig;
|
|
442
442
|
}
|
|
@@ -444,12 +444,12 @@ function hydratedCreateOptimistic(fn, second, third) {
|
|
|
444
444
|
return createOptimistic$1(prev => {
|
|
445
445
|
if (!sharedConfig.hydrating) return fn(prev);
|
|
446
446
|
subFetch(fn, prev);
|
|
447
|
-
return prev
|
|
448
|
-
}, second
|
|
447
|
+
return prev;
|
|
448
|
+
}, second);
|
|
449
449
|
}
|
|
450
|
-
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second
|
|
450
|
+
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second);
|
|
451
451
|
if (aiResult !== null) return aiResult;
|
|
452
|
-
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second
|
|
452
|
+
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
453
453
|
}
|
|
454
454
|
function wrapStoreFn(fn) {
|
|
455
455
|
return draft => readSerializedOrCompute(() => fn(draft), draft);
|
|
@@ -457,7 +457,7 @@ function wrapStoreFn(fn) {
|
|
|
457
457
|
function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
458
458
|
if (ssrSource === "client") {
|
|
459
459
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
460
|
-
|
|
460
|
+
ownedWrite: true
|
|
461
461
|
});
|
|
462
462
|
const result = coreFn(draft => {
|
|
463
463
|
if (!hydrated()) return;
|
|
@@ -468,7 +468,7 @@ function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
|
468
468
|
}
|
|
469
469
|
if (ssrSource === "hybrid") {
|
|
470
470
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
471
|
-
|
|
471
|
+
ownedWrite: true
|
|
472
472
|
});
|
|
473
473
|
const result = coreFn(draft => {
|
|
474
474
|
const o = getOwner();
|
|
@@ -498,14 +498,14 @@ function hydratedCreateStore(first, second, third) {
|
|
|
498
498
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createStore$1(first, second, third);
|
|
499
499
|
markTopLevelSnapshotScope();
|
|
500
500
|
const ssrSource = third?.ssrSource;
|
|
501
|
-
if (ssrSource === "initial") return createStore$1(second ?? {}
|
|
501
|
+
if (ssrSource === "initial") return createStore$1(second ?? {});
|
|
502
502
|
return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource);
|
|
503
503
|
}
|
|
504
504
|
function hydratedCreateOptimisticStore(first, second, third) {
|
|
505
505
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createOptimisticStore$1(first, second, third);
|
|
506
506
|
markTopLevelSnapshotScope();
|
|
507
507
|
const ssrSource = third?.ssrSource;
|
|
508
|
-
if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}
|
|
508
|
+
if (ssrSource === "initial") return createOptimisticStore$1(second ?? {});
|
|
509
509
|
return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource);
|
|
510
510
|
}
|
|
511
511
|
function hydratedCreateProjection(fn, initialValue, options) {
|
|
@@ -515,22 +515,22 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
515
515
|
if (ssrSource === "initial") return createProjection$1(draft => draft, initialValue, options);
|
|
516
516
|
return hydrateStoreLikeFn(createProjection$1, fn, initialValue, options, ssrSource);
|
|
517
517
|
}
|
|
518
|
-
function hydratedEffect(coreFn, compute, effectFn,
|
|
519
|
-
if (!sharedConfig.hydrating) return coreFn(compute, effectFn,
|
|
518
|
+
function hydratedEffect(coreFn, compute, effectFn, options) {
|
|
519
|
+
if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options);
|
|
520
520
|
const ssrSource = options?.ssrSource;
|
|
521
521
|
if (ssrSource === "client") {
|
|
522
522
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
523
|
-
|
|
523
|
+
ownedWrite: true
|
|
524
524
|
});
|
|
525
525
|
let active = false;
|
|
526
526
|
coreFn(prev => {
|
|
527
|
-
if (!hydrated()) return
|
|
527
|
+
if (!hydrated()) return prev;
|
|
528
528
|
active = true;
|
|
529
529
|
return compute(prev);
|
|
530
530
|
}, (next, prev) => {
|
|
531
531
|
if (!active) return;
|
|
532
532
|
return effectFn(next, prev);
|
|
533
|
-
},
|
|
533
|
+
}, options);
|
|
534
534
|
setHydrated(true);
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
@@ -538,18 +538,18 @@ function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
|
538
538
|
coreFn(prev => {
|
|
539
539
|
if (!sharedConfig.hydrating) return compute(prev);
|
|
540
540
|
subFetch(compute, prev);
|
|
541
|
-
return prev
|
|
542
|
-
}, effectFn,
|
|
541
|
+
return prev;
|
|
542
|
+
}, effectFn, options);
|
|
543
543
|
return;
|
|
544
544
|
}
|
|
545
545
|
markTopLevelSnapshotScope();
|
|
546
|
-
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn,
|
|
546
|
+
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options);
|
|
547
547
|
}
|
|
548
|
-
function hydratedCreateRenderEffect(compute, effectFn,
|
|
549
|
-
return hydratedEffect(createRenderEffect$1, compute, effectFn,
|
|
548
|
+
function hydratedCreateRenderEffect(compute, effectFn, options) {
|
|
549
|
+
return hydratedEffect(createRenderEffect$1, compute, effectFn, options);
|
|
550
550
|
}
|
|
551
|
-
function hydratedCreateEffect(compute, effectFn,
|
|
552
|
-
return hydratedEffect(createEffect$1, compute, effectFn,
|
|
551
|
+
function hydratedCreateEffect(compute, effectFn, options) {
|
|
552
|
+
return hydratedEffect(createEffect$1, compute, effectFn, options);
|
|
553
553
|
}
|
|
554
554
|
function enableHydration() {
|
|
555
555
|
_createMemo = hydratedCreateMemo;
|
|
@@ -608,24 +608,6 @@ const createStore = (...args) => (_createStore || createStore$1)(...args);
|
|
|
608
608
|
const createOptimisticStore = (...args) => (_createOptimisticStore || createOptimisticStore$1)(...args);
|
|
609
609
|
const createRenderEffect = (...args) => (_createRenderEffect || createRenderEffect$1)(...args);
|
|
610
610
|
const createEffect = (...args) => (_createEffect || createEffect$1)(...args);
|
|
611
|
-
function loadModuleAssets(mapping) {
|
|
612
|
-
const hy = globalThis._$HY;
|
|
613
|
-
if (!hy) return;
|
|
614
|
-
if (!hy.modules) hy.modules = {};
|
|
615
|
-
if (!hy.loading) hy.loading = {};
|
|
616
|
-
const pending = [];
|
|
617
|
-
for (const moduleUrl in mapping) {
|
|
618
|
-
if (hy.modules[moduleUrl]) continue;
|
|
619
|
-
const entryUrl = mapping[moduleUrl];
|
|
620
|
-
if (!hy.loading[moduleUrl]) {
|
|
621
|
-
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
622
|
-
hy.modules[moduleUrl] = mod;
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
pending.push(hy.loading[moduleUrl]);
|
|
626
|
-
}
|
|
627
|
-
return pending.length ? Promise.all(pending).then(() => {}) : undefined;
|
|
628
|
-
}
|
|
629
611
|
function createBoundaryTrigger() {
|
|
630
612
|
setSnapshotCapture(false);
|
|
631
613
|
const [s, set] = createSignal$1(undefined, {
|
|
@@ -653,6 +635,38 @@ function resumeBoundaryHydration(o, id, set) {
|
|
|
653
635
|
flush();
|
|
654
636
|
checkHydrationComplete();
|
|
655
637
|
}
|
|
638
|
+
function initBoundaryResume(o, id) {
|
|
639
|
+
_pendingBoundaries++;
|
|
640
|
+
onCleanup(() => {
|
|
641
|
+
if (!isDisposed(o)) return;
|
|
642
|
+
sharedConfig.cleanupFragment?.(id);
|
|
643
|
+
});
|
|
644
|
+
const set = createBoundaryTrigger();
|
|
645
|
+
return [set, () => resumeBoundaryHydration(o, id, set)];
|
|
646
|
+
}
|
|
647
|
+
function waitAndResume(p, resume, assetPromise) {
|
|
648
|
+
const waitFor = assetPromise ? Promise.all([p, assetPromise]) : p;
|
|
649
|
+
waitFor.then(() => {
|
|
650
|
+
if (p && typeof p === "object") p.s = 1;
|
|
651
|
+
resume();
|
|
652
|
+
}, err => {
|
|
653
|
+
if (p && typeof p === "object") {
|
|
654
|
+
p.s = 2;
|
|
655
|
+
p.v = err;
|
|
656
|
+
}
|
|
657
|
+
resume();
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function scheduleResumeAfterAssets(id, resume, assetPromise) {
|
|
661
|
+
sharedConfig.gather?.(id);
|
|
662
|
+
const doResume = () => queueMicrotask(resume);
|
|
663
|
+
if (assetPromise) {
|
|
664
|
+
assetPromise.then(doResume);
|
|
665
|
+
return true;
|
|
666
|
+
}
|
|
667
|
+
doResume();
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
656
670
|
function createLoadingBoundary(fn, fallback, options) {
|
|
657
671
|
if (!sharedConfig.hydrating) return createLoadingBoundary$1(fn, fallback, options);
|
|
658
672
|
let settledSerializationResumeQueued = false;
|
|
@@ -662,7 +676,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
662
676
|
let assetPromise;
|
|
663
677
|
if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
|
|
664
678
|
const mapping = sharedConfig.load(id + "_assets");
|
|
665
|
-
if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
|
|
679
|
+
if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping);
|
|
666
680
|
}
|
|
667
681
|
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
668
682
|
const ref = sharedConfig.load(id);
|
|
@@ -672,41 +686,14 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
672
686
|
}
|
|
673
687
|
if (ref && typeof ref === "object" && ref.s === 1 && p == null && !settledSerializationResumeQueued) {
|
|
674
688
|
settledSerializationResumeQueued = true;
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
if (!isDisposed(o)) return;
|
|
678
|
-
sharedConfig.cleanupFragment?.(id);
|
|
679
|
-
});
|
|
680
|
-
const set = createBoundaryTrigger();
|
|
681
|
-
const scheduleResume = () => queueMicrotask(() => resumeBoundaryHydration(o, id, set));
|
|
682
|
-
if (assetPromise) {
|
|
683
|
-
assetPromise.then(scheduleResume);
|
|
684
|
-
return undefined;
|
|
685
|
-
}
|
|
686
|
-
scheduleResume();
|
|
689
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
690
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
687
691
|
return fallback();
|
|
688
692
|
}
|
|
689
693
|
if (p) {
|
|
690
|
-
|
|
691
|
-
onCleanup(() => {
|
|
692
|
-
if (!isDisposed(o)) return;
|
|
693
|
-
sharedConfig.cleanupFragment?.(id);
|
|
694
|
-
});
|
|
695
|
-
const set = createBoundaryTrigger();
|
|
694
|
+
const [set, resume] = initBoundaryResume(o, id);
|
|
696
695
|
if (p !== "$$f") {
|
|
697
|
-
|
|
698
|
-
waitFor.then(() => {
|
|
699
|
-
if (p && typeof p === "object") {
|
|
700
|
-
p.s = 1;
|
|
701
|
-
}
|
|
702
|
-
resumeBoundaryHydration(o, id, set);
|
|
703
|
-
}, err => {
|
|
704
|
-
if (p && typeof p === "object") {
|
|
705
|
-
p.s = 2;
|
|
706
|
-
p.v = err;
|
|
707
|
-
}
|
|
708
|
-
resumeBoundaryHydration(o, id, set);
|
|
709
|
-
});
|
|
696
|
+
waitAndResume(p, resume, assetPromise);
|
|
710
697
|
} else {
|
|
711
698
|
const afterAssets = () => {
|
|
712
699
|
_pendingBoundaries--;
|
|
@@ -718,10 +705,20 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
718
705
|
return fallback();
|
|
719
706
|
}
|
|
720
707
|
}
|
|
708
|
+
if (sharedConfig.hydrating && sharedConfig.has(id + "_fr") && !settledSerializationResumeQueued) {
|
|
709
|
+
settledSerializationResumeQueued = true;
|
|
710
|
+
const fr = sharedConfig.load(id + "_fr");
|
|
711
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
712
|
+
if (fr && typeof fr === "object" && (fr.s === 1 || fr.s === 2)) {
|
|
713
|
+
if (scheduleResumeAfterAssets(id, resume, assetPromise)) return undefined;
|
|
714
|
+
return fallback();
|
|
715
|
+
}
|
|
716
|
+
waitAndResume(fr, resume, assetPromise);
|
|
717
|
+
return fallback();
|
|
718
|
+
}
|
|
721
719
|
if (assetPromise && !sharedConfig.has(id)) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
assetPromise.then(() => resumeBoundaryHydration(o, id, set));
|
|
720
|
+
const [, resume] = initBoundaryResume(o, id);
|
|
721
|
+
assetPromise.then(resume);
|
|
725
722
|
return undefined;
|
|
726
723
|
}
|
|
727
724
|
return createLoadingBoundary$1(fn, fallback, options);
|
|
@@ -793,8 +790,8 @@ function Repeat(props) {
|
|
|
793
790
|
}
|
|
794
791
|
function Show(props) {
|
|
795
792
|
const keyed = props.keyed;
|
|
796
|
-
const conditionValue = createMemo$1(() => props.when, undefined
|
|
797
|
-
const condition = keyed ? conditionValue : createMemo$1(conditionValue,
|
|
793
|
+
const conditionValue = createMemo$1(() => props.when, undefined);
|
|
794
|
+
const condition = keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
798
795
|
equals: (a, b) => !a === !b
|
|
799
796
|
});
|
|
800
797
|
return createMemo$1(() => {
|
|
@@ -808,7 +805,7 @@ function Show(props) {
|
|
|
808
805
|
}), IS_DEV) : child;
|
|
809
806
|
}
|
|
810
807
|
return props.fallback;
|
|
811
|
-
}, undefined
|
|
808
|
+
}, undefined);
|
|
812
809
|
}
|
|
813
810
|
function Switch(props) {
|
|
814
811
|
const chs = children(() => props.children);
|
|
@@ -819,8 +816,8 @@ function Switch(props) {
|
|
|
819
816
|
const index = i;
|
|
820
817
|
const mp = mps[i];
|
|
821
818
|
const prevFunc = func;
|
|
822
|
-
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined
|
|
823
|
-
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue,
|
|
819
|
+
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined);
|
|
820
|
+
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
824
821
|
equals: (a, b) => !a === !b
|
|
825
822
|
});
|
|
826
823
|
func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
|
|
@@ -837,7 +834,7 @@ function Switch(props) {
|
|
|
837
834
|
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
838
835
|
return conditionValue();
|
|
839
836
|
}), IS_DEV) : child;
|
|
840
|
-
}, undefined
|
|
837
|
+
}, undefined);
|
|
841
838
|
}
|
|
842
839
|
function Match(props) {
|
|
843
840
|
return props;
|
|
@@ -854,9 +851,15 @@ function Loading(props) {
|
|
|
854
851
|
} : undefined;
|
|
855
852
|
return createLoadingBoundary(() => props.children, () => props.fallback, onOpt);
|
|
856
853
|
}
|
|
854
|
+
function Reveal(props) {
|
|
855
|
+
return createRevealOrder(() => props.children, {
|
|
856
|
+
together: () => !!props.together,
|
|
857
|
+
collapsed: () => !!props.collapsed
|
|
858
|
+
});
|
|
859
|
+
}
|
|
857
860
|
|
|
858
861
|
function ssrHandleError() {}
|
|
859
862
|
function ssrRunInScope() {}
|
|
860
863
|
const DEV = undefined;
|
|
861
864
|
|
|
862
|
-
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
|
865
|
+
export { $DEVCOMP, DEV, Errored, For, Hydration, Loading, Match, NoHydrateContext, NoHydration, Repeat, Reveal, Show, Switch, children, createComponent, createContext, createEffect, createErrorBoundary, createLoadingBoundary, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.7",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -18,54 +18,101 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
20
|
"types",
|
|
21
|
+
"types-cjs",
|
|
21
22
|
"jsx-runtime.d.ts",
|
|
22
23
|
"package.json"
|
|
23
24
|
],
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
26
27
|
"worker": {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./types/index.d.ts",
|
|
30
|
+
"default": "./dist/server.js"
|
|
31
|
+
},
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./types-cjs/index.d.cts",
|
|
34
|
+
"default": "./dist/server.cjs"
|
|
35
|
+
}
|
|
30
36
|
},
|
|
31
37
|
"browser": {
|
|
32
38
|
"development": {
|
|
39
|
+
"import": {
|
|
40
|
+
"types": "./types/index.d.ts",
|
|
41
|
+
"default": "./dist/dev.js"
|
|
42
|
+
},
|
|
43
|
+
"require": {
|
|
44
|
+
"types": "./types-cjs/index.d.cts",
|
|
45
|
+
"default": "./dist/dev.cjs"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"import": {
|
|
33
49
|
"types": "./types/index.d.ts",
|
|
34
|
-
"
|
|
35
|
-
"require": "./dist/dev.cjs"
|
|
50
|
+
"default": "./dist/solid.js"
|
|
36
51
|
},
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./types-cjs/index.d.cts",
|
|
54
|
+
"default": "./dist/solid.cjs"
|
|
55
|
+
}
|
|
40
56
|
},
|
|
41
57
|
"deno": {
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
"import": {
|
|
59
|
+
"types": "./types/index.d.ts",
|
|
60
|
+
"default": "./dist/server.js"
|
|
61
|
+
},
|
|
62
|
+
"require": {
|
|
63
|
+
"types": "./types-cjs/index.d.cts",
|
|
64
|
+
"default": "./dist/server.cjs"
|
|
65
|
+
}
|
|
45
66
|
},
|
|
46
67
|
"node": {
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
"import": {
|
|
69
|
+
"types": "./types/index.d.ts",
|
|
70
|
+
"default": "./dist/server.js"
|
|
71
|
+
},
|
|
72
|
+
"require": {
|
|
73
|
+
"types": "./types-cjs/index.d.cts",
|
|
74
|
+
"default": "./dist/server.cjs"
|
|
75
|
+
}
|
|
50
76
|
},
|
|
51
77
|
"development": {
|
|
78
|
+
"import": {
|
|
79
|
+
"types": "./types/index.d.ts",
|
|
80
|
+
"default": "./dist/dev.js"
|
|
81
|
+
},
|
|
82
|
+
"require": {
|
|
83
|
+
"types": "./types-cjs/index.d.cts",
|
|
84
|
+
"default": "./dist/dev.cjs"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"import": {
|
|
52
88
|
"types": "./types/index.d.ts",
|
|
53
|
-
"
|
|
54
|
-
"require": "./dist/dev.cjs"
|
|
89
|
+
"default": "./dist/solid.js"
|
|
55
90
|
},
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
91
|
+
"require": {
|
|
92
|
+
"types": "./types-cjs/index.d.cts",
|
|
93
|
+
"default": "./dist/solid.cjs"
|
|
94
|
+
}
|
|
59
95
|
},
|
|
60
|
-
"./dist/*": "./dist/*",
|
|
61
96
|
"./types/*": "./types/*",
|
|
62
97
|
"./jsx-runtime": {
|
|
63
|
-
"
|
|
64
|
-
|
|
98
|
+
"import": {
|
|
99
|
+
"types": "./types/jsx.d.ts",
|
|
100
|
+
"default": "./dist/solid.js"
|
|
101
|
+
},
|
|
102
|
+
"require": {
|
|
103
|
+
"types": "./types-cjs/jsx.d.cts",
|
|
104
|
+
"default": "./dist/solid.cjs"
|
|
105
|
+
}
|
|
65
106
|
},
|
|
66
107
|
"./jsx-dev-runtime": {
|
|
67
|
-
"
|
|
68
|
-
|
|
108
|
+
"import": {
|
|
109
|
+
"types": "./types/jsx.d.ts",
|
|
110
|
+
"default": "./dist/solid.js"
|
|
111
|
+
},
|
|
112
|
+
"require": {
|
|
113
|
+
"types": "./types-cjs/jsx.d.cts",
|
|
114
|
+
"default": "./dist/solid.cjs"
|
|
115
|
+
}
|
|
69
116
|
},
|
|
70
117
|
"./package.json": "./package.json"
|
|
71
118
|
},
|
|
@@ -79,7 +126,7 @@
|
|
|
79
126
|
"performance"
|
|
80
127
|
],
|
|
81
128
|
"dependencies": {
|
|
82
|
-
"@solidjs/signals": "^0.
|
|
129
|
+
"@solidjs/signals": "^2.0.0-beta.7",
|
|
83
130
|
"csstype": "^3.1.0",
|
|
84
131
|
"seroval": "~1.5.0",
|
|
85
132
|
"seroval-plugins": "~1.5.0"
|
|
@@ -88,10 +135,11 @@
|
|
|
88
135
|
"build": "npm-run-all -nl build:*",
|
|
89
136
|
"build:clean": "rimraf dist/ coverage/",
|
|
90
137
|
"build:js": "rollup -c",
|
|
91
|
-
"types": "npm-run-all -nl types
|
|
92
|
-
"types:clean": "rimraf types/",
|
|
93
|
-
"types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts",
|
|
94
|
-
"types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts",
|
|
138
|
+
"types": "npm-run-all -nl types:clean types:copy types:src types:cjs",
|
|
139
|
+
"types:clean": "rimraf types/ types-cjs/",
|
|
140
|
+
"types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-properties.d.ts ./src/jsx-properties.d.ts",
|
|
141
|
+
"types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-properties.d.ts ./types/jsx-properties.d.ts",
|
|
142
|
+
"types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs",
|
|
95
143
|
"test": "vitest run",
|
|
96
144
|
"coverage": "vitest run --coverage",
|
|
97
145
|
"test-types": "tsc --project tsconfig.test.json"
|
package/types/client/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Accessor,
|
|
1
|
+
import type { Accessor, EffectOptions } from "@solidjs/signals";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
3
|
import { FlowComponent } from "./component.js";
|
|
4
4
|
export declare const IS_DEV: string | boolean;
|
|
@@ -56,10 +56,3 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
58
58
|
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
59
|
-
interface SourceMapValue {
|
|
60
|
-
value: unknown;
|
|
61
|
-
name?: string;
|
|
62
|
-
graph?: Owner;
|
|
63
|
-
}
|
|
64
|
-
export declare function registerGraph(value: SourceMapValue): void;
|
|
65
|
-
export {};
|
package/types/client/flow.d.ts
CHANGED
|
@@ -117,4 +117,26 @@ export declare function Loading(props: {
|
|
|
117
117
|
on?: any;
|
|
118
118
|
children: JSX.Element;
|
|
119
119
|
}): JSX.Element;
|
|
120
|
+
/**
|
|
121
|
+
* Coordinates the reveal timing of sibling `<Loading>` boundaries.
|
|
122
|
+
*
|
|
123
|
+
* - **Sequential** (default): boundaries reveal in DOM order as each resolves.
|
|
124
|
+
* - **Together** (`together`): all boundaries wait until the group is ready, then reveal at once.
|
|
125
|
+
* - **Collapsed** (`collapsed`, sequential only): only the frontier boundary shows its fallback;
|
|
126
|
+
* later boundaries produce nothing until their turn.
|
|
127
|
+
*
|
|
128
|
+
* ```typescript
|
|
129
|
+
* <Reveal>
|
|
130
|
+
* <Loading fallback={<Skeleton />}><ProfileHeader /></Loading>
|
|
131
|
+
* <Loading fallback={<Skeleton />}><Posts /></Loading>
|
|
132
|
+
* </Reveal>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @description https://docs.solidjs.com/reference/components/reveal
|
|
136
|
+
*/
|
|
137
|
+
export declare function Reveal(props: {
|
|
138
|
+
together?: boolean;
|
|
139
|
+
collapsed?: boolean;
|
|
140
|
+
children: JSX.Element;
|
|
141
|
+
}): JSX.Element;
|
|
120
142
|
export {};
|