solid-js 1.7.8 → 1.7.10
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 +35 -19
- package/dist/dev.js +558 -309
- package/dist/server.cjs +38 -23
- package/dist/server.js +202 -94
- package/dist/solid.cjs +35 -19
- package/dist/solid.js +485 -267
- package/h/dist/h.cjs +2 -2
- package/h/dist/h.js +36 -10
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +3 -0
- package/h/types/hyperscript.d.ts +11 -11
- package/h/types/index.d.ts +3 -2
- package/html/dist/html.cjs +2 -2
- package/html/dist/html.js +218 -96
- package/html/types/index.d.ts +3 -2
- package/html/types/lit.d.ts +45 -31
- package/package.json +1 -1
- package/store/dist/dev.cjs +36 -33
- package/store/dist/dev.js +143 -68
- package/store/dist/server.js +19 -8
- package/store/dist/store.cjs +36 -33
- package/store/dist/store.js +134 -65
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +12 -4
- package/store/types/store.d.ts +220 -63
- package/types/index.d.ts +72 -9
- package/types/jsx.d.ts +3 -0
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +237 -146
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +62 -31
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +12 -12
- package/types/server/index.d.ts +56 -2
- package/types/server/reactive.d.ts +71 -45
- package/types/server/rendering.d.ts +171 -95
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.js +610 -79
- package/web/dist/server.cjs +5 -1
- package/web/dist/server.js +181 -78
- package/web/dist/web.js +610 -79
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
- package/web/types/server.d.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -166,6 +166,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
166
166
|
const listener = Listener,
|
|
167
167
|
owner = Owner,
|
|
168
168
|
unowned = fn.length === 0,
|
|
169
|
+
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
169
170
|
root = unowned ? {
|
|
170
171
|
owned: null,
|
|
171
172
|
cleanups: null,
|
|
@@ -174,8 +175,8 @@ function createRoot(fn, detachedOwner) {
|
|
|
174
175
|
} : {
|
|
175
176
|
owned: null,
|
|
176
177
|
cleanups: null,
|
|
177
|
-
context: null,
|
|
178
|
-
owner:
|
|
178
|
+
context: current ? current.context : null,
|
|
179
|
+
owner: current
|
|
179
180
|
},
|
|
180
181
|
updateFn = unowned ? () => fn(() => {
|
|
181
182
|
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
@@ -221,7 +222,7 @@ function createRenderEffect(fn, value, options) {
|
|
|
221
222
|
function createEffect(fn, value, options) {
|
|
222
223
|
runEffects = runUserEffects;
|
|
223
224
|
const c = createComputation(fn, value, false, STALE, options ),
|
|
224
|
-
s = SuspenseContext &&
|
|
225
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
225
226
|
if (s) c.suspense = s;
|
|
226
227
|
if (!options || !options.render) c.user = true;
|
|
227
228
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
@@ -232,7 +233,7 @@ function createReaction(onInvalidate, options) {
|
|
|
232
233
|
fn ? fn() : untrack(onInvalidate);
|
|
233
234
|
fn = undefined;
|
|
234
235
|
}, undefined, false, 0, options ),
|
|
235
|
-
s = SuspenseContext &&
|
|
236
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
236
237
|
if (s) c.suspense = s;
|
|
237
238
|
c.user = true;
|
|
238
239
|
return tracking => {
|
|
@@ -313,7 +314,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
313
314
|
}, false);
|
|
314
315
|
}
|
|
315
316
|
function read() {
|
|
316
|
-
const c = SuspenseContext &&
|
|
317
|
+
const c = SuspenseContext && useContext(SuspenseContext),
|
|
317
318
|
v = value(),
|
|
318
319
|
err = error();
|
|
319
320
|
if (err !== undefined && !pr) throw err;
|
|
@@ -468,6 +469,7 @@ function catchError(fn, handler) {
|
|
|
468
469
|
ERROR || (ERROR = Symbol("error"));
|
|
469
470
|
Owner = createComputation(undefined, undefined, true);
|
|
470
471
|
Owner.context = {
|
|
472
|
+
...Owner.context,
|
|
471
473
|
[ERROR]: [handler]
|
|
472
474
|
};
|
|
473
475
|
if (Transition && Transition.running) Transition.sources.add(Owner);
|
|
@@ -479,12 +481,6 @@ function catchError(fn, handler) {
|
|
|
479
481
|
Owner = Owner.owner;
|
|
480
482
|
}
|
|
481
483
|
}
|
|
482
|
-
function onError(fn) {
|
|
483
|
-
ERROR || (ERROR = Symbol("error"));
|
|
484
|
-
if (Owner === null) console.warn("error handlers created outside a `createRoot` or `render` will never be run");else if (Owner.context === null) Owner.context = {
|
|
485
|
-
[ERROR]: [fn]
|
|
486
|
-
};else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];else Owner.context[ERROR].push(fn);
|
|
487
|
-
}
|
|
488
484
|
function getListener() {
|
|
489
485
|
return Listener;
|
|
490
486
|
}
|
|
@@ -572,8 +568,7 @@ function createContext(defaultValue, options) {
|
|
|
572
568
|
};
|
|
573
569
|
}
|
|
574
570
|
function useContext(context) {
|
|
575
|
-
|
|
576
|
-
return (ctx = lookup(Owner, context.id)) !== undefined ? ctx : context.defaultValue;
|
|
571
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
577
572
|
}
|
|
578
573
|
function children(fn) {
|
|
579
574
|
const children = createMemo(fn);
|
|
@@ -732,7 +727,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
732
727
|
cleanups: null,
|
|
733
728
|
value: init,
|
|
734
729
|
owner: Owner,
|
|
735
|
-
context: null,
|
|
730
|
+
context: Owner ? Owner.context : null,
|
|
736
731
|
pure
|
|
737
732
|
};
|
|
738
733
|
if (Transition && Transition.running) {
|
|
@@ -951,7 +946,6 @@ function cleanNode(node) {
|
|
|
951
946
|
node.cleanups = null;
|
|
952
947
|
}
|
|
953
948
|
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
954
|
-
node.context = null;
|
|
955
949
|
delete node.sourceMap;
|
|
956
950
|
}
|
|
957
951
|
function reset(node, top) {
|
|
@@ -977,7 +971,7 @@ function runErrors(err, fns, owner) {
|
|
|
977
971
|
}
|
|
978
972
|
}
|
|
979
973
|
function handleError(err, owner = Owner) {
|
|
980
|
-
const fns = ERROR &&
|
|
974
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
981
975
|
const error = castError(err);
|
|
982
976
|
if (!fns) throw error;
|
|
983
977
|
if (Effects) Effects.push({
|
|
@@ -987,9 +981,6 @@ function handleError(err, owner = Owner) {
|
|
|
987
981
|
state: STALE
|
|
988
982
|
});else runErrors(error, fns, owner);
|
|
989
983
|
}
|
|
990
|
-
function lookup(owner, key) {
|
|
991
|
-
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
992
|
-
}
|
|
993
984
|
function resolveChildren(children) {
|
|
994
985
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
995
986
|
if (Array.isArray(children)) {
|
|
@@ -1007,6 +998,7 @@ function createProvider(id, options) {
|
|
|
1007
998
|
let res;
|
|
1008
999
|
createRenderEffect(() => res = untrack(() => {
|
|
1009
1000
|
Owner.context = {
|
|
1001
|
+
...Owner.context,
|
|
1010
1002
|
[id]: props.value
|
|
1011
1003
|
};
|
|
1012
1004
|
return children(() => props.children);
|
|
@@ -1014,6 +1006,30 @@ function createProvider(id, options) {
|
|
|
1014
1006
|
return res;
|
|
1015
1007
|
};
|
|
1016
1008
|
}
|
|
1009
|
+
function onError(fn) {
|
|
1010
|
+
ERROR || (ERROR = Symbol("error"));
|
|
1011
|
+
if (Owner === null) console.warn("error handlers created outside a `createRoot` or `render` will never be run");else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1012
|
+
Owner.context = {
|
|
1013
|
+
...Owner.context,
|
|
1014
|
+
[ERROR]: [fn]
|
|
1015
|
+
};
|
|
1016
|
+
mutateContext(Owner, ERROR, [fn]);
|
|
1017
|
+
} else Owner.context[ERROR].push(fn);
|
|
1018
|
+
}
|
|
1019
|
+
function mutateContext(o, key, value) {
|
|
1020
|
+
if (o.owned) {
|
|
1021
|
+
for (let i = 0; i < o.owned.length; i++) {
|
|
1022
|
+
if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
|
|
1023
|
+
if (!o.owned[i].context) {
|
|
1024
|
+
o.owned[i].context = o.context;
|
|
1025
|
+
mutateContext(o.owned[i], key, value);
|
|
1026
|
+
} else if (!o.owned[i].context[key]) {
|
|
1027
|
+
o.owned[i].context[key] = value;
|
|
1028
|
+
mutateContext(o.owned[i], key, value);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1017
1033
|
|
|
1018
1034
|
function observable(input) {
|
|
1019
1035
|
return {
|