solid-js 1.8.23 → 1.9.0
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/h/jsx-runtime/types/index.d.ts +2 -2
- package/h/jsx-runtime/types/jsx.d.ts +22 -1
- package/h/types/index.d.ts +1 -1
- package/html/dist/html.cjs +4 -2
- package/html/dist/html.js +9 -4
- package/html/types/index.d.ts +1 -1
- package/html/types/lit.d.ts +6 -1
- package/package.json +1 -5
- package/store/dist/server.cjs +4 -0
- package/store/dist/server.js +4 -0
- package/store/package.json +0 -4
- package/store/types/server.d.ts +14 -1
- package/store/types/store.d.ts +1 -1
- package/types/jsx.d.ts +22 -1
- package/types/reactive/signal.d.ts +2 -2
- package/web/dist/dev.cjs +56 -24
- package/web/dist/dev.js +58 -23
- package/web/dist/server.cjs +95 -14
- package/web/dist/server.js +472 -15
- package/web/dist/web.cjs +52 -23
- package/web/dist/web.js +50 -21
- package/web/package.json +0 -4
- package/web/types/client.d.ts +3 -1
- package/web/types/server.d.ts +88 -0
package/web/dist/web.js
CHANGED
|
@@ -565,14 +565,14 @@ function render(code, element, init, options = {}) {
|
|
|
565
565
|
element.textContent = "";
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
|
-
function template(html,
|
|
568
|
+
function template(html, isImportNode, isSVG) {
|
|
569
569
|
let node;
|
|
570
570
|
const create = () => {
|
|
571
571
|
const t = document.createElement("template");
|
|
572
572
|
t.innerHTML = html;
|
|
573
573
|
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
574
574
|
};
|
|
575
|
-
const fn =
|
|
575
|
+
const fn = isImportNode
|
|
576
576
|
? () => untrack(() => document.importNode(node || (node = create()), true))
|
|
577
577
|
: () => (node || (node = create())).cloneNode(true);
|
|
578
578
|
fn.cloneNode = fn;
|
|
@@ -608,6 +608,10 @@ function setAttributeNS(node, namespace, name, value) {
|
|
|
608
608
|
if (value == null) node.removeAttributeNS(namespace, name);
|
|
609
609
|
else node.setAttributeNS(namespace, name, value);
|
|
610
610
|
}
|
|
611
|
+
function setBoolAttribute(node, name, value) {
|
|
612
|
+
if (isHydrating(node)) return;
|
|
613
|
+
value ? node.setAttribute(name, "") : node.removeAttribute(name);
|
|
614
|
+
}
|
|
611
615
|
function className(node, value) {
|
|
612
616
|
if (isHydrating(node)) return;
|
|
613
617
|
if (value == null) node.removeAttribute("class");
|
|
@@ -622,7 +626,7 @@ function addEventListener(node, name, handler, delegate) {
|
|
|
622
626
|
} else if (Array.isArray(handler)) {
|
|
623
627
|
const handlerFn = handler[0];
|
|
624
628
|
node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
|
|
625
|
-
} else node.addEventListener(name, handler);
|
|
629
|
+
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
626
630
|
}
|
|
627
631
|
function classList(node, value, prev = {}) {
|
|
628
632
|
const classKeys = Object.keys(value || {}),
|
|
@@ -698,7 +702,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
698
702
|
for (const prop in prevProps) {
|
|
699
703
|
if (!(prop in props)) {
|
|
700
704
|
if (prop === "children") continue;
|
|
701
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
|
|
705
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
|
|
702
706
|
}
|
|
703
707
|
}
|
|
704
708
|
for (const prop in props) {
|
|
@@ -707,7 +711,7 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
707
711
|
continue;
|
|
708
712
|
}
|
|
709
713
|
const value = props[prop];
|
|
710
|
-
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
|
|
714
|
+
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
|
|
711
715
|
}
|
|
712
716
|
}
|
|
713
717
|
function hydrate$1(code, element, options = {}) {
|
|
@@ -795,7 +799,7 @@ function toggleClassKey(node, key, value) {
|
|
|
795
799
|
for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
|
|
796
800
|
node.classList.toggle(classNames[i], value);
|
|
797
801
|
}
|
|
798
|
-
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
802
|
+
function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
799
803
|
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
800
804
|
if (prop === "style") return style(node, value, prev);
|
|
801
805
|
if (prop === "classList") return classList(node, value, prev);
|
|
@@ -804,8 +808,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
804
808
|
if (!skipRef) value(node);
|
|
805
809
|
} else if (prop.slice(0, 3) === "on:") {
|
|
806
810
|
const e = prop.slice(3);
|
|
807
|
-
prev && node.removeEventListener(e, prev);
|
|
808
|
-
value && node.addEventListener(e, value);
|
|
811
|
+
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
812
|
+
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
809
813
|
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
810
814
|
const e = prop.slice(10);
|
|
811
815
|
prev && node.removeEventListener(e, prev, true);
|
|
@@ -823,12 +827,14 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
823
827
|
}
|
|
824
828
|
} else if (prop.slice(0, 5) === "attr:") {
|
|
825
829
|
setAttribute(node, prop.slice(5), value);
|
|
830
|
+
} else if (prop.slice(0, 5) === "bool:") {
|
|
831
|
+
setBoolAttribute(node, prop.slice(5), value);
|
|
826
832
|
} else if (
|
|
827
833
|
(forceProp = prop.slice(0, 5) === "prop:") ||
|
|
828
834
|
(isChildProp = ChildProperties.has(prop)) ||
|
|
829
835
|
(!isSVG &&
|
|
830
836
|
((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
|
|
831
|
-
(isCE = node.nodeName.includes("-"))
|
|
837
|
+
(isCE = node.nodeName.includes("-") || "is" in props)
|
|
832
838
|
) {
|
|
833
839
|
if (forceProp) {
|
|
834
840
|
prop = prop.slice(5);
|
|
@@ -848,14 +854,28 @@ function eventHandler(e) {
|
|
|
848
854
|
if (sharedConfig.registry && sharedConfig.events) {
|
|
849
855
|
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
850
856
|
}
|
|
857
|
+
let node = e.target;
|
|
851
858
|
const key = `$$${e.type}`;
|
|
852
|
-
|
|
853
|
-
|
|
859
|
+
const oriTarget = e.target;
|
|
860
|
+
const oriCurrentTarget = e.currentTarget;
|
|
861
|
+
const retarget = value =>
|
|
854
862
|
Object.defineProperty(e, "target", {
|
|
855
863
|
configurable: true,
|
|
856
|
-
value
|
|
864
|
+
value
|
|
857
865
|
});
|
|
858
|
-
|
|
866
|
+
const handleNode = () => {
|
|
867
|
+
const handler = node[key];
|
|
868
|
+
if (handler && !node.disabled) {
|
|
869
|
+
const data = node[`${key}Data`];
|
|
870
|
+
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
871
|
+
if (e.cancelBubble) return;
|
|
872
|
+
}
|
|
873
|
+
node.host && node.contains(e.target) && !node.host._$host && retarget(node.host);
|
|
874
|
+
return true;
|
|
875
|
+
};
|
|
876
|
+
const walkUpTree = () => {
|
|
877
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host));
|
|
878
|
+
};
|
|
859
879
|
Object.defineProperty(e, "currentTarget", {
|
|
860
880
|
configurable: true,
|
|
861
881
|
get() {
|
|
@@ -863,15 +883,23 @@ function eventHandler(e) {
|
|
|
863
883
|
}
|
|
864
884
|
});
|
|
865
885
|
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
866
|
-
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
if (
|
|
886
|
+
if (e.composedPath) {
|
|
887
|
+
const path = e.composedPath();
|
|
888
|
+
retarget(path[0]);
|
|
889
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
890
|
+
node = path[i];
|
|
891
|
+
if (!handleNode()) break;
|
|
892
|
+
if (node._$host) {
|
|
893
|
+
node = node._$host;
|
|
894
|
+
walkUpTree();
|
|
895
|
+
break;
|
|
896
|
+
}
|
|
897
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
872
900
|
}
|
|
873
|
-
|
|
874
|
-
|
|
901
|
+
} else walkUpTree();
|
|
902
|
+
retarget(oriTarget);
|
|
875
903
|
}
|
|
876
904
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
877
905
|
const hydrating = isHydrating(parent);
|
|
@@ -1171,6 +1199,7 @@ export {
|
|
|
1171
1199
|
runHydrationEvents,
|
|
1172
1200
|
setAttribute,
|
|
1173
1201
|
setAttributeNS,
|
|
1202
|
+
setBoolAttribute,
|
|
1174
1203
|
setProperty,
|
|
1175
1204
|
spread,
|
|
1176
1205
|
ssr,
|
package/web/package.json
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
"name": "solid-js/web",
|
|
3
3
|
"main": "./dist/server.cjs",
|
|
4
4
|
"module": "./dist/server.js",
|
|
5
|
-
"browser": {
|
|
6
|
-
"./dist/server.cjs": "./dist/web.cjs",
|
|
7
|
-
"./dist/server.js": "./dist/web.js"
|
|
8
|
-
},
|
|
9
5
|
"unpkg": "./dist/web.cjs",
|
|
10
6
|
"types": "./types/index.d.ts",
|
|
11
7
|
"type": "module",
|
package/web/types/client.d.ts
CHANGED
|
@@ -32,12 +32,13 @@ export function spread<T>(
|
|
|
32
32
|
export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
|
|
33
33
|
export function setAttribute(node: Element, name: string, value: string): void;
|
|
34
34
|
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
35
|
+
export function setBoolAttribute(node: Element, name: string, value: any): void;
|
|
35
36
|
export function className(node: Element, value: string): void;
|
|
36
37
|
export function setProperty(node: Element, name: string, value: any): void;
|
|
37
38
|
export function addEventListener(
|
|
38
39
|
node: Element,
|
|
39
40
|
name: string,
|
|
40
|
-
handler: (
|
|
41
|
+
handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions),
|
|
41
42
|
delegate: boolean
|
|
42
43
|
): void;
|
|
43
44
|
export function classList(
|
|
@@ -75,3 +76,4 @@ export interface RequestEvent {
|
|
|
75
76
|
}
|
|
76
77
|
export declare const RequestContext: unique symbol;
|
|
77
78
|
export function getRequestEvent(): RequestEvent | undefined;
|
|
79
|
+
export function runHydrationEvents(): void;
|
package/web/types/server.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import { JSX } from "./jsx.js";
|
|
2
|
+
export const Aliases: Record<string, string>;
|
|
3
|
+
export const Properties: Set<string>;
|
|
4
|
+
export const ChildProperties: Set<string>;
|
|
5
|
+
export const DelegatedEvents: Set<string>;
|
|
6
|
+
export const DOMElements: Set<string>;
|
|
7
|
+
export const SVGElements: Set<string>;
|
|
8
|
+
export const SVGNamespace: Record<string, string>;
|
|
9
|
+
export function getPropAlias(prop: string, tagName: string): string | undefined;
|
|
10
|
+
|
|
11
|
+
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
12
|
+
|
|
1
13
|
export function renderToString<T>(
|
|
2
14
|
fn: () => T,
|
|
3
15
|
options?: {
|
|
@@ -87,3 +99,79 @@ export function pipeToNodeWritable<T>(
|
|
|
87
99
|
onCompleteAll?: () => void;
|
|
88
100
|
}
|
|
89
101
|
): void;
|
|
102
|
+
|
|
103
|
+
export function untrack<T>(fn: () => T): T;
|
|
104
|
+
|
|
105
|
+
// client-only APIs
|
|
106
|
+
|
|
107
|
+
/** @deprecated not supported on the server side */
|
|
108
|
+
export function classList(
|
|
109
|
+
node: Element,
|
|
110
|
+
value: { [k: string]: boolean },
|
|
111
|
+
prev?: { [k: string]: boolean }
|
|
112
|
+
): { [k: string]: boolean };
|
|
113
|
+
|
|
114
|
+
/** @deprecated not supported on the server side */
|
|
115
|
+
export function style(
|
|
116
|
+
node: Element,
|
|
117
|
+
value: { [k: string]: string },
|
|
118
|
+
prev?: { [k: string]: string }
|
|
119
|
+
): void;
|
|
120
|
+
|
|
121
|
+
/** @deprecated not supported on the server side */
|
|
122
|
+
export function insert<T>(
|
|
123
|
+
parent: MountableElement,
|
|
124
|
+
accessor: (() => T) | T,
|
|
125
|
+
marker?: Node | null,
|
|
126
|
+
init?: JSX.Element
|
|
127
|
+
): JSX.Element;
|
|
128
|
+
|
|
129
|
+
/** @deprecated not supported on the server side */
|
|
130
|
+
export function spread<T>(
|
|
131
|
+
node: Element,
|
|
132
|
+
accessor: (() => T) | T,
|
|
133
|
+
isSVG?: Boolean,
|
|
134
|
+
skipChildren?: Boolean
|
|
135
|
+
): void;
|
|
136
|
+
|
|
137
|
+
/** @deprecated not supported on the server side */
|
|
138
|
+
export function delegateEvents(eventNames: string[], d?: Document): void;
|
|
139
|
+
/** @deprecated not supported on the server side */
|
|
140
|
+
export function dynamicProperty(props: unknown, key: string): unknown;
|
|
141
|
+
/** @deprecated not supported on the server side */
|
|
142
|
+
export function setAttribute(node: Element, name: string, value: string): void;
|
|
143
|
+
/** @deprecated not supported on the server side */
|
|
144
|
+
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
145
|
+
|
|
146
|
+
/** @deprecated not supported on the server side */
|
|
147
|
+
export function addEventListener(
|
|
148
|
+
node: Element,
|
|
149
|
+
name: string,
|
|
150
|
+
handler: () => void,
|
|
151
|
+
delegate: boolean
|
|
152
|
+
): void;
|
|
153
|
+
|
|
154
|
+
/** @deprecated not supported on the server side */
|
|
155
|
+
export function render(code: () => JSX.Element, element: MountableElement): () => void;
|
|
156
|
+
/** @deprecated not supported on the server side */
|
|
157
|
+
export function template(html: string, isCE?: boolean, isSVG?: boolean): () => Element;
|
|
158
|
+
/** @deprecated not supported on the server side */
|
|
159
|
+
export function setProperty(node: Element, name: string, value: any): void;
|
|
160
|
+
/** @deprecated not supported on the server side */
|
|
161
|
+
export function className(node: Element, value: string): void;
|
|
162
|
+
/** @deprecated not supported on the server side */
|
|
163
|
+
export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
|
|
164
|
+
|
|
165
|
+
/** @deprecated not supported on the server side */
|
|
166
|
+
export function hydrate(
|
|
167
|
+
fn: () => JSX.Element,
|
|
168
|
+
node: MountableElement,
|
|
169
|
+
options?: { renderId?: string; owner?: unknown }
|
|
170
|
+
): () => void;
|
|
171
|
+
|
|
172
|
+
/** @deprecated not supported on the server side */
|
|
173
|
+
export function getNextElement(template?: HTMLTemplateElement): Element;
|
|
174
|
+
/** @deprecated not supported on the server side */
|
|
175
|
+
export function getNextMatch(start: Node, elementName: string): Element;
|
|
176
|
+
/** @deprecated not supported on the server side */
|
|
177
|
+
export function getNextMarker(start: Node): [Node, Array<Node>];
|