solid-js 1.8.18 → 1.8.19
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 +28 -23
- package/dist/dev.js +344 -580
- package/dist/server.cjs +33 -11
- package/dist/server.js +105 -176
- package/dist/solid.cjs +28 -23
- package/dist/solid.js +302 -507
- package/h/dist/h.js +9 -38
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +33 -47
- package/package.json +3 -3
- package/store/dist/dev.js +43 -122
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +40 -113
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +10 -75
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +142 -233
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +33 -64
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +98 -167
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.cjs +2 -3
- package/web/dist/dev.js +84 -629
- package/web/dist/server.cjs +3 -3
- package/web/dist/server.js +99 -213
- package/web/dist/web.cjs +2 -3
- package/web/dist/web.js +82 -620
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
package/dist/dev.cjs
CHANGED
|
@@ -118,15 +118,26 @@ function workLoop(hasTimeRemaining, initialTime) {
|
|
|
118
118
|
|
|
119
119
|
const sharedConfig = {
|
|
120
120
|
context: undefined,
|
|
121
|
-
registry: undefined
|
|
121
|
+
registry: undefined,
|
|
122
|
+
getContextId() {
|
|
123
|
+
return getContextId(this.context.count);
|
|
124
|
+
},
|
|
125
|
+
getNextContextId() {
|
|
126
|
+
return getContextId(this.context.count++);
|
|
127
|
+
}
|
|
122
128
|
};
|
|
129
|
+
function getContextId(count) {
|
|
130
|
+
const num = String(count),
|
|
131
|
+
len = num.length - 1;
|
|
132
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
133
|
+
}
|
|
123
134
|
function setHydrateContext(context) {
|
|
124
135
|
sharedConfig.context = context;
|
|
125
136
|
}
|
|
126
137
|
function nextHydrateContext() {
|
|
127
138
|
return {
|
|
128
139
|
...sharedConfig.context,
|
|
129
|
-
id:
|
|
140
|
+
id: sharedConfig.getNextContextId(),
|
|
130
141
|
count: 0
|
|
131
142
|
};
|
|
132
143
|
}
|
|
@@ -285,7 +296,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
285
296
|
}),
|
|
286
297
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
287
298
|
if (sharedConfig.context) {
|
|
288
|
-
id =
|
|
299
|
+
id = sharedConfig.getNextContextId();
|
|
289
300
|
let v;
|
|
290
301
|
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
291
302
|
}
|
|
@@ -578,7 +589,8 @@ function createContext(defaultValue, options) {
|
|
|
578
589
|
};
|
|
579
590
|
}
|
|
580
591
|
function useContext(context) {
|
|
581
|
-
|
|
592
|
+
let value;
|
|
593
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
582
594
|
}
|
|
583
595
|
function children(fn) {
|
|
584
596
|
const children = createMemo(fn);
|
|
@@ -1109,20 +1121,12 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1109
1121
|
onCleanup(() => dispose(disposers));
|
|
1110
1122
|
return () => {
|
|
1111
1123
|
let newItems = list() || [],
|
|
1124
|
+
newLen = newItems.length,
|
|
1112
1125
|
i,
|
|
1113
1126
|
j;
|
|
1114
1127
|
newItems[$TRACK];
|
|
1115
1128
|
return untrack(() => {
|
|
1116
|
-
let
|
|
1117
|
-
newIndices,
|
|
1118
|
-
newIndicesNext,
|
|
1119
|
-
temp,
|
|
1120
|
-
tempdisposers,
|
|
1121
|
-
tempIndexes,
|
|
1122
|
-
start,
|
|
1123
|
-
end,
|
|
1124
|
-
newEnd,
|
|
1125
|
-
item;
|
|
1129
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
1126
1130
|
if (newLen === 0) {
|
|
1127
1131
|
if (len !== 0) {
|
|
1128
1132
|
dispose(disposers);
|
|
@@ -1214,10 +1218,11 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1214
1218
|
i;
|
|
1215
1219
|
onCleanup(() => dispose(disposers));
|
|
1216
1220
|
return () => {
|
|
1217
|
-
const newItems = list() || []
|
|
1221
|
+
const newItems = list() || [],
|
|
1222
|
+
newLen = newItems.length;
|
|
1218
1223
|
newItems[$TRACK];
|
|
1219
1224
|
return untrack(() => {
|
|
1220
|
-
if (
|
|
1225
|
+
if (newLen === 0) {
|
|
1221
1226
|
if (len !== 0) {
|
|
1222
1227
|
dispose(disposers);
|
|
1223
1228
|
disposers = [];
|
|
@@ -1243,7 +1248,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1243
1248
|
mapped = [];
|
|
1244
1249
|
len = 0;
|
|
1245
1250
|
}
|
|
1246
|
-
for (i = 0; i <
|
|
1251
|
+
for (i = 0; i < newLen; i++) {
|
|
1247
1252
|
if (i < items.length && items[i] !== newItems[i]) {
|
|
1248
1253
|
signals[i](() => newItems[i]);
|
|
1249
1254
|
} else if (i >= items.length) {
|
|
@@ -1253,7 +1258,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1253
1258
|
for (; i < items.length; i++) {
|
|
1254
1259
|
disposers[i]();
|
|
1255
1260
|
}
|
|
1256
|
-
len = signals.length = disposers.length =
|
|
1261
|
+
len = signals.length = disposers.length = newLen;
|
|
1257
1262
|
items = newItems.slice(0);
|
|
1258
1263
|
return mapped = mapped.slice(0, len);
|
|
1259
1264
|
});
|
|
@@ -1471,7 +1476,7 @@ function lazy(fn) {
|
|
|
1471
1476
|
let counter = 0;
|
|
1472
1477
|
function createUniqueId() {
|
|
1473
1478
|
const ctx = sharedConfig.context;
|
|
1474
|
-
return ctx ?
|
|
1479
|
+
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
1475
1480
|
}
|
|
1476
1481
|
|
|
1477
1482
|
const narrowedError = name => `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` ;
|
|
@@ -1553,7 +1558,7 @@ function resetErrorBoundaries() {
|
|
|
1553
1558
|
}
|
|
1554
1559
|
function ErrorBoundary(props) {
|
|
1555
1560
|
let err;
|
|
1556
|
-
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.
|
|
1561
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
|
|
1557
1562
|
const [errored, setErrored] = createSignal(err, {
|
|
1558
1563
|
name: "errored"
|
|
1559
1564
|
} );
|
|
@@ -1574,7 +1579,7 @@ function ErrorBoundary(props) {
|
|
|
1574
1579
|
}
|
|
1575
1580
|
|
|
1576
1581
|
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1577
|
-
const SuspenseListContext = createContext();
|
|
1582
|
+
const SuspenseListContext = /* #__PURE__ */createContext();
|
|
1578
1583
|
function SuspenseList(props) {
|
|
1579
1584
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1580
1585
|
inFallback: false
|
|
@@ -1671,7 +1676,7 @@ function Suspense(props) {
|
|
|
1671
1676
|
},
|
|
1672
1677
|
owner = getOwner();
|
|
1673
1678
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1674
|
-
const key = sharedConfig.
|
|
1679
|
+
const key = sharedConfig.getContextId();
|
|
1675
1680
|
let ref = sharedConfig.load(key);
|
|
1676
1681
|
if (ref) {
|
|
1677
1682
|
if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
|
|
@@ -1728,7 +1733,7 @@ function Suspense(props) {
|
|
|
1728
1733
|
dispose = disposer;
|
|
1729
1734
|
if (ctx) {
|
|
1730
1735
|
setHydrateContext({
|
|
1731
|
-
id: ctx.id + "
|
|
1736
|
+
id: ctx.id + "F",
|
|
1732
1737
|
count: 0
|
|
1733
1738
|
});
|
|
1734
1739
|
ctx = undefined;
|