@solidjs/web 2.0.0-beta.14 → 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 +154 -52
- package/dist/dev.js +155 -54
- package/dist/server.cjs +97 -67
- package/dist/server.js +92 -69
- package/dist/web.cjs +154 -52
- package/dist/web.js +155 -54
- 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 +12 -1
- package/types/core.d.ts +1 -1
- package/types/jsx.d.ts +5 -1
- package/types/server.d.ts +1 -0
- package/types-cjs/client.d.cts +12 -1
- package/types-cjs/core.d.cts +1 -1
- package/types-cjs/jsx.d.cts +5 -1
- package/types-cjs/server.d.cts +1 -0
package/dist/web.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, createEffect, enableHydration, flush } from 'solid-js';
|
|
1
|
+
import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, getOwner, createEffect, enableHydration, flush } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const DOMWithState = {
|
|
@@ -31,6 +31,7 @@ const DOMWithState = {
|
|
|
31
31
|
};
|
|
32
32
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
33
33
|
const $$SLOT = /*#__PURE__*/Symbol("slot");
|
|
34
|
+
const $$HOST = /*#__PURE__*/Symbol("host");
|
|
34
35
|
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
35
36
|
const SVGElements = /*#__PURE__*/new Set([
|
|
36
37
|
"altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
|
|
@@ -58,9 +59,9 @@ const syncOptions = {
|
|
|
58
59
|
sync: true
|
|
59
60
|
};
|
|
60
61
|
const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
|
|
61
|
-
transparent: true,
|
|
62
62
|
sync: true,
|
|
63
|
-
...options
|
|
63
|
+
...options,
|
|
64
|
+
transparent: !options.scope
|
|
64
65
|
} : transparentOptions);
|
|
65
66
|
const memo = fn => createMemo(() => fn(), syncOptions);
|
|
66
67
|
|
|
@@ -328,20 +329,41 @@ function addEvent(node, name, handler, delegate) {
|
|
|
328
329
|
}
|
|
329
330
|
function style(node, value, prev) {
|
|
330
331
|
if (!value) {
|
|
331
|
-
if (prev
|
|
332
|
+
if (prev || node._$styles) {
|
|
333
|
+
setAttribute(node, "style");
|
|
334
|
+
node._$styles = undefined;
|
|
335
|
+
}
|
|
332
336
|
return;
|
|
333
337
|
}
|
|
334
338
|
const nodeStyle = node.style;
|
|
335
|
-
if (typeof value === "string")
|
|
336
|
-
|
|
337
|
-
|
|
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
|
+
}
|
|
338
353
|
let v, s;
|
|
354
|
+
for (s in applied) {
|
|
355
|
+
if (value[s] == null) {
|
|
356
|
+
nodeStyle.removeProperty(s);
|
|
357
|
+
delete applied[s];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
339
360
|
for (s in value) {
|
|
340
361
|
v = value[s];
|
|
341
|
-
if (v !==
|
|
342
|
-
|
|
362
|
+
if (v != null && v !== applied[s]) {
|
|
363
|
+
nodeStyle.setProperty(s, v);
|
|
364
|
+
applied[s] = v;
|
|
365
|
+
}
|
|
343
366
|
}
|
|
344
|
-
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
345
367
|
}
|
|
346
368
|
function setStyleProperty(node, name, value) {
|
|
347
369
|
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
@@ -380,22 +402,36 @@ function ref(fn, element) {
|
|
|
380
402
|
const resolved = untrack(fn);
|
|
381
403
|
runWithOwner(null, () => applyRef(resolved, element));
|
|
382
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
|
+
}
|
|
383
420
|
function insert(parent, accessor, marker, initial, options) {
|
|
384
421
|
const multi = marker !== undefined;
|
|
422
|
+
const host = options && options.host;
|
|
385
423
|
if (multi && !initial) initial = [];
|
|
386
424
|
if (isHydrating(parent)) {
|
|
387
425
|
if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
|
|
388
|
-
if (Array.isArray(initial))
|
|
389
|
-
let j = 0;
|
|
390
|
-
for (let i = 0; i < initial.length; i++) {
|
|
391
|
-
if (initial[i].nodeType === 8 && initial[i].nodeValue === "!$") initial[i].remove();else initial[j++] = initial[i];
|
|
392
|
-
}
|
|
393
|
-
initial.length = j;
|
|
394
|
-
}
|
|
426
|
+
if (Array.isArray(initial)) stripTextSeparators(initial);
|
|
395
427
|
}
|
|
396
428
|
if (typeof accessor !== "function") {
|
|
397
429
|
accessor = normalize(accessor, initial, multi, true);
|
|
398
|
-
if (typeof accessor !== "function")
|
|
430
|
+
if (typeof accessor !== "function") {
|
|
431
|
+
insertExpression(parent, accessor, initial, marker);
|
|
432
|
+
host && tagHost(accessor, host);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
399
435
|
}
|
|
400
436
|
if (multi && initial.length === 0) {
|
|
401
437
|
const placeholder = document.createTextNode("");
|
|
@@ -403,12 +439,37 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
403
439
|
initial = [placeholder];
|
|
404
440
|
}
|
|
405
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
|
+
}
|
|
406
465
|
effect(prev => {
|
|
466
|
+
reclaimSwappedRegion();
|
|
407
467
|
const value = normalize(accessor(), current, multi, true);
|
|
408
468
|
if (typeof value !== "function") return value;
|
|
409
|
-
effect(() => normalize(value, current, multi), inner => {
|
|
469
|
+
effect(() => (reclaimSwappedRegion(), normalize(value, current, multi)), inner => {
|
|
410
470
|
insertExpression(parent, inner, current, marker);
|
|
411
471
|
current = inner;
|
|
472
|
+
host && tagHost(current, host);
|
|
412
473
|
}, prev !== undefined && !(options && options.schedule) ? {
|
|
413
474
|
...options,
|
|
414
475
|
schedule: true
|
|
@@ -418,7 +479,12 @@ function insert(parent, accessor, marker, initial, options) {
|
|
|
418
479
|
if (value === INNER_OWNED) return;
|
|
419
480
|
insertExpression(parent, value, current, marker);
|
|
420
481
|
current = value;
|
|
421
|
-
|
|
482
|
+
host && tagHost(current, host);
|
|
483
|
+
},
|
|
484
|
+
accessor.$s ? options ? {
|
|
485
|
+
...options,
|
|
486
|
+
scope: true
|
|
487
|
+
} : SCOPE_OPTIONS : options);
|
|
422
488
|
}
|
|
423
489
|
function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
424
490
|
const nodeName = node.nodeName;
|
|
@@ -447,6 +513,9 @@ function loadModuleAssets(mapping) {
|
|
|
447
513
|
if (!hy.loading[moduleUrl]) {
|
|
448
514
|
hy.loading[moduleUrl] = import(entryUrl).then(mod => {
|
|
449
515
|
hy.modules[moduleUrl] = mod;
|
|
516
|
+
}, err => {
|
|
517
|
+
delete hy.loading[moduleUrl];
|
|
518
|
+
throw err;
|
|
450
519
|
});
|
|
451
520
|
}
|
|
452
521
|
pending.push(hy.loading[moduleUrl]);
|
|
@@ -494,8 +563,11 @@ function hydrate$1(code, element, options = {}) {
|
|
|
494
563
|
} finally {
|
|
495
564
|
sharedConfig.hydrating = false;
|
|
496
565
|
}
|
|
497
|
-
},
|
|
566
|
+
}, err => {
|
|
567
|
+
console.error("Hydration module preload failed, falling back to client render:", err);
|
|
498
568
|
sharedConfig.hydrating = false;
|
|
569
|
+
sharedConfig.registry = undefined;
|
|
570
|
+
disposer = render$1(code, element, [...element.childNodes], options);
|
|
499
571
|
});
|
|
500
572
|
return () => disposer && disposer();
|
|
501
573
|
}
|
|
@@ -565,17 +637,32 @@ function runHydrationEvents() {
|
|
|
565
637
|
const [el, e] = events[0];
|
|
566
638
|
if (!completed.has(el)) return;
|
|
567
639
|
events.shift();
|
|
568
|
-
let
|
|
640
|
+
let matchContainer, matchState, matchDistance, matches;
|
|
569
641
|
for (const [container, state] of delegatedContainers) {
|
|
570
642
|
if (!state.handlers.has(e.type)) continue;
|
|
571
643
|
const entry = findOwner(e.target, state);
|
|
572
|
-
if (
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|
+
}
|
|
577
661
|
}
|
|
578
|
-
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);
|
|
579
666
|
}
|
|
580
667
|
if (sharedConfig.done) {
|
|
581
668
|
sharedConfig.events = _$HY.events = null;
|
|
@@ -646,11 +733,16 @@ function eventHandler(e, container, state) {
|
|
|
646
733
|
if (sharedConfig.registry && sharedConfig.events) {
|
|
647
734
|
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
648
735
|
}
|
|
649
|
-
|
|
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
|
+
}
|
|
650
742
|
const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
|
|
651
743
|
if (state && !owner) return;
|
|
652
744
|
e[$$EVENT_OWNER] = owner || true;
|
|
653
|
-
let node = e.target;
|
|
745
|
+
let node = resumeNode || e.target;
|
|
654
746
|
const key = `$$${e.type}`;
|
|
655
747
|
const oriTarget = e.target;
|
|
656
748
|
const boundary = owner || container || e.currentTarget;
|
|
@@ -680,7 +772,10 @@ function eventHandler(e, container, state) {
|
|
|
680
772
|
return node || boundary || document;
|
|
681
773
|
}
|
|
682
774
|
});
|
|
683
|
-
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) {
|
|
684
779
|
const path = e.composedPath();
|
|
685
780
|
if (path.length) {
|
|
686
781
|
retarget(path[0]);
|
|
@@ -755,6 +850,17 @@ function normalize(value, current, multi, doNotUnwrap) {
|
|
|
755
850
|
}
|
|
756
851
|
return value;
|
|
757
852
|
}
|
|
853
|
+
function tagHost(value, host) {
|
|
854
|
+
if (Array.isArray(value)) {
|
|
855
|
+
for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
|
|
856
|
+
} else if (value && value.nodeType && value[$$HOST] !== host) {
|
|
857
|
+
value[$$HOST] = host;
|
|
858
|
+
Object.defineProperty(value, "_$host", {
|
|
859
|
+
get: host,
|
|
860
|
+
configurable: true
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
}
|
|
758
864
|
function appendNodes(parent, array, marker = null) {
|
|
759
865
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
760
866
|
const n = array[i];
|
|
@@ -837,21 +943,33 @@ function Portal(props) {
|
|
|
837
943
|
const treeMarker = document.createTextNode(""),
|
|
838
944
|
startMarker = document.createTextNode(""),
|
|
839
945
|
endMarker = document.createTextNode(""),
|
|
840
|
-
mount = () =>
|
|
946
|
+
mount = () => props.mount || document.body,
|
|
841
947
|
content = createMemo(() => [startMarker, props.children]);
|
|
842
|
-
createRenderEffect(
|
|
948
|
+
createRenderEffect(
|
|
949
|
+
() => [mount(), content(), getOwner()], ([, c, owner]) => {
|
|
950
|
+
const m = untrack(mount);
|
|
843
951
|
m.appendChild(endMarker);
|
|
844
|
-
|
|
952
|
+
const dispose = runWithOwner(owner, () => createRoot(d => {
|
|
953
|
+
insert(m, c, endMarker, undefined, {
|
|
954
|
+
host: () => treeMarker.parentNode
|
|
955
|
+
});
|
|
956
|
+
return d;
|
|
957
|
+
}));
|
|
845
958
|
return () => {
|
|
959
|
+
dispose();
|
|
846
960
|
let c = startMarker;
|
|
847
|
-
while (c
|
|
961
|
+
while (c) {
|
|
848
962
|
const n = c.nextSibling;
|
|
849
963
|
m.removeChild(c);
|
|
964
|
+
if (c === endMarker) break;
|
|
850
965
|
c = n;
|
|
851
966
|
}
|
|
852
967
|
};
|
|
968
|
+
}, {
|
|
969
|
+
schedule: true
|
|
853
970
|
});
|
|
854
|
-
createEffect(mount,
|
|
971
|
+
createEffect(mount, () => {
|
|
972
|
+
const m = untrack(mount);
|
|
855
973
|
const ownerRoot = getDelegatedRoot(treeMarker);
|
|
856
974
|
if (!ownerRoot || ownerRoot.contains(m)) return;
|
|
857
975
|
registerDelegatedContainer(m, ownerRoot);
|
|
@@ -886,22 +1004,5 @@ function createElement(tagName, is = undefined) {
|
|
|
886
1004
|
is
|
|
887
1005
|
});
|
|
888
1006
|
}
|
|
889
|
-
function createElementProxy(el, marker) {
|
|
890
|
-
return new Proxy(el, {
|
|
891
|
-
get(target, prop) {
|
|
892
|
-
if (prop === "appendChild" || prop === "insertBefore") {
|
|
893
|
-
return (...args) => {
|
|
894
|
-
Object.defineProperty(args[0], "_$host", {
|
|
895
|
-
get: () => marker.parentNode,
|
|
896
|
-
configurable: true
|
|
897
|
-
});
|
|
898
|
-
target[prop](...args);
|
|
899
|
-
};
|
|
900
|
-
}
|
|
901
|
-
const value = Reflect.get(target, prop);
|
|
902
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
903
|
-
}
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
1007
|
|
|
907
|
-
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;
|
|
@@ -30,7 +31,17 @@ export function insert<T>(
|
|
|
30
31
|
parent: MountableElement,
|
|
31
32
|
accessor: (() => T) | T,
|
|
32
33
|
marker?: Node | null,
|
|
33
|
-
init?: JSX.Element
|
|
34
|
+
init?: JSX.Element,
|
|
35
|
+
options?: {
|
|
36
|
+
/**
|
|
37
|
+
* Live accessor for the slot's logical host in the source tree (portals).
|
|
38
|
+
* Each top-level node the slot manages is tagged with a `_$host` getter
|
|
39
|
+
* backed by this accessor so delegated events retarget correctly.
|
|
40
|
+
*/
|
|
41
|
+
host?: () => Node | null;
|
|
42
|
+
/** Defer the insert effect to the queue instead of running it inline. */
|
|
43
|
+
schedule?: boolean;
|
|
44
|
+
}
|
|
34
45
|
): JSX.Element;
|
|
35
46
|
export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
36
47
|
export function delegateEvents(eventNames: string[]): void;
|
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/jsx.d.ts
CHANGED
|
@@ -226,8 +226,12 @@ export namespace JSX {
|
|
|
226
226
|
|
|
227
227
|
export type ClassValue =
|
|
228
228
|
| string
|
|
229
|
+
| number
|
|
230
|
+
| boolean
|
|
231
|
+
| null
|
|
232
|
+
| undefined
|
|
229
233
|
| Record<string, boolean>
|
|
230
|
-
|
|
|
234
|
+
| ClassValue[];
|
|
231
235
|
|
|
232
236
|
const SERIALIZABLE: unique symbol;
|
|
233
237
|
interface SerializableAttributeValue {
|
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;
|
|
@@ -30,7 +31,17 @@ export function insert<T>(
|
|
|
30
31
|
parent: MountableElement,
|
|
31
32
|
accessor: (() => T) | T,
|
|
32
33
|
marker?: Node | null,
|
|
33
|
-
init?: JSX.Element
|
|
34
|
+
init?: JSX.Element,
|
|
35
|
+
options?: {
|
|
36
|
+
/**
|
|
37
|
+
* Live accessor for the slot's logical host in the source tree (portals).
|
|
38
|
+
* Each top-level node the slot manages is tagged with a `_$host` getter
|
|
39
|
+
* backed by this accessor so delegated events retarget correctly.
|
|
40
|
+
*/
|
|
41
|
+
host?: () => Node | null;
|
|
42
|
+
/** Defer the insert effect to the queue instead of running it inline. */
|
|
43
|
+
schedule?: boolean;
|
|
44
|
+
}
|
|
34
45
|
): JSX.Element;
|
|
35
46
|
export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
36
47
|
export function delegateEvents(eventNames: string[]): void;
|
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/jsx.d.cts
CHANGED
|
@@ -226,8 +226,12 @@ export namespace JSX {
|
|
|
226
226
|
|
|
227
227
|
export type ClassValue =
|
|
228
228
|
| string
|
|
229
|
+
| number
|
|
230
|
+
| boolean
|
|
231
|
+
| null
|
|
232
|
+
| undefined
|
|
229
233
|
| Record<string, boolean>
|
|
230
|
-
|
|
|
234
|
+
| ClassValue[];
|
|
231
235
|
|
|
232
236
|
const SERIALIZABLE: unique symbol;
|
|
233
237
|
interface SerializableAttributeValue {
|
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;
|