solid-js 1.6.11 → 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 +32 -92
- package/dist/dev.js +32 -92
- package/dist/server.cjs +8 -6
- package/dist/server.js +8 -6
- package/dist/solid.cjs +11 -13
- package/dist/solid.js +11 -13
- package/package.json +1 -1
- 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/store.d.ts +7 -6
- package/types/index.d.ts +5 -6
- package/types/jsx.d.ts +0 -4
- package/types/reactive/signal.d.ts +12 -17
- package/types/render/flow.d.ts +7 -7
- package/types/server/reactive.d.ts +3 -3
- package/types/server/rendering.d.ts +1 -1
- package/web/types/index.d.ts +2 -2
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,
|
|
@@ -174,10 +177,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
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);
|
|
@@ -536,45 +539,10 @@ function devComponent(Comp, props) {
|
|
|
536
539
|
updateComputation(c);
|
|
537
540
|
return c.tValue !== undefined ? c.tValue : c.value;
|
|
538
541
|
}
|
|
539
|
-
function
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
if (s.has(v)) return;
|
|
544
|
-
s.add(v);
|
|
545
|
-
const keys = Object.keys(v);
|
|
546
|
-
const desc = Object.getOwnPropertyDescriptors(v);
|
|
547
|
-
const newDesc = keys.reduce((memo, key) => {
|
|
548
|
-
const value = desc[key];
|
|
549
|
-
if (!value.get) memo[key] = value;
|
|
550
|
-
return memo;
|
|
551
|
-
}, {});
|
|
552
|
-
v = Object.create({}, newDesc);
|
|
553
|
-
}
|
|
554
|
-
if (typeof v === "bigint") {
|
|
555
|
-
return `${v.toString()}n`;
|
|
556
|
-
}
|
|
557
|
-
return v;
|
|
558
|
-
}) || ""))}`;
|
|
559
|
-
}
|
|
560
|
-
function registerGraph(name, value) {
|
|
561
|
-
let tryName = name;
|
|
562
|
-
if (Owner) {
|
|
563
|
-
let i = 0;
|
|
564
|
-
Owner.sourceMap || (Owner.sourceMap = {});
|
|
565
|
-
while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
|
|
566
|
-
Owner.sourceMap[tryName] = value;
|
|
567
|
-
value.graph = Owner;
|
|
568
|
-
}
|
|
569
|
-
return tryName;
|
|
570
|
-
}
|
|
571
|
-
function serializeGraph(owner) {
|
|
572
|
-
owner || (owner = Owner);
|
|
573
|
-
if (!owner) return {};
|
|
574
|
-
return {
|
|
575
|
-
...serializeValues(owner.sourceMap),
|
|
576
|
-
...(owner.owned ? serializeChildren(owner) : {})
|
|
577
|
-
};
|
|
542
|
+
function registerGraph(value) {
|
|
543
|
+
if (!Owner) return;
|
|
544
|
+
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
|
|
545
|
+
value.graph = Owner;
|
|
578
546
|
}
|
|
579
547
|
function createContext(defaultValue, options) {
|
|
580
548
|
const id = Symbol("context");
|
|
@@ -757,8 +725,8 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
757
725
|
} else {
|
|
758
726
|
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
759
727
|
}
|
|
760
|
-
c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
|
|
761
728
|
}
|
|
729
|
+
if (options && options.name) c.name = options.name;
|
|
762
730
|
if (ExternalSourceFactory) {
|
|
763
731
|
const [track, trigger] = createSignal(undefined, {
|
|
764
732
|
equals: false
|
|
@@ -772,6 +740,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
772
740
|
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
773
741
|
};
|
|
774
742
|
}
|
|
743
|
+
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
|
|
775
744
|
return c;
|
|
776
745
|
}
|
|
777
746
|
function runTop(node) {
|
|
@@ -861,7 +830,7 @@ function completeUpdates(wait) {
|
|
|
861
830
|
}
|
|
862
831
|
const e = Effects;
|
|
863
832
|
Effects = null;
|
|
864
|
-
if (e.length) runUpdates(() => runEffects(e), false);else
|
|
833
|
+
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
865
834
|
if (res) res();
|
|
866
835
|
}
|
|
867
836
|
function runQueue(queue) {
|
|
@@ -963,22 +932,24 @@ function reset(node, top) {
|
|
|
963
932
|
}
|
|
964
933
|
}
|
|
965
934
|
function castError(err) {
|
|
966
|
-
if (err instanceof Error
|
|
967
|
-
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
|
+
});
|
|
968
939
|
}
|
|
969
940
|
function runErrors(fns, err) {
|
|
970
941
|
for (const f of fns) f(err);
|
|
971
942
|
}
|
|
972
943
|
function handleError(err) {
|
|
973
|
-
err = castError(err);
|
|
974
944
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
975
945
|
if (!fns) throw err;
|
|
946
|
+
const error = castError(err);
|
|
976
947
|
if (Effects) Effects.push({
|
|
977
948
|
fn() {
|
|
978
|
-
runErrors(fns,
|
|
949
|
+
runErrors(fns, error);
|
|
979
950
|
},
|
|
980
951
|
state: STALE
|
|
981
|
-
});else runErrors(fns,
|
|
952
|
+
});else runErrors(fns, error);
|
|
982
953
|
}
|
|
983
954
|
function lookup(owner, key) {
|
|
984
955
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1007,30 +978,6 @@ function createProvider(id, options) {
|
|
|
1007
978
|
return res;
|
|
1008
979
|
};
|
|
1009
980
|
}
|
|
1010
|
-
function hash(s) {
|
|
1011
|
-
for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
|
|
1012
|
-
return `${h ^ h >>> 9}`;
|
|
1013
|
-
}
|
|
1014
|
-
function serializeValues(sources = {}) {
|
|
1015
|
-
const k = Object.keys(sources);
|
|
1016
|
-
const result = {};
|
|
1017
|
-
for (let i = 0; i < k.length; i++) {
|
|
1018
|
-
const key = k[i];
|
|
1019
|
-
result[key] = sources[key].value;
|
|
1020
|
-
}
|
|
1021
|
-
return result;
|
|
1022
|
-
}
|
|
1023
|
-
function serializeChildren(root) {
|
|
1024
|
-
const result = {};
|
|
1025
|
-
for (let i = 0, len = root.owned.length; i < len; i++) {
|
|
1026
|
-
const node = root.owned[i];
|
|
1027
|
-
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
|
|
1028
|
-
...serializeValues(node.sourceMap),
|
|
1029
|
-
...(node.owned ? serializeChildren(node) : {})
|
|
1030
|
-
};
|
|
1031
|
-
}
|
|
1032
|
-
return result;
|
|
1033
|
-
}
|
|
1034
981
|
|
|
1035
982
|
function observable(input) {
|
|
1036
983
|
return {
|
|
@@ -1450,10 +1397,9 @@ function Index(props) {
|
|
|
1450
1397
|
}) ;
|
|
1451
1398
|
}
|
|
1452
1399
|
function Show(props) {
|
|
1453
|
-
let strictEqual = false;
|
|
1454
1400
|
const keyed = props.keyed;
|
|
1455
1401
|
const condition = createMemo(() => props.when, undefined, {
|
|
1456
|
-
equals: (a, b) =>
|
|
1402
|
+
equals: (a, b) => keyed ? a === b : !a === !b,
|
|
1457
1403
|
name: "condition"
|
|
1458
1404
|
} );
|
|
1459
1405
|
return createMemo(() => {
|
|
@@ -1461,8 +1407,7 @@ function Show(props) {
|
|
|
1461
1407
|
if (c) {
|
|
1462
1408
|
const child = props.children;
|
|
1463
1409
|
const fn = typeof child === "function" && child.length > 0;
|
|
1464
|
-
|
|
1465
|
-
return fn ? untrack(() => child(c)) : child;
|
|
1410
|
+
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child;
|
|
1466
1411
|
}
|
|
1467
1412
|
return props.fallback;
|
|
1468
1413
|
}, undefined, {
|
|
@@ -1470,9 +1415,8 @@ function Show(props) {
|
|
|
1470
1415
|
} );
|
|
1471
1416
|
}
|
|
1472
1417
|
function Switch(props) {
|
|
1473
|
-
let strictEqual = false;
|
|
1474
1418
|
let keyed = false;
|
|
1475
|
-
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];
|
|
1476
1420
|
const conditions = children(() => props.children),
|
|
1477
1421
|
evalConditions = createMemo(() => {
|
|
1478
1422
|
let conds = conditions();
|
|
@@ -1494,8 +1438,7 @@ function Switch(props) {
|
|
|
1494
1438
|
if (index < 0) return props.fallback;
|
|
1495
1439
|
const c = cond.children;
|
|
1496
1440
|
const fn = typeof c === "function" && c.length > 0;
|
|
1497
|
-
|
|
1498
|
-
return fn ? untrack(() => c(when)) : c;
|
|
1441
|
+
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c;
|
|
1499
1442
|
}, undefined, {
|
|
1500
1443
|
name: "value"
|
|
1501
1444
|
} );
|
|
@@ -1700,14 +1643,11 @@ function Suspense(props) {
|
|
|
1700
1643
|
}
|
|
1701
1644
|
|
|
1702
1645
|
exports.DEV = void 0;
|
|
1703
|
-
{
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
hashValue
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1646
|
+
exports.DEV = {
|
|
1647
|
+
hooks: DevHooks,
|
|
1648
|
+
writeSignal,
|
|
1649
|
+
registerGraph
|
|
1650
|
+
};
|
|
1711
1651
|
if (globalThis) {
|
|
1712
1652
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1713
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,
|
|
@@ -172,10 +175,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
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);
|
|
@@ -534,45 +537,10 @@ function devComponent(Comp, props) {
|
|
|
534
537
|
updateComputation(c);
|
|
535
538
|
return c.tValue !== undefined ? c.tValue : c.value;
|
|
536
539
|
}
|
|
537
|
-
function
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
if (s.has(v)) return;
|
|
542
|
-
s.add(v);
|
|
543
|
-
const keys = Object.keys(v);
|
|
544
|
-
const desc = Object.getOwnPropertyDescriptors(v);
|
|
545
|
-
const newDesc = keys.reduce((memo, key) => {
|
|
546
|
-
const value = desc[key];
|
|
547
|
-
if (!value.get) memo[key] = value;
|
|
548
|
-
return memo;
|
|
549
|
-
}, {});
|
|
550
|
-
v = Object.create({}, newDesc);
|
|
551
|
-
}
|
|
552
|
-
if (typeof v === "bigint") {
|
|
553
|
-
return `${v.toString()}n`;
|
|
554
|
-
}
|
|
555
|
-
return v;
|
|
556
|
-
}) || ""))}`;
|
|
557
|
-
}
|
|
558
|
-
function registerGraph(name, value) {
|
|
559
|
-
let tryName = name;
|
|
560
|
-
if (Owner) {
|
|
561
|
-
let i = 0;
|
|
562
|
-
Owner.sourceMap || (Owner.sourceMap = {});
|
|
563
|
-
while (Owner.sourceMap[tryName]) tryName = `${name}-${++i}`;
|
|
564
|
-
Owner.sourceMap[tryName] = value;
|
|
565
|
-
value.graph = Owner;
|
|
566
|
-
}
|
|
567
|
-
return tryName;
|
|
568
|
-
}
|
|
569
|
-
function serializeGraph(owner) {
|
|
570
|
-
owner || (owner = Owner);
|
|
571
|
-
if (!owner) return {};
|
|
572
|
-
return {
|
|
573
|
-
...serializeValues(owner.sourceMap),
|
|
574
|
-
...(owner.owned ? serializeChildren(owner) : {})
|
|
575
|
-
};
|
|
540
|
+
function registerGraph(value) {
|
|
541
|
+
if (!Owner) return;
|
|
542
|
+
if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
|
|
543
|
+
value.graph = Owner;
|
|
576
544
|
}
|
|
577
545
|
function createContext(defaultValue, options) {
|
|
578
546
|
const id = Symbol("context");
|
|
@@ -755,8 +723,8 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
755
723
|
} else {
|
|
756
724
|
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
757
725
|
}
|
|
758
|
-
c.name = options && options.name || `${Owner.name || "c"}-${(Owner.owned || Owner.tOwned).length}`;
|
|
759
726
|
}
|
|
727
|
+
if (options && options.name) c.name = options.name;
|
|
760
728
|
if (ExternalSourceFactory) {
|
|
761
729
|
const [track, trigger] = createSignal(undefined, {
|
|
762
730
|
equals: false
|
|
@@ -770,6 +738,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
770
738
|
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
771
739
|
};
|
|
772
740
|
}
|
|
741
|
+
DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
|
|
773
742
|
return c;
|
|
774
743
|
}
|
|
775
744
|
function runTop(node) {
|
|
@@ -859,7 +828,7 @@ function completeUpdates(wait) {
|
|
|
859
828
|
}
|
|
860
829
|
const e = Effects;
|
|
861
830
|
Effects = null;
|
|
862
|
-
if (e.length) runUpdates(() => runEffects(e), false);else
|
|
831
|
+
if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
|
|
863
832
|
if (res) res();
|
|
864
833
|
}
|
|
865
834
|
function runQueue(queue) {
|
|
@@ -961,22 +930,24 @@ function reset(node, top) {
|
|
|
961
930
|
}
|
|
962
931
|
}
|
|
963
932
|
function castError(err) {
|
|
964
|
-
if (err instanceof Error
|
|
965
|
-
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
|
+
});
|
|
966
937
|
}
|
|
967
938
|
function runErrors(fns, err) {
|
|
968
939
|
for (const f of fns) f(err);
|
|
969
940
|
}
|
|
970
941
|
function handleError(err) {
|
|
971
|
-
err = castError(err);
|
|
972
942
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
973
943
|
if (!fns) throw err;
|
|
944
|
+
const error = castError(err);
|
|
974
945
|
if (Effects) Effects.push({
|
|
975
946
|
fn() {
|
|
976
|
-
runErrors(fns,
|
|
947
|
+
runErrors(fns, error);
|
|
977
948
|
},
|
|
978
949
|
state: STALE
|
|
979
|
-
});else runErrors(fns,
|
|
950
|
+
});else runErrors(fns, error);
|
|
980
951
|
}
|
|
981
952
|
function lookup(owner, key) {
|
|
982
953
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1005,30 +976,6 @@ function createProvider(id, options) {
|
|
|
1005
976
|
return res;
|
|
1006
977
|
};
|
|
1007
978
|
}
|
|
1008
|
-
function hash(s) {
|
|
1009
|
-
for (var i = 0, h = 9; i < s.length;) h = Math.imul(h ^ s.charCodeAt(i++), 9 ** 9);
|
|
1010
|
-
return `${h ^ h >>> 9}`;
|
|
1011
|
-
}
|
|
1012
|
-
function serializeValues(sources = {}) {
|
|
1013
|
-
const k = Object.keys(sources);
|
|
1014
|
-
const result = {};
|
|
1015
|
-
for (let i = 0; i < k.length; i++) {
|
|
1016
|
-
const key = k[i];
|
|
1017
|
-
result[key] = sources[key].value;
|
|
1018
|
-
}
|
|
1019
|
-
return result;
|
|
1020
|
-
}
|
|
1021
|
-
function serializeChildren(root) {
|
|
1022
|
-
const result = {};
|
|
1023
|
-
for (let i = 0, len = root.owned.length; i < len; i++) {
|
|
1024
|
-
const node = root.owned[i];
|
|
1025
|
-
result[node.componentName ? `${node.componentName}:${node.name}` : node.name] = {
|
|
1026
|
-
...serializeValues(node.sourceMap),
|
|
1027
|
-
...(node.owned ? serializeChildren(node) : {})
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
return result;
|
|
1031
|
-
}
|
|
1032
979
|
|
|
1033
980
|
function observable(input) {
|
|
1034
981
|
return {
|
|
@@ -1448,10 +1395,9 @@ function Index(props) {
|
|
|
1448
1395
|
}) ;
|
|
1449
1396
|
}
|
|
1450
1397
|
function Show(props) {
|
|
1451
|
-
let strictEqual = false;
|
|
1452
1398
|
const keyed = props.keyed;
|
|
1453
1399
|
const condition = createMemo(() => props.when, undefined, {
|
|
1454
|
-
equals: (a, b) =>
|
|
1400
|
+
equals: (a, b) => keyed ? a === b : !a === !b,
|
|
1455
1401
|
name: "condition"
|
|
1456
1402
|
} );
|
|
1457
1403
|
return createMemo(() => {
|
|
@@ -1459,8 +1405,7 @@ function Show(props) {
|
|
|
1459
1405
|
if (c) {
|
|
1460
1406
|
const child = props.children;
|
|
1461
1407
|
const fn = typeof child === "function" && child.length > 0;
|
|
1462
|
-
|
|
1463
|
-
return fn ? untrack(() => child(c)) : child;
|
|
1408
|
+
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child;
|
|
1464
1409
|
}
|
|
1465
1410
|
return props.fallback;
|
|
1466
1411
|
}, undefined, {
|
|
@@ -1468,9 +1413,8 @@ function Show(props) {
|
|
|
1468
1413
|
} );
|
|
1469
1414
|
}
|
|
1470
1415
|
function Switch(props) {
|
|
1471
|
-
let strictEqual = false;
|
|
1472
1416
|
let keyed = false;
|
|
1473
|
-
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];
|
|
1474
1418
|
const conditions = children(() => props.children),
|
|
1475
1419
|
evalConditions = createMemo(() => {
|
|
1476
1420
|
let conds = conditions();
|
|
@@ -1492,8 +1436,7 @@ function Switch(props) {
|
|
|
1492
1436
|
if (index < 0) return props.fallback;
|
|
1493
1437
|
const c = cond.children;
|
|
1494
1438
|
const fn = typeof c === "function" && c.length > 0;
|
|
1495
|
-
|
|
1496
|
-
return fn ? untrack(() => c(when)) : c;
|
|
1439
|
+
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c;
|
|
1497
1440
|
}, undefined, {
|
|
1498
1441
|
name: "value"
|
|
1499
1442
|
} );
|
|
@@ -1698,14 +1641,11 @@ function Suspense(props) {
|
|
|
1698
1641
|
}
|
|
1699
1642
|
|
|
1700
1643
|
let DEV;
|
|
1701
|
-
{
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
hashValue
|
|
1707
|
-
};
|
|
1708
|
-
}
|
|
1644
|
+
DEV = {
|
|
1645
|
+
hooks: DevHooks,
|
|
1646
|
+
writeSignal,
|
|
1647
|
+
registerGraph
|
|
1648
|
+
};
|
|
1709
1649
|
if (globalThis) {
|
|
1710
1650
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1711
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,
|
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,
|
package/dist/solid.cjs
CHANGED
|
@@ -892,22 +892,24 @@ function reset(node, top) {
|
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
function castError(err) {
|
|
895
|
-
if (err instanceof Error
|
|
896
|
-
return new Error("Unknown error"
|
|
895
|
+
if (err instanceof Error) return err;
|
|
896
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
897
|
+
cause: err
|
|
898
|
+
});
|
|
897
899
|
}
|
|
898
900
|
function runErrors(fns, err) {
|
|
899
901
|
for (const f of fns) f(err);
|
|
900
902
|
}
|
|
901
903
|
function handleError(err) {
|
|
902
|
-
err = castError(err);
|
|
903
904
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
904
905
|
if (!fns) throw err;
|
|
906
|
+
const error = castError(err);
|
|
905
907
|
if (Effects) Effects.push({
|
|
906
908
|
fn() {
|
|
907
|
-
runErrors(fns,
|
|
909
|
+
runErrors(fns, error);
|
|
908
910
|
},
|
|
909
911
|
state: STALE
|
|
910
|
-
});else runErrors(fns,
|
|
912
|
+
});else runErrors(fns, error);
|
|
911
913
|
}
|
|
912
914
|
function lookup(owner, key) {
|
|
913
915
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1345,26 +1347,23 @@ function Index(props) {
|
|
|
1345
1347
|
return createMemo(indexArray(() => props.each, props.children, fallback || undefined));
|
|
1346
1348
|
}
|
|
1347
1349
|
function Show(props) {
|
|
1348
|
-
let strictEqual = false;
|
|
1349
1350
|
const keyed = props.keyed;
|
|
1350
1351
|
const condition = createMemo(() => props.when, undefined, {
|
|
1351
|
-
equals: (a, b) =>
|
|
1352
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1352
1353
|
});
|
|
1353
1354
|
return createMemo(() => {
|
|
1354
1355
|
const c = condition();
|
|
1355
1356
|
if (c) {
|
|
1356
1357
|
const child = props.children;
|
|
1357
1358
|
const fn = typeof child === "function" && child.length > 0;
|
|
1358
|
-
|
|
1359
|
-
return fn ? untrack(() => child(c)) : child;
|
|
1359
|
+
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child;
|
|
1360
1360
|
}
|
|
1361
1361
|
return props.fallback;
|
|
1362
1362
|
}, undefined, undefined);
|
|
1363
1363
|
}
|
|
1364
1364
|
function Switch(props) {
|
|
1365
|
-
let strictEqual = false;
|
|
1366
1365
|
let keyed = false;
|
|
1367
|
-
const equals = (a, b) => a[0] === b[0] && (
|
|
1366
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1368
1367
|
const conditions = children(() => props.children),
|
|
1369
1368
|
evalConditions = createMemo(() => {
|
|
1370
1369
|
let conds = conditions();
|
|
@@ -1385,8 +1384,7 @@ function Switch(props) {
|
|
|
1385
1384
|
if (index < 0) return props.fallback;
|
|
1386
1385
|
const c = cond.children;
|
|
1387
1386
|
const fn = typeof c === "function" && c.length > 0;
|
|
1388
|
-
|
|
1389
|
-
return fn ? untrack(() => c(when)) : c;
|
|
1387
|
+
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c;
|
|
1390
1388
|
}, undefined, undefined);
|
|
1391
1389
|
}
|
|
1392
1390
|
function Match(props) {
|
package/dist/solid.js
CHANGED
|
@@ -890,22 +890,24 @@ function reset(node, top) {
|
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
function castError(err) {
|
|
893
|
-
if (err instanceof Error
|
|
894
|
-
return new Error("Unknown error"
|
|
893
|
+
if (err instanceof Error) return err;
|
|
894
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
895
|
+
cause: err
|
|
896
|
+
});
|
|
895
897
|
}
|
|
896
898
|
function runErrors(fns, err) {
|
|
897
899
|
for (const f of fns) f(err);
|
|
898
900
|
}
|
|
899
901
|
function handleError(err) {
|
|
900
|
-
err = castError(err);
|
|
901
902
|
const fns = ERROR && lookup(Owner, ERROR);
|
|
902
903
|
if (!fns) throw err;
|
|
904
|
+
const error = castError(err);
|
|
903
905
|
if (Effects) Effects.push({
|
|
904
906
|
fn() {
|
|
905
|
-
runErrors(fns,
|
|
907
|
+
runErrors(fns, error);
|
|
906
908
|
},
|
|
907
909
|
state: STALE
|
|
908
|
-
});else runErrors(fns,
|
|
910
|
+
});else runErrors(fns, error);
|
|
909
911
|
}
|
|
910
912
|
function lookup(owner, key) {
|
|
911
913
|
return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
|
|
@@ -1343,26 +1345,23 @@ function Index(props) {
|
|
|
1343
1345
|
return createMemo(indexArray(() => props.each, props.children, fallback || undefined));
|
|
1344
1346
|
}
|
|
1345
1347
|
function Show(props) {
|
|
1346
|
-
let strictEqual = false;
|
|
1347
1348
|
const keyed = props.keyed;
|
|
1348
1349
|
const condition = createMemo(() => props.when, undefined, {
|
|
1349
|
-
equals: (a, b) =>
|
|
1350
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1350
1351
|
});
|
|
1351
1352
|
return createMemo(() => {
|
|
1352
1353
|
const c = condition();
|
|
1353
1354
|
if (c) {
|
|
1354
1355
|
const child = props.children;
|
|
1355
1356
|
const fn = typeof child === "function" && child.length > 0;
|
|
1356
|
-
|
|
1357
|
-
return fn ? untrack(() => child(c)) : child;
|
|
1357
|
+
return fn ? untrack(() => child(keyed ? c : () => props.when)) : child;
|
|
1358
1358
|
}
|
|
1359
1359
|
return props.fallback;
|
|
1360
1360
|
}, undefined, undefined);
|
|
1361
1361
|
}
|
|
1362
1362
|
function Switch(props) {
|
|
1363
|
-
let strictEqual = false;
|
|
1364
1363
|
let keyed = false;
|
|
1365
|
-
const equals = (a, b) => a[0] === b[0] && (
|
|
1364
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1366
1365
|
const conditions = children(() => props.children),
|
|
1367
1366
|
evalConditions = createMemo(() => {
|
|
1368
1367
|
let conds = conditions();
|
|
@@ -1383,8 +1382,7 @@ function Switch(props) {
|
|
|
1383
1382
|
if (index < 0) return props.fallback;
|
|
1384
1383
|
const c = cond.children;
|
|
1385
1384
|
const fn = typeof c === "function" && c.length > 0;
|
|
1386
|
-
|
|
1387
|
-
return fn ? untrack(() => c(when)) : c;
|
|
1385
|
+
return fn ? untrack(() => c(keyed ? when : () => cond.when)) : c;
|
|
1388
1386
|
}, undefined, undefined);
|
|
1389
1387
|
}
|
|
1390
1388
|
function Match(props) {
|
package/package.json
CHANGED
package/store/dist/dev.cjs
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
|
|
5
5
|
const $RAW = Symbol("store-raw"),
|
|
6
|
-
$NODE = Symbol("store-node")
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
$NODE = Symbol("store-node");
|
|
7
|
+
const DevHooks = {
|
|
8
|
+
onStoreNodeUpdate: null
|
|
9
|
+
};
|
|
10
|
+
function wrap$1(value) {
|
|
9
11
|
let p = value[solidJs.$PROXY];
|
|
10
12
|
if (!p) {
|
|
11
13
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -24,9 +26,6 @@ function wrap$1(value, name) {
|
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
28
|
-
value: name
|
|
29
|
-
});
|
|
30
29
|
}
|
|
31
30
|
return p;
|
|
32
31
|
}
|
|
@@ -69,7 +68,7 @@ function getDataNode(nodes, property, value) {
|
|
|
69
68
|
}
|
|
70
69
|
function proxyDescriptor$1(target, property) {
|
|
71
70
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
72
|
-
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
71
|
+
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
73
72
|
delete desc.value;
|
|
74
73
|
delete desc.writable;
|
|
75
74
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -109,7 +108,7 @@ const proxyTraps$1 = {
|
|
|
109
108
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
110
109
|
if (solidJs.getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();
|
|
111
110
|
}
|
|
112
|
-
return isWrappable(value) ? wrap$1(value
|
|
111
|
+
return isWrappable(value) ? wrap$1(value) : value;
|
|
113
112
|
},
|
|
114
113
|
has(target, property) {
|
|
115
114
|
if (property === $RAW || property === solidJs.$PROXY || property === solidJs.$TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -131,7 +130,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
131
130
|
if (!deleting && state[property] === value) return;
|
|
132
131
|
const prev = state[property],
|
|
133
132
|
len = state.length;
|
|
134
|
-
|
|
133
|
+
DevHooks.onStoreNodeUpdate && DevHooks.onStoreNodeUpdate(state, property, value, prev);
|
|
135
134
|
if (value === undefined) delete state[property];else state[property] = value;
|
|
136
135
|
let nodes = getDataNodes(state),
|
|
137
136
|
node;
|
|
@@ -209,13 +208,11 @@ function createStore(...[store, options]) {
|
|
|
209
208
|
const unwrappedStore = unwrap(store || {});
|
|
210
209
|
const isArray = Array.isArray(unwrappedStore);
|
|
211
210
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
|
|
212
|
-
const wrappedStore = wrap$1(unwrappedStore
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
218
|
-
}
|
|
211
|
+
const wrappedStore = wrap$1(unwrappedStore);
|
|
212
|
+
solidJs.DEV.registerGraph({
|
|
213
|
+
value: unwrappedStore,
|
|
214
|
+
name: options && options.name
|
|
215
|
+
});
|
|
219
216
|
function setStore(...args) {
|
|
220
217
|
solidJs.batch(() => {
|
|
221
218
|
isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
|
|
@@ -226,7 +223,7 @@ function createStore(...[store, options]) {
|
|
|
226
223
|
|
|
227
224
|
function proxyDescriptor(target, property) {
|
|
228
225
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
229
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
226
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
230
227
|
delete desc.value;
|
|
231
228
|
delete desc.writable;
|
|
232
229
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -252,7 +249,7 @@ const proxyTraps = {
|
|
|
252
249
|
return (...args) => solidJs.batch(() => Array.prototype[property].apply(receiver, args));
|
|
253
250
|
}
|
|
254
251
|
}
|
|
255
|
-
return isWrappable(value) ? wrap(value
|
|
252
|
+
return isWrappable(value) ? wrap(value) : value;
|
|
256
253
|
},
|
|
257
254
|
has(target, property) {
|
|
258
255
|
if (property === $RAW || property === solidJs.$PROXY || property === solidJs.$TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -270,7 +267,7 @@ const proxyTraps = {
|
|
|
270
267
|
ownKeys: ownKeys,
|
|
271
268
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
272
269
|
};
|
|
273
|
-
function wrap(value
|
|
270
|
+
function wrap(value) {
|
|
274
271
|
let p = value[solidJs.$PROXY];
|
|
275
272
|
if (!p) {
|
|
276
273
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -294,22 +291,17 @@ function wrap(value, name) {
|
|
|
294
291
|
});
|
|
295
292
|
}
|
|
296
293
|
}
|
|
297
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
298
|
-
value: name
|
|
299
|
-
});
|
|
300
294
|
}
|
|
301
295
|
return p;
|
|
302
296
|
}
|
|
303
297
|
function createMutable(state, options) {
|
|
304
298
|
const unwrappedStore = unwrap(state || {});
|
|
305
299
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`);
|
|
306
|
-
const wrappedStore = wrap(unwrappedStore
|
|
307
|
-
{
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
});
|
|
312
|
-
}
|
|
300
|
+
const wrappedStore = wrap(unwrappedStore);
|
|
301
|
+
solidJs.DEV.registerGraph({
|
|
302
|
+
value: unwrappedStore,
|
|
303
|
+
name: options && options.name
|
|
304
|
+
});
|
|
313
305
|
return wrappedStore;
|
|
314
306
|
}
|
|
315
307
|
function modifyMutable(state, modifier) {
|
|
@@ -432,14 +424,14 @@ function produce(fn) {
|
|
|
432
424
|
};
|
|
433
425
|
}
|
|
434
426
|
|
|
435
|
-
|
|
436
|
-
|
|
427
|
+
exports.DEV = void 0;
|
|
428
|
+
exports.DEV = {
|
|
437
429
|
$NODE,
|
|
438
|
-
isWrappable
|
|
439
|
-
|
|
430
|
+
isWrappable,
|
|
431
|
+
hooks: DevHooks
|
|
432
|
+
};
|
|
440
433
|
|
|
441
434
|
exports.$RAW = $RAW;
|
|
442
|
-
exports.DEV = DEV;
|
|
443
435
|
exports.createMutable = createMutable;
|
|
444
436
|
exports.createStore = createStore;
|
|
445
437
|
exports.modifyMutable = modifyMutable;
|
package/store/dist/dev.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { $PROXY, DEV as DEV$1, $TRACK, getListener, batch, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
|
-
$NODE = Symbol("store-node")
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
$NODE = Symbol("store-node");
|
|
5
|
+
const DevHooks = {
|
|
6
|
+
onStoreNodeUpdate: null
|
|
7
|
+
};
|
|
8
|
+
function wrap$1(value) {
|
|
7
9
|
let p = value[$PROXY];
|
|
8
10
|
if (!p) {
|
|
9
11
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -22,9 +24,6 @@ function wrap$1(value, name) {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
26
|
-
value: name
|
|
27
|
-
});
|
|
28
27
|
}
|
|
29
28
|
return p;
|
|
30
29
|
}
|
|
@@ -67,7 +66,7 @@ function getDataNode(nodes, property, value) {
|
|
|
67
66
|
}
|
|
68
67
|
function proxyDescriptor$1(target, property) {
|
|
69
68
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
70
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE
|
|
69
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
71
70
|
delete desc.value;
|
|
72
71
|
delete desc.writable;
|
|
73
72
|
desc.get = () => target[$PROXY][property];
|
|
@@ -107,7 +106,7 @@ const proxyTraps$1 = {
|
|
|
107
106
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
108
107
|
if (getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();
|
|
109
108
|
}
|
|
110
|
-
return isWrappable(value) ? wrap$1(value
|
|
109
|
+
return isWrappable(value) ? wrap$1(value) : value;
|
|
111
110
|
},
|
|
112
111
|
has(target, property) {
|
|
113
112
|
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -129,7 +128,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
129
128
|
if (!deleting && state[property] === value) return;
|
|
130
129
|
const prev = state[property],
|
|
131
130
|
len = state.length;
|
|
132
|
-
|
|
131
|
+
DevHooks.onStoreNodeUpdate && DevHooks.onStoreNodeUpdate(state, property, value, prev);
|
|
133
132
|
if (value === undefined) delete state[property];else state[property] = value;
|
|
134
133
|
let nodes = getDataNodes(state),
|
|
135
134
|
node;
|
|
@@ -207,13 +206,11 @@ function createStore(...[store, options]) {
|
|
|
207
206
|
const unwrappedStore = unwrap(store || {});
|
|
208
207
|
const isArray = Array.isArray(unwrappedStore);
|
|
209
208
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
|
|
210
|
-
const wrappedStore = wrap$1(unwrappedStore
|
|
211
|
-
{
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
216
|
-
}
|
|
209
|
+
const wrappedStore = wrap$1(unwrappedStore);
|
|
210
|
+
DEV$1.registerGraph({
|
|
211
|
+
value: unwrappedStore,
|
|
212
|
+
name: options && options.name
|
|
213
|
+
});
|
|
217
214
|
function setStore(...args) {
|
|
218
215
|
batch(() => {
|
|
219
216
|
isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
|
|
@@ -224,7 +221,7 @@ function createStore(...[store, options]) {
|
|
|
224
221
|
|
|
225
222
|
function proxyDescriptor(target, property) {
|
|
226
223
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
227
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE
|
|
224
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
228
225
|
delete desc.value;
|
|
229
226
|
delete desc.writable;
|
|
230
227
|
desc.get = () => target[$PROXY][property];
|
|
@@ -250,7 +247,7 @@ const proxyTraps = {
|
|
|
250
247
|
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
251
248
|
}
|
|
252
249
|
}
|
|
253
|
-
return isWrappable(value) ? wrap(value
|
|
250
|
+
return isWrappable(value) ? wrap(value) : value;
|
|
254
251
|
},
|
|
255
252
|
has(target, property) {
|
|
256
253
|
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -268,7 +265,7 @@ const proxyTraps = {
|
|
|
268
265
|
ownKeys: ownKeys,
|
|
269
266
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
270
267
|
};
|
|
271
|
-
function wrap(value
|
|
268
|
+
function wrap(value) {
|
|
272
269
|
let p = value[$PROXY];
|
|
273
270
|
if (!p) {
|
|
274
271
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -292,22 +289,17 @@ function wrap(value, name) {
|
|
|
292
289
|
});
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
296
|
-
value: name
|
|
297
|
-
});
|
|
298
292
|
}
|
|
299
293
|
return p;
|
|
300
294
|
}
|
|
301
295
|
function createMutable(state, options) {
|
|
302
296
|
const unwrappedStore = unwrap(state || {});
|
|
303
297
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`);
|
|
304
|
-
const wrappedStore = wrap(unwrappedStore
|
|
305
|
-
{
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
310
|
-
}
|
|
298
|
+
const wrappedStore = wrap(unwrappedStore);
|
|
299
|
+
DEV$1.registerGraph({
|
|
300
|
+
value: unwrappedStore,
|
|
301
|
+
name: options && options.name
|
|
302
|
+
});
|
|
311
303
|
return wrappedStore;
|
|
312
304
|
}
|
|
313
305
|
function modifyMutable(state, modifier) {
|
|
@@ -430,10 +422,11 @@ function produce(fn) {
|
|
|
430
422
|
};
|
|
431
423
|
}
|
|
432
424
|
|
|
433
|
-
|
|
434
|
-
|
|
425
|
+
let DEV;
|
|
426
|
+
DEV = {
|
|
435
427
|
$NODE,
|
|
436
|
-
isWrappable
|
|
437
|
-
|
|
428
|
+
isWrappable,
|
|
429
|
+
hooks: DevHooks
|
|
430
|
+
};
|
|
438
431
|
|
|
439
432
|
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/dist/store.cjs
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
|
|
5
5
|
const $RAW = Symbol("store-raw"),
|
|
6
|
-
$NODE = Symbol("store-node")
|
|
7
|
-
|
|
8
|
-
function wrap$1(value, name) {
|
|
6
|
+
$NODE = Symbol("store-node");
|
|
7
|
+
function wrap$1(value) {
|
|
9
8
|
let p = value[solidJs.$PROXY];
|
|
10
9
|
if (!p) {
|
|
11
10
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -66,7 +65,7 @@ function getDataNode(nodes, property, value) {
|
|
|
66
65
|
}
|
|
67
66
|
function proxyDescriptor$1(target, property) {
|
|
68
67
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
69
|
-
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
68
|
+
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
70
69
|
delete desc.value;
|
|
71
70
|
delete desc.writable;
|
|
72
71
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -213,7 +212,7 @@ function createStore(...[store, options]) {
|
|
|
213
212
|
|
|
214
213
|
function proxyDescriptor(target, property) {
|
|
215
214
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
216
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
215
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
217
216
|
delete desc.value;
|
|
218
217
|
delete desc.writable;
|
|
219
218
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -257,7 +256,7 @@ const proxyTraps = {
|
|
|
257
256
|
ownKeys: ownKeys,
|
|
258
257
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
259
258
|
};
|
|
260
|
-
function wrap(value
|
|
259
|
+
function wrap(value) {
|
|
261
260
|
let p = value[solidJs.$PROXY];
|
|
262
261
|
if (!p) {
|
|
263
262
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -409,7 +408,7 @@ function produce(fn) {
|
|
|
409
408
|
};
|
|
410
409
|
}
|
|
411
410
|
|
|
412
|
-
|
|
411
|
+
let DEV;
|
|
413
412
|
|
|
414
413
|
exports.$RAW = $RAW;
|
|
415
414
|
exports.DEV = DEV;
|
package/store/dist/store.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
|
-
$NODE = Symbol("store-node")
|
|
5
|
-
|
|
6
|
-
function wrap$1(value, name) {
|
|
4
|
+
$NODE = Symbol("store-node");
|
|
5
|
+
function wrap$1(value) {
|
|
7
6
|
let p = value[$PROXY];
|
|
8
7
|
if (!p) {
|
|
9
8
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -64,7 +63,7 @@ function getDataNode(nodes, property, value) {
|
|
|
64
63
|
}
|
|
65
64
|
function proxyDescriptor$1(target, property) {
|
|
66
65
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
67
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE
|
|
66
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
68
67
|
delete desc.value;
|
|
69
68
|
delete desc.writable;
|
|
70
69
|
desc.get = () => target[$PROXY][property];
|
|
@@ -211,7 +210,7 @@ function createStore(...[store, options]) {
|
|
|
211
210
|
|
|
212
211
|
function proxyDescriptor(target, property) {
|
|
213
212
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
214
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE
|
|
213
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
215
214
|
delete desc.value;
|
|
216
215
|
delete desc.writable;
|
|
217
216
|
desc.get = () => target[$PROXY][property];
|
|
@@ -255,7 +254,7 @@ const proxyTraps = {
|
|
|
255
254
|
ownKeys: ownKeys,
|
|
256
255
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
257
256
|
};
|
|
258
|
-
function wrap(value
|
|
257
|
+
function wrap(value) {
|
|
259
258
|
let p = value[$PROXY];
|
|
260
259
|
if (!p) {
|
|
261
260
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -407,6 +406,6 @@ function produce(fn) {
|
|
|
407
406
|
};
|
|
408
407
|
}
|
|
409
408
|
|
|
410
|
-
|
|
409
|
+
let DEV;
|
|
411
410
|
|
|
412
411
|
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { createStore, unwrap
|
|
2
|
-
export type {
|
|
1
|
+
export { $RAW, createStore, unwrap } from "./store.js";
|
|
2
|
+
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
3
3
|
export * from "./mutable.js";
|
|
4
4
|
export * from "./modifiers.js";
|
|
5
|
-
import { $
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { $NODE, isWrappable, DevHooks } from "./store.js";
|
|
6
|
+
declare let DEV: {
|
|
7
|
+
$NODE: typeof $NODE;
|
|
8
|
+
isWrappable: typeof isWrappable;
|
|
9
|
+
hooks: typeof DevHooks;
|
|
10
10
|
} | undefined;
|
|
11
|
+
export { DEV };
|
package/store/types/store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const $RAW: unique symbol, $NODE: unique symbol
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export declare const $RAW: unique symbol, $NODE: unique symbol;
|
|
2
|
+
export declare const DevHooks: {
|
|
3
|
+
onStoreNodeUpdate: OnStoreNodeUpdate | null;
|
|
4
|
+
};
|
|
5
5
|
type DataNode = {
|
|
6
6
|
(): any;
|
|
7
7
|
$(value?: any): void;
|
|
@@ -9,7 +9,6 @@ type DataNode = {
|
|
|
9
9
|
type DataNodes = Record<PropertyKey, DataNode>;
|
|
10
10
|
export type OnStoreNodeUpdate = (state: StoreNode, property: PropertyKey, value: StoreNode | NotWrappable, prev: StoreNode | NotWrappable) => void;
|
|
11
11
|
export interface StoreNode {
|
|
12
|
-
[$NAME]?: string;
|
|
13
12
|
[$NODE]?: DataNodes;
|
|
14
13
|
[key: PropertyKey]: any;
|
|
15
14
|
}
|
|
@@ -68,7 +67,9 @@ export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
|
|
|
68
67
|
export type StoreSetter<T, U extends PropertyKey[] = []> = T | CustomPartial<T> | ((prevState: T, traversed: U) => T | CustomPartial<T>);
|
|
69
68
|
export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
|
|
70
69
|
type W<T> = Exclude<T, NotWrappable>;
|
|
71
|
-
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [
|
|
70
|
+
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [
|
|
71
|
+
T
|
|
72
|
+
] extends [readonly unknown[]] ? number : keyof T : keyof T;
|
|
72
73
|
type MutableKeyOf<T> = KeyOf<T> & keyof PickMutable<T>;
|
|
73
74
|
type Rest<T, U extends PropertyKey[], K extends KeyOf<T> = KeyOf<T>> = [T] extends [never] ? never : K extends MutableKeyOf<T> ? [Part<T, K>, ...RestSetterOrContinue<T[K], [K, ...U]>] : K extends KeyOf<T> ? [Part<T, K>, ...RestContinue<T[K], [K, ...U]>] : never;
|
|
74
75
|
type RestContinue<T, U extends PropertyKey[]> = 0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : Rest<W<T>, U>;
|
package/types/index.d.ts
CHANGED
|
@@ -7,13 +7,12 @@ export * from "./render/index.js";
|
|
|
7
7
|
import type { JSX } from "./jsx.js";
|
|
8
8
|
type JSXElement = JSX.Element;
|
|
9
9
|
export type { JSXElement, JSX };
|
|
10
|
-
import {
|
|
10
|
+
import { registerGraph, writeSignal, DevHooks } from "./reactive/signal.js";
|
|
11
11
|
declare let DEV: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
registerGraph: typeof registerGraph;
|
|
15
|
-
|
|
16
|
-
};
|
|
12
|
+
readonly hooks: typeof DevHooks;
|
|
13
|
+
readonly writeSignal: typeof writeSignal;
|
|
14
|
+
readonly registerGraph: typeof registerGraph;
|
|
15
|
+
} | undefined;
|
|
17
16
|
export { DEV };
|
|
18
17
|
declare global {
|
|
19
18
|
var Solid$$: boolean;
|
package/types/jsx.d.ts
CHANGED
|
@@ -12,16 +12,12 @@ export namespace JSX {
|
|
|
12
12
|
type Element =
|
|
13
13
|
| Node
|
|
14
14
|
| ArrayElement
|
|
15
|
-
| FunctionElement
|
|
16
15
|
| (string & {})
|
|
17
16
|
| number
|
|
18
17
|
| boolean
|
|
19
18
|
| null
|
|
20
19
|
| undefined;
|
|
21
20
|
interface ArrayElement extends Array<Element> {}
|
|
22
|
-
interface FunctionElement {
|
|
23
|
-
(): Element;
|
|
24
|
-
}
|
|
25
21
|
interface ElementClass {
|
|
26
22
|
// empty, libs can define requirements downstream
|
|
27
23
|
}
|
|
@@ -8,13 +8,15 @@ export declare const $DEVCOMP: unique symbol;
|
|
|
8
8
|
export declare var Owner: Owner | null;
|
|
9
9
|
export declare let Transition: TransitionState | null;
|
|
10
10
|
declare let ExternalSourceFactory: ExternalSourceFactory | null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
/** Object storing callbacks for debugging during development */
|
|
12
|
+
export declare const DevHooks: {
|
|
13
|
+
afterUpdate: (() => void) | null;
|
|
14
|
+
afterCreateOwner: ((owner: Owner) => void) | null;
|
|
15
|
+
};
|
|
15
16
|
export type ComputationState = 0 | 1 | 2;
|
|
16
17
|
export interface SourceMapValue {
|
|
17
18
|
value: unknown;
|
|
19
|
+
name?: string;
|
|
18
20
|
graph?: Owner;
|
|
19
21
|
}
|
|
20
22
|
export interface SignalState<T> extends SourceMapValue {
|
|
@@ -23,16 +25,14 @@ export interface SignalState<T> extends SourceMapValue {
|
|
|
23
25
|
observerSlots: number[] | null;
|
|
24
26
|
tValue?: T;
|
|
25
27
|
comparator?: (prev: T, next: T) => boolean;
|
|
26
|
-
name?: string;
|
|
27
28
|
}
|
|
28
29
|
export interface Owner {
|
|
29
30
|
owned: Computation<any>[] | null;
|
|
30
31
|
cleanups: (() => void)[] | null;
|
|
31
32
|
owner: Owner | null;
|
|
32
33
|
context: any | null;
|
|
33
|
-
sourceMap?:
|
|
34
|
+
sourceMap?: SourceMapValue[];
|
|
34
35
|
name?: string;
|
|
35
|
-
componentName?: string;
|
|
36
36
|
}
|
|
37
37
|
export interface Computation<Init, Next extends Init = Init> extends Owner {
|
|
38
38
|
fn: EffectFunction<Init, Next>;
|
|
@@ -425,7 +425,7 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
425
425
|
*
|
|
426
426
|
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
427
427
|
*/
|
|
428
|
-
export declare function onError(fn: (err:
|
|
428
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
429
429
|
export declare function getListener(): Computation<any, any> | null;
|
|
430
430
|
export declare function getOwner(): Owner | null;
|
|
431
431
|
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
@@ -450,17 +450,12 @@ export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
|
450
450
|
*/
|
|
451
451
|
export declare function useTransition(): Transition;
|
|
452
452
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
453
|
-
export interface DevComponent<T> extends Memo<
|
|
453
|
+
export interface DevComponent<T> extends Memo<unknown> {
|
|
454
454
|
props: T;
|
|
455
455
|
componentName: string;
|
|
456
456
|
}
|
|
457
|
-
export declare function devComponent<
|
|
458
|
-
export declare function
|
|
459
|
-
export declare function registerGraph(name: string, value: SourceMapValue): string;
|
|
460
|
-
interface GraphRecord {
|
|
461
|
-
[k: string]: GraphRecord | unknown;
|
|
462
|
-
}
|
|
463
|
-
export declare function serializeGraph(owner?: Owner | null): GraphRecord;
|
|
457
|
+
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
458
|
+
export declare function registerGraph(value: SourceMapValue): void;
|
|
464
459
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
465
460
|
value: T;
|
|
466
461
|
}>;
|
|
@@ -499,7 +494,7 @@ export declare function createContext<T>(defaultValue: T, options?: EffectOption
|
|
|
499
494
|
* @description https://www.solidjs.com/docs/latest/api#usecontext
|
|
500
495
|
*/
|
|
501
496
|
export declare function useContext<T>(context: Context<T>): T;
|
|
502
|
-
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement
|
|
497
|
+
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
503
498
|
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
504
499
|
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
505
500
|
toArray: () => ResolvedJSXElement[];
|
package/types/render/flow.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function For<T extends readonly any[], U extends JSX.Element>(pro
|
|
|
17
17
|
each: T | undefined | null | false;
|
|
18
18
|
fallback?: JSX.Element;
|
|
19
19
|
children: (item: T[number], index: Accessor<number>) => U;
|
|
20
|
-
}):
|
|
20
|
+
}): JSX.Element;
|
|
21
21
|
/**
|
|
22
22
|
* Non-keyed iteration over a list creating elements from its items
|
|
23
23
|
*
|
|
@@ -35,7 +35,7 @@ export declare function Index<T extends readonly any[], U extends JSX.Element>(p
|
|
|
35
35
|
each: T | undefined | null | false;
|
|
36
36
|
fallback?: JSX.Element;
|
|
37
37
|
children: (item: Accessor<T[number]>, index: number) => U;
|
|
38
|
-
}):
|
|
38
|
+
}): JSX.Element;
|
|
39
39
|
/**
|
|
40
40
|
* Conditionally render its children or an optional fallback component
|
|
41
41
|
* @description https://www.solidjs.com/docs/latest/api#show
|
|
@@ -45,13 +45,13 @@ export declare function Show<T>(props: {
|
|
|
45
45
|
keyed: true;
|
|
46
46
|
fallback?: JSX.Element;
|
|
47
47
|
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
|
|
48
|
-
}):
|
|
48
|
+
}): JSX.Element;
|
|
49
49
|
export declare function Show<T>(props: {
|
|
50
50
|
when: T | undefined | null | false;
|
|
51
51
|
keyed?: false;
|
|
52
52
|
fallback?: JSX.Element;
|
|
53
|
-
children: JSX.Element;
|
|
54
|
-
}):
|
|
53
|
+
children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
|
|
54
|
+
}): JSX.Element;
|
|
55
55
|
/**
|
|
56
56
|
* switches between content based on mutually exclusive conditions
|
|
57
57
|
* ```typescript
|
|
@@ -69,7 +69,7 @@ export declare function Show<T>(props: {
|
|
|
69
69
|
export declare function Switch(props: {
|
|
70
70
|
fallback?: JSX.Element;
|
|
71
71
|
children: JSX.Element;
|
|
72
|
-
}):
|
|
72
|
+
}): JSX.Element;
|
|
73
73
|
export type MatchProps<T> = {
|
|
74
74
|
when: T | undefined | null | false;
|
|
75
75
|
keyed?: boolean;
|
|
@@ -113,4 +113,4 @@ export declare function resetErrorBoundaries(): void;
|
|
|
113
113
|
export declare function ErrorBoundary(props: {
|
|
114
114
|
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
115
115
|
children: JSX.Element;
|
|
116
|
-
}):
|
|
116
|
+
}): JSX.Element;
|
|
@@ -2,12 +2,12 @@ export declare const equalFn: <T>(a: T, b: T) => boolean;
|
|
|
2
2
|
export declare const $PROXY: unique symbol;
|
|
3
3
|
export declare const $TRACK: unique symbol;
|
|
4
4
|
export declare const $DEVCOMP: unique symbol;
|
|
5
|
-
export declare const DEV:
|
|
5
|
+
export declare const DEV: undefined;
|
|
6
6
|
export type Accessor<T> = () => T;
|
|
7
7
|
export type Setter<T> = undefined extends T ? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U : <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U;
|
|
8
8
|
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
9
9
|
export declare const BRANCH: unique symbol;
|
|
10
|
-
export declare function castError(err:
|
|
10
|
+
export declare function castError(err: unknown): Error;
|
|
11
11
|
export declare let Owner: Owner | null;
|
|
12
12
|
interface Owner {
|
|
13
13
|
owner: Owner | null;
|
|
@@ -35,7 +35,7 @@ export declare function onCleanup(fn: () => void): () => void;
|
|
|
35
35
|
export declare function cleanNode(node: {
|
|
36
36
|
cleanups?: Function[] | null;
|
|
37
37
|
}): void;
|
|
38
|
-
export declare function onError(fn: (err:
|
|
38
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
39
39
|
export declare function getListener(): null;
|
|
40
40
|
export interface Context<T> {
|
|
41
41
|
id: symbol;
|
|
@@ -146,7 +146,7 @@ export declare function SuspenseList(props: {
|
|
|
146
146
|
export declare function Suspense(props: {
|
|
147
147
|
fallback?: string;
|
|
148
148
|
children: string;
|
|
149
|
-
}): string | number | boolean | Node | JSX.ArrayElement |
|
|
149
|
+
}): string | number | boolean | Node | JSX.ArrayElement | {
|
|
150
150
|
t: string;
|
|
151
151
|
} | null | undefined;
|
|
152
152
|
export {};
|
package/web/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hydrate as hydrateCore } from "./client.js";
|
|
2
|
-
import { JSX,
|
|
2
|
+
import { JSX, ComponentProps, ValidComponent } from "solid-js";
|
|
3
3
|
export * from "./client.js";
|
|
4
4
|
export { For, Show, Suspense, SuspenseList, Switch, Match, Index, ErrorBoundary, mergeProps } from "solid-js";
|
|
5
5
|
export * from "./server-mock.js";
|
|
@@ -33,4 +33,4 @@ export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
|
33
33
|
* ```
|
|
34
34
|
* @description https://www.solidjs.com/docs/latest/api#dynamic
|
|
35
35
|
*/
|
|
36
|
-
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>):
|
|
36
|
+
export declare function Dynamic<T extends ValidComponent>(props: DynamicProps<T>): JSX.Element;
|