solid-js 2.0.0-experimental.15 → 2.0.0-experimental.16
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 +73 -16
- package/dist/dev.js +60 -9
- package/dist/server.cjs +86 -36
- package/dist/server.js +76 -38
- package/dist/solid.cjs +71 -14
- package/dist/solid.js +58 -7
- package/package.json +2 -2
- package/types/client/hydration.d.ts +10 -1
- package/types/index.d.ts +3 -3
- package/types/jsx.d.ts +5 -28
- package/types/server/core.d.ts +3 -2
- package/types/server/index.d.ts +2 -2
- package/types/server/signals.d.ts +3 -3
package/dist/dev.cjs
CHANGED
|
@@ -19,13 +19,16 @@ function useContext(context) {
|
|
|
19
19
|
return signals.getContext(context);
|
|
20
20
|
}
|
|
21
21
|
function children(fn) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const c = signals.createMemo(fn, undefined, {
|
|
23
|
+
lazy: true
|
|
24
|
+
});
|
|
25
|
+
const memo = signals.createMemo(() => signals.flatten(c()), undefined, {
|
|
26
|
+
name: "children",
|
|
27
|
+
lazy: true
|
|
28
|
+
} );
|
|
26
29
|
memo.toArray = () => {
|
|
27
|
-
const
|
|
28
|
-
return Array.isArray(
|
|
30
|
+
const v = memo();
|
|
31
|
+
return Array.isArray(v) ? v : v != null ? [v] : [];
|
|
29
32
|
};
|
|
30
33
|
return memo;
|
|
31
34
|
}
|
|
@@ -90,6 +93,7 @@ function drainHydrationCallbacks() {
|
|
|
90
93
|
_hydrationEndCallbacks = null;
|
|
91
94
|
if (cbs) for (const cb of cbs) cb();
|
|
92
95
|
setTimeout(() => {
|
|
96
|
+
if (sharedConfig.verifyHydration) sharedConfig.verifyHydration();
|
|
93
97
|
if (globalThis._$HY) globalThis._$HY.done = true;
|
|
94
98
|
});
|
|
95
99
|
}
|
|
@@ -105,6 +109,8 @@ let _createOptimistic;
|
|
|
105
109
|
let _createProjection;
|
|
106
110
|
let _createStore;
|
|
107
111
|
let _createOptimisticStore;
|
|
112
|
+
let _createRenderEffect;
|
|
113
|
+
let _createEffect;
|
|
108
114
|
class MockPromise {
|
|
109
115
|
static all() {
|
|
110
116
|
return new MockPromise();
|
|
@@ -385,6 +391,47 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
385
391
|
if (aiResult !== null) return aiResult[0];
|
|
386
392
|
return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options);
|
|
387
393
|
}
|
|
394
|
+
function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
395
|
+
if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options);
|
|
396
|
+
const ssrSource = options?.ssrSource;
|
|
397
|
+
if (ssrSource === "client") {
|
|
398
|
+
const [hydrated, setHydrated] = signals.createSignal(false);
|
|
399
|
+
let active = false;
|
|
400
|
+
coreFn(prev => {
|
|
401
|
+
if (!hydrated()) return value;
|
|
402
|
+
active = true;
|
|
403
|
+
return compute(prev);
|
|
404
|
+
}, (next, prev) => {
|
|
405
|
+
if (!active) return;
|
|
406
|
+
return effectFn(next, prev);
|
|
407
|
+
}, value, options);
|
|
408
|
+
setHydrated(true);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (ssrSource === "initial") {
|
|
412
|
+
coreFn(prev => {
|
|
413
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
414
|
+
subFetch(compute, prev);
|
|
415
|
+
return prev ?? value;
|
|
416
|
+
}, effectFn, value, options);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
markTopLevelSnapshotScope();
|
|
420
|
+
coreFn(prev => {
|
|
421
|
+
const o = signals.getOwner();
|
|
422
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
423
|
+
let initP;
|
|
424
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
425
|
+
const init = initP?.v ?? initP;
|
|
426
|
+
return init != null ? (subFetch(compute, prev), init) : compute(prev);
|
|
427
|
+
}, effectFn, value, options);
|
|
428
|
+
}
|
|
429
|
+
function hydratedCreateRenderEffect(compute, effectFn, value, options) {
|
|
430
|
+
return hydratedEffect(signals.createRenderEffect, compute, effectFn, value, options);
|
|
431
|
+
}
|
|
432
|
+
function hydratedCreateEffect(compute, effectFn, value, options) {
|
|
433
|
+
return hydratedEffect(signals.createEffect, compute, effectFn, value, options);
|
|
434
|
+
}
|
|
388
435
|
function enableHydration() {
|
|
389
436
|
_createMemo = hydratedCreateMemo;
|
|
390
437
|
_createSignal = hydratedCreateSignal;
|
|
@@ -393,6 +440,8 @@ function enableHydration() {
|
|
|
393
440
|
_createProjection = hydratedCreateProjection;
|
|
394
441
|
_createStore = hydratedCreateStore;
|
|
395
442
|
_createOptimisticStore = hydratedCreateOptimisticStore;
|
|
443
|
+
_createRenderEffect = hydratedCreateRenderEffect;
|
|
444
|
+
_createEffect = hydratedCreateEffect;
|
|
396
445
|
_hydratingValue = sharedConfig.hydrating;
|
|
397
446
|
_doneValue = sharedConfig.done;
|
|
398
447
|
Object.defineProperty(sharedConfig, "hydrating", {
|
|
@@ -438,6 +487,8 @@ const createOptimistic = (...args) => (_createOptimistic || signals.createOptimi
|
|
|
438
487
|
const createProjection = (...args) => (_createProjection || signals.createProjection)(...args);
|
|
439
488
|
const createStore = (...args) => (_createStore || signals.createStore)(...args);
|
|
440
489
|
const createOptimisticStore = (...args) => (_createOptimisticStore || signals.createOptimisticStore)(...args);
|
|
490
|
+
const createRenderEffect = (...args) => (_createRenderEffect || signals.createRenderEffect)(...args);
|
|
491
|
+
const createEffect = (...args) => (_createEffect || signals.createEffect)(...args);
|
|
441
492
|
function loadModuleAssets(mapping) {
|
|
442
493
|
const hy = globalThis._$HY;
|
|
443
494
|
if (!hy) return;
|
|
@@ -702,18 +753,14 @@ Object.defineProperty(exports, "action", {
|
|
|
702
753
|
enumerable: true,
|
|
703
754
|
get: function () { return signals.action; }
|
|
704
755
|
});
|
|
705
|
-
Object.defineProperty(exports, "
|
|
756
|
+
Object.defineProperty(exports, "createOwner", {
|
|
706
757
|
enumerable: true,
|
|
707
|
-
get: function () { return signals.
|
|
758
|
+
get: function () { return signals.createOwner; }
|
|
708
759
|
});
|
|
709
760
|
Object.defineProperty(exports, "createReaction", {
|
|
710
761
|
enumerable: true,
|
|
711
762
|
get: function () { return signals.createReaction; }
|
|
712
763
|
});
|
|
713
|
-
Object.defineProperty(exports, "createRenderEffect", {
|
|
714
|
-
enumerable: true,
|
|
715
|
-
get: function () { return signals.createRenderEffect; }
|
|
716
|
-
});
|
|
717
764
|
Object.defineProperty(exports, "createRoot", {
|
|
718
765
|
enumerable: true,
|
|
719
766
|
get: function () { return signals.createRoot; }
|
|
@@ -734,6 +781,10 @@ Object.defineProperty(exports, "flush", {
|
|
|
734
781
|
enumerable: true,
|
|
735
782
|
get: function () { return signals.flush; }
|
|
736
783
|
});
|
|
784
|
+
Object.defineProperty(exports, "getNextChildId", {
|
|
785
|
+
enumerable: true,
|
|
786
|
+
get: function () { return signals.getNextChildId; }
|
|
787
|
+
});
|
|
737
788
|
Object.defineProperty(exports, "getObserver", {
|
|
738
789
|
enumerable: true,
|
|
739
790
|
get: function () { return signals.getObserver; }
|
|
@@ -758,6 +809,10 @@ Object.defineProperty(exports, "isWrappable", {
|
|
|
758
809
|
enumerable: true,
|
|
759
810
|
get: function () { return signals.isWrappable; }
|
|
760
811
|
});
|
|
812
|
+
Object.defineProperty(exports, "latest", {
|
|
813
|
+
enumerable: true,
|
|
814
|
+
get: function () { return signals.latest; }
|
|
815
|
+
});
|
|
761
816
|
Object.defineProperty(exports, "mapArray", {
|
|
762
817
|
enumerable: true,
|
|
763
818
|
get: function () { return signals.mapArray; }
|
|
@@ -778,10 +833,6 @@ Object.defineProperty(exports, "onSettled", {
|
|
|
778
833
|
enumerable: true,
|
|
779
834
|
get: function () { return signals.onSettled; }
|
|
780
835
|
});
|
|
781
|
-
Object.defineProperty(exports, "pending", {
|
|
782
|
-
enumerable: true,
|
|
783
|
-
get: function () { return signals.pending; }
|
|
784
|
-
});
|
|
785
836
|
Object.defineProperty(exports, "reconcile", {
|
|
786
837
|
enumerable: true,
|
|
787
838
|
get: function () { return signals.reconcile; }
|
|
@@ -806,6 +857,10 @@ Object.defineProperty(exports, "snapshot", {
|
|
|
806
857
|
enumerable: true,
|
|
807
858
|
get: function () { return signals.snapshot; }
|
|
808
859
|
});
|
|
860
|
+
Object.defineProperty(exports, "storePath", {
|
|
861
|
+
enumerable: true,
|
|
862
|
+
get: function () { return signals.storePath; }
|
|
863
|
+
});
|
|
809
864
|
Object.defineProperty(exports, "untrack", {
|
|
810
865
|
enumerable: true,
|
|
811
866
|
get: function () { return signals.untrack; }
|
|
@@ -822,10 +877,12 @@ exports.Switch = Switch;
|
|
|
822
877
|
exports.children = children;
|
|
823
878
|
exports.createComponent = createComponent;
|
|
824
879
|
exports.createContext = createContext;
|
|
880
|
+
exports.createEffect = createEffect;
|
|
825
881
|
exports.createMemo = createMemo;
|
|
826
882
|
exports.createOptimistic = createOptimistic;
|
|
827
883
|
exports.createOptimisticStore = createOptimisticStore;
|
|
828
884
|
exports.createProjection = createProjection;
|
|
885
|
+
exports.createRenderEffect = createRenderEffect;
|
|
829
886
|
exports.createSignal = createSignal;
|
|
830
887
|
exports.createStore = createStore;
|
|
831
888
|
exports.createUniqueId = createUniqueId;
|
package/dist/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getContext, createMemo as createMemo$1, flatten, getOwner, createRoot, setContext, untrack, setStrictRead, createLoadBoundary, onCleanup, isDisposed, runWithOwner, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, mapArray, repeat } from '@solidjs/signals';
|
|
2
|
-
export { $PROXY, $TRACK, NotReadyError, action,
|
|
1
|
+
import { getContext, createMemo as createMemo$1, flatten, getOwner, createRoot, setContext, untrack, setStrictRead, createLoadBoundary, onCleanup, isDisposed, runWithOwner, createEffect as createEffect$1, 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, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, mapArray, repeat } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, 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';
|
|
3
3
|
|
|
4
4
|
const $DEVCOMP = Symbol("COMPONENT_DEV" );
|
|
5
5
|
function createContext(defaultValue, options) {
|
|
@@ -18,13 +18,16 @@ function useContext(context) {
|
|
|
18
18
|
return getContext(context);
|
|
19
19
|
}
|
|
20
20
|
function children(fn) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const c = createMemo$1(fn, undefined, {
|
|
22
|
+
lazy: true
|
|
23
|
+
});
|
|
24
|
+
const memo = createMemo$1(() => flatten(c()), undefined, {
|
|
25
|
+
name: "children",
|
|
26
|
+
lazy: true
|
|
27
|
+
} );
|
|
25
28
|
memo.toArray = () => {
|
|
26
|
-
const
|
|
27
|
-
return Array.isArray(
|
|
29
|
+
const v = memo();
|
|
30
|
+
return Array.isArray(v) ? v : v != null ? [v] : [];
|
|
28
31
|
};
|
|
29
32
|
return memo;
|
|
30
33
|
}
|
|
@@ -89,6 +92,7 @@ function drainHydrationCallbacks() {
|
|
|
89
92
|
_hydrationEndCallbacks = null;
|
|
90
93
|
if (cbs) for (const cb of cbs) cb();
|
|
91
94
|
setTimeout(() => {
|
|
95
|
+
if (sharedConfig.verifyHydration) sharedConfig.verifyHydration();
|
|
92
96
|
if (globalThis._$HY) globalThis._$HY.done = true;
|
|
93
97
|
});
|
|
94
98
|
}
|
|
@@ -104,6 +108,8 @@ let _createOptimistic;
|
|
|
104
108
|
let _createProjection;
|
|
105
109
|
let _createStore;
|
|
106
110
|
let _createOptimisticStore;
|
|
111
|
+
let _createRenderEffect;
|
|
112
|
+
let _createEffect;
|
|
107
113
|
class MockPromise {
|
|
108
114
|
static all() {
|
|
109
115
|
return new MockPromise();
|
|
@@ -384,6 +390,47 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
384
390
|
if (aiResult !== null) return aiResult[0];
|
|
385
391
|
return createProjection$1(wrapStoreFn(fn, ssrSource), initialValue, options);
|
|
386
392
|
}
|
|
393
|
+
function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
394
|
+
if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options);
|
|
395
|
+
const ssrSource = options?.ssrSource;
|
|
396
|
+
if (ssrSource === "client") {
|
|
397
|
+
const [hydrated, setHydrated] = createSignal$1(false);
|
|
398
|
+
let active = false;
|
|
399
|
+
coreFn(prev => {
|
|
400
|
+
if (!hydrated()) return value;
|
|
401
|
+
active = true;
|
|
402
|
+
return compute(prev);
|
|
403
|
+
}, (next, prev) => {
|
|
404
|
+
if (!active) return;
|
|
405
|
+
return effectFn(next, prev);
|
|
406
|
+
}, value, options);
|
|
407
|
+
setHydrated(true);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (ssrSource === "initial") {
|
|
411
|
+
coreFn(prev => {
|
|
412
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
413
|
+
subFetch(compute, prev);
|
|
414
|
+
return prev ?? value;
|
|
415
|
+
}, effectFn, value, options);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
markTopLevelSnapshotScope();
|
|
419
|
+
coreFn(prev => {
|
|
420
|
+
const o = getOwner();
|
|
421
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
422
|
+
let initP;
|
|
423
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
424
|
+
const init = initP?.v ?? initP;
|
|
425
|
+
return init != null ? (subFetch(compute, prev), init) : compute(prev);
|
|
426
|
+
}, effectFn, value, options);
|
|
427
|
+
}
|
|
428
|
+
function hydratedCreateRenderEffect(compute, effectFn, value, options) {
|
|
429
|
+
return hydratedEffect(createRenderEffect$1, compute, effectFn, value, options);
|
|
430
|
+
}
|
|
431
|
+
function hydratedCreateEffect(compute, effectFn, value, options) {
|
|
432
|
+
return hydratedEffect(createEffect$1, compute, effectFn, value, options);
|
|
433
|
+
}
|
|
387
434
|
function enableHydration() {
|
|
388
435
|
_createMemo = hydratedCreateMemo;
|
|
389
436
|
_createSignal = hydratedCreateSignal;
|
|
@@ -392,6 +439,8 @@ function enableHydration() {
|
|
|
392
439
|
_createProjection = hydratedCreateProjection;
|
|
393
440
|
_createStore = hydratedCreateStore;
|
|
394
441
|
_createOptimisticStore = hydratedCreateOptimisticStore;
|
|
442
|
+
_createRenderEffect = hydratedCreateRenderEffect;
|
|
443
|
+
_createEffect = hydratedCreateEffect;
|
|
395
444
|
_hydratingValue = sharedConfig.hydrating;
|
|
396
445
|
_doneValue = sharedConfig.done;
|
|
397
446
|
Object.defineProperty(sharedConfig, "hydrating", {
|
|
@@ -437,6 +486,8 @@ const createOptimistic = (...args) => (_createOptimistic || createOptimistic$1)(
|
|
|
437
486
|
const createProjection = (...args) => (_createProjection || createProjection$1)(...args);
|
|
438
487
|
const createStore = (...args) => (_createStore || createStore$1)(...args);
|
|
439
488
|
const createOptimisticStore = (...args) => (_createOptimisticStore || createOptimisticStore$1)(...args);
|
|
489
|
+
const createRenderEffect = (...args) => (_createRenderEffect || createRenderEffect$1)(...args);
|
|
490
|
+
const createEffect = (...args) => (_createEffect || createEffect$1)(...args);
|
|
440
491
|
function loadModuleAssets(mapping) {
|
|
441
492
|
const hy = globalThis._$HY;
|
|
442
493
|
if (!hy) return;
|
|
@@ -685,4 +736,4 @@ if (globalThis) {
|
|
|
685
736
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
686
737
|
}
|
|
687
738
|
|
|
688
|
-
export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createMemo, createOptimistic, createOptimisticStore, createProjection, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
|
739
|
+
export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createRenderEffect, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
package/dist/server.cjs
CHANGED
|
@@ -220,25 +220,42 @@ function processResult(comp, result, owner, ctx, deferStream, ssrSource) {
|
|
|
220
220
|
}
|
|
221
221
|
comp.value = result;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
function serverEffect(compute, effectFn, value, options) {
|
|
224
|
+
const ssrSource = options?.ssrSource;
|
|
225
|
+
if (ssrSource === "client" || ssrSource === "initial") {
|
|
226
|
+
signals.createOwner();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const ctx = sharedConfig.context;
|
|
228
230
|
const owner = signals.createOwner();
|
|
231
|
+
const comp = {
|
|
232
|
+
owner,
|
|
233
|
+
value: value,
|
|
234
|
+
compute: compute,
|
|
235
|
+
error: undefined,
|
|
236
|
+
computed: true,
|
|
237
|
+
disposed: false
|
|
238
|
+
};
|
|
239
|
+
if (ssrSource) {
|
|
240
|
+
signals.runWithOwner(owner, () => signals.onCleanup(() => {
|
|
241
|
+
comp.disposed = true;
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
229
244
|
try {
|
|
230
|
-
const result = signals.runWithOwner(owner, () => runWithObserver(
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
computed: true,
|
|
236
|
-
disposed: false
|
|
237
|
-
}, () => compute(value)));
|
|
238
|
-
effectFn(result, value);
|
|
245
|
+
const result = signals.runWithOwner(owner, () => runWithObserver(comp, () => compute(value)));
|
|
246
|
+
if (ssrSource) {
|
|
247
|
+
processResult(comp, result, owner, ctx, options?.deferStream, ssrSource);
|
|
248
|
+
}
|
|
249
|
+
effectFn?.(ssrSource ? comp.value ?? result : result, value);
|
|
239
250
|
} catch (err) {
|
|
240
251
|
}
|
|
241
252
|
}
|
|
253
|
+
function createEffect(compute, effect, value, options) {
|
|
254
|
+
serverEffect(compute, undefined, value, options);
|
|
255
|
+
}
|
|
256
|
+
function createRenderEffect(compute, effectFn, value, options) {
|
|
257
|
+
serverEffect(compute, effectFn, value, options);
|
|
258
|
+
}
|
|
242
259
|
function createTrackedEffect(compute, options) {
|
|
243
260
|
const o = signals.getOwner();
|
|
244
261
|
if (o?.id != null) signals.getNextChildId(o);
|
|
@@ -434,12 +451,23 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
434
451
|
};
|
|
435
452
|
}
|
|
436
453
|
function repeat(count, mapFn, options = {}) {
|
|
454
|
+
const owner = signals.createOwner();
|
|
437
455
|
const len = count();
|
|
438
456
|
const offset = options.from?.() || 0;
|
|
439
457
|
let s = [];
|
|
440
458
|
if (len) {
|
|
441
|
-
|
|
442
|
-
|
|
459
|
+
signals.runWithOwner(owner, () => {
|
|
460
|
+
for (let i = 0; i < len; i++) {
|
|
461
|
+
const itemOwner = signals.createOwner();
|
|
462
|
+
s.push(signals.runWithOwner(itemOwner, () => mapFn(i + offset)));
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
} else if (options.fallback) {
|
|
466
|
+
s = [signals.runWithOwner(owner, () => {
|
|
467
|
+
const fo = signals.createOwner();
|
|
468
|
+
return signals.runWithOwner(fo, () => options.fallback());
|
|
469
|
+
})];
|
|
470
|
+
}
|
|
443
471
|
return () => s;
|
|
444
472
|
}
|
|
445
473
|
const ErrorContext = {
|
|
@@ -449,6 +477,9 @@ const ErrorContext = {
|
|
|
449
477
|
function createErrorBoundary(fn, fallback) {
|
|
450
478
|
const ctx = sharedConfig.context;
|
|
451
479
|
const owner = signals.createOwner();
|
|
480
|
+
const parent = signals.getOwner();
|
|
481
|
+
if (parent?.id != null) signals.getNextChildId(parent);
|
|
482
|
+
owner.id = owner.id + "0";
|
|
452
483
|
return signals.runWithOwner(owner, () => {
|
|
453
484
|
let result;
|
|
454
485
|
signals.setContext(ErrorContext, err => {
|
|
@@ -493,7 +524,7 @@ function isPending(fn, fallback) {
|
|
|
493
524
|
throw err;
|
|
494
525
|
}
|
|
495
526
|
}
|
|
496
|
-
function
|
|
527
|
+
function latest(fn) {
|
|
497
528
|
return fn();
|
|
498
529
|
}
|
|
499
530
|
function isRefreshing() {
|
|
@@ -527,20 +558,20 @@ function useContext(context) {
|
|
|
527
558
|
return signals.getContext(context);
|
|
528
559
|
}
|
|
529
560
|
function children(fn) {
|
|
530
|
-
const
|
|
531
|
-
|
|
561
|
+
const c = createMemo(fn, undefined, {
|
|
562
|
+
lazy: true
|
|
563
|
+
});
|
|
564
|
+
const memo = createMemo(() => signals.flatten(c()), undefined, {
|
|
565
|
+
lazy: true
|
|
566
|
+
});
|
|
532
567
|
memo.toArray = () => {
|
|
533
|
-
const
|
|
534
|
-
return Array.isArray(
|
|
568
|
+
const v = memo();
|
|
569
|
+
return Array.isArray(v) ? v : v != null ? [v] : [];
|
|
535
570
|
};
|
|
536
571
|
return memo;
|
|
537
572
|
}
|
|
538
573
|
function ssrRunInScope(fn) {
|
|
539
|
-
|
|
540
|
-
const o = signals.createOwner();
|
|
541
|
-
return fn.map(f => signals.runWithOwner.bind(null, o, f));
|
|
542
|
-
}
|
|
543
|
-
return signals.runWithOwner.bind(null, signals.createOwner(), fn);
|
|
574
|
+
return fn;
|
|
544
575
|
}
|
|
545
576
|
|
|
546
577
|
function enableHydration() {}
|
|
@@ -608,20 +639,27 @@ function Repeat(props) {
|
|
|
608
639
|
return repeat(() => props.count, index => typeof props.children === "function" ? props.children(index) : props.children, options);
|
|
609
640
|
}
|
|
610
641
|
function Show(props) {
|
|
611
|
-
const
|
|
612
|
-
if (
|
|
613
|
-
|
|
614
|
-
if (
|
|
615
|
-
return child(() => when);
|
|
616
|
-
}
|
|
617
|
-
return child;
|
|
642
|
+
const o = signals.getOwner();
|
|
643
|
+
if (o?.id != null) {
|
|
644
|
+
signals.getNextChildId(o);
|
|
645
|
+
if (!props.keyed) signals.getNextChildId(o);
|
|
618
646
|
}
|
|
619
|
-
return
|
|
647
|
+
return createMemo(() => {
|
|
648
|
+
const when = props.when;
|
|
649
|
+
if (when) {
|
|
650
|
+
const child = props.children;
|
|
651
|
+
if (typeof child === "function" && child.length > 0) {
|
|
652
|
+
return child(() => when);
|
|
653
|
+
}
|
|
654
|
+
return child;
|
|
655
|
+
}
|
|
656
|
+
return props.fallback;
|
|
657
|
+
});
|
|
620
658
|
}
|
|
621
659
|
function Switch(props) {
|
|
622
660
|
const chs = children(() => props.children);
|
|
623
661
|
const o = signals.getOwner();
|
|
624
|
-
if (o) signals.getNextChildId(o);
|
|
662
|
+
if (o?.id != null) signals.getNextChildId(o);
|
|
625
663
|
return createMemo(() => {
|
|
626
664
|
let conds = chs();
|
|
627
665
|
if (!Array.isArray(conds)) conds = [conds];
|
|
@@ -743,6 +781,10 @@ Object.defineProperty(exports, "NotReadyError", {
|
|
|
743
781
|
enumerable: true,
|
|
744
782
|
get: function () { return signals.NotReadyError; }
|
|
745
783
|
});
|
|
784
|
+
Object.defineProperty(exports, "createOwner", {
|
|
785
|
+
enumerable: true,
|
|
786
|
+
get: function () { return signals.createOwner; }
|
|
787
|
+
});
|
|
746
788
|
Object.defineProperty(exports, "createRoot", {
|
|
747
789
|
enumerable: true,
|
|
748
790
|
get: function () { return signals.createRoot; }
|
|
@@ -751,6 +793,10 @@ Object.defineProperty(exports, "flatten", {
|
|
|
751
793
|
enumerable: true,
|
|
752
794
|
get: function () { return signals.flatten; }
|
|
753
795
|
});
|
|
796
|
+
Object.defineProperty(exports, "getNextChildId", {
|
|
797
|
+
enumerable: true,
|
|
798
|
+
get: function () { return signals.getNextChildId; }
|
|
799
|
+
});
|
|
754
800
|
Object.defineProperty(exports, "getOwner", {
|
|
755
801
|
enumerable: true,
|
|
756
802
|
get: function () { return signals.getOwner; }
|
|
@@ -783,6 +829,10 @@ Object.defineProperty(exports, "snapshot", {
|
|
|
783
829
|
enumerable: true,
|
|
784
830
|
get: function () { return signals.snapshot; }
|
|
785
831
|
});
|
|
832
|
+
Object.defineProperty(exports, "storePath", {
|
|
833
|
+
enumerable: true,
|
|
834
|
+
get: function () { return signals.storePath; }
|
|
835
|
+
});
|
|
786
836
|
exports.$DEVCOMP = $DEVCOMP;
|
|
787
837
|
exports.DEV = DEV;
|
|
788
838
|
exports.Errored = Errored;
|
|
@@ -814,10 +864,10 @@ exports.flush = flush;
|
|
|
814
864
|
exports.getObserver = getObserver;
|
|
815
865
|
exports.isPending = isPending;
|
|
816
866
|
exports.isRefreshing = isRefreshing;
|
|
867
|
+
exports.latest = latest;
|
|
817
868
|
exports.lazy = lazy;
|
|
818
869
|
exports.mapArray = mapArray;
|
|
819
870
|
exports.onSettled = onSettled;
|
|
820
|
-
exports.pending = pending;
|
|
821
871
|
exports.reconcile = reconcile;
|
|
822
872
|
exports.refresh = refresh;
|
|
823
873
|
exports.repeat = repeat;
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getOwner, getNextChildId, createOwner, runWithOwner, onCleanup, NotReadyError, isWrappable, setContext, getContext,
|
|
2
|
-
export { $PROXY, $TRACK, NotReadyError, createRoot, flatten, getOwner, isEqual, isWrappable, merge, omit, onCleanup, runWithOwner, snapshot } from '@solidjs/signals';
|
|
1
|
+
import { getOwner, getNextChildId, createOwner, runWithOwner, onCleanup, NotReadyError, isWrappable, setContext, getContext, flatten, createRoot } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $TRACK, NotReadyError, createOwner, createRoot, flatten, getNextChildId, getOwner, isEqual, isWrappable, merge, omit, onCleanup, runWithOwner, snapshot, storePath } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const sharedConfig = {
|
|
5
5
|
getNextContextId() {
|
|
@@ -219,25 +219,42 @@ function processResult(comp, result, owner, ctx, deferStream, ssrSource) {
|
|
|
219
219
|
}
|
|
220
220
|
comp.value = result;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
function serverEffect(compute, effectFn, value, options) {
|
|
223
|
+
const ssrSource = options?.ssrSource;
|
|
224
|
+
if (ssrSource === "client" || ssrSource === "initial") {
|
|
225
|
+
createOwner();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const ctx = sharedConfig.context;
|
|
227
229
|
const owner = createOwner();
|
|
230
|
+
const comp = {
|
|
231
|
+
owner,
|
|
232
|
+
value: value,
|
|
233
|
+
compute: compute,
|
|
234
|
+
error: undefined,
|
|
235
|
+
computed: true,
|
|
236
|
+
disposed: false
|
|
237
|
+
};
|
|
238
|
+
if (ssrSource) {
|
|
239
|
+
runWithOwner(owner, () => onCleanup(() => {
|
|
240
|
+
comp.disposed = true;
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
228
243
|
try {
|
|
229
|
-
const result = runWithOwner(owner, () => runWithObserver(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
computed: true,
|
|
235
|
-
disposed: false
|
|
236
|
-
}, () => compute(value)));
|
|
237
|
-
effectFn(result, value);
|
|
244
|
+
const result = runWithOwner(owner, () => runWithObserver(comp, () => compute(value)));
|
|
245
|
+
if (ssrSource) {
|
|
246
|
+
processResult(comp, result, owner, ctx, options?.deferStream, ssrSource);
|
|
247
|
+
}
|
|
248
|
+
effectFn?.(ssrSource ? comp.value ?? result : result, value);
|
|
238
249
|
} catch (err) {
|
|
239
250
|
}
|
|
240
251
|
}
|
|
252
|
+
function createEffect(compute, effect, value, options) {
|
|
253
|
+
serverEffect(compute, undefined, value, options);
|
|
254
|
+
}
|
|
255
|
+
function createRenderEffect(compute, effectFn, value, options) {
|
|
256
|
+
serverEffect(compute, effectFn, value, options);
|
|
257
|
+
}
|
|
241
258
|
function createTrackedEffect(compute, options) {
|
|
242
259
|
const o = getOwner();
|
|
243
260
|
if (o?.id != null) getNextChildId(o);
|
|
@@ -433,12 +450,23 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
433
450
|
};
|
|
434
451
|
}
|
|
435
452
|
function repeat(count, mapFn, options = {}) {
|
|
453
|
+
const owner = createOwner();
|
|
436
454
|
const len = count();
|
|
437
455
|
const offset = options.from?.() || 0;
|
|
438
456
|
let s = [];
|
|
439
457
|
if (len) {
|
|
440
|
-
|
|
441
|
-
|
|
458
|
+
runWithOwner(owner, () => {
|
|
459
|
+
for (let i = 0; i < len; i++) {
|
|
460
|
+
const itemOwner = createOwner();
|
|
461
|
+
s.push(runWithOwner(itemOwner, () => mapFn(i + offset)));
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
} else if (options.fallback) {
|
|
465
|
+
s = [runWithOwner(owner, () => {
|
|
466
|
+
const fo = createOwner();
|
|
467
|
+
return runWithOwner(fo, () => options.fallback());
|
|
468
|
+
})];
|
|
469
|
+
}
|
|
442
470
|
return () => s;
|
|
443
471
|
}
|
|
444
472
|
const ErrorContext = {
|
|
@@ -448,6 +476,9 @@ const ErrorContext = {
|
|
|
448
476
|
function createErrorBoundary(fn, fallback) {
|
|
449
477
|
const ctx = sharedConfig.context;
|
|
450
478
|
const owner = createOwner();
|
|
479
|
+
const parent = getOwner();
|
|
480
|
+
if (parent?.id != null) getNextChildId(parent);
|
|
481
|
+
owner.id = owner.id + "0";
|
|
451
482
|
return runWithOwner(owner, () => {
|
|
452
483
|
let result;
|
|
453
484
|
setContext(ErrorContext, err => {
|
|
@@ -492,7 +523,7 @@ function isPending(fn, fallback) {
|
|
|
492
523
|
throw err;
|
|
493
524
|
}
|
|
494
525
|
}
|
|
495
|
-
function
|
|
526
|
+
function latest(fn) {
|
|
496
527
|
return fn();
|
|
497
528
|
}
|
|
498
529
|
function isRefreshing() {
|
|
@@ -526,20 +557,20 @@ function useContext(context) {
|
|
|
526
557
|
return getContext(context);
|
|
527
558
|
}
|
|
528
559
|
function children(fn) {
|
|
529
|
-
const
|
|
530
|
-
|
|
560
|
+
const c = createMemo(fn, undefined, {
|
|
561
|
+
lazy: true
|
|
562
|
+
});
|
|
563
|
+
const memo = createMemo(() => flatten(c()), undefined, {
|
|
564
|
+
lazy: true
|
|
565
|
+
});
|
|
531
566
|
memo.toArray = () => {
|
|
532
|
-
const
|
|
533
|
-
return Array.isArray(
|
|
567
|
+
const v = memo();
|
|
568
|
+
return Array.isArray(v) ? v : v != null ? [v] : [];
|
|
534
569
|
};
|
|
535
570
|
return memo;
|
|
536
571
|
}
|
|
537
572
|
function ssrRunInScope(fn) {
|
|
538
|
-
|
|
539
|
-
const o = createOwner();
|
|
540
|
-
return fn.map(f => runWithOwner.bind(null, o, f));
|
|
541
|
-
}
|
|
542
|
-
return runWithOwner.bind(null, createOwner(), fn);
|
|
573
|
+
return fn;
|
|
543
574
|
}
|
|
544
575
|
|
|
545
576
|
function enableHydration() {}
|
|
@@ -607,20 +638,27 @@ function Repeat(props) {
|
|
|
607
638
|
return repeat(() => props.count, index => typeof props.children === "function" ? props.children(index) : props.children, options);
|
|
608
639
|
}
|
|
609
640
|
function Show(props) {
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
612
|
-
|
|
613
|
-
if (
|
|
614
|
-
return child(() => when);
|
|
615
|
-
}
|
|
616
|
-
return child;
|
|
641
|
+
const o = getOwner();
|
|
642
|
+
if (o?.id != null) {
|
|
643
|
+
getNextChildId(o);
|
|
644
|
+
if (!props.keyed) getNextChildId(o);
|
|
617
645
|
}
|
|
618
|
-
return
|
|
646
|
+
return createMemo(() => {
|
|
647
|
+
const when = props.when;
|
|
648
|
+
if (when) {
|
|
649
|
+
const child = props.children;
|
|
650
|
+
if (typeof child === "function" && child.length > 0) {
|
|
651
|
+
return child(() => when);
|
|
652
|
+
}
|
|
653
|
+
return child;
|
|
654
|
+
}
|
|
655
|
+
return props.fallback;
|
|
656
|
+
});
|
|
619
657
|
}
|
|
620
658
|
function Switch(props) {
|
|
621
659
|
const chs = children(() => props.children);
|
|
622
660
|
const o = getOwner();
|
|
623
|
-
if (o) getNextChildId(o);
|
|
661
|
+
if (o?.id != null) getNextChildId(o);
|
|
624
662
|
return createMemo(() => {
|
|
625
663
|
let conds = chs();
|
|
626
664
|
if (!Array.isArray(conds)) conds = [conds];
|
|
@@ -730,4 +768,4 @@ function Loading(props) {
|
|
|
730
768
|
|
|
731
769
|
const DEV = undefined;
|
|
732
770
|
|
|
733
|
-
export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, lazy, mapArray, onSettled,
|
|
771
|
+
export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, action, children, createComponent, createContext, createDeepProxy, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createSignal, createStore, createTrackedEffect, createUniqueId, deep, enableHydration, flush, getObserver, isPending, isRefreshing, latest, lazy, mapArray, onSettled, reconcile, refresh, repeat, resolve, sharedConfig, ssrHandleError, ssrRunInScope, untrack, useContext };
|
package/dist/solid.cjs
CHANGED
|
@@ -19,11 +19,15 @@ function useContext(context) {
|
|
|
19
19
|
return signals.getContext(context);
|
|
20
20
|
}
|
|
21
21
|
function children(fn) {
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const c = signals.createMemo(fn, undefined, {
|
|
23
|
+
lazy: true
|
|
24
|
+
});
|
|
25
|
+
const memo = signals.createMemo(() => signals.flatten(c()), undefined, {
|
|
26
|
+
lazy: true
|
|
27
|
+
});
|
|
24
28
|
memo.toArray = () => {
|
|
25
|
-
const
|
|
26
|
-
return Array.isArray(
|
|
29
|
+
const v = memo();
|
|
30
|
+
return Array.isArray(v) ? v : v != null ? [v] : [];
|
|
27
31
|
};
|
|
28
32
|
return memo;
|
|
29
33
|
}
|
|
@@ -76,6 +80,8 @@ let _createOptimistic;
|
|
|
76
80
|
let _createProjection;
|
|
77
81
|
let _createStore;
|
|
78
82
|
let _createOptimisticStore;
|
|
83
|
+
let _createRenderEffect;
|
|
84
|
+
let _createEffect;
|
|
79
85
|
class MockPromise {
|
|
80
86
|
static all() {
|
|
81
87
|
return new MockPromise();
|
|
@@ -356,6 +362,47 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
356
362
|
if (aiResult !== null) return aiResult[0];
|
|
357
363
|
return signals.createProjection(wrapStoreFn(fn, ssrSource), initialValue, options);
|
|
358
364
|
}
|
|
365
|
+
function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
366
|
+
if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options);
|
|
367
|
+
const ssrSource = options?.ssrSource;
|
|
368
|
+
if (ssrSource === "client") {
|
|
369
|
+
const [hydrated, setHydrated] = signals.createSignal(false);
|
|
370
|
+
let active = false;
|
|
371
|
+
coreFn(prev => {
|
|
372
|
+
if (!hydrated()) return value;
|
|
373
|
+
active = true;
|
|
374
|
+
return compute(prev);
|
|
375
|
+
}, (next, prev) => {
|
|
376
|
+
if (!active) return;
|
|
377
|
+
return effectFn(next, prev);
|
|
378
|
+
}, value, options);
|
|
379
|
+
setHydrated(true);
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (ssrSource === "initial") {
|
|
383
|
+
coreFn(prev => {
|
|
384
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
385
|
+
subFetch(compute, prev);
|
|
386
|
+
return prev ?? value;
|
|
387
|
+
}, effectFn, value, options);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
markTopLevelSnapshotScope();
|
|
391
|
+
coreFn(prev => {
|
|
392
|
+
const o = signals.getOwner();
|
|
393
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
394
|
+
let initP;
|
|
395
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
396
|
+
const init = initP?.v ?? initP;
|
|
397
|
+
return init != null ? (subFetch(compute, prev), init) : compute(prev);
|
|
398
|
+
}, effectFn, value, options);
|
|
399
|
+
}
|
|
400
|
+
function hydratedCreateRenderEffect(compute, effectFn, value, options) {
|
|
401
|
+
return hydratedEffect(signals.createRenderEffect, compute, effectFn, value, options);
|
|
402
|
+
}
|
|
403
|
+
function hydratedCreateEffect(compute, effectFn, value, options) {
|
|
404
|
+
return hydratedEffect(signals.createEffect, compute, effectFn, value, options);
|
|
405
|
+
}
|
|
359
406
|
function enableHydration() {
|
|
360
407
|
_createMemo = hydratedCreateMemo;
|
|
361
408
|
_createSignal = hydratedCreateSignal;
|
|
@@ -364,6 +411,8 @@ function enableHydration() {
|
|
|
364
411
|
_createProjection = hydratedCreateProjection;
|
|
365
412
|
_createStore = hydratedCreateStore;
|
|
366
413
|
_createOptimisticStore = hydratedCreateOptimisticStore;
|
|
414
|
+
_createRenderEffect = hydratedCreateRenderEffect;
|
|
415
|
+
_createEffect = hydratedCreateEffect;
|
|
367
416
|
_hydratingValue = sharedConfig.hydrating;
|
|
368
417
|
_doneValue = sharedConfig.done;
|
|
369
418
|
Object.defineProperty(sharedConfig, "hydrating", {
|
|
@@ -409,6 +458,8 @@ const createOptimistic = (...args) => (_createOptimistic || signals.createOptimi
|
|
|
409
458
|
const createProjection = (...args) => (_createProjection || signals.createProjection)(...args);
|
|
410
459
|
const createStore = (...args) => (_createStore || signals.createStore)(...args);
|
|
411
460
|
const createOptimisticStore = (...args) => (_createOptimisticStore || signals.createOptimisticStore)(...args);
|
|
461
|
+
const createRenderEffect = (...args) => (_createRenderEffect || signals.createRenderEffect)(...args);
|
|
462
|
+
const createEffect = (...args) => (_createEffect || signals.createEffect)(...args);
|
|
412
463
|
function loadModuleAssets(mapping) {
|
|
413
464
|
const hy = globalThis._$HY;
|
|
414
465
|
if (!hy) return;
|
|
@@ -646,18 +697,14 @@ Object.defineProperty(exports, "action", {
|
|
|
646
697
|
enumerable: true,
|
|
647
698
|
get: function () { return signals.action; }
|
|
648
699
|
});
|
|
649
|
-
Object.defineProperty(exports, "
|
|
700
|
+
Object.defineProperty(exports, "createOwner", {
|
|
650
701
|
enumerable: true,
|
|
651
|
-
get: function () { return signals.
|
|
702
|
+
get: function () { return signals.createOwner; }
|
|
652
703
|
});
|
|
653
704
|
Object.defineProperty(exports, "createReaction", {
|
|
654
705
|
enumerable: true,
|
|
655
706
|
get: function () { return signals.createReaction; }
|
|
656
707
|
});
|
|
657
|
-
Object.defineProperty(exports, "createRenderEffect", {
|
|
658
|
-
enumerable: true,
|
|
659
|
-
get: function () { return signals.createRenderEffect; }
|
|
660
|
-
});
|
|
661
708
|
Object.defineProperty(exports, "createRoot", {
|
|
662
709
|
enumerable: true,
|
|
663
710
|
get: function () { return signals.createRoot; }
|
|
@@ -678,6 +725,10 @@ Object.defineProperty(exports, "flush", {
|
|
|
678
725
|
enumerable: true,
|
|
679
726
|
get: function () { return signals.flush; }
|
|
680
727
|
});
|
|
728
|
+
Object.defineProperty(exports, "getNextChildId", {
|
|
729
|
+
enumerable: true,
|
|
730
|
+
get: function () { return signals.getNextChildId; }
|
|
731
|
+
});
|
|
681
732
|
Object.defineProperty(exports, "getObserver", {
|
|
682
733
|
enumerable: true,
|
|
683
734
|
get: function () { return signals.getObserver; }
|
|
@@ -702,6 +753,10 @@ Object.defineProperty(exports, "isWrappable", {
|
|
|
702
753
|
enumerable: true,
|
|
703
754
|
get: function () { return signals.isWrappable; }
|
|
704
755
|
});
|
|
756
|
+
Object.defineProperty(exports, "latest", {
|
|
757
|
+
enumerable: true,
|
|
758
|
+
get: function () { return signals.latest; }
|
|
759
|
+
});
|
|
705
760
|
Object.defineProperty(exports, "mapArray", {
|
|
706
761
|
enumerable: true,
|
|
707
762
|
get: function () { return signals.mapArray; }
|
|
@@ -722,10 +777,6 @@ Object.defineProperty(exports, "onSettled", {
|
|
|
722
777
|
enumerable: true,
|
|
723
778
|
get: function () { return signals.onSettled; }
|
|
724
779
|
});
|
|
725
|
-
Object.defineProperty(exports, "pending", {
|
|
726
|
-
enumerable: true,
|
|
727
|
-
get: function () { return signals.pending; }
|
|
728
|
-
});
|
|
729
780
|
Object.defineProperty(exports, "reconcile", {
|
|
730
781
|
enumerable: true,
|
|
731
782
|
get: function () { return signals.reconcile; }
|
|
@@ -750,6 +801,10 @@ Object.defineProperty(exports, "snapshot", {
|
|
|
750
801
|
enumerable: true,
|
|
751
802
|
get: function () { return signals.snapshot; }
|
|
752
803
|
});
|
|
804
|
+
Object.defineProperty(exports, "storePath", {
|
|
805
|
+
enumerable: true,
|
|
806
|
+
get: function () { return signals.storePath; }
|
|
807
|
+
});
|
|
753
808
|
Object.defineProperty(exports, "untrack", {
|
|
754
809
|
enumerable: true,
|
|
755
810
|
get: function () { return signals.untrack; }
|
|
@@ -766,10 +821,12 @@ exports.Switch = Switch;
|
|
|
766
821
|
exports.children = children;
|
|
767
822
|
exports.createComponent = createComponent;
|
|
768
823
|
exports.createContext = createContext;
|
|
824
|
+
exports.createEffect = createEffect;
|
|
769
825
|
exports.createMemo = createMemo;
|
|
770
826
|
exports.createOptimistic = createOptimistic;
|
|
771
827
|
exports.createOptimisticStore = createOptimisticStore;
|
|
772
828
|
exports.createProjection = createProjection;
|
|
829
|
+
exports.createRenderEffect = createRenderEffect;
|
|
773
830
|
exports.createSignal = createSignal;
|
|
774
831
|
exports.createStore = createStore;
|
|
775
832
|
exports.createUniqueId = createUniqueId;
|
package/dist/solid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createLoadBoundary, getOwner, onCleanup, isDisposed, runWithOwner, createOptimistic as createOptimistic$1, createOptimisticStore as createOptimisticStore$1, createProjection as createProjection$1, createSignal as createSignal$1, createStore as createStore$1, setSnapshotCapture, releaseSnapshotScope, getNextChildId, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, untrack, mapArray, repeat } from '@solidjs/signals';
|
|
2
|
-
export { $PROXY, $TRACK, NotReadyError, action,
|
|
1
|
+
import { getContext, createMemo as createMemo$1, flatten, createRoot, setContext, createLoadBoundary, getOwner, onCleanup, isDisposed, runWithOwner, createEffect as createEffect$1, 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, createErrorBoundary as createErrorBoundary$1, markSnapshotScope, flush, clearSnapshots, peekNextChildId, untrack, mapArray, repeat } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $TRACK, NotReadyError, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, 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';
|
|
3
3
|
|
|
4
4
|
const $DEVCOMP = Symbol(0);
|
|
5
5
|
function createContext(defaultValue, options) {
|
|
@@ -18,11 +18,15 @@ function useContext(context) {
|
|
|
18
18
|
return getContext(context);
|
|
19
19
|
}
|
|
20
20
|
function children(fn) {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const c = createMemo$1(fn, undefined, {
|
|
22
|
+
lazy: true
|
|
23
|
+
});
|
|
24
|
+
const memo = createMemo$1(() => flatten(c()), undefined, {
|
|
25
|
+
lazy: true
|
|
26
|
+
});
|
|
23
27
|
memo.toArray = () => {
|
|
24
|
-
const
|
|
25
|
-
return Array.isArray(
|
|
28
|
+
const v = memo();
|
|
29
|
+
return Array.isArray(v) ? v : v != null ? [v] : [];
|
|
26
30
|
};
|
|
27
31
|
return memo;
|
|
28
32
|
}
|
|
@@ -75,6 +79,8 @@ let _createOptimistic;
|
|
|
75
79
|
let _createProjection;
|
|
76
80
|
let _createStore;
|
|
77
81
|
let _createOptimisticStore;
|
|
82
|
+
let _createRenderEffect;
|
|
83
|
+
let _createEffect;
|
|
78
84
|
class MockPromise {
|
|
79
85
|
static all() {
|
|
80
86
|
return new MockPromise();
|
|
@@ -355,6 +361,47 @@ function hydratedCreateProjection(fn, initialValue, options) {
|
|
|
355
361
|
if (aiResult !== null) return aiResult[0];
|
|
356
362
|
return createProjection$1(wrapStoreFn(fn, ssrSource), initialValue, options);
|
|
357
363
|
}
|
|
364
|
+
function hydratedEffect(coreFn, compute, effectFn, value, options) {
|
|
365
|
+
if (!sharedConfig.hydrating) return coreFn(compute, effectFn, value, options);
|
|
366
|
+
const ssrSource = options?.ssrSource;
|
|
367
|
+
if (ssrSource === "client") {
|
|
368
|
+
const [hydrated, setHydrated] = createSignal$1(false);
|
|
369
|
+
let active = false;
|
|
370
|
+
coreFn(prev => {
|
|
371
|
+
if (!hydrated()) return value;
|
|
372
|
+
active = true;
|
|
373
|
+
return compute(prev);
|
|
374
|
+
}, (next, prev) => {
|
|
375
|
+
if (!active) return;
|
|
376
|
+
return effectFn(next, prev);
|
|
377
|
+
}, value, options);
|
|
378
|
+
setHydrated(true);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
if (ssrSource === "initial") {
|
|
382
|
+
coreFn(prev => {
|
|
383
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
384
|
+
subFetch(compute, prev);
|
|
385
|
+
return prev ?? value;
|
|
386
|
+
}, effectFn, value, options);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
markTopLevelSnapshotScope();
|
|
390
|
+
coreFn(prev => {
|
|
391
|
+
const o = getOwner();
|
|
392
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
393
|
+
let initP;
|
|
394
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
395
|
+
const init = initP?.v ?? initP;
|
|
396
|
+
return init != null ? (subFetch(compute, prev), init) : compute(prev);
|
|
397
|
+
}, effectFn, value, options);
|
|
398
|
+
}
|
|
399
|
+
function hydratedCreateRenderEffect(compute, effectFn, value, options) {
|
|
400
|
+
return hydratedEffect(createRenderEffect$1, compute, effectFn, value, options);
|
|
401
|
+
}
|
|
402
|
+
function hydratedCreateEffect(compute, effectFn, value, options) {
|
|
403
|
+
return hydratedEffect(createEffect$1, compute, effectFn, value, options);
|
|
404
|
+
}
|
|
358
405
|
function enableHydration() {
|
|
359
406
|
_createMemo = hydratedCreateMemo;
|
|
360
407
|
_createSignal = hydratedCreateSignal;
|
|
@@ -363,6 +410,8 @@ function enableHydration() {
|
|
|
363
410
|
_createProjection = hydratedCreateProjection;
|
|
364
411
|
_createStore = hydratedCreateStore;
|
|
365
412
|
_createOptimisticStore = hydratedCreateOptimisticStore;
|
|
413
|
+
_createRenderEffect = hydratedCreateRenderEffect;
|
|
414
|
+
_createEffect = hydratedCreateEffect;
|
|
366
415
|
_hydratingValue = sharedConfig.hydrating;
|
|
367
416
|
_doneValue = sharedConfig.done;
|
|
368
417
|
Object.defineProperty(sharedConfig, "hydrating", {
|
|
@@ -408,6 +457,8 @@ const createOptimistic = (...args) => (_createOptimistic || createOptimistic$1)(
|
|
|
408
457
|
const createProjection = (...args) => (_createProjection || createProjection$1)(...args);
|
|
409
458
|
const createStore = (...args) => (_createStore || createStore$1)(...args);
|
|
410
459
|
const createOptimisticStore = (...args) => (_createOptimisticStore || createOptimisticStore$1)(...args);
|
|
460
|
+
const createRenderEffect = (...args) => (_createRenderEffect || createRenderEffect$1)(...args);
|
|
461
|
+
const createEffect = (...args) => (_createEffect || createEffect$1)(...args);
|
|
411
462
|
function loadModuleAssets(mapping) {
|
|
412
463
|
const hy = globalThis._$HY;
|
|
413
464
|
if (!hy) return;
|
|
@@ -629,4 +680,4 @@ function ssrHandleError() {}
|
|
|
629
680
|
function ssrRunInScope() {}
|
|
630
681
|
const DEV = undefined;
|
|
631
682
|
|
|
632
|
-
export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createMemo, createOptimistic, createOptimisticStore, createProjection, createSignal, createStore, createUniqueId, enableHydration, lazy, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
|
683
|
+
export { $DEVCOMP, DEV, Errored, For, Loading, Match, Repeat, Show, Switch, children, createComponent, createContext, createEffect, 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-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.16",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"performance"
|
|
80
80
|
],
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@solidjs/signals": "^0.
|
|
82
|
+
"@solidjs/signals": "^0.11.1",
|
|
83
83
|
"csstype": "^3.1.0",
|
|
84
84
|
"seroval": "~1.5.0",
|
|
85
85
|
"seroval-plugins": "~1.5.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, type ProjectionOptions, type Store, type StoreSetter } from "@solidjs/signals";
|
|
1
|
+
import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, createRenderEffect as coreRenderEffect, createEffect as coreEffect, type ProjectionOptions, type Store, type StoreSetter } from "@solidjs/signals";
|
|
2
2
|
import { JSX } from "../jsx.js";
|
|
3
3
|
declare module "@solidjs/signals" {
|
|
4
4
|
interface MemoOptions<T> {
|
|
@@ -9,6 +9,10 @@ declare module "@solidjs/signals" {
|
|
|
9
9
|
deferStream?: boolean;
|
|
10
10
|
ssrSource?: "server" | "hybrid" | "initial" | "client";
|
|
11
11
|
}
|
|
12
|
+
interface EffectOptions {
|
|
13
|
+
deferStream?: boolean;
|
|
14
|
+
ssrSource?: "server" | "hybrid" | "initial" | "client";
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
export type HydrationProjectionOptions = ProjectionOptions & {
|
|
14
18
|
ssrSource?: "server" | "hybrid" | "initial" | "client";
|
|
@@ -24,6 +28,9 @@ type SharedConfig = {
|
|
|
24
28
|
gather?: (key: string) => void;
|
|
25
29
|
cleanupFragment?: (id: string) => void;
|
|
26
30
|
registry?: Map<string, Element>;
|
|
31
|
+
completed?: WeakSet<Element> | null;
|
|
32
|
+
events?: any[] | null;
|
|
33
|
+
verifyHydration?: () => void;
|
|
27
34
|
done: boolean;
|
|
28
35
|
getNextContextId(): string;
|
|
29
36
|
};
|
|
@@ -49,6 +56,8 @@ export declare const createOptimisticStore: {
|
|
|
49
56
|
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
50
57
|
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store?: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T>, set: StoreSetter<T>];
|
|
51
58
|
};
|
|
59
|
+
export declare const createRenderEffect: typeof coreRenderEffect;
|
|
60
|
+
export declare const createEffect: typeof coreEffect;
|
|
52
61
|
/**
|
|
53
62
|
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
54
63
|
* ```typescript
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { $PROXY, $TRACK, action,
|
|
2
|
-
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter } from "@solidjs/signals";
|
|
1
|
+
export { $PROXY, $TRACK, action, createOwner, createReaction, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, untrack } from "@solidjs/signals";
|
|
2
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
3
3
|
export { $DEVCOMP, children, createContext, useContext } from "./client/core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
5
5
|
export * from "./client/component.js";
|
|
6
6
|
export * from "./client/flow.js";
|
|
7
|
-
export { sharedConfig, Loading, enableHydration, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore } from "./client/hydration.js";
|
|
7
|
+
export { sharedConfig, Loading, enableHydration, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore, createRenderEffect, createEffect } from "./client/hydration.js";
|
|
8
8
|
export declare function ssrHandleError(): void;
|
|
9
9
|
export declare function ssrRunInScope(): void;
|
|
10
10
|
import type { JSX } from "./jsx.js";
|
package/types/jsx.d.ts
CHANGED
|
@@ -232,40 +232,19 @@ export namespace JSX {
|
|
|
232
232
|
[SERIALIZABLE]: never;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
type RefCallback<T> = (el: T) => void;
|
|
236
|
+
type Ref<T> = T | RefCallback<T> | (RefCallback<T> | Ref<T>)[];
|
|
237
|
+
|
|
235
238
|
interface IntrinsicAttributes {
|
|
236
|
-
ref?: unknown |
|
|
239
|
+
ref?: Ref<unknown> | undefined;
|
|
237
240
|
}
|
|
238
241
|
interface CustomAttributes<T> {
|
|
239
|
-
ref?: T |
|
|
242
|
+
ref?: Ref<T> | undefined;
|
|
240
243
|
children?: Element | undefined;
|
|
241
244
|
$ServerOnly?: boolean | undefined;
|
|
242
245
|
}
|
|
243
|
-
type Accessor<T> = () => T;
|
|
244
|
-
interface Directives {}
|
|
245
|
-
interface DirectiveFunctions {
|
|
246
|
-
[x: string]: (el: DOMElement, accessor: Accessor<any>) => void;
|
|
247
|
-
}
|
|
248
246
|
interface ExplicitProperties {}
|
|
249
247
|
interface CustomEvents {}
|
|
250
|
-
type DirectiveAttributes = {
|
|
251
|
-
[Key in keyof Directives as `use:${Key}`]?: Directives[Key];
|
|
252
|
-
};
|
|
253
|
-
type DirectiveFunctionAttributes<T> = {
|
|
254
|
-
[K in keyof DirectiveFunctions as string extends K
|
|
255
|
-
? never
|
|
256
|
-
: `use:${K}`]?: DirectiveFunctions[K] extends (
|
|
257
|
-
el: infer E, // will be unknown if not provided
|
|
258
|
-
...rest: infer R // use rest so that we can check whether it's provided or not
|
|
259
|
-
) => void
|
|
260
|
-
? T extends E // everything extends unknown if E is unknown
|
|
261
|
-
? R extends [infer A] // check if has accessor provided
|
|
262
|
-
? A extends Accessor<infer V>
|
|
263
|
-
? V // it's an accessor
|
|
264
|
-
: never // it isn't, type error
|
|
265
|
-
: true // no accessor provided
|
|
266
|
-
: never // T is the wrong element
|
|
267
|
-
: never; // it isn't a function
|
|
268
|
-
};
|
|
269
248
|
type PropAttributes = {
|
|
270
249
|
[Key in keyof ExplicitProperties as `prop:${Key}`]?: ExplicitProperties[Key];
|
|
271
250
|
};
|
|
@@ -1033,8 +1012,6 @@ export namespace JSX {
|
|
|
1033
1012
|
*/
|
|
1034
1013
|
interface ElementAttributes<T>
|
|
1035
1014
|
extends CustomAttributes<T>,
|
|
1036
|
-
DirectiveAttributes,
|
|
1037
|
-
DirectiveFunctionAttributes<T>,
|
|
1038
1015
|
PropAttributes,
|
|
1039
1016
|
OnAttributes<T>,
|
|
1040
1017
|
EventHandlersElement<T>,
|
package/types/server/core.d.ts
CHANGED
|
@@ -36,8 +36,9 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* Pass-through for SSR dynamic expressions.
|
|
40
|
+
* On the client, insert() render effects are transparent (0 owner slots),
|
|
41
|
+
* so the server doesn't need to create owners for these either.
|
|
41
42
|
*/
|
|
42
43
|
export declare function ssrRunInScope(fn: () => any): () => any;
|
|
43
44
|
export declare function ssrRunInScope(array: (() => any)[]): (() => any)[];
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { $PROXY, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled,
|
|
2
|
-
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, PatchOp } from "./signals.js";
|
|
1
|
+
export { $PROXY, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createOwner, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, createDeepProxy, untrack } from "./signals.js";
|
|
2
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter, PatchOp } from "./signals.js";
|
|
3
3
|
export { $DEVCOMP, children, createContext, useContext, ssrRunInScope } from "./core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./core.js";
|
|
5
5
|
export * from "./component.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createRoot, createOwner, runWithOwner, getOwner, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY } from "@solidjs/signals";
|
|
2
2
|
export { flatten } from "@solidjs/signals";
|
|
3
|
-
export { snapshot, merge, omit, $PROXY, $TRACK } from "@solidjs/signals";
|
|
4
|
-
export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue } from "@solidjs/signals";
|
|
3
|
+
export { snapshot, merge, omit, storePath, $PROXY, $TRACK } from "@solidjs/signals";
|
|
4
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
5
5
|
import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
|
|
6
6
|
interface ServerComputation<T = any> {
|
|
7
7
|
owner: Owner;
|
|
@@ -52,7 +52,7 @@ export declare function untrack<T>(fn: () => T): T;
|
|
|
52
52
|
export declare function flush(): void;
|
|
53
53
|
export declare function resolve<T>(fn: () => T): Promise<T>;
|
|
54
54
|
export declare function isPending(fn: () => any, fallback?: boolean): boolean;
|
|
55
|
-
export declare function
|
|
55
|
+
export declare function latest<T>(fn: () => T): T;
|
|
56
56
|
export declare function isRefreshing(): boolean;
|
|
57
57
|
export declare function refresh<T>(fn: () => T): T;
|
|
58
58
|
export declare function action<T extends (...args: any[]) => any>(fn: T): T;
|