solid-js 2.0.0-beta.6 → 2.0.0-beta.8
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 +66 -104
- package/dist/dev.js +66 -104
- package/dist/server.cjs +331 -132
- package/dist/server.js +331 -132
- package/dist/solid.cjs +66 -104
- package/dist/solid.js +66 -104
- package/package.json +78 -30
- package/types/client/flow.d.ts +34 -13
- package/types/client/hydration.d.ts +35 -9
- package/types/jsx-properties.d.ts +92 -0
- package/types/jsx.d.ts +390 -314
- package/types/server/flow.d.ts +40 -7
- package/types/server/hydration.d.ts +18 -1
- package/types/server/signals.d.ts +33 -15
- 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 +163 -0
- package/types-cjs/client/hydration.d.cts +121 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/jsx-properties.d.cts +92 -0
- package/types-cjs/jsx.d.cts +4294 -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 +115 -0
- package/types-cjs/server/hydration.d.cts +63 -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 +87 -0
package/dist/solid.js
CHANGED
|
@@ -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,9 +276,12 @@ function hydrateSignalFromAsyncIterable(coreFn, compute, value, options) {
|
|
|
276
276
|
return it;
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
|
-
return coreFn(
|
|
279
|
+
return coreFn(prev => {
|
|
280
|
+
subFetch(compute, prev);
|
|
281
|
+
return iterable;
|
|
282
|
+
}, options);
|
|
280
283
|
}
|
|
281
|
-
function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
284
|
+
function hydrateStoreFromAsyncIterable(coreFn, fn, initialValue, options) {
|
|
282
285
|
const parent = getOwner();
|
|
283
286
|
const expectedId = peekNextChildId(parent);
|
|
284
287
|
if (!sharedConfig.has(expectedId)) return null;
|
|
@@ -288,6 +291,10 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
|
288
291
|
let isFirst = true;
|
|
289
292
|
let buffered = null;
|
|
290
293
|
return coreFn(draft => {
|
|
294
|
+
const {
|
|
295
|
+
proxy
|
|
296
|
+
} = createShadowDraft(draft);
|
|
297
|
+
subFetch(fn, proxy);
|
|
291
298
|
const process = res => {
|
|
292
299
|
if (res.done) return {
|
|
293
300
|
done: true,
|
|
@@ -295,11 +302,16 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
|
295
302
|
};
|
|
296
303
|
if (isFirst) {
|
|
297
304
|
isFirst = false;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
setSnapshotCapture(false);
|
|
306
|
+
try {
|
|
307
|
+
if (Array.isArray(res.value)) {
|
|
308
|
+
for (let i = 0; i < res.value.length; i++) draft[i] = res.value[i];
|
|
309
|
+
draft.length = res.value.length;
|
|
310
|
+
} else {
|
|
311
|
+
Object.assign(draft, res.value);
|
|
312
|
+
}
|
|
313
|
+
} finally {
|
|
314
|
+
setSnapshotCapture(true);
|
|
303
315
|
}
|
|
304
316
|
} else {
|
|
305
317
|
applyPatches(draft, res.value);
|
|
@@ -351,59 +363,45 @@ function hydrateStoreFromAsyncIterable(coreFn, initialValue, options) {
|
|
|
351
363
|
};
|
|
352
364
|
}, initialValue, options);
|
|
353
365
|
}
|
|
354
|
-
function hydratedCreateMemo(compute,
|
|
366
|
+
function hydratedCreateMemo(compute, options) {
|
|
355
367
|
if (!sharedConfig.hydrating || options?.transparent) {
|
|
356
|
-
return createMemo$1(compute,
|
|
368
|
+
return createMemo$1(compute, options);
|
|
357
369
|
}
|
|
358
370
|
markTopLevelSnapshotScope();
|
|
359
371
|
const ssrSource = options?.ssrSource;
|
|
360
372
|
if (ssrSource === "client") {
|
|
361
373
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
362
|
-
|
|
374
|
+
ownedWrite: true
|
|
363
375
|
});
|
|
364
376
|
const memo = createMemo$1(prev => {
|
|
365
|
-
if (!hydrated()) return prev
|
|
377
|
+
if (!hydrated()) return prev;
|
|
366
378
|
return compute(prev);
|
|
367
|
-
},
|
|
379
|
+
}, options);
|
|
368
380
|
setHydrated(true);
|
|
369
381
|
return memo;
|
|
370
382
|
}
|
|
371
|
-
|
|
372
|
-
return createMemo$1(prev => {
|
|
373
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
374
|
-
subFetch(compute, prev);
|
|
375
|
-
return prev ?? value;
|
|
376
|
-
}, value, options);
|
|
377
|
-
}
|
|
378
|
-
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, value, options);
|
|
383
|
+
const aiResult = hydrateSignalFromAsyncIterable(createMemo$1, compute, options);
|
|
379
384
|
if (aiResult !== null) return aiResult;
|
|
380
|
-
return createMemo$1(prev => readSerializedOrCompute(compute, prev),
|
|
385
|
+
return createMemo$1(prev => readSerializedOrCompute(compute, prev), options);
|
|
381
386
|
}
|
|
382
|
-
function hydratedCreateSignal(fn, second
|
|
383
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second
|
|
387
|
+
function hydratedCreateSignal(fn, second) {
|
|
388
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createSignal$1(fn, second);
|
|
384
389
|
markTopLevelSnapshotScope();
|
|
385
|
-
const ssrSource =
|
|
390
|
+
const ssrSource = second?.ssrSource;
|
|
386
391
|
if (ssrSource === "client") {
|
|
387
392
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
388
|
-
|
|
393
|
+
ownedWrite: true
|
|
389
394
|
});
|
|
390
395
|
const sig = createSignal$1(prev => {
|
|
391
|
-
if (!hydrated()) return prev
|
|
396
|
+
if (!hydrated()) return prev;
|
|
392
397
|
return fn(prev);
|
|
393
|
-
}, second
|
|
398
|
+
}, second);
|
|
394
399
|
setHydrated(true);
|
|
395
400
|
return sig;
|
|
396
401
|
}
|
|
397
|
-
|
|
398
|
-
return createSignal$1(prev => {
|
|
399
|
-
if (!sharedConfig.hydrating) return fn(prev);
|
|
400
|
-
subFetch(fn, prev);
|
|
401
|
-
return prev ?? second;
|
|
402
|
-
}, second, third);
|
|
403
|
-
}
|
|
404
|
-
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second, third);
|
|
402
|
+
const aiResult = hydrateSignalFromAsyncIterable(createSignal$1, fn, second);
|
|
405
403
|
if (aiResult !== null) return aiResult;
|
|
406
|
-
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second
|
|
404
|
+
return createSignal$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
407
405
|
}
|
|
408
406
|
function hydratedCreateErrorBoundary(fn, fallback) {
|
|
409
407
|
if (!sharedConfig.hydrating) return createErrorBoundary$1(fn, fallback);
|
|
@@ -425,31 +423,24 @@ function hydratedCreateErrorBoundary(fn, fallback) {
|
|
|
425
423
|
}
|
|
426
424
|
return createErrorBoundary$1(fn, fallback);
|
|
427
425
|
}
|
|
428
|
-
function hydratedCreateOptimistic(fn, second
|
|
429
|
-
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second
|
|
426
|
+
function hydratedCreateOptimistic(fn, second) {
|
|
427
|
+
if (typeof fn !== "function" || !sharedConfig.hydrating) return createOptimistic$1(fn, second);
|
|
430
428
|
markTopLevelSnapshotScope();
|
|
431
|
-
const ssrSource =
|
|
429
|
+
const ssrSource = second?.ssrSource;
|
|
432
430
|
if (ssrSource === "client") {
|
|
433
431
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
434
|
-
|
|
432
|
+
ownedWrite: true
|
|
435
433
|
});
|
|
436
434
|
const sig = createOptimistic$1(prev => {
|
|
437
|
-
if (!hydrated()) return prev
|
|
435
|
+
if (!hydrated()) return prev;
|
|
438
436
|
return fn(prev);
|
|
439
|
-
}, second
|
|
437
|
+
}, second);
|
|
440
438
|
setHydrated(true);
|
|
441
439
|
return sig;
|
|
442
440
|
}
|
|
443
|
-
|
|
444
|
-
return createOptimistic$1(prev => {
|
|
445
|
-
if (!sharedConfig.hydrating) return fn(prev);
|
|
446
|
-
subFetch(fn, prev);
|
|
447
|
-
return prev ?? second;
|
|
448
|
-
}, second, third);
|
|
449
|
-
}
|
|
450
|
-
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second, third);
|
|
441
|
+
const aiResult = hydrateSignalFromAsyncIterable(createOptimistic$1, fn, second);
|
|
451
442
|
if (aiResult !== null) return aiResult;
|
|
452
|
-
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second
|
|
443
|
+
return createOptimistic$1(prev => readSerializedOrCompute(fn, prev), second);
|
|
453
444
|
}
|
|
454
445
|
function wrapStoreFn(fn) {
|
|
455
446
|
return draft => readSerializedOrCompute(() => fn(draft), draft);
|
|
@@ -457,7 +448,7 @@ function wrapStoreFn(fn) {
|
|
|
457
448
|
function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
458
449
|
if (ssrSource === "client") {
|
|
459
450
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
460
|
-
|
|
451
|
+
ownedWrite: true
|
|
461
452
|
});
|
|
462
453
|
const result = coreFn(draft => {
|
|
463
454
|
if (!hydrated()) return;
|
|
@@ -468,7 +459,7 @@ function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
|
468
459
|
}
|
|
469
460
|
if (ssrSource === "hybrid") {
|
|
470
461
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
471
|
-
|
|
462
|
+
ownedWrite: true
|
|
472
463
|
});
|
|
473
464
|
const result = coreFn(draft => {
|
|
474
465
|
const o = getOwner();
|
|
@@ -490,7 +481,7 @@ function hydrateStoreLikeFn(coreFn, fn, initialValue, options, ssrSource) {
|
|
|
490
481
|
setHydrated(true);
|
|
491
482
|
return result;
|
|
492
483
|
}
|
|
493
|
-
const aiResult = hydrateStoreFromAsyncIterable(coreFn, initialValue, options);
|
|
484
|
+
const aiResult = hydrateStoreFromAsyncIterable(coreFn, fn, initialValue, options);
|
|
494
485
|
if (aiResult !== null) return aiResult;
|
|
495
486
|
return coreFn(wrapStoreFn(fn), initialValue, options);
|
|
496
487
|
}
|
|
@@ -498,58 +489,47 @@ function hydratedCreateStore(first, second, third) {
|
|
|
498
489
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createStore$1(first, second, third);
|
|
499
490
|
markTopLevelSnapshotScope();
|
|
500
491
|
const ssrSource = third?.ssrSource;
|
|
501
|
-
if (ssrSource === "initial") return createStore$1(second ?? {}, undefined, third);
|
|
502
492
|
return hydrateStoreLikeFn(createStore$1, first, second ?? {}, third, ssrSource);
|
|
503
493
|
}
|
|
504
494
|
function hydratedCreateOptimisticStore(first, second, third) {
|
|
505
495
|
if (typeof first !== "function" || !sharedConfig.hydrating) return createOptimisticStore$1(first, second, third);
|
|
506
496
|
markTopLevelSnapshotScope();
|
|
507
497
|
const ssrSource = third?.ssrSource;
|
|
508
|
-
if (ssrSource === "initial") return createOptimisticStore$1(second ?? {}, undefined, third);
|
|
509
498
|
return hydrateStoreLikeFn(createOptimisticStore$1, first, second ?? {}, third, ssrSource);
|
|
510
499
|
}
|
|
511
500
|
function hydratedCreateProjection(fn, initialValue, options) {
|
|
512
501
|
if (!sharedConfig.hydrating) return createProjection$1(fn, initialValue, options);
|
|
513
502
|
markTopLevelSnapshotScope();
|
|
514
503
|
const ssrSource = options?.ssrSource;
|
|
515
|
-
if (ssrSource === "initial") return createProjection$1(draft => draft, initialValue, options);
|
|
516
504
|
return hydrateStoreLikeFn(createProjection$1, fn, initialValue, options, ssrSource);
|
|
517
505
|
}
|
|
518
|
-
function hydratedEffect(coreFn, compute, effectFn,
|
|
519
|
-
if (!sharedConfig.hydrating) return coreFn(compute, effectFn,
|
|
506
|
+
function hydratedEffect(coreFn, compute, effectFn, options) {
|
|
507
|
+
if (!sharedConfig.hydrating || options?.transparent) return coreFn(compute, effectFn, options);
|
|
520
508
|
const ssrSource = options?.ssrSource;
|
|
521
509
|
if (ssrSource === "client") {
|
|
522
510
|
const [hydrated, setHydrated] = createSignal$1(false, {
|
|
523
|
-
|
|
511
|
+
ownedWrite: true
|
|
524
512
|
});
|
|
525
513
|
let active = false;
|
|
526
514
|
coreFn(prev => {
|
|
527
|
-
if (!hydrated()) return
|
|
515
|
+
if (!hydrated()) return prev;
|
|
528
516
|
active = true;
|
|
529
517
|
return compute(prev);
|
|
530
518
|
}, (next, prev) => {
|
|
531
519
|
if (!active) return;
|
|
532
520
|
return effectFn(next, prev);
|
|
533
|
-
},
|
|
521
|
+
}, options);
|
|
534
522
|
setHydrated(true);
|
|
535
523
|
return;
|
|
536
524
|
}
|
|
537
|
-
if (ssrSource === "initial") {
|
|
538
|
-
coreFn(prev => {
|
|
539
|
-
if (!sharedConfig.hydrating) return compute(prev);
|
|
540
|
-
subFetch(compute, prev);
|
|
541
|
-
return prev ?? value;
|
|
542
|
-
}, effectFn, value, options);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
525
|
markTopLevelSnapshotScope();
|
|
546
|
-
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn,
|
|
526
|
+
coreFn(prev => readSerializedOrCompute(compute, prev), effectFn, options);
|
|
547
527
|
}
|
|
548
|
-
function hydratedCreateRenderEffect(compute, effectFn,
|
|
549
|
-
return hydratedEffect(createRenderEffect$1, compute, effectFn,
|
|
528
|
+
function hydratedCreateRenderEffect(compute, effectFn, options) {
|
|
529
|
+
return hydratedEffect(createRenderEffect$1, compute, effectFn, options);
|
|
550
530
|
}
|
|
551
|
-
function hydratedCreateEffect(compute, effectFn,
|
|
552
|
-
return hydratedEffect(createEffect$1, compute, effectFn,
|
|
531
|
+
function hydratedCreateEffect(compute, effectFn, options) {
|
|
532
|
+
return hydratedEffect(createEffect$1, compute, effectFn, options);
|
|
553
533
|
}
|
|
554
534
|
function enableHydration() {
|
|
555
535
|
_createMemo = hydratedCreateMemo;
|
|
@@ -608,24 +588,6 @@ const createStore = (...args) => (_createStore || createStore$1)(...args);
|
|
|
608
588
|
const createOptimisticStore = (...args) => (_createOptimisticStore || createOptimisticStore$1)(...args);
|
|
609
589
|
const createRenderEffect = (...args) => (_createRenderEffect || createRenderEffect$1)(...args);
|
|
610
590
|
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
591
|
function createBoundaryTrigger() {
|
|
630
592
|
setSnapshotCapture(false);
|
|
631
593
|
const [s, set] = createSignal$1(undefined, {
|
|
@@ -694,7 +656,7 @@ function createLoadingBoundary(fn, fallback, options) {
|
|
|
694
656
|
let assetPromise;
|
|
695
657
|
if (sharedConfig.hydrating && sharedConfig.has(id + "_assets")) {
|
|
696
658
|
const mapping = sharedConfig.load(id + "_assets");
|
|
697
|
-
if (mapping && typeof mapping === "object") assetPromise = loadModuleAssets(mapping);
|
|
659
|
+
if (mapping && typeof mapping === "object") assetPromise = sharedConfig.loadModuleAssets?.(mapping);
|
|
698
660
|
}
|
|
699
661
|
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
700
662
|
const ref = sharedConfig.load(id);
|
|
@@ -808,8 +770,8 @@ function Repeat(props) {
|
|
|
808
770
|
}
|
|
809
771
|
function Show(props) {
|
|
810
772
|
const keyed = props.keyed;
|
|
811
|
-
const conditionValue = createMemo$1(() => props.when, undefined
|
|
812
|
-
const condition = keyed ? conditionValue : createMemo$1(conditionValue,
|
|
773
|
+
const conditionValue = createMemo$1(() => props.when, undefined);
|
|
774
|
+
const condition = keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
813
775
|
equals: (a, b) => !a === !b
|
|
814
776
|
});
|
|
815
777
|
return createMemo$1(() => {
|
|
@@ -823,7 +785,7 @@ function Show(props) {
|
|
|
823
785
|
}), IS_DEV) : child;
|
|
824
786
|
}
|
|
825
787
|
return props.fallback;
|
|
826
|
-
}, undefined
|
|
788
|
+
}, undefined);
|
|
827
789
|
}
|
|
828
790
|
function Switch(props) {
|
|
829
791
|
const chs = children(() => props.children);
|
|
@@ -834,8 +796,8 @@ function Switch(props) {
|
|
|
834
796
|
const index = i;
|
|
835
797
|
const mp = mps[i];
|
|
836
798
|
const prevFunc = func;
|
|
837
|
-
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined
|
|
838
|
-
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue,
|
|
799
|
+
const conditionValue = createMemo$1(() => prevFunc() ? undefined : mp.when, undefined);
|
|
800
|
+
const condition = mp.keyed ? conditionValue : createMemo$1(conditionValue, {
|
|
839
801
|
equals: (a, b) => !a === !b
|
|
840
802
|
});
|
|
841
803
|
func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
|
|
@@ -852,7 +814,7 @@ function Switch(props) {
|
|
|
852
814
|
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
853
815
|
return conditionValue();
|
|
854
816
|
}), IS_DEV) : child;
|
|
855
|
-
}, undefined
|
|
817
|
+
}, undefined);
|
|
856
818
|
}
|
|
857
819
|
function Match(props) {
|
|
858
820
|
return props;
|
|
@@ -871,7 +833,7 @@ function Loading(props) {
|
|
|
871
833
|
}
|
|
872
834
|
function Reveal(props) {
|
|
873
835
|
return createRevealOrder(() => props.children, {
|
|
874
|
-
|
|
836
|
+
order: () => props.order ?? "sequential",
|
|
875
837
|
collapsed: () => !!props.collapsed
|
|
876
838
|
});
|
|
877
839
|
}
|
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.8",
|
|
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.8",
|
|
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/flow.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Accessor } from "@solidjs/signals";
|
|
1
|
+
import type { Accessor, RevealOrder } from "@solidjs/signals";
|
|
2
|
+
export type { RevealOrder };
|
|
2
3
|
import type { JSX } from "../jsx.js";
|
|
3
4
|
type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
|
|
4
5
|
type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => JSX.Element;
|
|
@@ -117,26 +118,46 @@ export declare function Loading(props: {
|
|
|
117
118
|
on?: any;
|
|
118
119
|
children: JSX.Element;
|
|
119
120
|
}): JSX.Element;
|
|
121
|
+
export type RevealProps = {
|
|
122
|
+
order?: RevealOrder;
|
|
123
|
+
collapsed?: boolean;
|
|
124
|
+
children: JSX.Element;
|
|
125
|
+
};
|
|
120
126
|
/**
|
|
121
127
|
* Coordinates the reveal timing of sibling `<Loading>` boundaries.
|
|
122
128
|
*
|
|
123
|
-
*
|
|
124
|
-
* -
|
|
125
|
-
*
|
|
126
|
-
*
|
|
129
|
+
* The `order` prop picks the reveal policy:
|
|
130
|
+
* - `"sequential"` (default) — boundaries reveal in registration order; later boundaries
|
|
131
|
+
* stay on their fallback until earlier ones resolve.
|
|
132
|
+
* - `"together"` — every direct slot stays on its fallback until the whole group is
|
|
133
|
+
* "minimally ready" (every direct slot has its own first visible content available),
|
|
134
|
+
* then the group releases in one cohesive reveal.
|
|
135
|
+
* - `"natural"` — each boundary reveals as its own data resolves. At the top level
|
|
136
|
+
* this is equivalent to omitting `<Reveal>`; the mode exists for nesting, where
|
|
137
|
+
* the group registers as a single composite slot in an enclosing `<Reveal>`.
|
|
138
|
+
*
|
|
139
|
+
* The `collapsed` prop is only consulted when `order="sequential"` (the default);
|
|
140
|
+
* it is ignored under `"together"` and `"natural"`. When set, tail boundaries past
|
|
141
|
+
* the frontier suppress their own fallback output.
|
|
142
|
+
*
|
|
143
|
+
* Nested `<Reveal>` groups compose: the inner group is one slot in the outer order
|
|
144
|
+
* and is held on its fallbacks until the outer releases the slot. Once released, the
|
|
145
|
+
* inner group runs its own `order` locally over whatever is still pending. There is
|
|
146
|
+
* no escape hatch — nesting under an outer group means participating in its ordering.
|
|
147
|
+
* See `documentation/solid-2.0/03-control-flow.md` for the full nesting matrix and the
|
|
148
|
+
* "minimally ready" definition per order.
|
|
127
149
|
*
|
|
128
150
|
* ```typescript
|
|
129
|
-
* <Reveal>
|
|
151
|
+
* <Reveal order="sequential">
|
|
130
152
|
* <Loading fallback={<Skeleton />}><ProfileHeader /></Loading>
|
|
131
|
-
* <
|
|
153
|
+
* <Reveal order="natural">
|
|
154
|
+
* <Loading fallback={<Skeleton />}><PostA /></Loading>
|
|
155
|
+
* <Loading fallback={<Skeleton />}><PostB /></Loading>
|
|
156
|
+
* </Reveal>
|
|
157
|
+
* <Loading fallback={<Skeleton />}><Comments /></Loading>
|
|
132
158
|
* </Reveal>
|
|
133
159
|
* ```
|
|
134
160
|
*
|
|
135
161
|
* @description https://docs.solidjs.com/reference/components/reveal
|
|
136
162
|
*/
|
|
137
|
-
export declare function Reveal(props:
|
|
138
|
-
together?: boolean;
|
|
139
|
-
collapsed?: boolean;
|
|
140
|
-
children: JSX.Element;
|
|
141
|
-
}): JSX.Element;
|
|
142
|
-
export {};
|
|
163
|
+
export declare function Reveal(props: RevealProps): JSX.Element;
|