solid-js 1.7.9 → 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 +39 -28
- package/dist/server.cjs +38 -23
- package/dist/server.js +40 -30
- package/dist/solid.cjs +35 -19
- package/dist/solid.js +38 -27
- package/package.json +1 -1
- package/store/dist/dev.cjs +4 -3
- package/store/dist/dev.js +4 -3
- package/store/dist/store.cjs +4 -3
- package/store/dist/store.js +4 -3
- package/store/types/store.d.ts +4 -1
- package/types/index.d.ts +4 -1
- package/types/reactive/signal.d.ts +10 -10
- package/types/server/index.d.ts +1 -0
- package/types/server/reactive.d.ts +4 -5
- package/web/dist/server.cjs +5 -1
- package/web/dist/server.js +5 -1
- 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 {
|
package/dist/dev.js
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
|
? {
|
|
171
172
|
owned: null,
|
|
@@ -176,8 +177,8 @@ function createRoot(fn, detachedOwner) {
|
|
|
176
177
|
: {
|
|
177
178
|
owned: null,
|
|
178
179
|
cleanups: null,
|
|
179
|
-
context: null,
|
|
180
|
-
owner:
|
|
180
|
+
context: current ? current.context : null,
|
|
181
|
+
owner: current
|
|
181
182
|
},
|
|
182
183
|
updateFn = unowned
|
|
183
184
|
? () =>
|
|
@@ -229,7 +230,7 @@ function createRenderEffect(fn, value, options) {
|
|
|
229
230
|
function createEffect(fn, value, options) {
|
|
230
231
|
runEffects = runUserEffects;
|
|
231
232
|
const c = createComputation(fn, value, false, STALE, options),
|
|
232
|
-
s = SuspenseContext &&
|
|
233
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
233
234
|
if (s) c.suspense = s;
|
|
234
235
|
if (!options || !options.render) c.user = true;
|
|
235
236
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
@@ -246,7 +247,7 @@ function createReaction(onInvalidate, options) {
|
|
|
246
247
|
0,
|
|
247
248
|
options
|
|
248
249
|
),
|
|
249
|
-
s = SuspenseContext &&
|
|
250
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
250
251
|
if (s) c.suspense = s;
|
|
251
252
|
c.user = true;
|
|
252
253
|
return tracking => {
|
|
@@ -331,7 +332,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
331
332
|
}, false);
|
|
332
333
|
}
|
|
333
334
|
function read() {
|
|
334
|
-
const c = SuspenseContext &&
|
|
335
|
+
const c = SuspenseContext && useContext(SuspenseContext),
|
|
335
336
|
v = value(),
|
|
336
337
|
err = error();
|
|
337
338
|
if (err !== undefined && !pr) throw err;
|
|
@@ -524,6 +525,7 @@ function catchError(fn, handler) {
|
|
|
524
525
|
ERROR || (ERROR = Symbol("error"));
|
|
525
526
|
Owner = createComputation(undefined, undefined, true);
|
|
526
527
|
Owner.context = {
|
|
528
|
+
...Owner.context,
|
|
527
529
|
[ERROR]: [handler]
|
|
528
530
|
};
|
|
529
531
|
if (Transition && Transition.running) Transition.sources.add(Owner);
|
|
@@ -535,17 +537,6 @@ function catchError(fn, handler) {
|
|
|
535
537
|
Owner = Owner.owner;
|
|
536
538
|
}
|
|
537
539
|
}
|
|
538
|
-
function onError(fn) {
|
|
539
|
-
ERROR || (ERROR = Symbol("error"));
|
|
540
|
-
if (Owner === null)
|
|
541
|
-
console.warn("error handlers created outside a `createRoot` or `render` will never be run");
|
|
542
|
-
else if (Owner.context === null)
|
|
543
|
-
Owner.context = {
|
|
544
|
-
[ERROR]: [fn]
|
|
545
|
-
};
|
|
546
|
-
else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];
|
|
547
|
-
else Owner.context[ERROR].push(fn);
|
|
548
|
-
}
|
|
549
540
|
function getListener() {
|
|
550
541
|
return Listener;
|
|
551
542
|
}
|
|
@@ -642,8 +633,9 @@ function createContext(defaultValue, options) {
|
|
|
642
633
|
};
|
|
643
634
|
}
|
|
644
635
|
function useContext(context) {
|
|
645
|
-
|
|
646
|
-
|
|
636
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
637
|
+
? Owner.context[context.id]
|
|
638
|
+
: context.defaultValue;
|
|
647
639
|
}
|
|
648
640
|
function children(fn) {
|
|
649
641
|
const children = createMemo(fn);
|
|
@@ -810,7 +802,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
810
802
|
cleanups: null,
|
|
811
803
|
value: init,
|
|
812
804
|
owner: Owner,
|
|
813
|
-
context: null,
|
|
805
|
+
context: Owner ? Owner.context : null,
|
|
814
806
|
pure
|
|
815
807
|
};
|
|
816
808
|
if (Transition && Transition.running) {
|
|
@@ -1042,7 +1034,6 @@ function cleanNode(node) {
|
|
|
1042
1034
|
}
|
|
1043
1035
|
if (Transition && Transition.running) node.tState = 0;
|
|
1044
1036
|
else node.state = 0;
|
|
1045
|
-
node.context = null;
|
|
1046
1037
|
delete node.sourceMap;
|
|
1047
1038
|
}
|
|
1048
1039
|
function reset(node, top) {
|
|
@@ -1068,7 +1059,7 @@ function runErrors(err, fns, owner) {
|
|
|
1068
1059
|
}
|
|
1069
1060
|
}
|
|
1070
1061
|
function handleError(err, owner = Owner) {
|
|
1071
|
-
const fns = ERROR &&
|
|
1062
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1072
1063
|
const error = castError(err);
|
|
1073
1064
|
if (!fns) throw error;
|
|
1074
1065
|
if (Effects)
|
|
@@ -1080,13 +1071,6 @@ function handleError(err, owner = Owner) {
|
|
|
1080
1071
|
});
|
|
1081
1072
|
else runErrors(error, fns, owner);
|
|
1082
1073
|
}
|
|
1083
|
-
function lookup(owner, key) {
|
|
1084
|
-
return owner
|
|
1085
|
-
? owner.context && owner.context[key] !== undefined
|
|
1086
|
-
? owner.context[key]
|
|
1087
|
-
: lookup(owner.owner, key)
|
|
1088
|
-
: undefined;
|
|
1089
|
-
}
|
|
1090
1074
|
function resolveChildren(children) {
|
|
1091
1075
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
1092
1076
|
if (Array.isArray(children)) {
|
|
@@ -1106,6 +1090,7 @@ function createProvider(id, options) {
|
|
|
1106
1090
|
() =>
|
|
1107
1091
|
(res = untrack(() => {
|
|
1108
1092
|
Owner.context = {
|
|
1093
|
+
...Owner.context,
|
|
1109
1094
|
[id]: props.value
|
|
1110
1095
|
};
|
|
1111
1096
|
return children(() => props.children);
|
|
@@ -1116,6 +1101,32 @@ function createProvider(id, options) {
|
|
|
1116
1101
|
return res;
|
|
1117
1102
|
};
|
|
1118
1103
|
}
|
|
1104
|
+
function onError(fn) {
|
|
1105
|
+
ERROR || (ERROR = Symbol("error"));
|
|
1106
|
+
if (Owner === null)
|
|
1107
|
+
console.warn("error handlers created outside a `createRoot` or `render` will never be run");
|
|
1108
|
+
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1109
|
+
Owner.context = {
|
|
1110
|
+
...Owner.context,
|
|
1111
|
+
[ERROR]: [fn]
|
|
1112
|
+
};
|
|
1113
|
+
mutateContext(Owner, ERROR, [fn]);
|
|
1114
|
+
} else Owner.context[ERROR].push(fn);
|
|
1115
|
+
}
|
|
1116
|
+
function mutateContext(o, key, value) {
|
|
1117
|
+
if (o.owned) {
|
|
1118
|
+
for (let i = 0; i < o.owned.length; i++) {
|
|
1119
|
+
if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
|
|
1120
|
+
if (!o.owned[i].context) {
|
|
1121
|
+
o.owned[i].context = o.context;
|
|
1122
|
+
mutateContext(o.owned[i], key, value);
|
|
1123
|
+
} else if (!o.owned[i].context[key]) {
|
|
1124
|
+
o.owned[i].context[key] = value;
|
|
1125
|
+
mutateContext(o.owned[i], key, value);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1119
1130
|
|
|
1120
1131
|
function observable(input) {
|
|
1121
1132
|
return {
|
package/dist/server.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function castError(err) {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
function handleError(err, owner = Owner) {
|
|
16
|
-
const fns =
|
|
16
|
+
const fns = owner && owner.context && owner.context[ERROR];
|
|
17
17
|
const error = castError(err);
|
|
18
18
|
if (!fns) throw error;
|
|
19
19
|
try {
|
|
@@ -32,7 +32,7 @@ let Owner = null;
|
|
|
32
32
|
function createOwner() {
|
|
33
33
|
const o = {
|
|
34
34
|
owner: Owner,
|
|
35
|
-
context: null,
|
|
35
|
+
context: Owner ? Owner.context : null,
|
|
36
36
|
owned: null,
|
|
37
37
|
cleanups: null
|
|
38
38
|
};
|
|
@@ -43,9 +43,10 @@ function createOwner() {
|
|
|
43
43
|
}
|
|
44
44
|
function createRoot(fn, detachedOwner) {
|
|
45
45
|
const owner = Owner,
|
|
46
|
+
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
46
47
|
root = fn.length === 0 ? UNOWNED : {
|
|
47
|
-
context: null,
|
|
48
|
-
owner:
|
|
48
|
+
context: current ? current.context : null,
|
|
49
|
+
owner: current,
|
|
49
50
|
owned: null,
|
|
50
51
|
cleanups: null
|
|
51
52
|
};
|
|
@@ -135,14 +136,12 @@ function cleanNode(node) {
|
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
function catchError(fn, handler) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
context
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
owned: null,
|
|
144
|
-
cleanups: null
|
|
139
|
+
const owner = createOwner();
|
|
140
|
+
owner.context = {
|
|
141
|
+
...owner.context,
|
|
142
|
+
[ERROR]: [handler]
|
|
145
143
|
};
|
|
144
|
+
Owner = owner;
|
|
146
145
|
try {
|
|
147
146
|
return fn();
|
|
148
147
|
} catch (err) {
|
|
@@ -151,13 +150,6 @@ function catchError(fn, handler) {
|
|
|
151
150
|
Owner = Owner.owner;
|
|
152
151
|
}
|
|
153
152
|
}
|
|
154
|
-
function onError(fn) {
|
|
155
|
-
if (Owner) {
|
|
156
|
-
if (Owner.context === null) Owner.context = {
|
|
157
|
-
[ERROR]: [fn]
|
|
158
|
-
};else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];else Owner.context[ERROR].push(fn);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
153
|
function getListener() {
|
|
162
154
|
return null;
|
|
163
155
|
}
|
|
@@ -170,8 +162,7 @@ function createContext(defaultValue) {
|
|
|
170
162
|
};
|
|
171
163
|
}
|
|
172
164
|
function useContext(context) {
|
|
173
|
-
|
|
174
|
-
return (ctx = lookup(Owner, context.id)) !== undefined ? ctx : context.defaultValue;
|
|
165
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
175
166
|
}
|
|
176
167
|
function getOwner() {
|
|
177
168
|
return Owner;
|
|
@@ -195,9 +186,6 @@ function runWithOwner(o, fn) {
|
|
|
195
186
|
Owner = prev;
|
|
196
187
|
}
|
|
197
188
|
}
|
|
198
|
-
function lookup(owner, key) {
|
|
199
|
-
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
200
|
-
}
|
|
201
189
|
function resolveChildren(children) {
|
|
202
190
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
203
191
|
if (Array.isArray(children)) {
|
|
@@ -214,6 +202,7 @@ function createProvider(id) {
|
|
|
214
202
|
return function provider(props) {
|
|
215
203
|
return createMemo(() => {
|
|
216
204
|
Owner.context = {
|
|
205
|
+
...Owner.context,
|
|
217
206
|
[id]: props.value
|
|
218
207
|
};
|
|
219
208
|
return children(() => props.children);
|
|
@@ -279,6 +268,31 @@ function from(producer) {
|
|
|
279
268
|
return s;
|
|
280
269
|
}
|
|
281
270
|
function enableExternalSource(factory) {}
|
|
271
|
+
function onError(fn) {
|
|
272
|
+
if (Owner) {
|
|
273
|
+
if (Owner.context === null || !Owner.context[ERROR]) {
|
|
274
|
+
Owner.context = {
|
|
275
|
+
...Owner.context,
|
|
276
|
+
[ERROR]: [fn]
|
|
277
|
+
};
|
|
278
|
+
mutateContext(Owner, ERROR, [fn]);
|
|
279
|
+
} else Owner.context[ERROR].push(fn);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function mutateContext(o, key, value) {
|
|
283
|
+
if (o.owned) {
|
|
284
|
+
for (let i = 0; i < o.owned.length; i++) {
|
|
285
|
+
if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
|
|
286
|
+
if (!o.owned[i].context) {
|
|
287
|
+
o.owned[i].context = o.context;
|
|
288
|
+
mutateContext(o.owned[i], key, value);
|
|
289
|
+
} else if (!o.owned[i].context[key]) {
|
|
290
|
+
o.owned[i].context[key] = value;
|
|
291
|
+
mutateContext(o.owned[i], key, value);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
282
296
|
|
|
283
297
|
function resolveSSRNode(node) {
|
|
284
298
|
const t = typeof node;
|
|
@@ -663,6 +677,7 @@ exports.Suspense = Suspense;
|
|
|
663
677
|
exports.SuspenseList = SuspenseList;
|
|
664
678
|
exports.Switch = Switch;
|
|
665
679
|
exports.batch = batch;
|
|
680
|
+
exports.catchError = catchError;
|
|
666
681
|
exports.children = children;
|
|
667
682
|
exports.createComponent = createComponent;
|
|
668
683
|
exports.createComputed = createComputed;
|
package/dist/server.js
CHANGED
|
@@ -11,7 +11,7 @@ function castError(err) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function handleError(err, owner = Owner) {
|
|
14
|
-
const fns =
|
|
14
|
+
const fns = owner && owner.context && owner.context[ERROR];
|
|
15
15
|
const error = castError(err);
|
|
16
16
|
if (!fns) throw error;
|
|
17
17
|
try {
|
|
@@ -30,7 +30,7 @@ let Owner = null;
|
|
|
30
30
|
function createOwner() {
|
|
31
31
|
const o = {
|
|
32
32
|
owner: Owner,
|
|
33
|
-
context: null,
|
|
33
|
+
context: Owner ? Owner.context : null,
|
|
34
34
|
owned: null,
|
|
35
35
|
cleanups: null
|
|
36
36
|
};
|
|
@@ -42,12 +42,13 @@ function createOwner() {
|
|
|
42
42
|
}
|
|
43
43
|
function createRoot(fn, detachedOwner) {
|
|
44
44
|
const owner = Owner,
|
|
45
|
+
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
45
46
|
root =
|
|
46
47
|
fn.length === 0
|
|
47
48
|
? UNOWNED
|
|
48
49
|
: {
|
|
49
|
-
context: null,
|
|
50
|
-
owner:
|
|
50
|
+
context: current ? current.context : null,
|
|
51
|
+
owner: current,
|
|
51
52
|
owned: null,
|
|
52
53
|
cleanups: null
|
|
53
54
|
};
|
|
@@ -141,14 +142,12 @@ function cleanNode(node) {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
function catchError(fn, handler) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
context
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
owned: null,
|
|
150
|
-
cleanups: null
|
|
145
|
+
const owner = createOwner();
|
|
146
|
+
owner.context = {
|
|
147
|
+
...owner.context,
|
|
148
|
+
[ERROR]: [handler]
|
|
151
149
|
};
|
|
150
|
+
Owner = owner;
|
|
152
151
|
try {
|
|
153
152
|
return fn();
|
|
154
153
|
} catch (err) {
|
|
@@ -157,16 +156,6 @@ function catchError(fn, handler) {
|
|
|
157
156
|
Owner = Owner.owner;
|
|
158
157
|
}
|
|
159
158
|
}
|
|
160
|
-
function onError(fn) {
|
|
161
|
-
if (Owner) {
|
|
162
|
-
if (Owner.context === null)
|
|
163
|
-
Owner.context = {
|
|
164
|
-
[ERROR]: [fn]
|
|
165
|
-
};
|
|
166
|
-
else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];
|
|
167
|
-
else Owner.context[ERROR].push(fn);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
159
|
function getListener() {
|
|
171
160
|
return null;
|
|
172
161
|
}
|
|
@@ -179,8 +168,9 @@ function createContext(defaultValue) {
|
|
|
179
168
|
};
|
|
180
169
|
}
|
|
181
170
|
function useContext(context) {
|
|
182
|
-
|
|
183
|
-
|
|
171
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
172
|
+
? Owner.context[context.id]
|
|
173
|
+
: context.defaultValue;
|
|
184
174
|
}
|
|
185
175
|
function getOwner() {
|
|
186
176
|
return Owner;
|
|
@@ -204,13 +194,6 @@ function runWithOwner(o, fn) {
|
|
|
204
194
|
Owner = prev;
|
|
205
195
|
}
|
|
206
196
|
}
|
|
207
|
-
function lookup(owner, key) {
|
|
208
|
-
return owner
|
|
209
|
-
? owner.context && owner.context[key] !== undefined
|
|
210
|
-
? owner.context[key]
|
|
211
|
-
: lookup(owner.owner, key)
|
|
212
|
-
: undefined;
|
|
213
|
-
}
|
|
214
197
|
function resolveChildren(children) {
|
|
215
198
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
216
199
|
if (Array.isArray(children)) {
|
|
@@ -227,6 +210,7 @@ function createProvider(id) {
|
|
|
227
210
|
return function provider(props) {
|
|
228
211
|
return createMemo(() => {
|
|
229
212
|
Owner.context = {
|
|
213
|
+
...Owner.context,
|
|
230
214
|
[id]: props.value
|
|
231
215
|
};
|
|
232
216
|
return children(() => props.children);
|
|
@@ -293,6 +277,31 @@ function from(producer) {
|
|
|
293
277
|
return s;
|
|
294
278
|
}
|
|
295
279
|
function enableExternalSource(factory) {}
|
|
280
|
+
function onError(fn) {
|
|
281
|
+
if (Owner) {
|
|
282
|
+
if (Owner.context === null || !Owner.context[ERROR]) {
|
|
283
|
+
Owner.context = {
|
|
284
|
+
...Owner.context,
|
|
285
|
+
[ERROR]: [fn]
|
|
286
|
+
};
|
|
287
|
+
mutateContext(Owner, ERROR, [fn]);
|
|
288
|
+
} else Owner.context[ERROR].push(fn);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function mutateContext(o, key, value) {
|
|
292
|
+
if (o.owned) {
|
|
293
|
+
for (let i = 0; i < o.owned.length; i++) {
|
|
294
|
+
if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
|
|
295
|
+
if (!o.owned[i].context) {
|
|
296
|
+
o.owned[i].context = o.context;
|
|
297
|
+
mutateContext(o.owned[i], key, value);
|
|
298
|
+
} else if (!o.owned[i].context[key]) {
|
|
299
|
+
o.owned[i].context[key] = value;
|
|
300
|
+
mutateContext(o.owned[i], key, value);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
296
305
|
|
|
297
306
|
function resolveSSRNode(node) {
|
|
298
307
|
const t = typeof node;
|
|
@@ -708,6 +717,7 @@ export {
|
|
|
708
717
|
SuspenseList,
|
|
709
718
|
Switch,
|
|
710
719
|
batch,
|
|
720
|
+
catchError,
|
|
711
721
|
children,
|
|
712
722
|
createComponent,
|
|
713
723
|
createComputed,
|
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);
|
|
@@ -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 {
|
package/dist/solid.js
CHANGED
|
@@ -162,13 +162,14 @@ 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
|
|
166
167
|
? UNOWNED
|
|
167
168
|
: {
|
|
168
169
|
owned: null,
|
|
169
170
|
cleanups: null,
|
|
170
|
-
context: null,
|
|
171
|
-
owner:
|
|
171
|
+
context: current ? current.context : null,
|
|
172
|
+
owner: current
|
|
172
173
|
},
|
|
173
174
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
174
175
|
Owner = root;
|
|
@@ -210,7 +211,7 @@ function createRenderEffect(fn, value, options) {
|
|
|
210
211
|
function createEffect(fn, value, options) {
|
|
211
212
|
runEffects = runUserEffects;
|
|
212
213
|
const c = createComputation(fn, value, false, STALE),
|
|
213
|
-
s = SuspenseContext &&
|
|
214
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
214
215
|
if (s) c.suspense = s;
|
|
215
216
|
if (!options || !options.render) c.user = true;
|
|
216
217
|
Effects ? Effects.push(c) : updateComputation(c);
|
|
@@ -226,7 +227,7 @@ function createReaction(onInvalidate, options) {
|
|
|
226
227
|
false,
|
|
227
228
|
0
|
|
228
229
|
),
|
|
229
|
-
s = SuspenseContext &&
|
|
230
|
+
s = SuspenseContext && useContext(SuspenseContext);
|
|
230
231
|
if (s) c.suspense = s;
|
|
231
232
|
c.user = true;
|
|
232
233
|
return tracking => {
|
|
@@ -311,7 +312,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
311
312
|
}, false);
|
|
312
313
|
}
|
|
313
314
|
function read() {
|
|
314
|
-
const c = SuspenseContext &&
|
|
315
|
+
const c = SuspenseContext && useContext(SuspenseContext),
|
|
315
316
|
v = value(),
|
|
316
317
|
err = error();
|
|
317
318
|
if (err !== undefined && !pr) throw err;
|
|
@@ -502,6 +503,7 @@ function catchError(fn, handler) {
|
|
|
502
503
|
ERROR || (ERROR = Symbol("error"));
|
|
503
504
|
Owner = createComputation(undefined, undefined, true);
|
|
504
505
|
Owner.context = {
|
|
506
|
+
...Owner.context,
|
|
505
507
|
[ERROR]: [handler]
|
|
506
508
|
};
|
|
507
509
|
if (Transition && Transition.running) Transition.sources.add(Owner);
|
|
@@ -513,16 +515,6 @@ function catchError(fn, handler) {
|
|
|
513
515
|
Owner = Owner.owner;
|
|
514
516
|
}
|
|
515
517
|
}
|
|
516
|
-
function onError(fn) {
|
|
517
|
-
ERROR || (ERROR = Symbol("error"));
|
|
518
|
-
if (Owner === null);
|
|
519
|
-
else if (Owner.context === null)
|
|
520
|
-
Owner.context = {
|
|
521
|
-
[ERROR]: [fn]
|
|
522
|
-
};
|
|
523
|
-
else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];
|
|
524
|
-
else Owner.context[ERROR].push(fn);
|
|
525
|
-
}
|
|
526
518
|
function getListener() {
|
|
527
519
|
return Listener;
|
|
528
520
|
}
|
|
@@ -592,8 +584,9 @@ function createContext(defaultValue, options) {
|
|
|
592
584
|
};
|
|
593
585
|
}
|
|
594
586
|
function useContext(context) {
|
|
595
|
-
|
|
596
|
-
|
|
587
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
588
|
+
? Owner.context[context.id]
|
|
589
|
+
: context.defaultValue;
|
|
597
590
|
}
|
|
598
591
|
function children(fn) {
|
|
599
592
|
const children = createMemo(fn);
|
|
@@ -758,7 +751,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
758
751
|
cleanups: null,
|
|
759
752
|
value: init,
|
|
760
753
|
owner: Owner,
|
|
761
|
-
context: null,
|
|
754
|
+
context: Owner ? Owner.context : null,
|
|
762
755
|
pure
|
|
763
756
|
};
|
|
764
757
|
if (Transition && Transition.running) {
|
|
@@ -986,7 +979,6 @@ function cleanNode(node) {
|
|
|
986
979
|
}
|
|
987
980
|
if (Transition && Transition.running) node.tState = 0;
|
|
988
981
|
else node.state = 0;
|
|
989
|
-
node.context = null;
|
|
990
982
|
}
|
|
991
983
|
function reset(node, top) {
|
|
992
984
|
if (!top) {
|
|
@@ -1011,7 +1003,7 @@ function runErrors(err, fns, owner) {
|
|
|
1011
1003
|
}
|
|
1012
1004
|
}
|
|
1013
1005
|
function handleError(err, owner = Owner) {
|
|
1014
|
-
const fns = ERROR &&
|
|
1006
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1015
1007
|
const error = castError(err);
|
|
1016
1008
|
if (!fns) throw error;
|
|
1017
1009
|
if (Effects)
|
|
@@ -1023,13 +1015,6 @@ function handleError(err, owner = Owner) {
|
|
|
1023
1015
|
});
|
|
1024
1016
|
else runErrors(error, fns, owner);
|
|
1025
1017
|
}
|
|
1026
|
-
function lookup(owner, key) {
|
|
1027
|
-
return owner
|
|
1028
|
-
? owner.context && owner.context[key] !== undefined
|
|
1029
|
-
? owner.context[key]
|
|
1030
|
-
: lookup(owner.owner, key)
|
|
1031
|
-
: undefined;
|
|
1032
|
-
}
|
|
1033
1018
|
function resolveChildren(children) {
|
|
1034
1019
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
1035
1020
|
if (Array.isArray(children)) {
|
|
@@ -1049,6 +1034,7 @@ function createProvider(id, options) {
|
|
|
1049
1034
|
() =>
|
|
1050
1035
|
(res = untrack(() => {
|
|
1051
1036
|
Owner.context = {
|
|
1037
|
+
...Owner.context,
|
|
1052
1038
|
[id]: props.value
|
|
1053
1039
|
};
|
|
1054
1040
|
return children(() => props.children);
|
|
@@ -1058,6 +1044,31 @@ function createProvider(id, options) {
|
|
|
1058
1044
|
return res;
|
|
1059
1045
|
};
|
|
1060
1046
|
}
|
|
1047
|
+
function onError(fn) {
|
|
1048
|
+
ERROR || (ERROR = Symbol("error"));
|
|
1049
|
+
if (Owner === null);
|
|
1050
|
+
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1051
|
+
Owner.context = {
|
|
1052
|
+
...Owner.context,
|
|
1053
|
+
[ERROR]: [fn]
|
|
1054
|
+
};
|
|
1055
|
+
mutateContext(Owner, ERROR, [fn]);
|
|
1056
|
+
} else Owner.context[ERROR].push(fn);
|
|
1057
|
+
}
|
|
1058
|
+
function mutateContext(o, key, value) {
|
|
1059
|
+
if (o.owned) {
|
|
1060
|
+
for (let i = 0; i < o.owned.length; i++) {
|
|
1061
|
+
if (o.owned[i].context === o.context) mutateContext(o.owned[i], key, value);
|
|
1062
|
+
if (!o.owned[i].context) {
|
|
1063
|
+
o.owned[i].context = o.context;
|
|
1064
|
+
mutateContext(o.owned[i], key, value);
|
|
1065
|
+
} else if (!o.owned[i].context[key]) {
|
|
1066
|
+
o.owned[i].context[key] = value;
|
|
1067
|
+
mutateContext(o.owned[i], key, value);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1061
1072
|
|
|
1062
1073
|
function observable(input) {
|
|
1063
1074
|
return {
|
package/package.json
CHANGED
package/store/dist/dev.cjs
CHANGED
|
@@ -4,7 +4,8 @@ var solidJs = require('solid-js');
|
|
|
4
4
|
|
|
5
5
|
const $RAW = Symbol("store-raw"),
|
|
6
6
|
$NODE = Symbol("store-node"),
|
|
7
|
-
$HAS = Symbol("store-has")
|
|
7
|
+
$HAS = Symbol("store-has"),
|
|
8
|
+
$SELF = Symbol("store-self");
|
|
8
9
|
const DevHooks = {
|
|
9
10
|
onStoreNodeUpdate: null
|
|
10
11
|
};
|
|
@@ -82,7 +83,7 @@ function proxyDescriptor$1(target, property) {
|
|
|
82
83
|
return desc;
|
|
83
84
|
}
|
|
84
85
|
function trackSelf(target) {
|
|
85
|
-
solidJs.getListener() && getNode(getNodes(target, $NODE),
|
|
86
|
+
solidJs.getListener() && getNode(getNodes(target, $NODE), $SELF)();
|
|
86
87
|
}
|
|
87
88
|
function ownKeys(target) {
|
|
88
89
|
trackSelf(target);
|
|
@@ -141,7 +142,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
141
142
|
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
142
143
|
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
143
144
|
}
|
|
144
|
-
(node = nodes
|
|
145
|
+
(node = nodes[$SELF]) && node.$();
|
|
145
146
|
}
|
|
146
147
|
function mergeStoreNode(state, value) {
|
|
147
148
|
const keys = Object.keys(value);
|
package/store/dist/dev.js
CHANGED
|
@@ -2,7 +2,8 @@ import { DEV as DEV$1, $PROXY, $TRACK, getListener, batch, createSignal } from "
|
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
4
|
$NODE = Symbol("store-node"),
|
|
5
|
-
$HAS = Symbol("store-has")
|
|
5
|
+
$HAS = Symbol("store-has"),
|
|
6
|
+
$SELF = Symbol("store-self");
|
|
6
7
|
const DevHooks = {
|
|
7
8
|
onStoreNodeUpdate: null
|
|
8
9
|
};
|
|
@@ -91,7 +92,7 @@ function proxyDescriptor$1(target, property) {
|
|
|
91
92
|
return desc;
|
|
92
93
|
}
|
|
93
94
|
function trackSelf(target) {
|
|
94
|
-
getListener() && getNode(getNodes(target, $NODE),
|
|
95
|
+
getListener() && getNode(getNodes(target, $NODE), $SELF)();
|
|
95
96
|
}
|
|
96
97
|
function ownKeys(target) {
|
|
97
98
|
trackSelf(target);
|
|
@@ -163,7 +164,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
163
164
|
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
164
165
|
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
165
166
|
}
|
|
166
|
-
(node = nodes
|
|
167
|
+
(node = nodes[$SELF]) && node.$();
|
|
167
168
|
}
|
|
168
169
|
function mergeStoreNode(state, value) {
|
|
169
170
|
const keys = Object.keys(value);
|
package/store/dist/store.cjs
CHANGED
|
@@ -4,7 +4,8 @@ var solidJs = require('solid-js');
|
|
|
4
4
|
|
|
5
5
|
const $RAW = Symbol("store-raw"),
|
|
6
6
|
$NODE = Symbol("store-node"),
|
|
7
|
-
$HAS = Symbol("store-has")
|
|
7
|
+
$HAS = Symbol("store-has"),
|
|
8
|
+
$SELF = Symbol("store-self");
|
|
8
9
|
function wrap$1(value) {
|
|
9
10
|
let p = value[solidJs.$PROXY];
|
|
10
11
|
if (!p) {
|
|
@@ -79,7 +80,7 @@ function proxyDescriptor$1(target, property) {
|
|
|
79
80
|
return desc;
|
|
80
81
|
}
|
|
81
82
|
function trackSelf(target) {
|
|
82
|
-
solidJs.getListener() && getNode(getNodes(target, $NODE),
|
|
83
|
+
solidJs.getListener() && getNode(getNodes(target, $NODE), $SELF)();
|
|
83
84
|
}
|
|
84
85
|
function ownKeys(target) {
|
|
85
86
|
trackSelf(target);
|
|
@@ -135,7 +136,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
135
136
|
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
136
137
|
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
137
138
|
}
|
|
138
|
-
(node = nodes
|
|
139
|
+
(node = nodes[$SELF]) && node.$();
|
|
139
140
|
}
|
|
140
141
|
function mergeStoreNode(state, value) {
|
|
141
142
|
const keys = Object.keys(value);
|
package/store/dist/store.js
CHANGED
|
@@ -2,7 +2,8 @@ import { $PROXY, $TRACK, getListener, batch, createSignal } from "solid-js";
|
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
4
|
$NODE = Symbol("store-node"),
|
|
5
|
-
$HAS = Symbol("store-has")
|
|
5
|
+
$HAS = Symbol("store-has"),
|
|
6
|
+
$SELF = Symbol("store-self");
|
|
6
7
|
function wrap$1(value) {
|
|
7
8
|
let p = value[$PROXY];
|
|
8
9
|
if (!p) {
|
|
@@ -88,7 +89,7 @@ function proxyDescriptor$1(target, property) {
|
|
|
88
89
|
return desc;
|
|
89
90
|
}
|
|
90
91
|
function trackSelf(target) {
|
|
91
|
-
getListener() && getNode(getNodes(target, $NODE),
|
|
92
|
+
getListener() && getNode(getNodes(target, $NODE), $SELF)();
|
|
92
93
|
}
|
|
93
94
|
function ownKeys(target) {
|
|
94
95
|
trackSelf(target);
|
|
@@ -157,7 +158,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
157
158
|
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
158
159
|
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
159
160
|
}
|
|
160
|
-
(node = nodes
|
|
161
|
+
(node = nodes[$SELF]) && node.$();
|
|
161
162
|
}
|
|
162
163
|
function mergeStoreNode(state, value) {
|
|
163
164
|
const keys = Object.keys(value);
|
package/store/types/store.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare const $RAW: unique symbol,
|
|
1
|
+
export declare const $RAW: unique symbol,
|
|
2
|
+
$NODE: unique symbol,
|
|
3
|
+
$HAS: unique symbol,
|
|
4
|
+
$SELF: unique symbol;
|
|
2
5
|
export declare const DevHooks: {
|
|
3
6
|
onStoreNodeUpdate: OnStoreNodeUpdate | null;
|
|
4
7
|
};
|
package/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export {
|
|
|
3
3
|
$PROXY,
|
|
4
4
|
$TRACK,
|
|
5
5
|
batch,
|
|
6
|
+
catchError,
|
|
6
7
|
children,
|
|
7
8
|
createComputed,
|
|
8
9
|
createContext,
|
|
@@ -23,7 +24,6 @@ export {
|
|
|
23
24
|
on,
|
|
24
25
|
onCleanup,
|
|
25
26
|
onError,
|
|
26
|
-
catchError,
|
|
27
27
|
onMount,
|
|
28
28
|
runWithOwner,
|
|
29
29
|
startTransition,
|
|
@@ -36,6 +36,7 @@ export type {
|
|
|
36
36
|
AccessorArray,
|
|
37
37
|
ChildrenReturn,
|
|
38
38
|
Context,
|
|
39
|
+
ContextProviderComponent,
|
|
39
40
|
EffectFunction,
|
|
40
41
|
EffectOptions,
|
|
41
42
|
InitializedResource,
|
|
@@ -46,6 +47,8 @@ export type {
|
|
|
46
47
|
OnEffectFunction,
|
|
47
48
|
OnOptions,
|
|
48
49
|
Owner,
|
|
50
|
+
ResolvedChildren,
|
|
51
|
+
ResolvedJSXElement,
|
|
49
52
|
Resource,
|
|
50
53
|
ResourceActions,
|
|
51
54
|
ResourceFetcher,
|
|
@@ -536,16 +536,6 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
536
536
|
* @description https://www.solidjs.com/docs/latest/api#catcherror
|
|
537
537
|
*/
|
|
538
538
|
export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
|
|
539
|
-
/**
|
|
540
|
-
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
541
|
-
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
542
|
-
* @param fn an error handler that receives the error
|
|
543
|
-
*
|
|
544
|
-
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
545
|
-
*
|
|
546
|
-
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
547
|
-
*/
|
|
548
|
-
export declare function onError(fn: (err: Error) => void): void;
|
|
549
539
|
export declare function getListener(): Computation<any, any> | null;
|
|
550
540
|
export declare function getOwner(): Owner | null;
|
|
551
541
|
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
@@ -653,4 +643,14 @@ export declare function writeSignal(
|
|
|
653
643
|
value: any,
|
|
654
644
|
isComp?: boolean
|
|
655
645
|
): any;
|
|
646
|
+
/**
|
|
647
|
+
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
648
|
+
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
649
|
+
* @param fn an error handler that receives the error
|
|
650
|
+
*
|
|
651
|
+
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
652
|
+
*
|
|
653
|
+
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
654
|
+
*/
|
|
655
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
656
656
|
export {};
|
package/types/server/index.d.ts
CHANGED
|
@@ -51,10 +51,6 @@ export declare function onMount(fn: () => void): void;
|
|
|
51
51
|
export declare function onCleanup(fn: () => void): () => void;
|
|
52
52
|
export declare function cleanNode(node: Owner): void;
|
|
53
53
|
export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
56
|
-
*/
|
|
57
|
-
export declare function onError(fn: (err: Error) => void): void;
|
|
58
54
|
export declare function getListener(): null;
|
|
59
55
|
export interface Context<T> {
|
|
60
56
|
id: symbol;
|
|
@@ -69,7 +65,6 @@ type ChildrenReturn = Accessor<any> & {
|
|
|
69
65
|
};
|
|
70
66
|
export declare function children(fn: () => any): ChildrenReturn;
|
|
71
67
|
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
72
|
-
export declare function lookup(owner: Owner | null, key: symbol | string): any;
|
|
73
68
|
export interface Task {
|
|
74
69
|
id: number;
|
|
75
70
|
fn: ((didTimeout: boolean) => void) | null;
|
|
@@ -115,4 +110,8 @@ export declare function from<T>(
|
|
|
115
110
|
}
|
|
116
111
|
): Accessor<T>;
|
|
117
112
|
export declare function enableExternalSource(factory: any): void;
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
115
|
+
*/
|
|
116
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
118
117
|
export {};
|
package/web/dist/server.cjs
CHANGED
|
@@ -215,14 +215,17 @@ function renderToStream(code, options = {}) {
|
|
|
215
215
|
});
|
|
216
216
|
},
|
|
217
217
|
pipeTo(w) {
|
|
218
|
-
Promise.allSettled(blockingResources).then(() => {
|
|
218
|
+
return Promise.allSettled(blockingResources).then(() => {
|
|
219
219
|
doShell();
|
|
220
220
|
const encoder = new TextEncoder();
|
|
221
221
|
const writer = w.getWriter();
|
|
222
|
+
let resolve;
|
|
223
|
+
const p = new Promise(r => resolve = r);
|
|
222
224
|
writable = {
|
|
223
225
|
end() {
|
|
224
226
|
writer.releaseLock();
|
|
225
227
|
w.close();
|
|
228
|
+
resolve();
|
|
226
229
|
}
|
|
227
230
|
};
|
|
228
231
|
buffer = {
|
|
@@ -233,6 +236,7 @@ function renderToStream(code, options = {}) {
|
|
|
233
236
|
buffer.write(tmp);
|
|
234
237
|
firstFlushed = true;
|
|
235
238
|
if (completed) writable.end();else setTimeout(checkEnd);
|
|
239
|
+
return p;
|
|
236
240
|
});
|
|
237
241
|
}
|
|
238
242
|
};
|
package/web/dist/server.js
CHANGED
|
@@ -264,14 +264,17 @@ function renderToStream(code, options = {}) {
|
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
266
|
pipeTo(w) {
|
|
267
|
-
Promise.allSettled(blockingResources).then(() => {
|
|
267
|
+
return Promise.allSettled(blockingResources).then(() => {
|
|
268
268
|
doShell();
|
|
269
269
|
const encoder = new TextEncoder();
|
|
270
270
|
const writer = w.getWriter();
|
|
271
|
+
let resolve;
|
|
272
|
+
const p = new Promise(r => (resolve = r));
|
|
271
273
|
writable = {
|
|
272
274
|
end() {
|
|
273
275
|
writer.releaseLock();
|
|
274
276
|
w.close();
|
|
277
|
+
resolve();
|
|
275
278
|
}
|
|
276
279
|
};
|
|
277
280
|
buffer = {
|
|
@@ -283,6 +286,7 @@ function renderToStream(code, options = {}) {
|
|
|
283
286
|
firstFlushed = true;
|
|
284
287
|
if (completed) writable.end();
|
|
285
288
|
else setTimeout(checkEnd);
|
|
289
|
+
return p;
|
|
286
290
|
});
|
|
287
291
|
}
|
|
288
292
|
};
|
package/web/types/server.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function renderToStream<T>(
|
|
|
23
23
|
}
|
|
24
24
|
): {
|
|
25
25
|
pipe: (writable: { write: (v: string) => void }) => void;
|
|
26
|
-
pipeTo: (writable: WritableStream) => void
|
|
26
|
+
pipeTo: (writable: WritableStream) => Promise<void>;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export function HydrationScript(props: { nonce?: string; eventNames?: string[] }): JSX.Element;
|