solid-js 1.3.4 → 1.3.8
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 +11 -6
- package/dist/dev.js +11 -6
- package/dist/server.cjs +7 -3
- package/dist/server.js +6 -4
- package/dist/solid.cjs +11 -6
- package/dist/solid.js +11 -6
- package/package.json +2 -2
- package/store/dist/dev.cjs +3 -3
- package/store/dist/dev.js +3 -3
- package/store/dist/server.cjs +3 -3
- package/store/dist/server.js +3 -3
- package/store/dist/store.cjs +3 -3
- package/store/dist/store.js +3 -3
- package/types/jsx.d.ts +2 -0
- package/types/reactive/signal.d.ts +3 -1
- package/types/server/index.d.ts +1 -1
- package/types/server/reactive.d.ts +1 -1
- package/web/dist/dev.cjs +11 -10
- package/web/dist/dev.js +11 -11
- package/web/dist/server.cjs +27 -11
- package/web/dist/server.js +27 -11
- package/web/dist/web.cjs +11 -10
- package/web/dist/web.js +11 -11
- package/web/types/client.d.ts +1 -0
package/dist/dev.cjs
CHANGED
|
@@ -124,7 +124,7 @@ function setHydrateContext(context) {
|
|
|
124
124
|
}
|
|
125
125
|
function nextHydrateContext() {
|
|
126
126
|
return { ...sharedConfig.context,
|
|
127
|
-
id: `${sharedConfig.context.id}${sharedConfig.context.count++}
|
|
127
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
128
128
|
count: 0
|
|
129
129
|
};
|
|
130
130
|
}
|
|
@@ -158,14 +158,13 @@ let Effects = null;
|
|
|
158
158
|
let ExecCount = 0;
|
|
159
159
|
let rootCount = 0;
|
|
160
160
|
function createRoot(fn, detachedOwner) {
|
|
161
|
-
detachedOwner && (Owner = detachedOwner);
|
|
162
161
|
const listener = Listener,
|
|
163
162
|
owner = Owner,
|
|
164
163
|
root = fn.length === 0 && !"_SOLID_DEV_" ? UNOWNED : {
|
|
165
164
|
owned: null,
|
|
166
165
|
cleanups: null,
|
|
167
166
|
context: null,
|
|
168
|
-
owner
|
|
167
|
+
owner: detachedOwner || owner
|
|
169
168
|
};
|
|
170
169
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
171
170
|
Owner = root;
|
|
@@ -267,6 +266,7 @@ function createResource(source, fetcher, options) {
|
|
|
267
266
|
initP = null,
|
|
268
267
|
id = null,
|
|
269
268
|
loadedUnderTransition = false,
|
|
269
|
+
scheduled = false,
|
|
270
270
|
dynamic = typeof source === "function";
|
|
271
271
|
if (sharedConfig.context) {
|
|
272
272
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -321,6 +321,8 @@ function createResource(source, fetcher, options) {
|
|
|
321
321
|
return v;
|
|
322
322
|
}
|
|
323
323
|
function load(refetching = true) {
|
|
324
|
+
if (refetching && scheduled) return;
|
|
325
|
+
scheduled = false;
|
|
324
326
|
setError(err = undefined);
|
|
325
327
|
const lookup = dynamic ? source() : source;
|
|
326
328
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -338,6 +340,8 @@ function createResource(source, fetcher, options) {
|
|
|
338
340
|
return p;
|
|
339
341
|
}
|
|
340
342
|
pr = p;
|
|
343
|
+
scheduled = true;
|
|
344
|
+
queueMicrotask(() => scheduled = false);
|
|
341
345
|
batch(() => {
|
|
342
346
|
setLoading(true);
|
|
343
347
|
trigger();
|
|
@@ -400,7 +404,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
400
404
|
let l;
|
|
401
405
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
402
406
|
onCleanup(() => {
|
|
403
|
-
l.
|
|
407
|
+
l.delete(listener);
|
|
408
|
+
!l.size && subs.delete(key);
|
|
404
409
|
});
|
|
405
410
|
}
|
|
406
411
|
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
@@ -1010,7 +1015,7 @@ function observable(input) {
|
|
|
1010
1015
|
if (!(observer instanceof Object) || observer == null) {
|
|
1011
1016
|
throw new TypeError("Expected the observer to be an object.");
|
|
1012
1017
|
}
|
|
1013
|
-
const handler = "next" in observer ? observer.next : observer;
|
|
1018
|
+
const handler = "next" in observer ? observer.next.bind(observer) : observer;
|
|
1014
1019
|
let complete = false;
|
|
1015
1020
|
createComputed(() => {
|
|
1016
1021
|
if (complete) return;
|
|
@@ -1348,7 +1353,7 @@ function lazy(fn) {
|
|
|
1348
1353
|
let counter = 0;
|
|
1349
1354
|
function createUniqueId() {
|
|
1350
1355
|
const ctx = sharedConfig.context;
|
|
1351
|
-
return ctx ? `${ctx.id}${ctx.count++}` : `cl
|
|
1356
|
+
return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
|
|
1352
1357
|
}
|
|
1353
1358
|
|
|
1354
1359
|
function For(props) {
|
package/dist/dev.js
CHANGED
|
@@ -120,7 +120,7 @@ function setHydrateContext(context) {
|
|
|
120
120
|
}
|
|
121
121
|
function nextHydrateContext() {
|
|
122
122
|
return { ...sharedConfig.context,
|
|
123
|
-
id: `${sharedConfig.context.id}${sharedConfig.context.count++}
|
|
123
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
124
124
|
count: 0
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -154,14 +154,13 @@ let Effects = null;
|
|
|
154
154
|
let ExecCount = 0;
|
|
155
155
|
let rootCount = 0;
|
|
156
156
|
function createRoot(fn, detachedOwner) {
|
|
157
|
-
detachedOwner && (Owner = detachedOwner);
|
|
158
157
|
const listener = Listener,
|
|
159
158
|
owner = Owner,
|
|
160
159
|
root = fn.length === 0 && !"_SOLID_DEV_" ? UNOWNED : {
|
|
161
160
|
owned: null,
|
|
162
161
|
cleanups: null,
|
|
163
162
|
context: null,
|
|
164
|
-
owner
|
|
163
|
+
owner: detachedOwner || owner
|
|
165
164
|
};
|
|
166
165
|
if (owner) root.name = `${owner.name}-r${rootCount++}`;
|
|
167
166
|
Owner = root;
|
|
@@ -263,6 +262,7 @@ function createResource(source, fetcher, options) {
|
|
|
263
262
|
initP = null,
|
|
264
263
|
id = null,
|
|
265
264
|
loadedUnderTransition = false,
|
|
265
|
+
scheduled = false,
|
|
266
266
|
dynamic = typeof source === "function";
|
|
267
267
|
if (sharedConfig.context) {
|
|
268
268
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -317,6 +317,8 @@ function createResource(source, fetcher, options) {
|
|
|
317
317
|
return v;
|
|
318
318
|
}
|
|
319
319
|
function load(refetching = true) {
|
|
320
|
+
if (refetching && scheduled) return;
|
|
321
|
+
scheduled = false;
|
|
320
322
|
setError(err = undefined);
|
|
321
323
|
const lookup = dynamic ? source() : source;
|
|
322
324
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -334,6 +336,8 @@ function createResource(source, fetcher, options) {
|
|
|
334
336
|
return p;
|
|
335
337
|
}
|
|
336
338
|
pr = p;
|
|
339
|
+
scheduled = true;
|
|
340
|
+
queueMicrotask(() => scheduled = false);
|
|
337
341
|
batch(() => {
|
|
338
342
|
setLoading(true);
|
|
339
343
|
trigger();
|
|
@@ -396,7 +400,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
396
400
|
let l;
|
|
397
401
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
398
402
|
onCleanup(() => {
|
|
399
|
-
l.
|
|
403
|
+
l.delete(listener);
|
|
404
|
+
!l.size && subs.delete(key);
|
|
400
405
|
});
|
|
401
406
|
}
|
|
402
407
|
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
@@ -1006,7 +1011,7 @@ function observable(input) {
|
|
|
1006
1011
|
if (!(observer instanceof Object) || observer == null) {
|
|
1007
1012
|
throw new TypeError("Expected the observer to be an object.");
|
|
1008
1013
|
}
|
|
1009
|
-
const handler = "next" in observer ? observer.next : observer;
|
|
1014
|
+
const handler = "next" in observer ? observer.next.bind(observer) : observer;
|
|
1010
1015
|
let complete = false;
|
|
1011
1016
|
createComputed(() => {
|
|
1012
1017
|
if (complete) return;
|
|
@@ -1344,7 +1349,7 @@ function lazy(fn) {
|
|
|
1344
1349
|
let counter = 0;
|
|
1345
1350
|
function createUniqueId() {
|
|
1346
1351
|
const ctx = sharedConfig.context;
|
|
1347
|
-
return ctx ? `${ctx.id}${ctx.count++}` : `cl
|
|
1352
|
+
return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
|
|
1348
1353
|
}
|
|
1349
1354
|
|
|
1350
1355
|
function For(props) {
|
package/dist/server.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const equalFn = (a, b) => a === b;
|
|
6
6
|
const $PROXY = Symbol("solid-proxy");
|
|
7
|
-
const $DEVCOMP = Symbol(
|
|
7
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
8
8
|
const DEV = {};
|
|
9
9
|
const ERROR = Symbol("error");
|
|
10
10
|
const UNOWNED = {
|
|
@@ -79,7 +79,7 @@ function createMemo(fn, value) {
|
|
|
79
79
|
function createDeferred(source) {
|
|
80
80
|
return source;
|
|
81
81
|
}
|
|
82
|
-
function createSelector(source, fn) {
|
|
82
|
+
function createSelector(source, fn = equalFn) {
|
|
83
83
|
return k => fn(k, source());
|
|
84
84
|
}
|
|
85
85
|
function batch(fn) {
|
|
@@ -231,7 +231,7 @@ function setHydrateContext(context) {
|
|
|
231
231
|
}
|
|
232
232
|
function nextHydrateContext() {
|
|
233
233
|
return sharedConfig.context ? { ...sharedConfig.context,
|
|
234
|
-
id: `${sharedConfig.context.id}${sharedConfig.context.count++}
|
|
234
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
235
235
|
count: 0
|
|
236
236
|
} : undefined;
|
|
237
237
|
}
|
|
@@ -311,6 +311,7 @@ function Switch(props) {
|
|
|
311
311
|
function Match(props) {
|
|
312
312
|
return props;
|
|
313
313
|
}
|
|
314
|
+
function resetErrorBoundaries() {}
|
|
314
315
|
function ErrorBoundary(props) {
|
|
315
316
|
let error, res;
|
|
316
317
|
const ctx = sharedConfig.context;
|
|
@@ -411,6 +412,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
411
412
|
mutate: v => value = v
|
|
412
413
|
}];
|
|
413
414
|
}
|
|
415
|
+
function refetchResources(info) {}
|
|
414
416
|
function lazy(fn) {
|
|
415
417
|
let resolved;
|
|
416
418
|
const p = fn();
|
|
@@ -558,7 +560,9 @@ exports.on = on;
|
|
|
558
560
|
exports.onCleanup = onCleanup;
|
|
559
561
|
exports.onError = onError;
|
|
560
562
|
exports.onMount = onMount;
|
|
563
|
+
exports.refetchResources = refetchResources;
|
|
561
564
|
exports.requestCallback = requestCallback;
|
|
565
|
+
exports.resetErrorBoundaries = resetErrorBoundaries;
|
|
562
566
|
exports.runWithOwner = runWithOwner;
|
|
563
567
|
exports.sharedConfig = sharedConfig;
|
|
564
568
|
exports.splitProps = splitProps;
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const equalFn = (a, b) => a === b;
|
|
2
2
|
const $PROXY = Symbol("solid-proxy");
|
|
3
|
-
const $DEVCOMP = Symbol(
|
|
3
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
4
4
|
const DEV = {};
|
|
5
5
|
const ERROR = Symbol("error");
|
|
6
6
|
const UNOWNED = {
|
|
@@ -75,7 +75,7 @@ function createMemo(fn, value) {
|
|
|
75
75
|
function createDeferred(source) {
|
|
76
76
|
return source;
|
|
77
77
|
}
|
|
78
|
-
function createSelector(source, fn) {
|
|
78
|
+
function createSelector(source, fn = equalFn) {
|
|
79
79
|
return k => fn(k, source());
|
|
80
80
|
}
|
|
81
81
|
function batch(fn) {
|
|
@@ -227,7 +227,7 @@ function setHydrateContext(context) {
|
|
|
227
227
|
}
|
|
228
228
|
function nextHydrateContext() {
|
|
229
229
|
return sharedConfig.context ? { ...sharedConfig.context,
|
|
230
|
-
id: `${sharedConfig.context.id}${sharedConfig.context.count++}
|
|
230
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
231
231
|
count: 0
|
|
232
232
|
} : undefined;
|
|
233
233
|
}
|
|
@@ -307,6 +307,7 @@ function Switch(props) {
|
|
|
307
307
|
function Match(props) {
|
|
308
308
|
return props;
|
|
309
309
|
}
|
|
310
|
+
function resetErrorBoundaries() {}
|
|
310
311
|
function ErrorBoundary(props) {
|
|
311
312
|
let error, res;
|
|
312
313
|
const ctx = sharedConfig.context;
|
|
@@ -407,6 +408,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
407
408
|
mutate: v => value = v
|
|
408
409
|
}];
|
|
409
410
|
}
|
|
411
|
+
function refetchResources(info) {}
|
|
410
412
|
function lazy(fn) {
|
|
411
413
|
let resolved;
|
|
412
414
|
const p = fn();
|
|
@@ -513,4 +515,4 @@ function Suspense(props) {
|
|
|
513
515
|
return props.fallback;
|
|
514
516
|
}
|
|
515
517
|
|
|
516
|
-
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
518
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -124,7 +124,7 @@ function setHydrateContext(context) {
|
|
|
124
124
|
}
|
|
125
125
|
function nextHydrateContext() {
|
|
126
126
|
return { ...sharedConfig.context,
|
|
127
|
-
id: `${sharedConfig.context.id}${sharedConfig.context.count++}
|
|
127
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
128
128
|
count: 0
|
|
129
129
|
};
|
|
130
130
|
}
|
|
@@ -157,14 +157,13 @@ let Updates = null;
|
|
|
157
157
|
let Effects = null;
|
|
158
158
|
let ExecCount = 0;
|
|
159
159
|
function createRoot(fn, detachedOwner) {
|
|
160
|
-
detachedOwner && (Owner = detachedOwner);
|
|
161
160
|
const listener = Listener,
|
|
162
161
|
owner = Owner,
|
|
163
162
|
root = fn.length === 0 && !false ? UNOWNED : {
|
|
164
163
|
owned: null,
|
|
165
164
|
cleanups: null,
|
|
166
165
|
context: null,
|
|
167
|
-
owner
|
|
166
|
+
owner: detachedOwner || owner
|
|
168
167
|
};
|
|
169
168
|
Owner = root;
|
|
170
169
|
Listener = null;
|
|
@@ -264,6 +263,7 @@ function createResource(source, fetcher, options) {
|
|
|
264
263
|
initP = null,
|
|
265
264
|
id = null,
|
|
266
265
|
loadedUnderTransition = false,
|
|
266
|
+
scheduled = false,
|
|
267
267
|
dynamic = typeof source === "function";
|
|
268
268
|
if (sharedConfig.context) {
|
|
269
269
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -318,6 +318,8 @@ function createResource(source, fetcher, options) {
|
|
|
318
318
|
return v;
|
|
319
319
|
}
|
|
320
320
|
function load(refetching = true) {
|
|
321
|
+
if (refetching && scheduled) return;
|
|
322
|
+
scheduled = false;
|
|
321
323
|
setError(err = undefined);
|
|
322
324
|
const lookup = dynamic ? source() : source;
|
|
323
325
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -335,6 +337,8 @@ function createResource(source, fetcher, options) {
|
|
|
335
337
|
return p;
|
|
336
338
|
}
|
|
337
339
|
pr = p;
|
|
340
|
+
scheduled = true;
|
|
341
|
+
queueMicrotask(() => scheduled = false);
|
|
338
342
|
batch(() => {
|
|
339
343
|
setLoading(true);
|
|
340
344
|
trigger();
|
|
@@ -397,7 +401,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
397
401
|
let l;
|
|
398
402
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
399
403
|
onCleanup(() => {
|
|
400
|
-
l.
|
|
404
|
+
l.delete(listener);
|
|
405
|
+
!l.size && subs.delete(key);
|
|
401
406
|
});
|
|
402
407
|
}
|
|
403
408
|
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
@@ -929,7 +934,7 @@ function observable(input) {
|
|
|
929
934
|
if (!(observer instanceof Object) || observer == null) {
|
|
930
935
|
throw new TypeError("Expected the observer to be an object.");
|
|
931
936
|
}
|
|
932
|
-
const handler = "next" in observer ? observer.next : observer;
|
|
937
|
+
const handler = "next" in observer ? observer.next.bind(observer) : observer;
|
|
933
938
|
let complete = false;
|
|
934
939
|
createComputed(() => {
|
|
935
940
|
if (complete) return;
|
|
@@ -1264,7 +1269,7 @@ function lazy(fn) {
|
|
|
1264
1269
|
let counter = 0;
|
|
1265
1270
|
function createUniqueId() {
|
|
1266
1271
|
const ctx = sharedConfig.context;
|
|
1267
|
-
return ctx ? `${ctx.id}${ctx.count++}` : `cl
|
|
1272
|
+
return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
|
|
1268
1273
|
}
|
|
1269
1274
|
|
|
1270
1275
|
function For(props) {
|
package/dist/solid.js
CHANGED
|
@@ -120,7 +120,7 @@ function setHydrateContext(context) {
|
|
|
120
120
|
}
|
|
121
121
|
function nextHydrateContext() {
|
|
122
122
|
return { ...sharedConfig.context,
|
|
123
|
-
id: `${sharedConfig.context.id}${sharedConfig.context.count++}
|
|
123
|
+
id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
|
|
124
124
|
count: 0
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -153,14 +153,13 @@ let Updates = null;
|
|
|
153
153
|
let Effects = null;
|
|
154
154
|
let ExecCount = 0;
|
|
155
155
|
function createRoot(fn, detachedOwner) {
|
|
156
|
-
detachedOwner && (Owner = detachedOwner);
|
|
157
156
|
const listener = Listener,
|
|
158
157
|
owner = Owner,
|
|
159
158
|
root = fn.length === 0 && !false ? UNOWNED : {
|
|
160
159
|
owned: null,
|
|
161
160
|
cleanups: null,
|
|
162
161
|
context: null,
|
|
163
|
-
owner
|
|
162
|
+
owner: detachedOwner || owner
|
|
164
163
|
};
|
|
165
164
|
Owner = root;
|
|
166
165
|
Listener = null;
|
|
@@ -260,6 +259,7 @@ function createResource(source, fetcher, options) {
|
|
|
260
259
|
initP = null,
|
|
261
260
|
id = null,
|
|
262
261
|
loadedUnderTransition = false,
|
|
262
|
+
scheduled = false,
|
|
263
263
|
dynamic = typeof source === "function";
|
|
264
264
|
if (sharedConfig.context) {
|
|
265
265
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -314,6 +314,8 @@ function createResource(source, fetcher, options) {
|
|
|
314
314
|
return v;
|
|
315
315
|
}
|
|
316
316
|
function load(refetching = true) {
|
|
317
|
+
if (refetching && scheduled) return;
|
|
318
|
+
scheduled = false;
|
|
317
319
|
setError(err = undefined);
|
|
318
320
|
const lookup = dynamic ? source() : source;
|
|
319
321
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -331,6 +333,8 @@ function createResource(source, fetcher, options) {
|
|
|
331
333
|
return p;
|
|
332
334
|
}
|
|
333
335
|
pr = p;
|
|
336
|
+
scheduled = true;
|
|
337
|
+
queueMicrotask(() => scheduled = false);
|
|
334
338
|
batch(() => {
|
|
335
339
|
setLoading(true);
|
|
336
340
|
trigger();
|
|
@@ -393,7 +397,8 @@ function createSelector(source, fn = equalFn, options) {
|
|
|
393
397
|
let l;
|
|
394
398
|
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
395
399
|
onCleanup(() => {
|
|
396
|
-
l.
|
|
400
|
+
l.delete(listener);
|
|
401
|
+
!l.size && subs.delete(key);
|
|
397
402
|
});
|
|
398
403
|
}
|
|
399
404
|
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
@@ -925,7 +930,7 @@ function observable(input) {
|
|
|
925
930
|
if (!(observer instanceof Object) || observer == null) {
|
|
926
931
|
throw new TypeError("Expected the observer to be an object.");
|
|
927
932
|
}
|
|
928
|
-
const handler = "next" in observer ? observer.next : observer;
|
|
933
|
+
const handler = "next" in observer ? observer.next.bind(observer) : observer;
|
|
929
934
|
let complete = false;
|
|
930
935
|
createComputed(() => {
|
|
931
936
|
if (complete) return;
|
|
@@ -1260,7 +1265,7 @@ function lazy(fn) {
|
|
|
1260
1265
|
let counter = 0;
|
|
1261
1266
|
function createUniqueId() {
|
|
1262
1267
|
const ctx = sharedConfig.context;
|
|
1263
|
-
return ctx ? `${ctx.id}${ctx.count++}` : `cl
|
|
1268
|
+
return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
|
|
1264
1269
|
}
|
|
1265
1270
|
|
|
1266
1271
|
function For(props) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.8",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "6e7f0a80cd949e6dd5c0baaf45432ed2b0693119"
|
|
148
148
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -147,12 +147,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
147
147
|
isArray = Array.isArray(current);
|
|
148
148
|
if (Array.isArray(part)) {
|
|
149
149
|
for (let i = 0; i < part.length; i++) {
|
|
150
|
-
updatePath(current, [part[i]].concat(path),
|
|
150
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
151
151
|
}
|
|
152
152
|
return;
|
|
153
153
|
} else if (isArray && partType === "function") {
|
|
154
154
|
for (let i = 0; i < current.length; i++) {
|
|
155
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
155
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
156
156
|
}
|
|
157
157
|
return;
|
|
158
158
|
} else if (isArray && partType === "object") {
|
|
@@ -162,7 +162,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
162
162
|
by = 1
|
|
163
163
|
} = part;
|
|
164
164
|
for (let i = from; i <= to; i += by) {
|
|
165
|
-
updatePath(current, [i].concat(path),
|
|
165
|
+
updatePath(current, [i].concat(path), traversed);
|
|
166
166
|
}
|
|
167
167
|
return;
|
|
168
168
|
} else if (path.length > 1) {
|
package/store/dist/dev.js
CHANGED
|
@@ -143,12 +143,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
143
143
|
isArray = Array.isArray(current);
|
|
144
144
|
if (Array.isArray(part)) {
|
|
145
145
|
for (let i = 0; i < part.length; i++) {
|
|
146
|
-
updatePath(current, [part[i]].concat(path),
|
|
146
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
147
147
|
}
|
|
148
148
|
return;
|
|
149
149
|
} else if (isArray && partType === "function") {
|
|
150
150
|
for (let i = 0; i < current.length; i++) {
|
|
151
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
151
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
152
152
|
}
|
|
153
153
|
return;
|
|
154
154
|
} else if (isArray && partType === "object") {
|
|
@@ -158,7 +158,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
158
158
|
by = 1
|
|
159
159
|
} = part;
|
|
160
160
|
for (let i = from; i <= to; i += by) {
|
|
161
|
-
updatePath(current, [i].concat(path),
|
|
161
|
+
updatePath(current, [i].concat(path), traversed);
|
|
162
162
|
}
|
|
163
163
|
return;
|
|
164
164
|
} else if (path.length > 1) {
|
package/store/dist/server.cjs
CHANGED
|
@@ -31,12 +31,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
31
31
|
isArray = Array.isArray(current);
|
|
32
32
|
if (Array.isArray(part)) {
|
|
33
33
|
for (let i = 0; i < part.length; i++) {
|
|
34
|
-
updatePath(current, [part[i]].concat(path),
|
|
34
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
35
35
|
}
|
|
36
36
|
return;
|
|
37
37
|
} else if (isArray && partType === "function") {
|
|
38
38
|
for (let i = 0; i < current.length; i++) {
|
|
39
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
39
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
} else if (isArray && partType === "object") {
|
|
@@ -46,7 +46,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
46
46
|
by = 1
|
|
47
47
|
} = part;
|
|
48
48
|
for (let i = from; i <= to; i += by) {
|
|
49
|
-
updatePath(current, [i].concat(path),
|
|
49
|
+
updatePath(current, [i].concat(path), traversed);
|
|
50
50
|
}
|
|
51
51
|
return;
|
|
52
52
|
} else if (path.length > 1) {
|
package/store/dist/server.js
CHANGED
|
@@ -27,12 +27,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
27
27
|
isArray = Array.isArray(current);
|
|
28
28
|
if (Array.isArray(part)) {
|
|
29
29
|
for (let i = 0; i < part.length; i++) {
|
|
30
|
-
updatePath(current, [part[i]].concat(path),
|
|
30
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
31
31
|
}
|
|
32
32
|
return;
|
|
33
33
|
} else if (isArray && partType === "function") {
|
|
34
34
|
for (let i = 0; i < current.length; i++) {
|
|
35
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
35
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
36
36
|
}
|
|
37
37
|
return;
|
|
38
38
|
} else if (isArray && partType === "object") {
|
|
@@ -42,7 +42,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
42
42
|
by = 1
|
|
43
43
|
} = part;
|
|
44
44
|
for (let i = from; i <= to; i += by) {
|
|
45
|
-
updatePath(current, [i].concat(path),
|
|
45
|
+
updatePath(current, [i].concat(path), traversed);
|
|
46
46
|
}
|
|
47
47
|
return;
|
|
48
48
|
} else if (path.length > 1) {
|
package/store/dist/store.cjs
CHANGED
|
@@ -142,12 +142,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
142
142
|
isArray = Array.isArray(current);
|
|
143
143
|
if (Array.isArray(part)) {
|
|
144
144
|
for (let i = 0; i < part.length; i++) {
|
|
145
|
-
updatePath(current, [part[i]].concat(path),
|
|
145
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
146
146
|
}
|
|
147
147
|
return;
|
|
148
148
|
} else if (isArray && partType === "function") {
|
|
149
149
|
for (let i = 0; i < current.length; i++) {
|
|
150
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
150
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
151
151
|
}
|
|
152
152
|
return;
|
|
153
153
|
} else if (isArray && partType === "object") {
|
|
@@ -157,7 +157,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
157
157
|
by = 1
|
|
158
158
|
} = part;
|
|
159
159
|
for (let i = from; i <= to; i += by) {
|
|
160
|
-
updatePath(current, [i].concat(path),
|
|
160
|
+
updatePath(current, [i].concat(path), traversed);
|
|
161
161
|
}
|
|
162
162
|
return;
|
|
163
163
|
} else if (path.length > 1) {
|
package/store/dist/store.js
CHANGED
|
@@ -138,12 +138,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
138
138
|
isArray = Array.isArray(current);
|
|
139
139
|
if (Array.isArray(part)) {
|
|
140
140
|
for (let i = 0; i < part.length; i++) {
|
|
141
|
-
updatePath(current, [part[i]].concat(path),
|
|
141
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
142
142
|
}
|
|
143
143
|
return;
|
|
144
144
|
} else if (isArray && partType === "function") {
|
|
145
145
|
for (let i = 0; i < current.length; i++) {
|
|
146
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
146
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
147
147
|
}
|
|
148
148
|
return;
|
|
149
149
|
} else if (isArray && partType === "object") {
|
|
@@ -153,7 +153,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
153
153
|
by = 1
|
|
154
154
|
} = part;
|
|
155
155
|
for (let i = from; i <= to; i += by) {
|
|
156
|
-
updatePath(current, [i].concat(path),
|
|
156
|
+
updatePath(current, [i].concat(path), traversed);
|
|
157
157
|
}
|
|
158
158
|
return;
|
|
159
159
|
} else if (path.length > 1) {
|
package/types/jsx.d.ts
CHANGED
|
@@ -2085,6 +2085,8 @@ export namespace JSX {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
interface DetailsHtmlAttributes<T> extends HTMLAttributes<T> {
|
|
2087
2087
|
open?: boolean;
|
|
2088
|
+
onToggle?: EventHandlerUnion<T, Event>;
|
|
2089
|
+
ontoggle?: EventHandlerUnion<T, Event>;
|
|
2088
2090
|
}
|
|
2089
2091
|
interface DialogHtmlAttributes<T> extends HTMLAttributes<T> {
|
|
2090
2092
|
open?: boolean;
|
|
@@ -437,6 +437,8 @@ export declare function createContext<T>(defaultValue: T): Context<T>;
|
|
|
437
437
|
* @description https://www.solidjs.com/docs/latest/api#usecontext
|
|
438
438
|
*/
|
|
439
439
|
export declare function useContext<T>(context: Context<T>): T;
|
|
440
|
+
export declare type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement | JSX.FunctionElement>;
|
|
441
|
+
export declare type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
440
442
|
/**
|
|
441
443
|
* Resolves child elements to help interact with children
|
|
442
444
|
*
|
|
@@ -445,7 +447,7 @@ export declare function useContext<T>(context: Context<T>): T;
|
|
|
445
447
|
*
|
|
446
448
|
* @description https://www.solidjs.com/docs/latest/api#children
|
|
447
449
|
*/
|
|
448
|
-
export declare function children(fn: Accessor<JSX.Element>): Accessor<
|
|
450
|
+
export declare function children(fn: Accessor<JSX.Element>): Accessor<ResolvedChildren>;
|
|
449
451
|
export declare type SuspenseContextType = {
|
|
450
452
|
increment?: () => void;
|
|
451
453
|
decrement?: () => void;
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createReaction, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, $DEVCOMP, DEV, enableExternalSource } from "./reactive";
|
|
2
|
-
export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
|
|
2
|
+
export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, refetchResources, resetErrorBoundaries, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
|
|
3
3
|
export type { Component, Resource } from "./rendering";
|
|
@@ -19,7 +19,7 @@ export declare function createEffect<T>(fn: (v?: T) => T, value?: T): void;
|
|
|
19
19
|
export declare function createReaction(fn: () => void): (fn: () => void) => void;
|
|
20
20
|
export declare function createMemo<T>(fn: (v?: T) => T, value?: T): () => T;
|
|
21
21
|
export declare function createDeferred<T>(source: () => T): () => T;
|
|
22
|
-
export declare function createSelector<T>(source: () => T, fn
|
|
22
|
+
export declare function createSelector<T>(source: () => T, fn?: (k: T, value: T) => boolean): (k: T) => boolean;
|
|
23
23
|
export declare function batch<T>(fn: () => T): T;
|
|
24
24
|
export declare const untrack: typeof batch;
|
|
25
25
|
export declare function on<T, U>(deps: Array<() => T> | (() => T), fn: (value: Array<T> | T, prev?: Array<T> | T, prevResults?: U) => U, options?: {
|
package/web/dist/dev.cjs
CHANGED
|
@@ -197,6 +197,9 @@ function dynamicProperty(props, key) {
|
|
|
197
197
|
});
|
|
198
198
|
return props;
|
|
199
199
|
}
|
|
200
|
+
function innerHTML(parent, content) {
|
|
201
|
+
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|
|
202
|
+
}
|
|
200
203
|
function insert(parent, accessor, marker, initial) {
|
|
201
204
|
if (marker !== undefined && !initial) initial = [];
|
|
202
205
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -391,20 +394,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
391
394
|
if (array.length === 0) {
|
|
392
395
|
current = cleanChildren(parent, current, marker);
|
|
393
396
|
if (multi) return current;
|
|
397
|
+
} else if (Array.isArray(current)) {
|
|
398
|
+
if (current.length === 0) {
|
|
399
|
+
appendNodes(parent, array, marker);
|
|
400
|
+
} else reconcileArrays(parent, current, array);
|
|
394
401
|
} else {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
appendNodes(parent, array, marker);
|
|
398
|
-
} else reconcileArrays(parent, current, array);
|
|
399
|
-
} else if (current == null || current === "") {
|
|
400
|
-
appendNodes(parent, array);
|
|
401
|
-
} else {
|
|
402
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
403
|
-
}
|
|
402
|
+
current && cleanChildren(parent);
|
|
403
|
+
appendNodes(parent, array);
|
|
404
404
|
}
|
|
405
405
|
current = array;
|
|
406
406
|
} else if (value instanceof Node) {
|
|
407
|
-
if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
407
|
+
if (solidJs.sharedConfig.context && current && current.length) return current = value.parentNode ? multi ? [value] : value : current;
|
|
408
408
|
if (Array.isArray(current)) {
|
|
409
409
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
410
410
|
cleanChildren(parent, current, null, value);
|
|
@@ -626,6 +626,7 @@ exports.getNextElement = getNextElement;
|
|
|
626
626
|
exports.getNextMarker = getNextMarker;
|
|
627
627
|
exports.getNextMatch = getNextMatch;
|
|
628
628
|
exports.hydrate = hydrate;
|
|
629
|
+
exports.innerHTML = innerHTML;
|
|
629
630
|
exports.insert = insert;
|
|
630
631
|
exports.isServer = isServer;
|
|
631
632
|
exports.memo = memo;
|
package/web/dist/dev.js
CHANGED
|
@@ -194,6 +194,9 @@ function dynamicProperty(props, key) {
|
|
|
194
194
|
});
|
|
195
195
|
return props;
|
|
196
196
|
}
|
|
197
|
+
function innerHTML(parent, content) {
|
|
198
|
+
!sharedConfig.context && (parent.innerHTML = content);
|
|
199
|
+
}
|
|
197
200
|
function insert(parent, accessor, marker, initial) {
|
|
198
201
|
if (marker !== undefined && !initial) initial = [];
|
|
199
202
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -388,20 +391,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
388
391
|
if (array.length === 0) {
|
|
389
392
|
current = cleanChildren(parent, current, marker);
|
|
390
393
|
if (multi) return current;
|
|
394
|
+
} else if (Array.isArray(current)) {
|
|
395
|
+
if (current.length === 0) {
|
|
396
|
+
appendNodes(parent, array, marker);
|
|
397
|
+
} else reconcileArrays(parent, current, array);
|
|
391
398
|
} else {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
appendNodes(parent, array, marker);
|
|
395
|
-
} else reconcileArrays(parent, current, array);
|
|
396
|
-
} else if (current == null || current === "") {
|
|
397
|
-
appendNodes(parent, array);
|
|
398
|
-
} else {
|
|
399
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
400
|
-
}
|
|
399
|
+
current && cleanChildren(parent);
|
|
400
|
+
appendNodes(parent, array);
|
|
401
401
|
}
|
|
402
402
|
current = array;
|
|
403
403
|
} else if (value instanceof Node) {
|
|
404
|
-
if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
404
|
+
if (sharedConfig.context && current && current.length) return current = value.parentNode ? multi ? [value] : value : current;
|
|
405
405
|
if (Array.isArray(current)) {
|
|
406
406
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
407
407
|
cleanChildren(parent, current, null, value);
|
|
@@ -550,4 +550,4 @@ function Dynamic(props) {
|
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
|
553
|
+
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
package/web/dist/server.cjs
CHANGED
|
@@ -232,7 +232,7 @@ function stringifyString(str) {
|
|
|
232
232
|
return result;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
235
|
+
const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
236
236
|
const FRAGMENT_REPLACE = /<!\[([\d.]+)\]>/;
|
|
237
237
|
function renderToString(code, options = {}) {
|
|
238
238
|
let scripts = "";
|
|
@@ -323,7 +323,11 @@ function renderToStream(code, options = {}) {
|
|
|
323
323
|
const checkEnd = () => {
|
|
324
324
|
if (!registry.size && !completed) {
|
|
325
325
|
writeTasks();
|
|
326
|
-
onCompleteAll && onCompleteAll(
|
|
326
|
+
onCompleteAll && onCompleteAll({
|
|
327
|
+
write(v) {
|
|
328
|
+
!completed && buffer.write(v);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
327
331
|
writable && writable.end();
|
|
328
332
|
completed = true;
|
|
329
333
|
}
|
|
@@ -375,12 +379,14 @@ function renderToStream(code, options = {}) {
|
|
|
375
379
|
}
|
|
376
380
|
tasks.push(`_$HY.init("${key}")`);
|
|
377
381
|
return (value, error) => {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
if (registry.has(key)) {
|
|
383
|
+
const keys = registry.get(key);
|
|
384
|
+
registry.delete(key);
|
|
385
|
+
if (waitForFragments(registry, key)) return;
|
|
386
|
+
if ((value !== undefined || error) && !completed) {
|
|
387
|
+
buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div><script${nonce ? ` nonce="${nonce}"` : ""}>${!scriptFlushed ? REPLACE_SCRIPT : ""}${keys.length ? keys.map(k => `_$HY.unset("${k}");`) : ""}$df("${key}"${error ? "," + serializeError(error) : ""})</script>`);
|
|
388
|
+
scriptFlushed = true;
|
|
389
|
+
}
|
|
384
390
|
}
|
|
385
391
|
checkEnd();
|
|
386
392
|
return true;
|
|
@@ -394,7 +400,11 @@ function renderToStream(code, options = {}) {
|
|
|
394
400
|
buffer.write(html);
|
|
395
401
|
tasks.length = 0;
|
|
396
402
|
scheduled = false;
|
|
397
|
-
onCompleteShell && onCompleteShell(
|
|
403
|
+
onCompleteShell && onCompleteShell({
|
|
404
|
+
write(v) {
|
|
405
|
+
!completed && buffer.write(v);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
398
408
|
});
|
|
399
409
|
return {
|
|
400
410
|
pipe(w) {
|
|
@@ -613,8 +623,11 @@ function serializeSet(registry, key, value) {
|
|
|
613
623
|
}
|
|
614
624
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
615
625
|
if (options.onReady) {
|
|
616
|
-
options.onCompleteShell = (
|
|
626
|
+
options.onCompleteShell = ({
|
|
627
|
+
write
|
|
628
|
+
}) => {
|
|
617
629
|
options.onReady({
|
|
630
|
+
write,
|
|
618
631
|
startWriting() {
|
|
619
632
|
stream.pipe(writable);
|
|
620
633
|
}
|
|
@@ -626,8 +639,11 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
626
639
|
}
|
|
627
640
|
function pipeToWritable(code, writable, options = {}) {
|
|
628
641
|
if (options.onReady) {
|
|
629
|
-
options.onCompleteShell = (
|
|
642
|
+
options.onCompleteShell = ({
|
|
643
|
+
write
|
|
644
|
+
}) => {
|
|
630
645
|
options.onReady({
|
|
646
|
+
write,
|
|
631
647
|
startWriting() {
|
|
632
648
|
stream.pipeTo(writable);
|
|
633
649
|
}
|
package/web/dist/server.js
CHANGED
|
@@ -229,7 +229,7 @@ function stringifyString(str) {
|
|
|
229
229
|
return result;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
232
|
+
const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
233
233
|
const FRAGMENT_REPLACE = /<!\[([\d.]+)\]>/;
|
|
234
234
|
function renderToString(code, options = {}) {
|
|
235
235
|
let scripts = "";
|
|
@@ -320,7 +320,11 @@ function renderToStream(code, options = {}) {
|
|
|
320
320
|
const checkEnd = () => {
|
|
321
321
|
if (!registry.size && !completed) {
|
|
322
322
|
writeTasks();
|
|
323
|
-
onCompleteAll && onCompleteAll(
|
|
323
|
+
onCompleteAll && onCompleteAll({
|
|
324
|
+
write(v) {
|
|
325
|
+
!completed && buffer.write(v);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
324
328
|
writable && writable.end();
|
|
325
329
|
completed = true;
|
|
326
330
|
}
|
|
@@ -372,12 +376,14 @@ function renderToStream(code, options = {}) {
|
|
|
372
376
|
}
|
|
373
377
|
tasks.push(`_$HY.init("${key}")`);
|
|
374
378
|
return (value, error) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
if (registry.has(key)) {
|
|
380
|
+
const keys = registry.get(key);
|
|
381
|
+
registry.delete(key);
|
|
382
|
+
if (waitForFragments(registry, key)) return;
|
|
383
|
+
if ((value !== undefined || error) && !completed) {
|
|
384
|
+
buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div><script${nonce ? ` nonce="${nonce}"` : ""}>${!scriptFlushed ? REPLACE_SCRIPT : ""}${keys.length ? keys.map(k => `_$HY.unset("${k}");`) : ""}$df("${key}"${error ? "," + serializeError(error) : ""})</script>`);
|
|
385
|
+
scriptFlushed = true;
|
|
386
|
+
}
|
|
381
387
|
}
|
|
382
388
|
checkEnd();
|
|
383
389
|
return true;
|
|
@@ -391,7 +397,11 @@ function renderToStream(code, options = {}) {
|
|
|
391
397
|
buffer.write(html);
|
|
392
398
|
tasks.length = 0;
|
|
393
399
|
scheduled = false;
|
|
394
|
-
onCompleteShell && onCompleteShell(
|
|
400
|
+
onCompleteShell && onCompleteShell({
|
|
401
|
+
write(v) {
|
|
402
|
+
!completed && buffer.write(v);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
395
405
|
});
|
|
396
406
|
return {
|
|
397
407
|
pipe(w) {
|
|
@@ -610,8 +620,11 @@ function serializeSet(registry, key, value) {
|
|
|
610
620
|
}
|
|
611
621
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
612
622
|
if (options.onReady) {
|
|
613
|
-
options.onCompleteShell = (
|
|
623
|
+
options.onCompleteShell = ({
|
|
624
|
+
write
|
|
625
|
+
}) => {
|
|
614
626
|
options.onReady({
|
|
627
|
+
write,
|
|
615
628
|
startWriting() {
|
|
616
629
|
stream.pipe(writable);
|
|
617
630
|
}
|
|
@@ -623,8 +636,11 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
623
636
|
}
|
|
624
637
|
function pipeToWritable(code, writable, options = {}) {
|
|
625
638
|
if (options.onReady) {
|
|
626
|
-
options.onCompleteShell = (
|
|
639
|
+
options.onCompleteShell = ({
|
|
640
|
+
write
|
|
641
|
+
}) => {
|
|
627
642
|
options.onReady({
|
|
643
|
+
write,
|
|
628
644
|
startWriting() {
|
|
629
645
|
stream.pipeTo(writable);
|
|
630
646
|
}
|
package/web/dist/web.cjs
CHANGED
|
@@ -196,6 +196,9 @@ function dynamicProperty(props, key) {
|
|
|
196
196
|
});
|
|
197
197
|
return props;
|
|
198
198
|
}
|
|
199
|
+
function innerHTML(parent, content) {
|
|
200
|
+
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|
|
201
|
+
}
|
|
199
202
|
function insert(parent, accessor, marker, initial) {
|
|
200
203
|
if (marker !== undefined && !initial) initial = [];
|
|
201
204
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -390,20 +393,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
390
393
|
if (array.length === 0) {
|
|
391
394
|
current = cleanChildren(parent, current, marker);
|
|
392
395
|
if (multi) return current;
|
|
396
|
+
} else if (Array.isArray(current)) {
|
|
397
|
+
if (current.length === 0) {
|
|
398
|
+
appendNodes(parent, array, marker);
|
|
399
|
+
} else reconcileArrays(parent, current, array);
|
|
393
400
|
} else {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
appendNodes(parent, array, marker);
|
|
397
|
-
} else reconcileArrays(parent, current, array);
|
|
398
|
-
} else if (current == null || current === "") {
|
|
399
|
-
appendNodes(parent, array);
|
|
400
|
-
} else {
|
|
401
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
402
|
-
}
|
|
401
|
+
current && cleanChildren(parent);
|
|
402
|
+
appendNodes(parent, array);
|
|
403
403
|
}
|
|
404
404
|
current = array;
|
|
405
405
|
} else if (value instanceof Node) {
|
|
406
|
-
if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
406
|
+
if (solidJs.sharedConfig.context && current && current.length) return current = value.parentNode ? multi ? [value] : value : current;
|
|
407
407
|
if (Array.isArray(current)) {
|
|
408
408
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
409
409
|
cleanChildren(parent, current, null, value);
|
|
@@ -622,6 +622,7 @@ exports.getNextElement = getNextElement;
|
|
|
622
622
|
exports.getNextMarker = getNextMarker;
|
|
623
623
|
exports.getNextMatch = getNextMatch;
|
|
624
624
|
exports.hydrate = hydrate;
|
|
625
|
+
exports.innerHTML = innerHTML;
|
|
625
626
|
exports.insert = insert;
|
|
626
627
|
exports.isServer = isServer;
|
|
627
628
|
exports.memo = memo;
|
package/web/dist/web.js
CHANGED
|
@@ -193,6 +193,9 @@ function dynamicProperty(props, key) {
|
|
|
193
193
|
});
|
|
194
194
|
return props;
|
|
195
195
|
}
|
|
196
|
+
function innerHTML(parent, content) {
|
|
197
|
+
!sharedConfig.context && (parent.innerHTML = content);
|
|
198
|
+
}
|
|
196
199
|
function insert(parent, accessor, marker, initial) {
|
|
197
200
|
if (marker !== undefined && !initial) initial = [];
|
|
198
201
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -387,20 +390,17 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
387
390
|
if (array.length === 0) {
|
|
388
391
|
current = cleanChildren(parent, current, marker);
|
|
389
392
|
if (multi) return current;
|
|
393
|
+
} else if (Array.isArray(current)) {
|
|
394
|
+
if (current.length === 0) {
|
|
395
|
+
appendNodes(parent, array, marker);
|
|
396
|
+
} else reconcileArrays(parent, current, array);
|
|
390
397
|
} else {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
appendNodes(parent, array, marker);
|
|
394
|
-
} else reconcileArrays(parent, current, array);
|
|
395
|
-
} else if (current == null || current === "") {
|
|
396
|
-
appendNodes(parent, array);
|
|
397
|
-
} else {
|
|
398
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
399
|
-
}
|
|
398
|
+
current && cleanChildren(parent);
|
|
399
|
+
appendNodes(parent, array);
|
|
400
400
|
}
|
|
401
401
|
current = array;
|
|
402
402
|
} else if (value instanceof Node) {
|
|
403
|
-
if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
403
|
+
if (sharedConfig.context && current && current.length) return current = value.parentNode ? multi ? [value] : value : current;
|
|
404
404
|
if (Array.isArray(current)) {
|
|
405
405
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
406
406
|
cleanChildren(parent, current, null, value);
|
|
@@ -546,4 +546,4 @@ function Dynamic(props) {
|
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
|
549
|
+
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
package/web/types/client.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export function spread<T>(
|
|
|
30
30
|
export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
|
|
31
31
|
export function setAttribute(node: Element, name: string, value: string): void;
|
|
32
32
|
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
33
|
+
export function innerHTML(node: Element, content: string): void;
|
|
33
34
|
export function addEventListener(
|
|
34
35
|
node: Element,
|
|
35
36
|
name: string,
|