@solidjs/web 2.0.0-beta.5 → 2.0.0-beta.6
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 +31 -14
- package/dist/dev.js +28 -15
- package/dist/server.cjs +102 -9
- package/dist/server.js +98 -10
- package/dist/web.cjs +31 -14
- package/dist/web.js +28 -15
- package/package.json +5 -5
- package/storage/types/src/index.d.ts +1 -1
- package/types/client.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/server.d.ts +2 -1
package/dist/dev.cjs
CHANGED
|
@@ -6,25 +6,36 @@ var signals = require('@solidjs/signals');
|
|
|
6
6
|
const DOMWithState = {
|
|
7
7
|
INPUT: {
|
|
8
8
|
value: 1,
|
|
9
|
-
|
|
9
|
+
defaultValue: 1,
|
|
10
|
+
checked: 1,
|
|
11
|
+
defaultChecked: 1
|
|
10
12
|
},
|
|
11
13
|
SELECT: {
|
|
12
14
|
value: 1
|
|
13
15
|
},
|
|
14
16
|
OPTION: {
|
|
15
17
|
value: 1,
|
|
16
|
-
selected: 1
|
|
18
|
+
selected: 1,
|
|
19
|
+
defaultSelected: 1
|
|
17
20
|
},
|
|
18
21
|
TEXTAREA: {
|
|
19
|
-
value: 1
|
|
22
|
+
value: 1,
|
|
23
|
+
defaultValue: 1
|
|
20
24
|
},
|
|
21
25
|
VIDEO: {
|
|
22
|
-
muted: 1
|
|
26
|
+
muted: 1,
|
|
27
|
+
defaultMuted: 1
|
|
23
28
|
},
|
|
24
29
|
AUDIO: {
|
|
25
|
-
muted: 1
|
|
30
|
+
muted: 1,
|
|
31
|
+
defaultMuted: 1
|
|
26
32
|
}
|
|
27
33
|
};
|
|
34
|
+
for (const tagName in DOMWithState) {
|
|
35
|
+
for (const propName in DOMWithState[tagName]) {
|
|
36
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
28
39
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
29
40
|
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"]);
|
|
30
41
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -33,7 +44,9 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
33
44
|
"svg", "switch", "symbol", "text", "textPath",
|
|
34
45
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
35
46
|
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
36
|
-
const
|
|
47
|
+
const Namespaces = {
|
|
48
|
+
svg: "http://www.w3.org/2000/svg",
|
|
49
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
37
50
|
xlink: "http://www.w3.org/1999/xlink",
|
|
38
51
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
39
52
|
};
|
|
@@ -289,15 +302,15 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
|
289
302
|
for (const prop in prevProps) {
|
|
290
303
|
if (!(prop in props)) {
|
|
291
304
|
if (prop === "children") continue;
|
|
292
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName
|
|
305
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
293
306
|
}
|
|
294
307
|
}
|
|
295
308
|
for (const prop in props) {
|
|
296
309
|
if (prop === "children") {
|
|
297
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
310
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
298
311
|
continue;
|
|
299
312
|
}
|
|
300
|
-
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName
|
|
313
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
301
314
|
}
|
|
302
315
|
}
|
|
303
316
|
function hydrate$1(code, element, options = {}) {
|
|
@@ -475,7 +488,7 @@ function flattenClassList(list, result) {
|
|
|
475
488
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
476
489
|
}
|
|
477
490
|
}
|
|
478
|
-
function assignProp(node, prop, value, prev, skipRef, nodeName
|
|
491
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
479
492
|
if (prop === "style") return style(node, value, prev), value;
|
|
480
493
|
if (prop === "class") return className(node, value, prev), value;
|
|
481
494
|
if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
|
|
@@ -488,7 +501,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
488
501
|
const e = prop.slice(3);
|
|
489
502
|
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
490
503
|
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
491
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
504
|
+
} else if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
492
505
|
const name = prop.slice(2).toLowerCase();
|
|
493
506
|
const delegate = DelegatedEvents.has(name);
|
|
494
507
|
if (!delegate && prev) {
|
|
@@ -499,11 +512,11 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
499
512
|
addEventListener(node, name, value, delegate);
|
|
500
513
|
delegate && delegateEvents([name]);
|
|
501
514
|
}
|
|
502
|
-
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]
|
|
515
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
503
516
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
504
517
|
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
505
518
|
} else {
|
|
506
|
-
const ns = hasNamespace &&
|
|
519
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
507
520
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
508
521
|
}
|
|
509
522
|
return value;
|
|
@@ -761,6 +774,10 @@ Object.defineProperty(exports, "NoHydration", {
|
|
|
761
774
|
enumerable: true,
|
|
762
775
|
get: function () { return solidJs.NoHydration; }
|
|
763
776
|
});
|
|
777
|
+
Object.defineProperty(exports, "Reveal", {
|
|
778
|
+
enumerable: true,
|
|
779
|
+
get: function () { return solidJs.Reveal; }
|
|
780
|
+
});
|
|
764
781
|
Object.defineProperty(exports, "Show", {
|
|
765
782
|
enumerable: true,
|
|
766
783
|
get: function () { return solidJs.Show; }
|
|
@@ -793,10 +810,10 @@ exports.DelegatedEvents = DelegatedEvents;
|
|
|
793
810
|
exports.Dynamic = Dynamic;
|
|
794
811
|
exports.HydrationScript = voidFn;
|
|
795
812
|
exports.MathMLElements = MathMLElements;
|
|
813
|
+
exports.Namespaces = Namespaces;
|
|
796
814
|
exports.Portal = Portal;
|
|
797
815
|
exports.RequestContext = RequestContext;
|
|
798
816
|
exports.SVGElements = SVGElements;
|
|
799
|
-
exports.SVGNamespace = SVGNamespace;
|
|
800
817
|
exports.addEventListener = addEventListener;
|
|
801
818
|
exports.applyRef = applyRef;
|
|
802
819
|
exports.assign = assign;
|
package/dist/dev.js
CHANGED
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo as createMemo$1, sharedConfig, untrack, runWithOwner, flatten, createRoot, omit, $DEVCOMP, enableHydration, enforceLoadingBoundary } from 'solid-js';
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
3
|
import { createMemo } from '@solidjs/signals';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
7
7
|
value: 1,
|
|
8
|
-
|
|
8
|
+
defaultValue: 1,
|
|
9
|
+
checked: 1,
|
|
10
|
+
defaultChecked: 1
|
|
9
11
|
},
|
|
10
12
|
SELECT: {
|
|
11
13
|
value: 1
|
|
12
14
|
},
|
|
13
15
|
OPTION: {
|
|
14
16
|
value: 1,
|
|
15
|
-
selected: 1
|
|
17
|
+
selected: 1,
|
|
18
|
+
defaultSelected: 1
|
|
16
19
|
},
|
|
17
20
|
TEXTAREA: {
|
|
18
|
-
value: 1
|
|
21
|
+
value: 1,
|
|
22
|
+
defaultValue: 1
|
|
19
23
|
},
|
|
20
24
|
VIDEO: {
|
|
21
|
-
muted: 1
|
|
25
|
+
muted: 1,
|
|
26
|
+
defaultMuted: 1
|
|
22
27
|
},
|
|
23
28
|
AUDIO: {
|
|
24
|
-
muted: 1
|
|
29
|
+
muted: 1,
|
|
30
|
+
defaultMuted: 1
|
|
25
31
|
}
|
|
26
32
|
};
|
|
33
|
+
for (const tagName in DOMWithState) {
|
|
34
|
+
for (const propName in DOMWithState[tagName]) {
|
|
35
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
27
38
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
28
39
|
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"]);
|
|
29
40
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -32,7 +43,9 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
32
43
|
"svg", "switch", "symbol", "text", "textPath",
|
|
33
44
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
34
45
|
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
35
|
-
const
|
|
46
|
+
const Namespaces = {
|
|
47
|
+
svg: "http://www.w3.org/2000/svg",
|
|
48
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
36
49
|
xlink: "http://www.w3.org/1999/xlink",
|
|
37
50
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
38
51
|
};
|
|
@@ -288,15 +301,15 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
|
288
301
|
for (const prop in prevProps) {
|
|
289
302
|
if (!(prop in props)) {
|
|
290
303
|
if (prop === "children") continue;
|
|
291
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName
|
|
304
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
292
305
|
}
|
|
293
306
|
}
|
|
294
307
|
for (const prop in props) {
|
|
295
308
|
if (prop === "children") {
|
|
296
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
309
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
297
310
|
continue;
|
|
298
311
|
}
|
|
299
|
-
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName
|
|
312
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
300
313
|
}
|
|
301
314
|
}
|
|
302
315
|
function hydrate$1(code, element, options = {}) {
|
|
@@ -474,7 +487,7 @@ function flattenClassList(list, result) {
|
|
|
474
487
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
475
488
|
}
|
|
476
489
|
}
|
|
477
|
-
function assignProp(node, prop, value, prev, skipRef, nodeName
|
|
490
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
478
491
|
if (prop === "style") return style(node, value, prev), value;
|
|
479
492
|
if (prop === "class") return className(node, value, prev), value;
|
|
480
493
|
if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
|
|
@@ -487,7 +500,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
487
500
|
const e = prop.slice(3);
|
|
488
501
|
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
489
502
|
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
490
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
503
|
+
} else if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
491
504
|
const name = prop.slice(2).toLowerCase();
|
|
492
505
|
const delegate = DelegatedEvents.has(name);
|
|
493
506
|
if (!delegate && prev) {
|
|
@@ -498,11 +511,11 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
498
511
|
addEventListener(node, name, value, delegate);
|
|
499
512
|
delegate && delegateEvents([name]);
|
|
500
513
|
}
|
|
501
|
-
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]
|
|
514
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
502
515
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
503
516
|
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
504
517
|
} else {
|
|
505
|
-
const ns = hasNamespace &&
|
|
518
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
506
519
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
507
520
|
}
|
|
508
521
|
return value;
|
|
@@ -736,4 +749,4 @@ function Dynamic(props) {
|
|
|
736
749
|
return createDynamic(() => props.component, others);
|
|
737
750
|
}
|
|
738
751
|
|
|
739
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Portal, RequestContext, SVGElements,
|
|
752
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, addEventListener, applyRef, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, voidFn as useAssets };
|
package/dist/server.cjs
CHANGED
|
@@ -5,6 +5,39 @@ var seroval = require('seroval');
|
|
|
5
5
|
var web = require('seroval-plugins/web');
|
|
6
6
|
var signals = require('@solidjs/signals');
|
|
7
7
|
|
|
8
|
+
const DOMWithState = {
|
|
9
|
+
INPUT: {
|
|
10
|
+
value: 1,
|
|
11
|
+
defaultValue: 1,
|
|
12
|
+
checked: 1,
|
|
13
|
+
defaultChecked: 1
|
|
14
|
+
},
|
|
15
|
+
SELECT: {
|
|
16
|
+
value: 1
|
|
17
|
+
},
|
|
18
|
+
OPTION: {
|
|
19
|
+
value: 1,
|
|
20
|
+
selected: 1,
|
|
21
|
+
defaultSelected: 1
|
|
22
|
+
},
|
|
23
|
+
TEXTAREA: {
|
|
24
|
+
value: 1,
|
|
25
|
+
defaultValue: 1
|
|
26
|
+
},
|
|
27
|
+
VIDEO: {
|
|
28
|
+
muted: 1,
|
|
29
|
+
defaultMuted: 1
|
|
30
|
+
},
|
|
31
|
+
AUDIO: {
|
|
32
|
+
muted: 1,
|
|
33
|
+
defaultMuted: 1
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
for (const tagName in DOMWithState) {
|
|
37
|
+
for (const propName in DOMWithState[tagName]) {
|
|
38
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
8
41
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
9
42
|
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"]);
|
|
10
43
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -12,7 +45,10 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
12
45
|
"set", "stop",
|
|
13
46
|
"svg", "switch", "symbol", "text", "textPath",
|
|
14
47
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
15
|
-
const
|
|
48
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
49
|
+
const Namespaces = {
|
|
50
|
+
svg: "http://www.w3.org/2000/svg",
|
|
51
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
16
52
|
xlink: "http://www.w3.org/1999/xlink",
|
|
17
53
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
18
54
|
};
|
|
@@ -140,7 +176,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
140
176
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
141
177
|
}
|
|
142
178
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
143
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e)
|
|
179
|
+
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)if($dfl(e[i]))return e[i];return null}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
144
180
|
function renderToString(code, options = {}) {
|
|
145
181
|
const {
|
|
146
182
|
renderId = "",
|
|
@@ -265,7 +301,29 @@ function renderToStream(code, options = {}) {
|
|
|
265
301
|
let shellCompleted = false;
|
|
266
302
|
let scriptFlushed = false;
|
|
267
303
|
let headStyles;
|
|
304
|
+
const revealGroups = new Map();
|
|
268
305
|
let timer = null;
|
|
306
|
+
const emitTask = task => {
|
|
307
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
308
|
+
scriptFlushed = true;
|
|
309
|
+
};
|
|
310
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
311
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
312
|
+
let group = revealGroups.get(groupOrKeys);
|
|
313
|
+
if (!group) {
|
|
314
|
+
if (!release) return;
|
|
315
|
+
group = {
|
|
316
|
+
order: [],
|
|
317
|
+
keys: new Set(),
|
|
318
|
+
released: true
|
|
319
|
+
};
|
|
320
|
+
revealGroups.set(groupOrKeys, group);
|
|
321
|
+
} else if (release) group.released = true;
|
|
322
|
+
if (!group.order.length) return;
|
|
323
|
+
const keys = group.order.slice();
|
|
324
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
325
|
+
return keys;
|
|
326
|
+
}
|
|
269
327
|
let rootHoles = null;
|
|
270
328
|
let nextHoleId = 0;
|
|
271
329
|
let buffer = {
|
|
@@ -315,7 +373,26 @@ function renderToStream(code, options = {}) {
|
|
|
315
373
|
escape: escape,
|
|
316
374
|
resolve: resolveSSRNode,
|
|
317
375
|
ssr: ssr,
|
|
318
|
-
registerFragment(key) {
|
|
376
|
+
registerFragment(key, options) {
|
|
377
|
+
const revealGroup = options && options.revealGroup;
|
|
378
|
+
if (revealGroup) {
|
|
379
|
+
let group = revealGroups.get(revealGroup);
|
|
380
|
+
if (!group) {
|
|
381
|
+
group = {
|
|
382
|
+
order: [],
|
|
383
|
+
keys: new Set(),
|
|
384
|
+
released: false
|
|
385
|
+
};
|
|
386
|
+
revealGroups.set(revealGroup, group);
|
|
387
|
+
}
|
|
388
|
+
if (!group.keys.has(key)) {
|
|
389
|
+
group.keys.add(key);
|
|
390
|
+
group.order.push(key);
|
|
391
|
+
}
|
|
392
|
+
if (group.released) {
|
|
393
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
319
396
|
if (!registry.has(key)) {
|
|
320
397
|
let resolve, reject;
|
|
321
398
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -325,7 +402,7 @@ function renderToStream(code, options = {}) {
|
|
|
325
402
|
queue(flushEnd);
|
|
326
403
|
}))
|
|
327
404
|
});
|
|
328
|
-
serializer.write(key, p);
|
|
405
|
+
serializer.write(key + "_fr", p);
|
|
329
406
|
}
|
|
330
407
|
return (value, error) => {
|
|
331
408
|
if (registry.has(key)) {
|
|
@@ -354,9 +431,9 @@ function renderToStream(code, options = {}) {
|
|
|
354
431
|
} else {
|
|
355
432
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
356
433
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
434
|
+
const deferActivation = !!revealGroup;
|
|
357
435
|
if (styles.length) {
|
|
358
|
-
|
|
359
|
-
scriptFlushed = true;
|
|
436
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
360
437
|
writeTasks();
|
|
361
438
|
for (const url of styles) {
|
|
362
439
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -364,8 +441,9 @@ function renderToStream(code, options = {}) {
|
|
|
364
441
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
365
442
|
} else {
|
|
366
443
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
367
|
-
|
|
368
|
-
|
|
444
|
+
if (!deferActivation) {
|
|
445
|
+
emitTask(`$df("${key}")`);
|
|
446
|
+
}
|
|
369
447
|
}
|
|
370
448
|
item.resolve(error);
|
|
371
449
|
}
|
|
@@ -373,6 +451,16 @@ function renderToStream(code, options = {}) {
|
|
|
373
451
|
}
|
|
374
452
|
return firstFlushed;
|
|
375
453
|
};
|
|
454
|
+
},
|
|
455
|
+
revealFragments(groupOrKeys) {
|
|
456
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
457
|
+
if (!keys) return;
|
|
458
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
459
|
+
},
|
|
460
|
+
revealFallbacks(groupOrKeys) {
|
|
461
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
462
|
+
if (!keys) return;
|
|
463
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
376
464
|
}
|
|
377
465
|
};
|
|
378
466
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -883,6 +971,10 @@ Object.defineProperty(exports, "Repeat", {
|
|
|
883
971
|
enumerable: true,
|
|
884
972
|
get: function () { return solidJs.Repeat; }
|
|
885
973
|
});
|
|
974
|
+
Object.defineProperty(exports, "Reveal", {
|
|
975
|
+
enumerable: true,
|
|
976
|
+
get: function () { return solidJs.Reveal; }
|
|
977
|
+
});
|
|
886
978
|
Object.defineProperty(exports, "Show", {
|
|
887
979
|
enumerable: true,
|
|
888
980
|
get: function () { return solidJs.Show; }
|
|
@@ -912,10 +1004,11 @@ exports.DOMElements = DOMElements;
|
|
|
912
1004
|
exports.DelegatedEvents = DelegatedEvents;
|
|
913
1005
|
exports.Dynamic = Dynamic;
|
|
914
1006
|
exports.HydrationScript = HydrationScript;
|
|
1007
|
+
exports.MathMLElements = MathMLElements;
|
|
1008
|
+
exports.Namespaces = Namespaces;
|
|
915
1009
|
exports.Portal = Portal;
|
|
916
1010
|
exports.RequestContext = RequestContext;
|
|
917
1011
|
exports.SVGElements = SVGElements;
|
|
918
|
-
exports.SVGNamespace = SVGNamespace;
|
|
919
1012
|
exports.addEventListener = notSup;
|
|
920
1013
|
exports.applyRef = applyRef;
|
|
921
1014
|
exports.assign = notSup;
|
package/dist/server.js
CHANGED
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo as createMemo$1, sharedConfig, createRoot, ssrHandleError, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
|
|
3
3
|
import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
|
|
4
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
5
5
|
import { createMemo } from '@solidjs/signals';
|
|
6
6
|
|
|
7
|
+
const DOMWithState = {
|
|
8
|
+
INPUT: {
|
|
9
|
+
value: 1,
|
|
10
|
+
defaultValue: 1,
|
|
11
|
+
checked: 1,
|
|
12
|
+
defaultChecked: 1
|
|
13
|
+
},
|
|
14
|
+
SELECT: {
|
|
15
|
+
value: 1
|
|
16
|
+
},
|
|
17
|
+
OPTION: {
|
|
18
|
+
value: 1,
|
|
19
|
+
selected: 1,
|
|
20
|
+
defaultSelected: 1
|
|
21
|
+
},
|
|
22
|
+
TEXTAREA: {
|
|
23
|
+
value: 1,
|
|
24
|
+
defaultValue: 1
|
|
25
|
+
},
|
|
26
|
+
VIDEO: {
|
|
27
|
+
muted: 1,
|
|
28
|
+
defaultMuted: 1
|
|
29
|
+
},
|
|
30
|
+
AUDIO: {
|
|
31
|
+
muted: 1,
|
|
32
|
+
defaultMuted: 1
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
for (const tagName in DOMWithState) {
|
|
36
|
+
for (const propName in DOMWithState[tagName]) {
|
|
37
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
7
40
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
41
|
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"]);
|
|
9
42
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -11,7 +44,10 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
11
44
|
"set", "stop",
|
|
12
45
|
"svg", "switch", "symbol", "text", "textPath",
|
|
13
46
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
14
|
-
const
|
|
47
|
+
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
48
|
+
const Namespaces = {
|
|
49
|
+
svg: "http://www.w3.org/2000/svg",
|
|
50
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
15
51
|
xlink: "http://www.w3.org/1999/xlink",
|
|
16
52
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
17
53
|
};
|
|
@@ -139,7 +175,7 @@ function applyAssetTracking(context, tracking, manifest) {
|
|
|
139
175
|
if (manifest) context.resolveAssets = moduleUrl => resolveAssets(moduleUrl, manifest);
|
|
140
176
|
}
|
|
141
177
|
const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
142
|
-
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(n=document.getElementById(e)
|
|
178
|
+
const REPLACE_SCRIPT = `function $df(e,n,o,t){if(!(n=document.getElementById(e))||!(o=document.getElementById("pl-"+e)))return 0;for(;o&&8!==o.nodeType&&o.nodeValue!=="pl-"+e;)t=o.nextSibling,o.remove(),o=t;_$HY.done?o.remove():o.replaceWith(n.content),n.remove(),_$HY.fe(e);return 1}function $dfl(e,o,n){if(!(o=document.getElementById("pl-"+e)))return 0;if(o._$fl)return 1;for(n=o.nextSibling;n;){if(8===n.nodeType&&n.nodeValue==="pl-"+e){o.parentNode&&o.parentNode.insertBefore(o.content.cloneNode(!0),n),o._$fl=1;return 1}n=n.nextSibling}return 0}function $dflj(e,i){for(i=0;i<e.length;i++)if($dfl(e[i]))return e[i];return null}function $dfs(e,c,d){(_$HY.sc=_$HY.sc||{})[e]=c,d&&((_$HY.sd=_$HY.sd||{})[e]=1)}function $dfg(e,g,i,k){if(!(g=_$HY.sg&&_$HY.sg[e]))return;for(i=0;i<g.length;i++)if(_$HY.sc&&_$HY.sc[g[i]]>0)return;for(i=0;i<g.length;i++)k=g[i],delete _$HY.sg[k],$df(k)}function $dfc(e){if(--_$HY.sc[e]<=0){delete _$HY.sc[e],_$HY.sg&&_$HY.sg[e]?$dfg(e):!(_$HY.sd&&_$HY.sd[e])&&$df(e);_$HY.sd&&delete _$HY.sd[e]}}function $dfj(e,i,n){for(i=0;i<e.length;i++)if(_$HY.sc&&_$HY.sc[e[i]]>0){for(n=0;n<e.length;n++)(_$HY.sg=_$HY.sg||{})[e[n]]=e;return}for(i=0;i<e.length;i++)$df(e[i])}`;
|
|
143
179
|
function renderToString(code, options = {}) {
|
|
144
180
|
const {
|
|
145
181
|
renderId = "",
|
|
@@ -264,7 +300,29 @@ function renderToStream(code, options = {}) {
|
|
|
264
300
|
let shellCompleted = false;
|
|
265
301
|
let scriptFlushed = false;
|
|
266
302
|
let headStyles;
|
|
303
|
+
const revealGroups = new Map();
|
|
267
304
|
let timer = null;
|
|
305
|
+
const emitTask = task => {
|
|
306
|
+
pushTask(`${task}${!scriptFlushed ? ";" + REPLACE_SCRIPT : ""}`);
|
|
307
|
+
scriptFlushed = true;
|
|
308
|
+
};
|
|
309
|
+
function resolveRevealKeys(groupOrKeys, release, consume) {
|
|
310
|
+
if (Array.isArray(groupOrKeys)) return groupOrKeys.slice();
|
|
311
|
+
let group = revealGroups.get(groupOrKeys);
|
|
312
|
+
if (!group) {
|
|
313
|
+
if (!release) return;
|
|
314
|
+
group = {
|
|
315
|
+
order: [],
|
|
316
|
+
keys: new Set(),
|
|
317
|
+
released: true
|
|
318
|
+
};
|
|
319
|
+
revealGroups.set(groupOrKeys, group);
|
|
320
|
+
} else if (release) group.released = true;
|
|
321
|
+
if (!group.order.length) return;
|
|
322
|
+
const keys = group.order.slice();
|
|
323
|
+
if (consume) revealGroups.delete(groupOrKeys);
|
|
324
|
+
return keys;
|
|
325
|
+
}
|
|
268
326
|
let rootHoles = null;
|
|
269
327
|
let nextHoleId = 0;
|
|
270
328
|
let buffer = {
|
|
@@ -314,7 +372,26 @@ function renderToStream(code, options = {}) {
|
|
|
314
372
|
escape: escape,
|
|
315
373
|
resolve: resolveSSRNode,
|
|
316
374
|
ssr: ssr,
|
|
317
|
-
registerFragment(key) {
|
|
375
|
+
registerFragment(key, options) {
|
|
376
|
+
const revealGroup = options && options.revealGroup;
|
|
377
|
+
if (revealGroup) {
|
|
378
|
+
let group = revealGroups.get(revealGroup);
|
|
379
|
+
if (!group) {
|
|
380
|
+
group = {
|
|
381
|
+
order: [],
|
|
382
|
+
keys: new Set(),
|
|
383
|
+
released: false
|
|
384
|
+
};
|
|
385
|
+
revealGroups.set(revealGroup, group);
|
|
386
|
+
}
|
|
387
|
+
if (!group.keys.has(key)) {
|
|
388
|
+
group.keys.add(key);
|
|
389
|
+
group.order.push(key);
|
|
390
|
+
}
|
|
391
|
+
if (group.released) {
|
|
392
|
+
throw new Error("registerFragment() for reveal group '" + revealGroup + "' was called after revealFragments(). Ensure template payload is emitted before grouped reveal.");
|
|
393
|
+
}
|
|
394
|
+
}
|
|
318
395
|
if (!registry.has(key)) {
|
|
319
396
|
let resolve, reject;
|
|
320
397
|
const p = new Promise((r, rej) => (resolve = r, reject = rej));
|
|
@@ -324,7 +401,7 @@ function renderToStream(code, options = {}) {
|
|
|
324
401
|
queue(flushEnd);
|
|
325
402
|
}))
|
|
326
403
|
});
|
|
327
|
-
serializer.write(key, p);
|
|
404
|
+
serializer.write(key + "_fr", p);
|
|
328
405
|
}
|
|
329
406
|
return (value, error) => {
|
|
330
407
|
if (registry.has(key)) {
|
|
@@ -353,9 +430,9 @@ function renderToStream(code, options = {}) {
|
|
|
353
430
|
} else {
|
|
354
431
|
serializeFragmentAssets(key, tracking.boundaryModules, context);
|
|
355
432
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
433
|
+
const deferActivation = !!revealGroup;
|
|
356
434
|
if (styles.length) {
|
|
357
|
-
|
|
358
|
-
scriptFlushed = true;
|
|
435
|
+
emitTask(`$dfs("${key}",${styles.length},${deferActivation ? 1 : 0})`);
|
|
359
436
|
writeTasks();
|
|
360
437
|
for (const url of styles) {
|
|
361
438
|
buffer.write(`<link rel="stylesheet" href="${url}" onload="$dfc('${key}')" onerror="$dfc('${key}')">`);
|
|
@@ -363,8 +440,9 @@ function renderToStream(code, options = {}) {
|
|
|
363
440
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
364
441
|
} else {
|
|
365
442
|
buffer.write(`<template id="${key}">${value !== undefined ? value : " "}</template>`);
|
|
366
|
-
|
|
367
|
-
|
|
443
|
+
if (!deferActivation) {
|
|
444
|
+
emitTask(`$df("${key}")`);
|
|
445
|
+
}
|
|
368
446
|
}
|
|
369
447
|
item.resolve(error);
|
|
370
448
|
}
|
|
@@ -372,6 +450,16 @@ function renderToStream(code, options = {}) {
|
|
|
372
450
|
}
|
|
373
451
|
return firstFlushed;
|
|
374
452
|
};
|
|
453
|
+
},
|
|
454
|
+
revealFragments(groupOrKeys) {
|
|
455
|
+
const keys = resolveRevealKeys(groupOrKeys, true, true);
|
|
456
|
+
if (!keys) return;
|
|
457
|
+
emitTask(`$dfj(${JSON.stringify(keys)})`);
|
|
458
|
+
},
|
|
459
|
+
revealFallbacks(groupOrKeys) {
|
|
460
|
+
const keys = resolveRevealKeys(groupOrKeys, false, false);
|
|
461
|
+
if (!keys) return;
|
|
462
|
+
emitTask(`$dflj(${JSON.stringify(keys)})`);
|
|
375
463
|
}
|
|
376
464
|
};
|
|
377
465
|
applyAssetTracking(context, tracking, manifest);
|
|
@@ -854,4 +942,4 @@ function Portal(props) {
|
|
|
854
942
|
throw new Error("Portal is not supported on the server");
|
|
855
943
|
}
|
|
856
944
|
|
|
857
|
-
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, Portal, RequestContext, SVGElements,
|
|
945
|
+
export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
|
package/dist/web.cjs
CHANGED
|
@@ -6,25 +6,36 @@ var signals = require('@solidjs/signals');
|
|
|
6
6
|
const DOMWithState = {
|
|
7
7
|
INPUT: {
|
|
8
8
|
value: 1,
|
|
9
|
-
|
|
9
|
+
defaultValue: 1,
|
|
10
|
+
checked: 1,
|
|
11
|
+
defaultChecked: 1
|
|
10
12
|
},
|
|
11
13
|
SELECT: {
|
|
12
14
|
value: 1
|
|
13
15
|
},
|
|
14
16
|
OPTION: {
|
|
15
17
|
value: 1,
|
|
16
|
-
selected: 1
|
|
18
|
+
selected: 1,
|
|
19
|
+
defaultSelected: 1
|
|
17
20
|
},
|
|
18
21
|
TEXTAREA: {
|
|
19
|
-
value: 1
|
|
22
|
+
value: 1,
|
|
23
|
+
defaultValue: 1
|
|
20
24
|
},
|
|
21
25
|
VIDEO: {
|
|
22
|
-
muted: 1
|
|
26
|
+
muted: 1,
|
|
27
|
+
defaultMuted: 1
|
|
23
28
|
},
|
|
24
29
|
AUDIO: {
|
|
25
|
-
muted: 1
|
|
30
|
+
muted: 1,
|
|
31
|
+
defaultMuted: 1
|
|
26
32
|
}
|
|
27
33
|
};
|
|
34
|
+
for (const tagName in DOMWithState) {
|
|
35
|
+
for (const propName in DOMWithState[tagName]) {
|
|
36
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
28
39
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
29
40
|
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"]);
|
|
30
41
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -33,7 +44,9 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
33
44
|
"svg", "switch", "symbol", "text", "textPath",
|
|
34
45
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
35
46
|
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
36
|
-
const
|
|
47
|
+
const Namespaces = {
|
|
48
|
+
svg: "http://www.w3.org/2000/svg",
|
|
49
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
37
50
|
xlink: "http://www.w3.org/1999/xlink",
|
|
38
51
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
39
52
|
};
|
|
@@ -284,15 +297,15 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
|
284
297
|
for (const prop in prevProps) {
|
|
285
298
|
if (!(prop in props)) {
|
|
286
299
|
if (prop === "children") continue;
|
|
287
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName
|
|
300
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
288
301
|
}
|
|
289
302
|
}
|
|
290
303
|
for (const prop in props) {
|
|
291
304
|
if (prop === "children") {
|
|
292
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
305
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
293
306
|
continue;
|
|
294
307
|
}
|
|
295
|
-
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName
|
|
308
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
296
309
|
}
|
|
297
310
|
}
|
|
298
311
|
function hydrate$1(code, element, options = {}) {
|
|
@@ -419,7 +432,7 @@ function flattenClassList(list, result) {
|
|
|
419
432
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
420
433
|
}
|
|
421
434
|
}
|
|
422
|
-
function assignProp(node, prop, value, prev, skipRef, nodeName
|
|
435
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
423
436
|
if (prop === "style") return style(node, value, prev), value;
|
|
424
437
|
if (prop === "class") return className(node, value, prev), value;
|
|
425
438
|
if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
|
|
@@ -432,7 +445,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
432
445
|
const e = prop.slice(3);
|
|
433
446
|
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
434
447
|
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
435
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
448
|
+
} else if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
436
449
|
const name = prop.slice(2).toLowerCase();
|
|
437
450
|
const delegate = DelegatedEvents.has(name);
|
|
438
451
|
if (!delegate && prev) {
|
|
@@ -443,11 +456,11 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
443
456
|
addEventListener(node, name, value, delegate);
|
|
444
457
|
delegate && delegateEvents([name]);
|
|
445
458
|
}
|
|
446
|
-
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]
|
|
459
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
447
460
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
448
461
|
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
449
462
|
} else {
|
|
450
|
-
const ns = hasNamespace &&
|
|
463
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
451
464
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
452
465
|
}
|
|
453
466
|
return value;
|
|
@@ -700,6 +713,10 @@ Object.defineProperty(exports, "NoHydration", {
|
|
|
700
713
|
enumerable: true,
|
|
701
714
|
get: function () { return solidJs.NoHydration; }
|
|
702
715
|
});
|
|
716
|
+
Object.defineProperty(exports, "Reveal", {
|
|
717
|
+
enumerable: true,
|
|
718
|
+
get: function () { return solidJs.Reveal; }
|
|
719
|
+
});
|
|
703
720
|
Object.defineProperty(exports, "Show", {
|
|
704
721
|
enumerable: true,
|
|
705
722
|
get: function () { return solidJs.Show; }
|
|
@@ -732,10 +749,10 @@ exports.DelegatedEvents = DelegatedEvents;
|
|
|
732
749
|
exports.Dynamic = Dynamic;
|
|
733
750
|
exports.HydrationScript = voidFn;
|
|
734
751
|
exports.MathMLElements = MathMLElements;
|
|
752
|
+
exports.Namespaces = Namespaces;
|
|
735
753
|
exports.Portal = Portal;
|
|
736
754
|
exports.RequestContext = RequestContext;
|
|
737
755
|
exports.SVGElements = SVGElements;
|
|
738
|
-
exports.SVGNamespace = SVGNamespace;
|
|
739
756
|
exports.addEventListener = addEventListener;
|
|
740
757
|
exports.applyRef = applyRef;
|
|
741
758
|
exports.assign = assign;
|
package/dist/web.js
CHANGED
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo as createMemo$1, sharedConfig, untrack, runWithOwner, flatten, createRoot, omit, enableHydration } from 'solid-js';
|
|
2
|
-
export { Errored, For, Hydration, Loading, Match, NoHydration, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
2
|
+
export { Errored, For, Hydration, Loading, Match, NoHydration, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
3
|
import { createMemo } from '@solidjs/signals';
|
|
4
4
|
|
|
5
5
|
const DOMWithState = {
|
|
6
6
|
INPUT: {
|
|
7
7
|
value: 1,
|
|
8
|
-
|
|
8
|
+
defaultValue: 1,
|
|
9
|
+
checked: 1,
|
|
10
|
+
defaultChecked: 1
|
|
9
11
|
},
|
|
10
12
|
SELECT: {
|
|
11
13
|
value: 1
|
|
12
14
|
},
|
|
13
15
|
OPTION: {
|
|
14
16
|
value: 1,
|
|
15
|
-
selected: 1
|
|
17
|
+
selected: 1,
|
|
18
|
+
defaultSelected: 1
|
|
16
19
|
},
|
|
17
20
|
TEXTAREA: {
|
|
18
|
-
value: 1
|
|
21
|
+
value: 1,
|
|
22
|
+
defaultValue: 1
|
|
19
23
|
},
|
|
20
24
|
VIDEO: {
|
|
21
|
-
muted: 1
|
|
25
|
+
muted: 1,
|
|
26
|
+
defaultMuted: 1
|
|
22
27
|
},
|
|
23
28
|
AUDIO: {
|
|
24
|
-
muted: 1
|
|
29
|
+
muted: 1,
|
|
30
|
+
defaultMuted: 1
|
|
25
31
|
}
|
|
26
32
|
};
|
|
33
|
+
for (const tagName in DOMWithState) {
|
|
34
|
+
for (const propName in DOMWithState[tagName]) {
|
|
35
|
+
DOMWithState[tagName]["prop:" + propName] = 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
27
38
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
28
39
|
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"]);
|
|
29
40
|
const SVGElements = /*#__PURE__*/new Set([
|
|
@@ -32,7 +43,9 @@ const SVGElements = /*#__PURE__*/new Set([
|
|
|
32
43
|
"svg", "switch", "symbol", "text", "textPath",
|
|
33
44
|
"tref", "tspan", "use", "view", "vkern"]);
|
|
34
45
|
const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
|
|
35
|
-
const
|
|
46
|
+
const Namespaces = {
|
|
47
|
+
svg: "http://www.w3.org/2000/svg",
|
|
48
|
+
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
36
49
|
xlink: "http://www.w3.org/1999/xlink",
|
|
37
50
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
38
51
|
};
|
|
@@ -283,15 +296,15 @@ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
|
|
|
283
296
|
for (const prop in prevProps) {
|
|
284
297
|
if (!(prop in props)) {
|
|
285
298
|
if (prop === "children") continue;
|
|
286
|
-
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName
|
|
299
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
|
|
287
300
|
}
|
|
288
301
|
}
|
|
289
302
|
for (const prop in props) {
|
|
290
303
|
if (prop === "children") {
|
|
291
|
-
if (!skipChildren) insertExpression(node, props.children);
|
|
304
|
+
if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
|
|
292
305
|
continue;
|
|
293
306
|
}
|
|
294
|
-
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName
|
|
307
|
+
prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
|
|
295
308
|
}
|
|
296
309
|
}
|
|
297
310
|
function hydrate$1(code, element, options = {}) {
|
|
@@ -418,7 +431,7 @@ function flattenClassList(list, result) {
|
|
|
418
431
|
if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
|
|
419
432
|
}
|
|
420
433
|
}
|
|
421
|
-
function assignProp(node, prop, value, prev, skipRef, nodeName
|
|
434
|
+
function assignProp(node, prop, value, prev, skipRef, nodeName) {
|
|
422
435
|
if (prop === "style") return style(node, value, prev), value;
|
|
423
436
|
if (prop === "class") return className(node, value, prev), value;
|
|
424
437
|
if (value === prev && !DOMWithState[nodeName]?.[prop]) return prev;
|
|
@@ -431,7 +444,7 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
431
444
|
const e = prop.slice(3);
|
|
432
445
|
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
433
446
|
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
434
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
447
|
+
} else if (!hasNamespace && prop.slice(0, 2) === "on") {
|
|
435
448
|
const name = prop.slice(2).toLowerCase();
|
|
436
449
|
const delegate = DelegatedEvents.has(name);
|
|
437
450
|
if (!delegate && prev) {
|
|
@@ -442,11 +455,11 @@ function assignProp(node, prop, value, prev, skipRef, nodeName, props) {
|
|
|
442
455
|
addEventListener(node, name, value, delegate);
|
|
443
456
|
delegate && delegateEvents([name]);
|
|
444
457
|
}
|
|
445
|
-
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]
|
|
458
|
+
} else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
|
|
446
459
|
if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
447
460
|
if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
448
461
|
} else {
|
|
449
|
-
const ns = hasNamespace &&
|
|
462
|
+
const ns = hasNamespace && Namespaces[prop.split(":")[0]];
|
|
450
463
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
451
464
|
}
|
|
452
465
|
return value;
|
|
@@ -675,4 +688,4 @@ function Dynamic(props) {
|
|
|
675
688
|
return createDynamic(() => props.component, others);
|
|
676
689
|
}
|
|
677
690
|
|
|
678
|
-
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Portal, RequestContext, SVGElements,
|
|
691
|
+
export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, addEventListener, applyRef, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, 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 for the browser and the server",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.6",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"seroval-plugins": "^1.1.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@solidjs/signals": "^0.13.
|
|
79
|
-
"solid-js": "^2.0.0-beta.
|
|
78
|
+
"@solidjs/signals": "^0.13.11",
|
|
79
|
+
"solid-js": "^2.0.0-beta.6"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@solidjs/signals": "^0.13.
|
|
83
|
-
"solid-js": "2.0.0-beta.
|
|
82
|
+
"@solidjs/signals": "^0.13.11",
|
|
83
|
+
"solid-js": "2.0.0-beta.6"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "npm-run-all -nl build:*",
|
|
@@ -2,7 +2,7 @@ import { hydrate as hydrateCore, render as renderCore } from "./client.js";
|
|
|
2
2
|
import { JSX, ComponentProps, ValidComponent } from "solid-js";
|
|
3
3
|
export * from "./client.js";
|
|
4
4
|
export declare function render(...args: Parameters<typeof renderCore>): ReturnType<typeof renderCore>;
|
|
5
|
-
export { For, Show, Switch, Match, Errored, Loading, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
5
|
+
export { For, Show, Switch, Match, Errored, Loading, Reveal, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
6
6
|
export * from "./server-mock.js";
|
|
7
7
|
export declare const isServer: boolean;
|
|
8
8
|
export declare const isDev: boolean;
|
package/types/client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const DelegatedEvents: Set<string>;
|
|
|
5
5
|
export const DOMElements: Set<string>;
|
|
6
6
|
export const SVGElements: Set<string>;
|
|
7
7
|
export const MathMLElements: Set<string>;
|
|
8
|
-
export const
|
|
8
|
+
export const Namespaces: Record<string, string>;
|
|
9
9
|
|
|
10
10
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
11
11
|
export function render(
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { hydrate as hydrateCore, render as renderCore } from "./client.js";
|
|
|
2
2
|
import { JSX, ComponentProps, ValidComponent } from "solid-js";
|
|
3
3
|
export * from "./client.js";
|
|
4
4
|
export declare function render(...args: Parameters<typeof renderCore>): ReturnType<typeof renderCore>;
|
|
5
|
-
export { For, Show, Switch, Match, Errored, Loading, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
5
|
+
export { For, Show, Switch, Match, Errored, Loading, Reveal, NoHydration, Hydration, merge as mergeProps } from "solid-js";
|
|
6
6
|
export * from "./server-mock.js";
|
|
7
7
|
export declare const isServer: boolean;
|
|
8
8
|
export declare const isDev: boolean;
|
package/types/server.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export const ChildProperties: Set<string>;
|
|
|
3
3
|
export const DelegatedEvents: Set<string>;
|
|
4
4
|
export const DOMElements: Set<string>;
|
|
5
5
|
export const SVGElements: Set<string>;
|
|
6
|
-
export const
|
|
6
|
+
export const MathMLElements: Set<string>;
|
|
7
|
+
export const Namespaces: Record<string, string>;
|
|
7
8
|
|
|
8
9
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
9
10
|
|