solid-js 1.7.9 → 1.7.11
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 +36 -20
- package/dist/dev.js +326 -548
- package/dist/server.cjs +38 -23
- package/dist/server.js +108 -192
- package/dist/solid.cjs +36 -20
- package/dist/solid.js +284 -475
- package/h/dist/h.js +8 -34
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +31 -45
- package/package.json +1 -1
- package/store/dist/dev.cjs +4 -3
- package/store/dist/dev.js +46 -117
- package/store/dist/server.js +8 -19
- package/store/dist/store.cjs +4 -3
- package/store/dist/store.js +43 -108
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -215
- package/types/index.d.ts +9 -69
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +150 -236
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +31 -62
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +12 -12
- package/types/server/index.d.ts +2 -55
- package/types/server/reactive.d.ts +44 -72
- package/types/server/rendering.d.ts +95 -171
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.js +79 -610
- package/web/dist/server.cjs +5 -1
- package/web/dist/server.js +82 -177
- package/web/dist/web.js +79 -610
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
- package/web/types/server.d.ts +1 -1
package/dist/solid.cjs
CHANGED
|
@@ -162,11 +162,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
162
162
|
const listener = Listener,
|
|
163
163
|
owner = Owner,
|
|
164
164
|
unowned = fn.length === 0,
|
|
165
|
+
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
165
166
|
root = unowned ? UNOWNED : {
|
|
166
167
|
owned: null,
|
|
167
168
|
cleanups: null,
|
|
168
|
-
context: null,
|
|
169
|
-
owner:
|
|
169
|
+
context: current ? current.context : null,
|
|
170
|
+
owner: current
|
|
170
171
|
},
|
|
171
172
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
172
173
|
Owner = root;
|
|
@@ -205,7 +206,7 @@ function createRenderEffect(fn, value, options) {
|
|
|
205
206
|
function createEffect(fn, value, options) {
|
|
206
207
|
runEffects = runUserEffects;
|
|
207
208
|
const c = createComputation(fn, value, false, STALE),
|
|
208
|
-
s = SuspenseContext &&
|
|
209
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
209
210
|
if (s) c.suspense = s;
|
|
210
211
|
if (!options || !options.render) c.user = true;
|
|
211
212
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
@@ -216,7 +217,7 @@ function createReaction(onInvalidate, options) {
|
|
|
216
217
|
fn ? fn() : untrack(onInvalidate);
|
|
217
218
|
fn = undefined;
|
|
218
219
|
}, undefined, false, 0),
|
|
219
|
-
s = SuspenseContext &&
|
|
220
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
220
221
|
if (s) c.suspense = s;
|
|
221
222
|
c.user = true;
|
|
222
223
|
return tracking => {
|
|
@@ -297,7 +298,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
297
298
|
}, false);
|
|
298
299
|
}
|
|
299
300
|
function read() {
|
|
300
|
-
const c = SuspenseContext &&
|
|
301
|
+
const c = SuspenseContext && useContext(SuspenseContext),
|
|
301
302
|
v = value(),
|
|
302
303
|
err = error();
|
|
303
304
|
if (err !== undefined && !pr) throw err;
|
|
@@ -452,6 +453,7 @@ function catchError(fn, handler) {
|
|
|
452
453
|
ERROR || (ERROR = Symbol("error"));
|
|
453
454
|
Owner = createComputation(undefined, undefined, true);
|
|
454
455
|
Owner.context = {
|
|
456
|
+
...Owner.context,
|
|
455
457
|
[ERROR]: [handler]
|
|
456
458
|
};
|
|
457
459
|
if (Transition && Transition.running) Transition.sources.add(Owner);
|
|
@@ -463,12 +465,6 @@ function catchError(fn, handler) {
|
|
|
463
465
|
Owner = Owner.owner;
|
|
464
466
|
}
|
|
465
467
|
}
|
|
466
|
-
function onError(fn) {
|
|
467
|
-
ERROR || (ERROR = Symbol("error"));
|
|
468
|
-
if (Owner === null) ;else if (Owner.context === null) Owner.context = {
|
|
469
|
-
[ERROR]: [fn]
|
|
470
|
-
};else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];else Owner.context[ERROR].push(fn);
|
|
471
|
-
}
|
|
472
468
|
function getListener() {
|
|
473
469
|
return Listener;
|
|
474
470
|
}
|
|
@@ -536,8 +532,7 @@ function createContext(defaultValue, options) {
|
|
|
536
532
|
};
|
|
537
533
|
}
|
|
538
534
|
function useContext(context) {
|
|
539
|
-
|
|
540
|
-
return (ctx = lookup(Owner, context.id)) !== undefined ? ctx : context.defaultValue;
|
|
535
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
541
536
|
}
|
|
542
537
|
function children(fn) {
|
|
543
538
|
const children = createMemo(fn);
|
|
@@ -550,7 +545,7 @@ function children(fn) {
|
|
|
550
545
|
}
|
|
551
546
|
let SuspenseContext;
|
|
552
547
|
function getSuspenseContext() {
|
|
553
|
-
return SuspenseContext || (SuspenseContext = createContext(
|
|
548
|
+
return SuspenseContext || (SuspenseContext = createContext());
|
|
554
549
|
}
|
|
555
550
|
function enableExternalSource(factory) {
|
|
556
551
|
if (ExternalSourceFactory) {
|
|
@@ -694,7 +689,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
694
689
|
cleanups: null,
|
|
695
690
|
value: init,
|
|
696
691
|
owner: Owner,
|
|
697
|
-
context: null,
|
|
692
|
+
context: Owner ? Owner.context : null,
|
|
698
693
|
pure
|
|
699
694
|
};
|
|
700
695
|
if (Transition && Transition.running) {
|
|
@@ -911,7 +906,6 @@ function cleanNode(node) {
|
|
|
911
906
|
node.cleanups = null;
|
|
912
907
|
}
|
|
913
908
|
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
914
|
-
node.context = null;
|
|
915
909
|
}
|
|
916
910
|
function reset(node, top) {
|
|
917
911
|
if (!top) {
|
|
@@ -936,7 +930,7 @@ function runErrors(err, fns, owner) {
|
|
|
936
930
|
}
|
|
937
931
|
}
|
|
938
932
|
function handleError(err, owner = Owner) {
|
|
939
|
-
const fns = ERROR &&
|
|
933
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
940
934
|
const error = castError(err);
|
|
941
935
|
if (!fns) throw error;
|
|
942
936
|
if (Effects) Effects.push({
|
|
@@ -946,9 +940,6 @@ function handleError(err, owner = Owner) {
|
|
|
946
940
|
state: STALE
|
|
947
941
|
});else runErrors(error, fns, owner);
|
|
948
942
|
}
|
|
949
|
-
function lookup(owner, key) {
|
|
950
|
-
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
951
|
-
}
|
|
952
943
|
function resolveChildren(children) {
|
|
953
944
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
954
945
|
if (Array.isArray(children)) {
|
|
@@ -966,6 +957,7 @@ function createProvider(id, options) {
|
|
|
966
957
|
let res;
|
|
967
958
|
createRenderEffect(() => res = untrack(() => {
|
|
968
959
|
Owner.context = {
|
|
960
|
+
...Owner.context,
|
|
969
961
|
[id]: props.value
|
|
970
962
|
};
|
|
971
963
|
return children(() => props.children);
|
|
@@ -973,6 +965,30 @@ function createProvider(id, options) {
|
|
|
973
965
|
return res;
|
|
974
966
|
};
|
|
975
967
|
}
|
|
968
|
+
function onError(fn) {
|
|
969
|
+
ERROR || (ERROR = Symbol("error"));
|
|
970
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
971
|
+
Owner.context = {
|
|
972
|
+
...Owner.context,
|
|
973
|
+
[ERROR]: [fn]
|
|
974
|
+
};
|
|
975
|
+
mutateContext(Owner, ERROR, [fn]);
|
|
976
|
+
} else Owner.context[ERROR].push(fn);
|
|
977
|
+
}
|
|
978
|
+
function mutateContext(o, key, value) {
|
|
979
|
+
if (o.owned) {
|
|
980
|
+
for (let i = 0; i < o.owned.length; i++) {
|
|
981
|
+
if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
|
|
982
|
+
if (!o.owned[i].context) {
|
|
983
|
+
o.owned[i].context = o.context;
|
|
984
|
+
mutateContext(o.owned[i], key, value);
|
|
985
|
+
} else if (!o.owned[i].context[key]) {
|
|
986
|
+
o.owned[i].context[key] = value;
|
|
987
|
+
mutateContext(o.owned[i], key, value);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
976
992
|
|
|
977
993
|
function observable(input) {
|
|
978
994
|
return {
|