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/solid.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
|
}
|
|
@@ -267,7 +278,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
267
278
|
}),
|
|
268
279
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
269
280
|
if (sharedConfig.context) {
|
|
270
|
-
id =
|
|
281
|
+
id = sharedConfig.getNextContextId();
|
|
271
282
|
let v;
|
|
272
283
|
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
273
284
|
}
|
|
@@ -540,7 +551,8 @@ function createContext(defaultValue, options) {
|
|
|
540
551
|
};
|
|
541
552
|
}
|
|
542
553
|
function useContext(context) {
|
|
543
|
-
|
|
554
|
+
let value;
|
|
555
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
544
556
|
}
|
|
545
557
|
function children(fn) {
|
|
546
558
|
const children = createMemo(fn);
|
|
@@ -1066,20 +1078,12 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1066
1078
|
onCleanup(() => dispose(disposers));
|
|
1067
1079
|
return () => {
|
|
1068
1080
|
let newItems = list() || [],
|
|
1081
|
+
newLen = newItems.length,
|
|
1069
1082
|
i,
|
|
1070
1083
|
j;
|
|
1071
1084
|
newItems[$TRACK];
|
|
1072
1085
|
return untrack(() => {
|
|
1073
|
-
let
|
|
1074
|
-
newIndices,
|
|
1075
|
-
newIndicesNext,
|
|
1076
|
-
temp,
|
|
1077
|
-
tempdisposers,
|
|
1078
|
-
tempIndexes,
|
|
1079
|
-
start,
|
|
1080
|
-
end,
|
|
1081
|
-
newEnd,
|
|
1082
|
-
item;
|
|
1086
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
1083
1087
|
if (newLen === 0) {
|
|
1084
1088
|
if (len !== 0) {
|
|
1085
1089
|
dispose(disposers);
|
|
@@ -1169,10 +1173,11 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1169
1173
|
i;
|
|
1170
1174
|
onCleanup(() => dispose(disposers));
|
|
1171
1175
|
return () => {
|
|
1172
|
-
const newItems = list() || []
|
|
1176
|
+
const newItems = list() || [],
|
|
1177
|
+
newLen = newItems.length;
|
|
1173
1178
|
newItems[$TRACK];
|
|
1174
1179
|
return untrack(() => {
|
|
1175
|
-
if (
|
|
1180
|
+
if (newLen === 0) {
|
|
1176
1181
|
if (len !== 0) {
|
|
1177
1182
|
dispose(disposers);
|
|
1178
1183
|
disposers = [];
|
|
@@ -1198,7 +1203,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1198
1203
|
mapped = [];
|
|
1199
1204
|
len = 0;
|
|
1200
1205
|
}
|
|
1201
|
-
for (i = 0; i <
|
|
1206
|
+
for (i = 0; i < newLen; i++) {
|
|
1202
1207
|
if (i < items.length && items[i] !== newItems[i]) {
|
|
1203
1208
|
signals[i](() => newItems[i]);
|
|
1204
1209
|
} else if (i >= items.length) {
|
|
@@ -1208,7 +1213,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1208
1213
|
for (; i < items.length; i++) {
|
|
1209
1214
|
disposers[i]();
|
|
1210
1215
|
}
|
|
1211
|
-
len = signals.length = disposers.length =
|
|
1216
|
+
len = signals.length = disposers.length = newLen;
|
|
1212
1217
|
items = newItems.slice(0);
|
|
1213
1218
|
return mapped = mapped.slice(0, len);
|
|
1214
1219
|
});
|
|
@@ -1422,7 +1427,7 @@ function lazy(fn) {
|
|
|
1422
1427
|
let counter = 0;
|
|
1423
1428
|
function createUniqueId() {
|
|
1424
1429
|
const ctx = sharedConfig.context;
|
|
1425
|
-
return ctx ?
|
|
1430
|
+
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
1426
1431
|
}
|
|
1427
1432
|
|
|
1428
1433
|
const narrowedError = name => `Stale read from <${name}>.`;
|
|
@@ -1494,7 +1499,7 @@ function resetErrorBoundaries() {
|
|
|
1494
1499
|
}
|
|
1495
1500
|
function ErrorBoundary(props) {
|
|
1496
1501
|
let err;
|
|
1497
|
-
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.
|
|
1502
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
|
|
1498
1503
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1499
1504
|
Errors || (Errors = new Set());
|
|
1500
1505
|
Errors.add(setErrored);
|
|
@@ -1510,7 +1515,7 @@ function ErrorBoundary(props) {
|
|
|
1510
1515
|
}
|
|
1511
1516
|
|
|
1512
1517
|
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1513
|
-
const SuspenseListContext = createContext();
|
|
1518
|
+
const SuspenseListContext = /* #__PURE__ */createContext();
|
|
1514
1519
|
function SuspenseList(props) {
|
|
1515
1520
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1516
1521
|
inFallback: false
|
|
@@ -1607,7 +1612,7 @@ function Suspense(props) {
|
|
|
1607
1612
|
},
|
|
1608
1613
|
owner = getOwner();
|
|
1609
1614
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1610
|
-
const key = sharedConfig.
|
|
1615
|
+
const key = sharedConfig.getContextId();
|
|
1611
1616
|
let ref = sharedConfig.load(key);
|
|
1612
1617
|
if (ref) {
|
|
1613
1618
|
if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
|
|
@@ -1664,7 +1669,7 @@ function Suspense(props) {
|
|
|
1664
1669
|
dispose = disposer;
|
|
1665
1670
|
if (ctx) {
|
|
1666
1671
|
setHydrateContext({
|
|
1667
|
-
id: ctx.id + "
|
|
1672
|
+
id: ctx.id + "F",
|
|
1668
1673
|
count: 0
|
|
1669
1674
|
});
|
|
1670
1675
|
ctx = undefined;
|