@solidjs/web 2.0.0-beta.15 → 2.0.0-beta.16
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 +119 -30
- package/dist/dev.js +119 -31
- package/dist/server.cjs +97 -67
- package/dist/server.js +92 -69
- package/dist/web.cjs +119 -30
- package/dist/web.js +119 -31
- package/package.json +5 -5
- package/storage/types/src/client.d.ts +1 -1
- package/storage/types-cjs/src/client.d.cts +1 -1
- package/types/client.d.ts +1 -0
- package/types/core.d.ts +1 -1
- package/types/server.d.ts +1 -0
- package/types-cjs/client.d.cts +1 -0
- package/types-cjs/core.d.cts +1 -1
- package/types-cjs/server.d.cts +1 -0
package/dist/web.cjs
CHANGED
|
@@ -60,9 +60,9 @@ const syncOptions = {
|
|
|
60
60
|
sync: true
|
|
61
61
|
};
|
|
62
62
|
const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
|
|
63
|
-
transparent: true,
|
|
64
63
|
sync: true,
|
|
65
|
-
...options
|
|
64
|
+
...options,
|
|
65
|
+
transparent: !options.scope
|
|
66
66
|
} : transparentOptions);
|
|
67
67
|
const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
|
|
68
68
|
|
|
@@ -330,20 +330,41 @@ function addEvent(node, name, handler, delegate) {
|
|
|
330
330
|
}
|
|
331
331
|
function style(node, value, prev) {
|
|
332
332
|
if (!value) {
|
|
333
|
-
if (prev
|
|
333
|
+
if (prev || node._$styles) {
|
|
334
|
+
setAttribute(node, "style");
|
|
335
|
+
node._$styles = undefined;
|
|
336
|
+
}
|
|
334
337
|
return;
|
|
335
338
|
}
|
|
336
339
|
const nodeStyle = node.style;
|
|
337
|
-
if (typeof value === "string")
|
|
338
|
-
|
|
339
|
-
|
|
340
|
+
if (typeof value === "string") {
|
|
341
|
+
node._$styles = undefined;
|
|
342
|
+
return nodeStyle.cssText = value;
|
|
343
|
+
}
|
|
344
|
+
if (typeof prev === "string") {
|
|
345
|
+
nodeStyle.cssText = "";
|
|
346
|
+
prev = undefined;
|
|
347
|
+
}
|
|
348
|
+
let applied = node._$styles;
|
|
349
|
+
if (!applied) {
|
|
350
|
+
applied = node._$styles = prev ? {
|
|
351
|
+
...prev
|
|
352
|
+
} : {};
|
|
353
|
+
}
|
|
340
354
|
let v, s;
|
|
355
|
+
for (s in applied) {
|
|
356
|
+
if (value[s] == null) {
|
|
357
|
+
nodeStyle.removeProperty(s);
|
|
358
|
+
delete applied[s];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
341
361
|
for (s in value) {
|
|
342
362
|
v = value[s];
|
|
343
|
-
if (v !==
|
|
344
|
-
|
|
363
|
+
if (v != null && v !== applied[s]) {
|
|
364
|
+
nodeStyle.setProperty(s, v);
|
|
365
|
+
applied[s] = v;
|
|
366
|
+
}
|
|
345
367
|
}
|
|
346
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
347
368
|
}
|
|
348
369
|
function setStyleProperty(node, name, value) {
|
|
349
370
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
@@ -382,19 +403,28 @@ function ref(fn, element) {
|
|
|
382
403
|
const resolved = solidJs.untrack(fn);
|
|
383
404
|
solidJs.runWithOwner(null, () => applyRef(resolved, element));
|
|
384
405
|
}
|
|
406
|
+
function scope(fn) {
|
|
407
|
+
fn.$s = true;
|
|
408
|
+
return fn;
|
|
409
|
+
}
|
|
410
|
+
const SCOPE_OPTIONS = {
|
|
411
|
+
scope: true
|
|
412
|
+
};
|
|
413
|
+
function stripTextSeparators(nodes) {
|
|
414
|
+
let j = 0;
|
|
415
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
416
|
+
if (nodes[i].nodeType === 8 && nodes[i].nodeValue === "!$") nodes[i].remove();else nodes[j++] = nodes[i];
|
|
417
|
+
}
|
|
418
|
+
nodes.length = j;
|
|
419
|
+
return nodes;
|
|
420
|
+
}
|
|
385
421
|
function insert(parent, accessor, marker, initial, options) {
|
|
386
422
|
const multi = marker !== undefined;
|
|
387
423
|
const host = options && options.host;
|
|
388
424
|
if (multi && !initial) initial = [];
|
|
389
425
|
if (isHydrating(parent)) {
|
|
390
426
|
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
391
|
-
if (Array.isArray(initial))
|
|
392
|
-
let j = 0;
|
|
393
|
-
for (let i = 0; i < initial.length; i++) {
|
|
394
|
-
if (initial[i].nodeType === 8 && initial[i].nodeValue === "!$") initial[i].remove();else initial[j++] = initial[i];
|
|
395
|
-
}
|
|
396
|
-
initial.length = j;
|
|
397
|
-
}
|
|
427
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
398
428
|
}
|
|
399
429
|
if (typeof accessor !== "function") {
|
|
400
430
|
accessor = normalize(accessor, initial, multi, true);
|
|
@@ -410,10 +440,34 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
410
440
|
initial = [placeholder];
|
|
411
441
|
}
|
|
412
442
|
let current = initial;
|
|
443
|
+
function reclaimSwappedRegion() {
|
|
444
|
+
if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return;
|
|
445
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
446
|
+
if (!first || !first.nodeType || first.isConnected) return;
|
|
447
|
+
let nodes;
|
|
448
|
+
if (marker) {
|
|
449
|
+
nodes = [];
|
|
450
|
+
let node = marker.previousSibling,
|
|
451
|
+
depth = 0;
|
|
452
|
+
while (node) {
|
|
453
|
+
if (node.nodeType === 8) {
|
|
454
|
+
const v = node.nodeValue;
|
|
455
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
456
|
+
if (depth === 0) break;
|
|
457
|
+
depth--;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
nodes.unshift(node);
|
|
461
|
+
node = node.previousSibling;
|
|
462
|
+
}
|
|
463
|
+
} else nodes = [...parent.childNodes];
|
|
464
|
+
current = stripTextSeparators(nodes);
|
|
465
|
+
}
|
|
413
466
|
effect(prev => {
|
|
467
|
+
reclaimSwappedRegion();
|
|
414
468
|
const value = normalize(accessor(), current, multi, true);
|
|
415
469
|
if (typeof value !== "function") return value;
|
|
416
|
-
effect(() => normalize(value, current, multi), inner => {
|
|
470
|
+
effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
|
|
417
471
|
insertExpression(parent, inner, current, marker);
|
|
418
472
|
current = inner;
|
|
419
473
|
host && tagHost(current, host);
|
|
@@ -427,7 +481,11 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
427
481
|
insertExpression(parent, value, current, marker);
|
|
428
482
|
current = value;
|
|
429
483
|
host && tagHost(current, host);
|
|
430
|
-
},
|
|
484
|
+
},
|
|
485
|
+
accessor.$s ? options ? {
|
|
486
|
+
...options,
|
|
487
|
+
scope: true
|
|
488
|
+
} : SCOPE_OPTIONS : options);
|
|
431
489
|
}
|
|
432
490
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
433
491
|
const nodeName = node.nodeName;
|
|
@@ -456,6 +514,9 @@ function loadModuleAssets(mapping) {
|
|
|
456
514
|
if (!hy.loading[moduleUrl]) {
|
|
457
515
|
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
458
516
|
hy.modules[moduleUrl] = mod;
|
|
517
|
+
}, err => {
|
|
518
|
+
delete hy.loading[moduleUrl];
|
|
519
|
+
throw err;
|
|
459
520
|
});
|
|
460
521
|
}
|
|
461
522
|
pending.push(hy.loading[moduleUrl]);
|
|
@@ -503,8 +564,11 @@ function hydrate$1(code, element, options = {}) {
|
|
|
503
564
|
} finally {
|
|
504
565
|
solidJs.sharedConfig.hydrating = false;
|
|
505
566
|
}
|
|
506
|
-
},
|
|
567
|
+
}, err => {
|
|
568
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
507
569
|
solidJs.sharedConfig.hydrating = false;
|
|
570
|
+
solidJs.sharedConfig.registry = undefined;
|
|
571
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
508
572
|
});
|
|
509
573
|
return () => disposer && disposer();
|
|
510
574
|
}
|
|
@@ -574,17 +638,32 @@ function runHydrationEvents() {
|
|
|
574
638
|
const [el, e] = events[0];
|
|
575
639
|
if (!completed.has(el)) return;
|
|
576
640
|
events.shift();
|
|
577
|
-
let
|
|
641
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
578
642
|
for (const [container, state] of delegatedContainers) {
|
|
579
643
|
if (!state.handlers.has(e.type)) continue;
|
|
580
644
|
const entry = findOwner(e.target, state);
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
645
|
+
if (!entry) continue;
|
|
646
|
+
if (matchContainer) {
|
|
647
|
+
if (!matches) matches = [{
|
|
648
|
+
container: matchContainer,
|
|
649
|
+
state: matchState,
|
|
650
|
+
distance: matchDistance
|
|
651
|
+
}];
|
|
652
|
+
matches.push({
|
|
653
|
+
container,
|
|
654
|
+
state,
|
|
655
|
+
distance: entry.distance
|
|
656
|
+
});
|
|
657
|
+
} else {
|
|
658
|
+
matchContainer = container;
|
|
659
|
+
matchState = state;
|
|
660
|
+
matchDistance = entry.distance;
|
|
661
|
+
}
|
|
586
662
|
}
|
|
587
|
-
if (
|
|
663
|
+
if (matches) {
|
|
664
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
665
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
666
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
588
667
|
}
|
|
589
668
|
if (solidJs.sharedConfig.done) {
|
|
590
669
|
solidJs.sharedConfig.events = _$HY.events = null;
|
|
@@ -655,11 +734,16 @@ function eventHandler(e, container, state) {
|
|
|
655
734
|
if (solidJs.sharedConfig.registry && solidJs.sharedConfig.events) {
|
|
656
735
|
if (solidJs.sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
657
736
|
}
|
|
658
|
-
|
|
737
|
+
const prev = e[$$EVENT_OWNER];
|
|
738
|
+
let resumeNode;
|
|
739
|
+
if (prev) {
|
|
740
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
741
|
+
resumeNode = prev;
|
|
742
|
+
}
|
|
659
743
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
660
744
|
if (state && !owner) return;
|
|
661
745
|
e[$$EVENT_OWNER] = owner || true;
|
|
662
|
-
let node = e.target;
|
|
746
|
+
let node = resumeNode || e.target;
|
|
663
747
|
const key = `$$${e.type}`;
|
|
664
748
|
const oriTarget = e.target;
|
|
665
749
|
const boundary = owner || container || e.currentTarget;
|
|
@@ -689,7 +773,10 @@ function eventHandler(e, container, state) {
|
|
|
689
773
|
return node || boundary || document;
|
|
690
774
|
}
|
|
691
775
|
});
|
|
692
|
-
if (
|
|
776
|
+
if (resumeNode) {
|
|
777
|
+
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
778
|
+
if (node && node !== boundary) walkUpTree();
|
|
779
|
+
} else if (e.composedPath) {
|
|
693
780
|
const path = e.composedPath();
|
|
694
781
|
if (path.length) {
|
|
695
782
|
retarget(path[0]);
|
|
@@ -872,9 +959,10 @@ function Portal(props) {
|
|
|
872
959
|
return () => {
|
|
873
960
|
dispose();
|
|
874
961
|
let c = startMarker;
|
|
875
|
-
while (c
|
|
962
|
+
while (c) {
|
|
876
963
|
const n = c.nextSibling;
|
|
877
964
|
m.removeChild(c);
|
|
965
|
+
if (c === endMarker) break;
|
|
878
966
|
c = n;
|
|
879
967
|
}
|
|
880
968
|
};
|
|
@@ -1018,6 +1106,7 @@ exports.renderToString = renderToString;
|
|
|
1018
1106
|
exports.renderToStringAsync = renderToStringAsync;
|
|
1019
1107
|
exports.resolveSSRNode = resolveSSRNode;
|
|
1020
1108
|
exports.runHydrationEvents = runHydrationEvents;
|
|
1109
|
+
exports.scope = scope;
|
|
1021
1110
|
exports.setAttribute = setAttribute;
|
|
1022
1111
|
exports.setAttributeNS = setAttributeNS;
|
|
1023
1112
|
exports.setProperty = setProperty;
|
package/dist/web.js
CHANGED
|
@@ -59,9 +59,9 @@ const syncOptions = {
|
|
|
59
59
|
sync: true
|
|
60
60
|
};
|
|
61
61
|
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
62
|
-
transparent: true,
|
|
63
62
|
sync: true,
|
|
64
|
-
...options
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
65
65
|
} : transparentOptions);
|
|
66
66
|
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
67
67
|
|
|
@@ -329,20 +329,41 @@ function addEvent(node, name, handler, delegate) {
|
|
|
329
329
|
}
|
|
330
330
|
function style(node, value, prev) {
|
|
331
331
|
if (!value) {
|
|
332
|
-
if (prev
|
|
332
|
+
if (prev || node._$styles) {
|
|
333
|
+
setAttribute(node, "style");
|
|
334
|
+
node._$styles = undefined;
|
|
335
|
+
}
|
|
333
336
|
return;
|
|
334
337
|
}
|
|
335
338
|
const nodeStyle = node.style;
|
|
336
|
-
if (typeof value === "string")
|
|
337
|
-
|
|
338
|
-
|
|
339
|
+
if (typeof value === "string") {
|
|
340
|
+
node._$styles = undefined;
|
|
341
|
+
return nodeStyle.cssText = value;
|
|
342
|
+
}
|
|
343
|
+
if (typeof prev === "string") {
|
|
344
|
+
nodeStyle.cssText = "";
|
|
345
|
+
prev = undefined;
|
|
346
|
+
}
|
|
347
|
+
let applied = node._$styles;
|
|
348
|
+
if (!applied) {
|
|
349
|
+
applied = node._$styles = prev ? {
|
|
350
|
+
...prev
|
|
351
|
+
} : {};
|
|
352
|
+
}
|
|
339
353
|
let v, s;
|
|
354
|
+
for (s in applied) {
|
|
355
|
+
if (value[s] == null) {
|
|
356
|
+
nodeStyle.removeProperty(s);
|
|
357
|
+
delete applied[s];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
340
360
|
for (s in value) {
|
|
341
361
|
v = value[s];
|
|
342
|
-
if (v !==
|
|
343
|
-
|
|
362
|
+
if (v != null && v !== applied[s]) {
|
|
363
|
+
nodeStyle.setProperty(s, v);
|
|
364
|
+
applied[s] = v;
|
|
365
|
+
}
|
|
344
366
|
}
|
|
345
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
346
367
|
}
|
|
347
368
|
function setStyleProperty(node, name, value) {
|
|
348
369
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
@@ -381,19 +402,28 @@ function ref(fn, element) {
|
|
|
381
402
|
const resolved = untrack(fn);
|
|
382
403
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
383
404
|
}
|
|
405
|
+
function scope(fn) {
|
|
406
|
+
fn.$s = true;
|
|
407
|
+
return fn;
|
|
408
|
+
}
|
|
409
|
+
const SCOPE_OPTIONS = {
|
|
410
|
+
scope: true
|
|
411
|
+
};
|
|
412
|
+
function stripTextSeparators(nodes) {
|
|
413
|
+
let j = 0;
|
|
414
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
415
|
+
if (nodes[i].nodeType === 8 && nodes[i].nodeValue === "!$") nodes[i].remove();else nodes[j++] = nodes[i];
|
|
416
|
+
}
|
|
417
|
+
nodes.length = j;
|
|
418
|
+
return nodes;
|
|
419
|
+
}
|
|
384
420
|
function insert(parent, accessor, marker, initial, options) {
|
|
385
421
|
const multi = marker !== undefined;
|
|
386
422
|
const host = options && options.host;
|
|
387
423
|
if (multi && !initial) initial = [];
|
|
388
424
|
if (isHydrating(parent)) {
|
|
389
425
|
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
390
|
-
if (Array.isArray(initial))
|
|
391
|
-
let j = 0;
|
|
392
|
-
for (let i = 0; i < initial.length; i++) {
|
|
393
|
-
if (initial[i].nodeType === 8 && initial[i].nodeValue === "!$") initial[i].remove();else initial[j++] = initial[i];
|
|
394
|
-
}
|
|
395
|
-
initial.length = j;
|
|
396
|
-
}
|
|
426
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
397
427
|
}
|
|
398
428
|
if (typeof accessor !== "function") {
|
|
399
429
|
accessor = normalize(accessor, initial, multi, true);
|
|
@@ -409,10 +439,34 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
409
439
|
initial = [placeholder];
|
|
410
440
|
}
|
|
411
441
|
let current = initial;
|
|
442
|
+
function reclaimSwappedRegion() {
|
|
443
|
+
if (!sharedConfig.hydrating || !current || !parent.isConnected) return;
|
|
444
|
+
const first = Array.isArray(current) ? current[0] : current;
|
|
445
|
+
if (!first || !first.nodeType || first.isConnected) return;
|
|
446
|
+
let nodes;
|
|
447
|
+
if (marker) {
|
|
448
|
+
nodes = [];
|
|
449
|
+
let node = marker.previousSibling,
|
|
450
|
+
depth = 0;
|
|
451
|
+
while (node) {
|
|
452
|
+
if (node.nodeType === 8) {
|
|
453
|
+
const v = node.nodeValue;
|
|
454
|
+
if (v === "/") depth++;else if (v === "$") {
|
|
455
|
+
if (depth === 0) break;
|
|
456
|
+
depth--;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
nodes.unshift(node);
|
|
460
|
+
node = node.previousSibling;
|
|
461
|
+
}
|
|
462
|
+
} else nodes = [...parent.childNodes];
|
|
463
|
+
current = stripTextSeparators(nodes);
|
|
464
|
+
}
|
|
412
465
|
effect(prev => {
|
|
466
|
+
reclaimSwappedRegion();
|
|
413
467
|
const value = normalize(accessor(), current, multi, true);
|
|
414
468
|
if (typeof value !== "function") return value;
|
|
415
|
-
effect(() => normalize(value, current, multi), inner => {
|
|
469
|
+
effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
|
|
416
470
|
insertExpression(parent, inner, current, marker);
|
|
417
471
|
current = inner;
|
|
418
472
|
host && tagHost(current, host);
|
|
@@ -426,7 +480,11 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
426
480
|
insertExpression(parent, value, current, marker);
|
|
427
481
|
current = value;
|
|
428
482
|
host && tagHost(current, host);
|
|
429
|
-
},
|
|
483
|
+
},
|
|
484
|
+
accessor.$s ? options ? {
|
|
485
|
+
...options,
|
|
486
|
+
scope: true
|
|
487
|
+
} : SCOPE_OPTIONS : options);
|
|
430
488
|
}
|
|
431
489
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
432
490
|
const nodeName = node.nodeName;
|
|
@@ -455,6 +513,9 @@ function loadModuleAssets(mapping) {
|
|
|
455
513
|
if (!hy.loading[moduleUrl]) {
|
|
456
514
|
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
457
515
|
hy.modules[moduleUrl] = mod;
|
|
516
|
+
}, err => {
|
|
517
|
+
delete hy.loading[moduleUrl];
|
|
518
|
+
throw err;
|
|
458
519
|
});
|
|
459
520
|
}
|
|
460
521
|
pending.push(hy.loading[moduleUrl]);
|
|
@@ -502,8 +563,11 @@ function hydrate$1(code, element, options = {}) {
|
|
|
502
563
|
} finally {
|
|
503
564
|
sharedConfig.hydrating = false;
|
|
504
565
|
}
|
|
505
|
-
},
|
|
566
|
+
}, err => {
|
|
567
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
506
568
|
sharedConfig.hydrating = false;
|
|
569
|
+
sharedConfig.registry = undefined;
|
|
570
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
507
571
|
});
|
|
508
572
|
return () => disposer && disposer();
|
|
509
573
|
}
|
|
@@ -573,17 +637,32 @@ function runHydrationEvents() {
|
|
|
573
637
|
const [el, e] = events[0];
|
|
574
638
|
if (!completed.has(el)) return;
|
|
575
639
|
events.shift();
|
|
576
|
-
let
|
|
640
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
577
641
|
for (const [container, state] of delegatedContainers) {
|
|
578
642
|
if (!state.handlers.has(e.type)) continue;
|
|
579
643
|
const entry = findOwner(e.target, state);
|
|
580
|
-
if (
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
644
|
+
if (!entry) continue;
|
|
645
|
+
if (matchContainer) {
|
|
646
|
+
if (!matches) matches = [{
|
|
647
|
+
container: matchContainer,
|
|
648
|
+
state: matchState,
|
|
649
|
+
distance: matchDistance
|
|
650
|
+
}];
|
|
651
|
+
matches.push({
|
|
652
|
+
container,
|
|
653
|
+
state,
|
|
654
|
+
distance: entry.distance
|
|
655
|
+
});
|
|
656
|
+
} else {
|
|
657
|
+
matchContainer = container;
|
|
658
|
+
matchState = state;
|
|
659
|
+
matchDistance = entry.distance;
|
|
660
|
+
}
|
|
585
661
|
}
|
|
586
|
-
if (
|
|
662
|
+
if (matches) {
|
|
663
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
664
|
+
for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
|
|
665
|
+
} else if (matchContainer) eventHandler(e, matchContainer, matchState);
|
|
587
666
|
}
|
|
588
667
|
if (sharedConfig.done) {
|
|
589
668
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -654,11 +733,16 @@ function eventHandler(e, container, state) {
|
|
|
654
733
|
if (sharedConfig.registry && sharedConfig.events) {
|
|
655
734
|
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
656
735
|
}
|
|
657
|
-
|
|
736
|
+
const prev = e[$$EVENT_OWNER];
|
|
737
|
+
let resumeNode;
|
|
738
|
+
if (prev) {
|
|
739
|
+
if (prev === true || prev === container || !container.contains(prev)) return;
|
|
740
|
+
resumeNode = prev;
|
|
741
|
+
}
|
|
658
742
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
659
743
|
if (state && !owner) return;
|
|
660
744
|
e[$$EVENT_OWNER] = owner || true;
|
|
661
|
-
let node = e.target;
|
|
745
|
+
let node = resumeNode || e.target;
|
|
662
746
|
const key = `$$${e.type}`;
|
|
663
747
|
const oriTarget = e.target;
|
|
664
748
|
const boundary = owner || container || e.currentTarget;
|
|
@@ -688,7 +772,10 @@ function eventHandler(e, container, state) {
|
|
|
688
772
|
return node || boundary || document;
|
|
689
773
|
}
|
|
690
774
|
});
|
|
691
|
-
if (
|
|
775
|
+
if (resumeNode) {
|
|
776
|
+
if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
|
|
777
|
+
if (node && node !== boundary) walkUpTree();
|
|
778
|
+
} else if (e.composedPath) {
|
|
692
779
|
const path = e.composedPath();
|
|
693
780
|
if (path.length) {
|
|
694
781
|
retarget(path[0]);
|
|
@@ -871,9 +958,10 @@ function Portal(props) {
|
|
|
871
958
|
return () => {
|
|
872
959
|
dispose();
|
|
873
960
|
let c = startMarker;
|
|
874
|
-
while (c
|
|
961
|
+
while (c) {
|
|
875
962
|
const n = c.nextSibling;
|
|
876
963
|
m.removeChild(c);
|
|
964
|
+
if (c === endMarker) break;
|
|
877
965
|
c = n;
|
|
878
966
|
}
|
|
879
967
|
};
|
|
@@ -917,4 +1005,4 @@ function createElement(tagName, is = undefined) {
|
|
|
917
1005
|
});
|
|
918
1006
|
}
|
|
919
1007
|
|
|
920
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
|
1008
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEvent, applyRef, assign, className, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getDelegatedRoot, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, registerDelegatedContainer, registerDelegatedRoot, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, scope, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, voidFn as useAssets };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.16",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -137,10 +137,10 @@
|
|
|
137
137
|
"seroval-plugins": "^1.1.0"
|
|
138
138
|
},
|
|
139
139
|
"peerDependencies": {
|
|
140
|
-
"solid-js": "^2.0.0-beta.
|
|
140
|
+
"solid-js": "^2.0.0-beta.16"
|
|
141
141
|
},
|
|
142
142
|
"devDependencies": {
|
|
143
|
-
"solid-js": "2.0.0-beta.
|
|
143
|
+
"solid-js": "2.0.0-beta.16"
|
|
144
144
|
},
|
|
145
145
|
"scripts": {
|
|
146
146
|
"build": "npm-run-all -nl build:clean types:copy-jsx build:js",
|
|
@@ -149,9 +149,9 @@
|
|
|
149
149
|
"link": "symlink-dir . node_modules/@solidjs/web",
|
|
150
150
|
"types": "npm-run-all -nl types:clean types:copy-jsx types:web types:copy-web types:web-storage types:cjs",
|
|
151
151
|
"types:clean": "rimraf types/ types-cjs/ storage/types-cjs/",
|
|
152
|
-
"types:copy-jsx": "ncp ../../node_modules
|
|
152
|
+
"types:copy-jsx": "ncp ../../node_modules/@dom-expressions/runtime/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/jsx-properties.d.ts ./src/jsx-properties.d.ts && dom-expressions-jsx-types --input ./src/jsx.d.ts --element \"SolidElement | Node | ArrayElement\" --import 'import type { Element as SolidElement } from \"solid-js\";'",
|
|
153
153
|
"types:web": "tsc --project ./tsconfig.build.json",
|
|
154
|
-
"types:copy-web": "ncp ../../node_modules
|
|
154
|
+
"types:copy-web": "ncp ../../node_modules/@dom-expressions/runtime/src/client.d.ts ./types/client.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/server.d.ts ./types/server.d.ts && ncp ./src/jsx.d.ts ./types/jsx.d.ts && ncp ./src/jsx-properties.d.ts ./types/jsx-properties.d.ts",
|
|
155
155
|
"types:web-storage": "tsc --project ./storage/tsconfig.build.json",
|
|
156
156
|
"types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs ./storage/types ./storage/types-cjs",
|
|
157
157
|
"test": "vitest run && vitest run --config vite.config.server.mjs && vitest run --config vite.config.hydrate.mjs",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "dom-expressions/src/client.js";
|
|
1
|
+
export * from "@dom-expressions/runtime/src/client.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "dom-expressions/src/client.js";
|
|
1
|
+
export * from "@dom-expressions/runtime/src/client.js";
|
package/types/client.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export function render(
|
|
|
23
23
|
* - `2` — the template html is wrapped; the outer tag is stripped at clone time.
|
|
24
24
|
*/
|
|
25
25
|
export function template(html: string, flag?: 1 | 2): () => Element;
|
|
26
|
+
export function scope<T extends () => any>(fn: T): T;
|
|
26
27
|
export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
|
|
27
28
|
export function memo<T>(fn: () => T, equal: boolean): () => T;
|
|
28
29
|
export function untrack<T>(fn: () => T): T;
|
package/types/core.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError } from "solid-js";
|
|
1
|
+
export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrScope } from "solid-js";
|
|
2
2
|
export declare const effect: (fn: any, effectFn: any, options: any) => void;
|
|
3
3
|
export declare const memo: (fn: any) => import("solid-js").SourceAccessor<any>;
|
package/types/server.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export function ssrStyle(value: string | { [k: string]: string }): string;
|
|
|
75
75
|
export function ssrStyleProperty(name: string, value: any): string;
|
|
76
76
|
export function ssrAttribute(key: string, value: any): string;
|
|
77
77
|
export function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
78
|
+
export function scope<T>(fn: () => T): () => unknown;
|
|
78
79
|
export function ssrHydrationKey(): string;
|
|
79
80
|
export function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
80
81
|
export function escape(s: any, attr?: boolean): any;
|
package/types-cjs/client.d.cts
CHANGED
|
@@ -23,6 +23,7 @@ export function render(
|
|
|
23
23
|
* - `2` — the template html is wrapped; the outer tag is stripped at clone time.
|
|
24
24
|
*/
|
|
25
25
|
export function template(html: string, flag?: 1 | 2): () => Element;
|
|
26
|
+
export function scope<T extends () => any>(fn: T): T;
|
|
26
27
|
export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void): void;
|
|
27
28
|
export function memo<T>(fn: () => T, equal: boolean): () => T;
|
|
28
29
|
export function untrack<T>(fn: () => T): T;
|
package/types-cjs/core.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError } from "solid-js";
|
|
1
|
+
export { getOwner, runWithOwner, createComponent, createRoot as root, sharedConfig, untrack, merge as mergeProps, flatten, ssrHandleError, ssrScope } from "solid-js";
|
|
2
2
|
export declare const effect: (fn: any, effectFn: any, options: any) => void;
|
|
3
3
|
export declare const memo: (fn: any) => import("solid-js").SourceAccessor<any>;
|
package/types-cjs/server.d.cts
CHANGED
|
@@ -75,6 +75,7 @@ export function ssrStyle(value: string | { [k: string]: string }): string;
|
|
|
75
75
|
export function ssrStyleProperty(name: string, value: any): string;
|
|
76
76
|
export function ssrAttribute(key: string, value: any): string;
|
|
77
77
|
export function ssrGroup<T extends () => any[]>(fn: T, n: number): T;
|
|
78
|
+
export function scope<T>(fn: () => T): () => unknown;
|
|
78
79
|
export function ssrHydrationKey(): string;
|
|
79
80
|
export function resolveSSRNode(node: any, result?: any, top?: boolean): any;
|
|
80
81
|
export function escape(s: any, attr?: boolean): any;
|