solid-js 1.6.10 → 1.7.0-beta.0
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 +45 -96
- package/dist/dev.js +45 -96
- package/dist/server.cjs +9 -8
- package/dist/server.js +9 -8
- package/dist/solid.cjs +24 -17
- package/dist/solid.js +24 -17
- package/h/jsx-runtime/dist/jsx.cjs +6 -3
- package/h/jsx-runtime/dist/jsx.js +5 -2
- package/h/jsx-runtime/types/index.d.ts +6 -2
- package/h/jsx-runtime/types/jsx.d.ts +1 -0
- package/package.json +3 -2
- package/store/dist/dev.cjs +26 -34
- package/store/dist/dev.js +26 -33
- package/store/dist/store.cjs +6 -7
- package/store/dist/store.js +6 -7
- package/store/types/index.d.ts +8 -7
- package/store/types/modifiers.d.ts +1 -1
- package/store/types/server.d.ts +2 -2
- package/store/types/store.d.ts +27 -26
- package/types/index.d.ts +6 -7
- package/types/jsx.d.ts +1 -4
- package/types/reactive/observable.d.ts +1 -1
- package/types/reactive/signal.d.ts +42 -47
- package/types/render/component.d.ts +18 -18
- package/types/render/flow.d.ts +8 -8
- package/types/render/hydration.d.ts +2 -2
- package/types/server/reactive.d.ts +10 -10
- package/types/server/rendering.d.ts +21 -21
- package/web/dist/server.cjs +8 -1
- package/web/dist/server.js +8 -1
- package/web/types/index.d.ts +3 -3
- package/web/types/server-mock.d.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -154,7 +154,10 @@ let Listener = null;
|
|
|
154
154
|
let Updates = null;
|
|
155
155
|
let Effects = null;
|
|
156
156
|
let ExecCount = 0;
|
|
157
|
-
|
|
157
|
+
const DevHooks = {
|
|
158
|
+
afterUpdate: null,
|
|
159
|
+
afterCreateOwner: null
|
|
160
|
+
};
|
|
158
161
|
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
159
162
|
function createRoot(fn, detachedOwner) {
|
|
160
163
|
const listener = Listener,
|
|
@@ -169,15 +172,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
169
172
|
owned: null,
|
|
170
173
|
cleanups: null,
|
|
171
174
|
context: null,
|
|
172
|
-
owner: detachedOwner
|
|
175
|
+
owner: detachedOwner === undefined ? owner : detachedOwner
|
|
173
176
|
},
|
|
174
177
|
updateFn = unowned ? () => fn(() => {
|
|
175
178
|
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
176
179
|
}) : () => fn(() => untrack(() => cleanNode(root)));
|
|
177
|
-
|
|
178
|
-
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
179
|
-
globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
|
|
180
|
-
}
|
|
180
|
+
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
|
|
181
181
|
Owner = root;
|
|
182
182
|
Listener = null;
|
|
183
183
|
try {
|
|
@@ -195,7 +195,10 @@ function createSignal(value, options) {
|
|
|
195
195
|
observerSlots: null,
|
|
196
196
|
comparator: options.equals || undefined
|
|
197
197
|
};
|
|
198
|
-
if (!options.internal)
|
|
198
|
+
if (!options.internal) {
|
|
199
|
+
if (options.name) s.name = options.name;
|
|
200
|
+
registerGraph(s);
|
|
201
|
+
}
|
|
199
202
|
const setter = value => {
|
|
200
203
|
if (typeof value === "function") {
|
|
201
204
|
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
@@ -299,8 +302,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
299
302
|
}
|
|
300
303
|
function completeLoad(v, err) {
|
|
301
304
|
runUpdates(() => {
|
|
302
|
-
if (
|
|
303
|
-
setState(err ? "errored" : "ready");
|
|
305
|
+
if (err === undefined) setValue(() => v);
|
|
306
|
+
setState(err !== undefined ? "errored" : "ready");
|
|
304
307
|
setError(err);
|
|
305
308
|
for (const c of contexts.keys()) c.decrement();
|
|
306
309
|
contexts.clear();
|
|
@@ -310,7 +313,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
310
313
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
311
314
|
v = value(),
|
|
312
315
|
err = error();
|
|
313
|
-
if (err && !pr) throw err;
|
|
316
|
+
if (err !== undefined && !pr) throw err;
|
|
314
317
|
if (Listener && !Listener.user && c) {
|
|
315
318
|
createComputed(() => {
|
|
316
319
|
track();
|
|
@@ -423,6 +426,7 @@ function batch(fn) {
|
|
|
423
426
|
return runUpdates(fn, false);
|
|
424
427
|
}
|
|
425
428
|
function untrack(fn) {
|
|
429
|
+
if (Listener === null) return fn();
|
|
426
430
|
const listener = Listener;
|
|
427
431
|
Listener = null;
|
|
428
432
|
try {
|
|
@@ -535,45 +539,10 @@ function devComponent(Comp, props) {
|
|
|
535
539
|
updateComputation(c);
|
|
536
540
|
return c.tValue !== undefined ? c.tValue : c.value;
|
|
537
541
|
}
|
|
538
|
-
function
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
if (s.has(v)) return;
|
|
543
|
-
s.add(v);
|
|
544
|
-
const keys = Object.keys(v);
|
|
545
|
-
const desc = Object.getOwnPropertyDescriptors(v);
|
|
546
|
-
const newDesc = keys.reduce((memo, key) => {
|
|
547
|
-
const value = desc[key];
|
|
548
|
-
if (!value.get) memo[key] = value;
|
|
549
|
-
return memo;
|
|
550
|
-
}, {});
|
|
551
|
-
v = Object.create({}, newDesc);
|
|
552
|
-
}
|
|
553
|
-
if (typeof v === "bigint") {
|
|
554
|
-
return `${v.toString()}n`;
|
|
555
|
-
}
|
|
556
|
-
return v;
|
|
557
|
-
}) || ""))}`;
|
|
558
|
-
}
|
|
559
|
-
function registerGraph(name, value) {
|
|
560
|
-
let tryName = name;
|
|
561
|
-
if (Owner) {
|
|
562
|
-
let i = 0;
|
|
563
|
-
Owner.sourceMap || (Owner.sourceMap = {});
|
|
564
|
-
while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
|
|
565
|
-
Owner.sourceMap[tryName] = value;
|
|
566
|
-
value.graph = Owner;
|
|
567
|
-
}
|
|
568
|
-
return tryName;
|
|
569
|
-
}
|
|
570
|
-
function serializeGraph(owner) {
|
|
571
|
-
owner || (owner = Owner);
|
|
572
|
-
if (!owner) return {};
|
|
573
|
-
return {
|
|
574
|
-
...serializeValues(owner.sourceMap),
|
|
575
|
-
...(owner.owned ? serializeChildren(owner) : {})
|
|
576
|
-
};
|
|
542
|
+
function registerGraph(value) {
|
|
543
|
+
if (!Owner) return;
|
|
544
|
+
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
|
|
545
|
+
value.graph = Owner;
|
|
577
546
|
}
|
|
578
547
|
function createContext(defaultValue, options) {
|
|
579
548
|
const id = Symbol("context");
|
|
@@ -756,8 +725,8 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
756
725
|
} else {
|
|
757
726
|
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
758
727
|
}
|
|
759
|
-
c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
|
|
760
728
|
}
|
|
729
|
+
if (options && options.name) c.name = options.name;
|
|
761
730
|
if (ExternalSourceFactory) {
|
|
762
731
|
const [track, trigger] = createSignal(undefined, {
|
|
763
732
|
equals: false
|
|
@@ -771,6 +740,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
771
740
|
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
772
741
|
};
|
|
773
742
|
}
|
|
743
|
+
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
|
|
774
744
|
return c;
|
|
775
745
|
}
|
|
776
746
|
function runTop(node) {
|
|
@@ -813,7 +783,7 @@ function runUpdates(fn, init) {
|
|
|
813
783
|
completeUpdates(wait);
|
|
814
784
|
return res;
|
|
815
785
|
} catch (err) {
|
|
816
|
-
if (!
|
|
786
|
+
if (!wait) Effects = null;
|
|
817
787
|
Updates = null;
|
|
818
788
|
handleError(err);
|
|
819
789
|
}
|
|
@@ -860,7 +830,7 @@ function completeUpdates(wait) {
|
|
|
860
830
|
}
|
|
861
831
|
const e = Effects;
|
|
862
832
|
Effects = null;
|
|
863
|
-
if (e.length) runUpdates(() => runEffects(e), false);else
|
|
833
|
+
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
864
834
|
if (res) res();
|
|
865
835
|
}
|
|
866
836
|
function runQueue(queue) {
|
|
@@ -962,14 +932,24 @@ function reset(node, top) {
|
|
|
962
932
|
}
|
|
963
933
|
}
|
|
964
934
|
function castError(err) {
|
|
965
|
-
if (err instanceof Error
|
|
966
|
-
return new Error("Unknown error"
|
|
935
|
+
if (err instanceof Error) return err;
|
|
936
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
937
|
+
cause: err
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
function runErrors(fns, err) {
|
|
941
|
+
for (const f of fns) f(err);
|
|
967
942
|
}
|
|
968
943
|
function handleError(err) {
|
|
969
|
-
err = castError(err);
|
|
970
944
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
971
945
|
if (!fns) throw err;
|
|
972
|
-
|
|
946
|
+
const error = castError(err);
|
|
947
|
+
if (Effects) Effects.push({
|
|
948
|
+
fn() {
|
|
949
|
+
runErrors(fns, error);
|
|
950
|
+
},
|
|
951
|
+
state: STALE
|
|
952
|
+
});else runErrors(fns, error);
|
|
973
953
|
}
|
|
974
954
|
function lookup(owner, key) {
|
|
975
955
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -998,30 +978,6 @@ function createProvider(id, options) {
|
|
|
998
978
|
return res;
|
|
999
979
|
};
|
|
1000
980
|
}
|
|
1001
|
-
function hash(s) {
|
|
1002
|
-
for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
|
|
1003
|
-
return `${h ^ h >>> 9}`;
|
|
1004
|
-
}
|
|
1005
|
-
function serializeValues(sources = {}) {
|
|
1006
|
-
const k = Object.keys(sources);
|
|
1007
|
-
const result = {};
|
|
1008
|
-
for (let i = 0; i < k.length; i++) {
|
|
1009
|
-
const key = k[i];
|
|
1010
|
-
result[key] = sources[key].value;
|
|
1011
|
-
}
|
|
1012
|
-
return result;
|
|
1013
|
-
}
|
|
1014
|
-
function serializeChildren(root) {
|
|
1015
|
-
const result = {};
|
|
1016
|
-
for (let i = 0, len = root.owned.length; i < len; i++) {
|
|
1017
|
-
const node = root.owned[i];
|
|
1018
|
-
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
|
|
1019
|
-
...serializeValues(node.sourceMap),
|
|
1020
|
-
...(node.owned ? serializeChildren(node) : {})
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
return result;
|
|
1024
|
-
}
|
|
1025
981
|
|
|
1026
982
|
function observable(input) {
|
|
1027
983
|
return {
|
|
@@ -1441,10 +1397,9 @@ function Index(props) {
|
|
|
1441
1397
|
}) ;
|
|
1442
1398
|
}
|
|
1443
1399
|
function Show(props) {
|
|
1444
|
-
let strictEqual = false;
|
|
1445
1400
|
const keyed = props.keyed;
|
|
1446
1401
|
const condition = createMemo(() => props.when, undefined, {
|
|
1447
|
-
equals: (a, b) =>
|
|
1402
|
+
equals: (a, b) => keyed ? a === b : !a === !b,
|
|
1448
1403
|
name: "condition"
|
|
1449
1404
|
} );
|
|
1450
1405
|
return createMemo(() => {
|
|
@@ -1452,8 +1407,7 @@ function Show(props) {
|
|
|
1452
1407
|
if (c) {
|
|
1453
1408
|
const child = props.children;
|
|
1454
1409
|
const fn = typeof child === "function" && child.length > 0;
|
|
1455
|
-
|
|
1456
|
-
return fn ? untrack(() => child(c)) : child;
|
|
1410
|
+
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child;
|
|
1457
1411
|
}
|
|
1458
1412
|
return props.fallback;
|
|
1459
1413
|
}, undefined, {
|
|
@@ -1461,9 +1415,8 @@ function Show(props) {
|
|
|
1461
1415
|
} );
|
|
1462
1416
|
}
|
|
1463
1417
|
function Switch(props) {
|
|
1464
|
-
let strictEqual = false;
|
|
1465
1418
|
let keyed = false;
|
|
1466
|
-
const equals = (a, b) => a[0] === b[0] && (
|
|
1419
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1467
1420
|
const conditions = children(() => props.children),
|
|
1468
1421
|
evalConditions = createMemo(() => {
|
|
1469
1422
|
let conds = conditions();
|
|
@@ -1485,8 +1438,7 @@ function Switch(props) {
|
|
|
1485
1438
|
if (index < 0) return props.fallback;
|
|
1486
1439
|
const c = cond.children;
|
|
1487
1440
|
const fn = typeof c === "function" && c.length > 0;
|
|
1488
|
-
|
|
1489
|
-
return fn ? untrack(() => c(when)) : c;
|
|
1441
|
+
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c;
|
|
1490
1442
|
}, undefined, {
|
|
1491
1443
|
name: "value"
|
|
1492
1444
|
} );
|
|
@@ -1691,14 +1643,11 @@ function Suspense(props) {
|
|
|
1691
1643
|
}
|
|
1692
1644
|
|
|
1693
1645
|
exports.DEV = void 0;
|
|
1694
|
-
{
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
hashValue
|
|
1700
|
-
};
|
|
1701
|
-
}
|
|
1646
|
+
exports.DEV = {
|
|
1647
|
+
hooks: DevHooks,
|
|
1648
|
+
writeSignal,
|
|
1649
|
+
registerGraph
|
|
1650
|
+
};
|
|
1702
1651
|
if (globalThis) {
|
|
1703
1652
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1704
1653
|
}
|
package/dist/dev.js
CHANGED
|
@@ -152,7 +152,10 @@ let Listener = null;
|
|
|
152
152
|
let Updates = null;
|
|
153
153
|
let Effects = null;
|
|
154
154
|
let ExecCount = 0;
|
|
155
|
-
|
|
155
|
+
const DevHooks = {
|
|
156
|
+
afterUpdate: null,
|
|
157
|
+
afterCreateOwner: null
|
|
158
|
+
};
|
|
156
159
|
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
157
160
|
function createRoot(fn, detachedOwner) {
|
|
158
161
|
const listener = Listener,
|
|
@@ -167,15 +170,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
167
170
|
owned: null,
|
|
168
171
|
cleanups: null,
|
|
169
172
|
context: null,
|
|
170
|
-
owner: detachedOwner
|
|
173
|
+
owner: detachedOwner === undefined ? owner : detachedOwner
|
|
171
174
|
},
|
|
172
175
|
updateFn = unowned ? () => fn(() => {
|
|
173
176
|
throw new Error("Dispose method must be an explicit argument to createRoot function");
|
|
174
177
|
}) : () => fn(() => untrack(() => cleanNode(root)));
|
|
175
|
-
|
|
176
|
-
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
177
|
-
globalThis._$afterCreateRoot && globalThis._$afterCreateRoot(root);
|
|
178
|
-
}
|
|
178
|
+
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
|
|
179
179
|
Owner = root;
|
|
180
180
|
Listener = null;
|
|
181
181
|
try {
|
|
@@ -193,7 +193,10 @@ function createSignal(value, options) {
|
|
|
193
193
|
observerSlots: null,
|
|
194
194
|
comparator: options.equals || undefined
|
|
195
195
|
};
|
|
196
|
-
if (!options.internal)
|
|
196
|
+
if (!options.internal) {
|
|
197
|
+
if (options.name) s.name = options.name;
|
|
198
|
+
registerGraph(s);
|
|
199
|
+
}
|
|
197
200
|
const setter = value => {
|
|
198
201
|
if (typeof value === "function") {
|
|
199
202
|
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
@@ -297,8 +300,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
297
300
|
}
|
|
298
301
|
function completeLoad(v, err) {
|
|
299
302
|
runUpdates(() => {
|
|
300
|
-
if (
|
|
301
|
-
setState(err ? "errored" : "ready");
|
|
303
|
+
if (err === undefined) setValue(() => v);
|
|
304
|
+
setState(err !== undefined ? "errored" : "ready");
|
|
302
305
|
setError(err);
|
|
303
306
|
for (const c of contexts.keys()) c.decrement();
|
|
304
307
|
contexts.clear();
|
|
@@ -308,7 +311,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
308
311
|
const c = SuspenseContext && lookup(Owner, SuspenseContext.id),
|
|
309
312
|
v = value(),
|
|
310
313
|
err = error();
|
|
311
|
-
if (err && !pr) throw err;
|
|
314
|
+
if (err !== undefined && !pr) throw err;
|
|
312
315
|
if (Listener && !Listener.user && c) {
|
|
313
316
|
createComputed(() => {
|
|
314
317
|
track();
|
|
@@ -421,6 +424,7 @@ function batch(fn) {
|
|
|
421
424
|
return runUpdates(fn, false);
|
|
422
425
|
}
|
|
423
426
|
function untrack(fn) {
|
|
427
|
+
if (Listener === null) return fn();
|
|
424
428
|
const listener = Listener;
|
|
425
429
|
Listener = null;
|
|
426
430
|
try {
|
|
@@ -533,45 +537,10 @@ function devComponent(Comp, props) {
|
|
|
533
537
|
updateComputation(c);
|
|
534
538
|
return c.tValue !== undefined ? c.tValue : c.value;
|
|
535
539
|
}
|
|
536
|
-
function
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
if (s.has(v)) return;
|
|
541
|
-
s.add(v);
|
|
542
|
-
const keys = Object.keys(v);
|
|
543
|
-
const desc = Object.getOwnPropertyDescriptors(v);
|
|
544
|
-
const newDesc = keys.reduce((memo, key) => {
|
|
545
|
-
const value = desc[key];
|
|
546
|
-
if (!value.get) memo[key] = value;
|
|
547
|
-
return memo;
|
|
548
|
-
}, {});
|
|
549
|
-
v = Object.create({}, newDesc);
|
|
550
|
-
}
|
|
551
|
-
if (typeof v === "bigint") {
|
|
552
|
-
return `${v.toString()}n`;
|
|
553
|
-
}
|
|
554
|
-
return v;
|
|
555
|
-
}) || ""))}`;
|
|
556
|
-
}
|
|
557
|
-
function registerGraph(name, value) {
|
|
558
|
-
let tryName = name;
|
|
559
|
-
if (Owner) {
|
|
560
|
-
let i = 0;
|
|
561
|
-
Owner.sourceMap || (Owner.sourceMap = {});
|
|
562
|
-
while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
|
|
563
|
-
Owner.sourceMap[tryName] = value;
|
|
564
|
-
value.graph = Owner;
|
|
565
|
-
}
|
|
566
|
-
return tryName;
|
|
567
|
-
}
|
|
568
|
-
function serializeGraph(owner) {
|
|
569
|
-
owner || (owner = Owner);
|
|
570
|
-
if (!owner) return {};
|
|
571
|
-
return {
|
|
572
|
-
...serializeValues(owner.sourceMap),
|
|
573
|
-
...(owner.owned ? serializeChildren(owner) : {})
|
|
574
|
-
};
|
|
540
|
+
function registerGraph(value) {
|
|
541
|
+
if (!Owner) return;
|
|
542
|
+
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
|
|
543
|
+
value.graph = Owner;
|
|
575
544
|
}
|
|
576
545
|
function createContext(defaultValue, options) {
|
|
577
546
|
const id = Symbol("context");
|
|
@@ -754,8 +723,8 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
754
723
|
} else {
|
|
755
724
|
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
756
725
|
}
|
|
757
|
-
c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
|
|
758
726
|
}
|
|
727
|
+
if (options && options.name) c.name = options.name;
|
|
759
728
|
if (ExternalSourceFactory) {
|
|
760
729
|
const [track, trigger] = createSignal(undefined, {
|
|
761
730
|
equals: false
|
|
@@ -769,6 +738,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
769
738
|
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
770
739
|
};
|
|
771
740
|
}
|
|
741
|
+
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
|
|
772
742
|
return c;
|
|
773
743
|
}
|
|
774
744
|
function runTop(node) {
|
|
@@ -811,7 +781,7 @@ function runUpdates(fn, init) {
|
|
|
811
781
|
completeUpdates(wait);
|
|
812
782
|
return res;
|
|
813
783
|
} catch (err) {
|
|
814
|
-
if (!
|
|
784
|
+
if (!wait) Effects = null;
|
|
815
785
|
Updates = null;
|
|
816
786
|
handleError(err);
|
|
817
787
|
}
|
|
@@ -858,7 +828,7 @@ function completeUpdates(wait) {
|
|
|
858
828
|
}
|
|
859
829
|
const e = Effects;
|
|
860
830
|
Effects = null;
|
|
861
|
-
if (e.length) runUpdates(() => runEffects(e), false);else
|
|
831
|
+
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
862
832
|
if (res) res();
|
|
863
833
|
}
|
|
864
834
|
function runQueue(queue) {
|
|
@@ -960,14 +930,24 @@ function reset(node, top) {
|
|
|
960
930
|
}
|
|
961
931
|
}
|
|
962
932
|
function castError(err) {
|
|
963
|
-
if (err instanceof Error
|
|
964
|
-
return new Error("Unknown error"
|
|
933
|
+
if (err instanceof Error) return err;
|
|
934
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
935
|
+
cause: err
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
function runErrors(fns, err) {
|
|
939
|
+
for (const f of fns) f(err);
|
|
965
940
|
}
|
|
966
941
|
function handleError(err) {
|
|
967
|
-
err = castError(err);
|
|
968
942
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
969
943
|
if (!fns) throw err;
|
|
970
|
-
|
|
944
|
+
const error = castError(err);
|
|
945
|
+
if (Effects) Effects.push({
|
|
946
|
+
fn() {
|
|
947
|
+
runErrors(fns, error);
|
|
948
|
+
},
|
|
949
|
+
state: STALE
|
|
950
|
+
});else runErrors(fns, error);
|
|
971
951
|
}
|
|
972
952
|
function lookup(owner, key) {
|
|
973
953
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -996,30 +976,6 @@ function createProvider(id, options) {
|
|
|
996
976
|
return res;
|
|
997
977
|
};
|
|
998
978
|
}
|
|
999
|
-
function hash(s) {
|
|
1000
|
-
for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
|
|
1001
|
-
return `${h ^ h >>> 9}`;
|
|
1002
|
-
}
|
|
1003
|
-
function serializeValues(sources = {}) {
|
|
1004
|
-
const k = Object.keys(sources);
|
|
1005
|
-
const result = {};
|
|
1006
|
-
for (let i = 0; i < k.length; i++) {
|
|
1007
|
-
const key = k[i];
|
|
1008
|
-
result[key] = sources[key].value;
|
|
1009
|
-
}
|
|
1010
|
-
return result;
|
|
1011
|
-
}
|
|
1012
|
-
function serializeChildren(root) {
|
|
1013
|
-
const result = {};
|
|
1014
|
-
for (let i = 0, len = root.owned.length; i < len; i++) {
|
|
1015
|
-
const node = root.owned[i];
|
|
1016
|
-
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
|
|
1017
|
-
...serializeValues(node.sourceMap),
|
|
1018
|
-
...(node.owned ? serializeChildren(node) : {})
|
|
1019
|
-
};
|
|
1020
|
-
}
|
|
1021
|
-
return result;
|
|
1022
|
-
}
|
|
1023
979
|
|
|
1024
980
|
function observable(input) {
|
|
1025
981
|
return {
|
|
@@ -1439,10 +1395,9 @@ function Index(props) {
|
|
|
1439
1395
|
}) ;
|
|
1440
1396
|
}
|
|
1441
1397
|
function Show(props) {
|
|
1442
|
-
let strictEqual = false;
|
|
1443
1398
|
const keyed = props.keyed;
|
|
1444
1399
|
const condition = createMemo(() => props.when, undefined, {
|
|
1445
|
-
equals: (a, b) =>
|
|
1400
|
+
equals: (a, b) => keyed ? a === b : !a === !b,
|
|
1446
1401
|
name: "condition"
|
|
1447
1402
|
} );
|
|
1448
1403
|
return createMemo(() => {
|
|
@@ -1450,8 +1405,7 @@ function Show(props) {
|
|
|
1450
1405
|
if (c) {
|
|
1451
1406
|
const child = props.children;
|
|
1452
1407
|
const fn = typeof child === "function" && child.length > 0;
|
|
1453
|
-
|
|
1454
|
-
return fn ? untrack(() => child(c)) : child;
|
|
1408
|
+
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child;
|
|
1455
1409
|
}
|
|
1456
1410
|
return props.fallback;
|
|
1457
1411
|
}, undefined, {
|
|
@@ -1459,9 +1413,8 @@ function Show(props) {
|
|
|
1459
1413
|
} );
|
|
1460
1414
|
}
|
|
1461
1415
|
function Switch(props) {
|
|
1462
|
-
let strictEqual = false;
|
|
1463
1416
|
let keyed = false;
|
|
1464
|
-
const equals = (a, b) => a[0] === b[0] && (
|
|
1417
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1465
1418
|
const conditions = children(() => props.children),
|
|
1466
1419
|
evalConditions = createMemo(() => {
|
|
1467
1420
|
let conds = conditions();
|
|
@@ -1483,8 +1436,7 @@ function Switch(props) {
|
|
|
1483
1436
|
if (index < 0) return props.fallback;
|
|
1484
1437
|
const c = cond.children;
|
|
1485
1438
|
const fn = typeof c === "function" && c.length > 0;
|
|
1486
|
-
|
|
1487
|
-
return fn ? untrack(() => c(when)) : c;
|
|
1439
|
+
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c;
|
|
1488
1440
|
}, undefined, {
|
|
1489
1441
|
name: "value"
|
|
1490
1442
|
} );
|
|
@@ -1689,14 +1641,11 @@ function Suspense(props) {
|
|
|
1689
1641
|
}
|
|
1690
1642
|
|
|
1691
1643
|
let DEV;
|
|
1692
|
-
{
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
hashValue
|
|
1698
|
-
};
|
|
1699
|
-
}
|
|
1644
|
+
DEV = {
|
|
1645
|
+
hooks: DevHooks,
|
|
1646
|
+
writeSignal,
|
|
1647
|
+
registerGraph
|
|
1648
|
+
};
|
|
1700
1649
|
if (globalThis) {
|
|
1701
1650
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1702
1651
|
}
|
package/dist/server.cjs
CHANGED
|
@@ -4,18 +4,20 @@ const equalFn = (a, b) => a === b;
|
|
|
4
4
|
const $PROXY = Symbol("solid-proxy");
|
|
5
5
|
const $TRACK = Symbol("solid-track");
|
|
6
6
|
const $DEVCOMP = Symbol("solid-dev-component");
|
|
7
|
-
const DEV =
|
|
7
|
+
const DEV = undefined;
|
|
8
8
|
const ERROR = Symbol("error");
|
|
9
9
|
const BRANCH = Symbol("branch");
|
|
10
10
|
function castError(err) {
|
|
11
|
-
if (err instanceof Error
|
|
12
|
-
return new Error("Unknown error"
|
|
11
|
+
if (err instanceof Error) return err;
|
|
12
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
13
|
+
cause: err
|
|
14
|
+
});
|
|
13
15
|
}
|
|
14
16
|
function handleError(err) {
|
|
15
|
-
|
|
17
|
+
const error = castError(err);
|
|
16
18
|
const fns = lookup(Owner, ERROR);
|
|
17
|
-
if (!fns) throw
|
|
18
|
-
for (const f of fns) f(
|
|
19
|
+
if (!fns) throw error;
|
|
20
|
+
for (const f of fns) f(error);
|
|
19
21
|
}
|
|
20
22
|
const UNOWNED = {
|
|
21
23
|
context: null,
|
|
@@ -23,11 +25,10 @@ const UNOWNED = {
|
|
|
23
25
|
};
|
|
24
26
|
let Owner = null;
|
|
25
27
|
function createRoot(fn, detachedOwner) {
|
|
26
|
-
detachedOwner && (Owner = detachedOwner);
|
|
27
28
|
const owner = Owner,
|
|
28
29
|
root = fn.length === 0 ? UNOWNED : {
|
|
29
30
|
context: null,
|
|
30
|
-
owner
|
|
31
|
+
owner: detachedOwner === undefined ? owner : detachedOwner
|
|
31
32
|
};
|
|
32
33
|
Owner = root;
|
|
33
34
|
let result;
|
package/dist/server.js
CHANGED
|
@@ -2,18 +2,20 @@ const equalFn = (a, b) => a === b;
|
|
|
2
2
|
const $PROXY = Symbol("solid-proxy");
|
|
3
3
|
const $TRACK = Symbol("solid-track");
|
|
4
4
|
const $DEVCOMP = Symbol("solid-dev-component");
|
|
5
|
-
const DEV =
|
|
5
|
+
const DEV = undefined;
|
|
6
6
|
const ERROR = Symbol("error");
|
|
7
7
|
const BRANCH = Symbol("branch");
|
|
8
8
|
function castError(err) {
|
|
9
|
-
if (err instanceof Error
|
|
10
|
-
return new Error("Unknown error"
|
|
9
|
+
if (err instanceof Error) return err;
|
|
10
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
11
|
+
cause: err
|
|
12
|
+
});
|
|
11
13
|
}
|
|
12
14
|
function handleError(err) {
|
|
13
|
-
|
|
15
|
+
const error = castError(err);
|
|
14
16
|
const fns = lookup(Owner, ERROR);
|
|
15
|
-
if (!fns) throw
|
|
16
|
-
for (const f of fns) f(
|
|
17
|
+
if (!fns) throw error;
|
|
18
|
+
for (const f of fns) f(error);
|
|
17
19
|
}
|
|
18
20
|
const UNOWNED = {
|
|
19
21
|
context: null,
|
|
@@ -21,11 +23,10 @@ const UNOWNED = {
|
|
|
21
23
|
};
|
|
22
24
|
let Owner = null;
|
|
23
25
|
function createRoot(fn, detachedOwner) {
|
|
24
|
-
detachedOwner && (Owner = detachedOwner);
|
|
25
26
|
const owner = Owner,
|
|
26
27
|
root = fn.length === 0 ? UNOWNED : {
|
|
27
28
|
context: null,
|
|
28
|
-
owner
|
|
29
|
+
owner: detachedOwner === undefined ? owner : detachedOwner
|
|
29
30
|
};
|
|
30
31
|
Owner = root;
|
|
31
32
|
let result;
|