solid-js 1.9.4 → 1.9.6
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/LICENSE +1 -1
- package/dist/dev.cjs +57 -42
- package/dist/dev.js +65 -50
- package/dist/solid.cjs +38 -34
- package/dist/solid.js +49 -41
- package/h/jsx-runtime/types/jsx.d.ts +2975 -1021
- package/html/dist/html.cjs +5 -5
- package/html/dist/html.js +5 -5
- package/package.json +1 -1
- package/store/types/store.d.ts +1 -0
- package/types/index.d.ts +3 -0
- package/types/jsx.d.ts +2126 -281
- package/types/reactive/observable.d.ts +11 -11
- package/types/reactive/signal.d.ts +4 -0
- package/types/server/reactive.d.ts +6 -1
- package/universal/dist/dev.cjs +3 -1
- package/universal/dist/dev.js +4 -2
- package/universal/dist/universal.cjs +3 -1
- package/universal/dist/universal.js +4 -2
- package/web/dist/dev.cjs +21 -14
- package/web/dist/dev.js +25 -12
- package/web/dist/server.cjs +18 -11
- package/web/dist/server.js +22 -8
- package/web/dist/web.cjs +21 -14
- package/web/dist/web.js +23 -10
- package/web/types/core.d.ts +1 -1
- package/web/types/index.d.ts +16 -0
package/dist/solid.js
CHANGED
|
@@ -144,6 +144,7 @@ function nextHydrateContext() {
|
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
const IS_DEV = false;
|
|
147
148
|
const equalFn = (a, b) => a === b;
|
|
148
149
|
const $PROXY = Symbol("solid-proxy");
|
|
149
150
|
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
@@ -407,12 +408,13 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
410
|
});
|
|
410
|
-
|
|
411
|
+
let owner = Owner;
|
|
412
|
+
if (dynamic) createComputed(() => ((owner = Owner), load(false)));
|
|
411
413
|
else load(false);
|
|
412
414
|
return [
|
|
413
415
|
read,
|
|
414
416
|
{
|
|
415
|
-
refetch: load,
|
|
417
|
+
refetch: info => runWithOwner(owner, () => load(info)),
|
|
416
418
|
mutate: setValue
|
|
417
419
|
}
|
|
418
420
|
];
|
|
@@ -712,7 +714,7 @@ function writeSignal(node, value, isComp) {
|
|
|
712
714
|
}
|
|
713
715
|
if (Updates.length > 10e5) {
|
|
714
716
|
Updates = [];
|
|
715
|
-
if (
|
|
717
|
+
if (IS_DEV);
|
|
716
718
|
throw new Error();
|
|
717
719
|
}
|
|
718
720
|
}, false);
|
|
@@ -1138,8 +1140,8 @@ function observable(input) {
|
|
|
1138
1140
|
}
|
|
1139
1141
|
};
|
|
1140
1142
|
}
|
|
1141
|
-
function from(producer) {
|
|
1142
|
-
const [s, set] = createSignal(
|
|
1143
|
+
function from(producer, initalValue = undefined) {
|
|
1144
|
+
const [s, set] = createSignal(initalValue, {
|
|
1143
1145
|
equals: false
|
|
1144
1146
|
});
|
|
1145
1147
|
if ("subscribe" in producer) {
|
|
@@ -1531,7 +1533,7 @@ function lazy(fn) {
|
|
|
1531
1533
|
return createMemo(() =>
|
|
1532
1534
|
(Comp = comp())
|
|
1533
1535
|
? untrack(() => {
|
|
1534
|
-
if (
|
|
1536
|
+
if (IS_DEV);
|
|
1535
1537
|
if (!ctx || sharedConfig.done) return Comp(props);
|
|
1536
1538
|
const c = sharedConfig.context;
|
|
1537
1539
|
setHydrateContext(ctx);
|
|
@@ -1566,9 +1568,12 @@ function Index(props) {
|
|
|
1566
1568
|
}
|
|
1567
1569
|
function Show(props) {
|
|
1568
1570
|
const keyed = props.keyed;
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
|
|
1571
|
+
const conditionValue = createMemo(() => props.when, undefined, undefined);
|
|
1572
|
+
const condition = keyed
|
|
1573
|
+
? conditionValue
|
|
1574
|
+
: createMemo(conditionValue, undefined, {
|
|
1575
|
+
equals: (a, b) => !a === !b
|
|
1576
|
+
});
|
|
1572
1577
|
return createMemo(
|
|
1573
1578
|
() => {
|
|
1574
1579
|
const c = condition();
|
|
@@ -1582,7 +1587,7 @@ function Show(props) {
|
|
|
1582
1587
|
? c
|
|
1583
1588
|
: () => {
|
|
1584
1589
|
if (!untrack(condition)) throw narrowedError("Show");
|
|
1585
|
-
return
|
|
1590
|
+
return conditionValue();
|
|
1586
1591
|
}
|
|
1587
1592
|
)
|
|
1588
1593
|
)
|
|
@@ -1595,45 +1600,48 @@ function Show(props) {
|
|
|
1595
1600
|
);
|
|
1596
1601
|
}
|
|
1597
1602
|
function Switch(props) {
|
|
1598
|
-
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1603
|
+
const chs = children(() => props.children);
|
|
1604
|
+
const switchFunc = createMemo(() => {
|
|
1605
|
+
const ch = chs();
|
|
1606
|
+
const mps = Array.isArray(ch) ? ch : [ch];
|
|
1607
|
+
let func = () => undefined;
|
|
1608
|
+
for (let i = 0; i < mps.length; i++) {
|
|
1609
|
+
const index = i;
|
|
1610
|
+
const mp = mps[i];
|
|
1611
|
+
const prevFunc = func;
|
|
1612
|
+
const conditionValue = createMemo(
|
|
1613
|
+
() => (prevFunc() ? undefined : mp.when),
|
|
1614
|
+
undefined,
|
|
1615
|
+
undefined
|
|
1616
|
+
);
|
|
1617
|
+
const condition = mp.keyed
|
|
1618
|
+
? conditionValue
|
|
1619
|
+
: createMemo(conditionValue, undefined, {
|
|
1620
|
+
equals: (a, b) => !a === !b
|
|
1621
|
+
});
|
|
1622
|
+
func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
|
|
1623
|
+
}
|
|
1624
|
+
return func;
|
|
1625
|
+
});
|
|
1619
1626
|
return createMemo(
|
|
1620
1627
|
() => {
|
|
1621
|
-
const
|
|
1622
|
-
if (
|
|
1623
|
-
const
|
|
1624
|
-
const
|
|
1628
|
+
const sel = switchFunc()();
|
|
1629
|
+
if (!sel) return props.fallback;
|
|
1630
|
+
const [index, conditionValue, mp] = sel;
|
|
1631
|
+
const child = mp.children;
|
|
1632
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1625
1633
|
return fn
|
|
1626
1634
|
? untrack(() =>
|
|
1627
|
-
|
|
1628
|
-
keyed
|
|
1629
|
-
?
|
|
1635
|
+
child(
|
|
1636
|
+
mp.keyed
|
|
1637
|
+
? conditionValue()
|
|
1630
1638
|
: () => {
|
|
1631
|
-
if (untrack(
|
|
1632
|
-
return
|
|
1639
|
+
if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
|
|
1640
|
+
return conditionValue();
|
|
1633
1641
|
}
|
|
1634
1642
|
)
|
|
1635
1643
|
)
|
|
1636
|
-
:
|
|
1644
|
+
: child;
|
|
1637
1645
|
},
|
|
1638
1646
|
undefined,
|
|
1639
1647
|
undefined
|