@solidjs/web 2.0.0-experimental.4 → 2.0.0-experimental.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 +39 -66
- package/dist/dev.js +102 -672
- package/dist/server.cjs +137 -136
- package/dist/server.js +211 -733
- package/dist/web.cjs +39 -66
- package/dist/web.js +100 -660
- package/package.json +3 -3
- package/storage/dist/storage.js +3 -3
- package/types/client.d.ts +2 -13
- package/types/core.d.ts +2 -11
- package/types/index.d.ts +5 -8
- package/types/server-mock.d.ts +26 -33
- package/types/server.d.ts +0 -1
package/dist/web.cjs
CHANGED
|
@@ -2,38 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const Properties = /*#__PURE__*/new Set([
|
|
6
|
+
"value", "checked", "selected", "muted"]);
|
|
7
7
|
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
8
|
-
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
9
|
-
class: "className",
|
|
10
|
-
formnovalidate: {
|
|
11
|
-
$: "formNoValidate",
|
|
12
|
-
BUTTON: 1,
|
|
13
|
-
INPUT: 1
|
|
14
|
-
},
|
|
15
|
-
ismap: {
|
|
16
|
-
$: "isMap",
|
|
17
|
-
IMG: 1
|
|
18
|
-
},
|
|
19
|
-
nomodule: {
|
|
20
|
-
$: "noModule",
|
|
21
|
-
SCRIPT: 1
|
|
22
|
-
},
|
|
23
|
-
playsinline: {
|
|
24
|
-
$: "playsInline",
|
|
25
|
-
VIDEO: 1
|
|
26
|
-
},
|
|
27
|
-
readonly: {
|
|
28
|
-
$: "readOnly",
|
|
29
|
-
INPUT: 1,
|
|
30
|
-
TEXTAREA: 1
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
function getPropAlias(prop, tagName) {
|
|
34
|
-
const a = PropAliases[prop];
|
|
35
|
-
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
36
|
-
}
|
|
37
8
|
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"]);
|
|
38
9
|
const SVGElements = /*#__PURE__*/new Set([
|
|
39
10
|
"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",
|
|
@@ -44,7 +15,11 @@ const SVGNamespace = {
|
|
|
44
15
|
xlink: "http://www.w3.org/1999/xlink",
|
|
45
16
|
xml: "http://www.w3.org/XML/1998/namespace"
|
|
46
17
|
};
|
|
47
|
-
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6"
|
|
18
|
+
const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
|
|
19
|
+
"webview",
|
|
20
|
+
"isindex", "listing", "multicol", "nextid", "noindex", "search"]);
|
|
21
|
+
|
|
22
|
+
const memo = fn => solidJs.createMemo(() => fn());
|
|
48
23
|
|
|
49
24
|
function reconcileArrays(parentNode, a, b) {
|
|
50
25
|
let bLength = b.length,
|
|
@@ -108,8 +83,10 @@ function render(code, element, init, options = {}) {
|
|
|
108
83
|
let disposer;
|
|
109
84
|
solidJs.createRoot(dispose => {
|
|
110
85
|
disposer = dispose;
|
|
111
|
-
element === document ? code
|
|
112
|
-
},
|
|
86
|
+
element === document ? solidJs.flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
|
|
87
|
+
}, {
|
|
88
|
+
id: options.renderId
|
|
89
|
+
});
|
|
113
90
|
return () => {
|
|
114
91
|
disposer();
|
|
115
92
|
element.textContent = "";
|
|
@@ -141,20 +118,20 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
141
118
|
}
|
|
142
119
|
}
|
|
143
120
|
function setProperty(node, name, value) {
|
|
121
|
+
if (isHydrating(node)) return;
|
|
144
122
|
node[name] = value;
|
|
145
123
|
}
|
|
146
124
|
function setAttribute(node, name, value) {
|
|
147
|
-
if (
|
|
125
|
+
if (isHydrating(node)) return;
|
|
126
|
+
if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
|
|
148
127
|
}
|
|
149
128
|
function setAttributeNS(node, namespace, name, value) {
|
|
150
|
-
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
151
|
-
}
|
|
152
|
-
function setBoolAttribute(node, name, value) {
|
|
153
129
|
if (isHydrating(node)) return;
|
|
154
|
-
value
|
|
130
|
+
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
155
131
|
}
|
|
156
132
|
function className(node, value, isSVG, prev) {
|
|
157
|
-
if (
|
|
133
|
+
if (isHydrating(node)) return;
|
|
134
|
+
if (value == null || value === false) {
|
|
158
135
|
prev && node.removeAttribute("class");
|
|
159
136
|
return;
|
|
160
137
|
}
|
|
@@ -211,6 +188,9 @@ function style(node, value, prev) {
|
|
|
211
188
|
}
|
|
212
189
|
for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
|
|
213
190
|
}
|
|
191
|
+
function setStyleProperty(node, name, value) {
|
|
192
|
+
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
193
|
+
}
|
|
214
194
|
function spread(node, props = {}, isSVG, skipChildren) {
|
|
215
195
|
const prevProps = {};
|
|
216
196
|
if (!skipChildren) {
|
|
@@ -271,21 +251,19 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
271
251
|
}
|
|
272
252
|
function hydrate$1(code, element, options = {}) {
|
|
273
253
|
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
254
|
+
options.renderId ||= "";
|
|
274
255
|
solidJs.sharedConfig.completed = globalThis._$HY.completed;
|
|
275
256
|
solidJs.sharedConfig.events = globalThis._$HY.events;
|
|
276
257
|
solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
|
|
277
258
|
solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
|
|
278
259
|
solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
|
|
279
260
|
solidJs.sharedConfig.registry = new Map();
|
|
280
|
-
solidJs.sharedConfig.
|
|
281
|
-
id: options.renderId || "",
|
|
282
|
-
count: 0
|
|
283
|
-
};
|
|
261
|
+
solidJs.sharedConfig.hydrating = true;
|
|
284
262
|
try {
|
|
285
263
|
gatherHydratable(element, options.renderId);
|
|
286
264
|
return render(code, element, [...element.childNodes], options);
|
|
287
265
|
} finally {
|
|
288
|
-
solidJs.sharedConfig.
|
|
266
|
+
solidJs.sharedConfig.hydrating = false;
|
|
289
267
|
}
|
|
290
268
|
}
|
|
291
269
|
function getNextElement(template) {
|
|
@@ -346,7 +324,7 @@ function runHydrationEvents() {
|
|
|
346
324
|
}
|
|
347
325
|
}
|
|
348
326
|
function isHydrating(node) {
|
|
349
|
-
return
|
|
327
|
+
return solidJs.sharedConfig.hydrating && !solidJs.sharedConfig.done && (!node || node.isConnected);
|
|
350
328
|
}
|
|
351
329
|
function toggleClassKey(node, key, value) {
|
|
352
330
|
const classNames = key.trim().split(/\s+/);
|
|
@@ -367,7 +345,7 @@ function flattenClassList(list, result) {
|
|
|
367
345
|
}
|
|
368
346
|
}
|
|
369
347
|
function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
370
|
-
let
|
|
348
|
+
let forceProp;
|
|
371
349
|
if (prop === "style") return style(node, value, prev), value;
|
|
372
350
|
if (prop === "class") return className(node, value, isSVG, prev), value;
|
|
373
351
|
if (value === prev) return prev;
|
|
@@ -388,13 +366,9 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
388
366
|
addEventListener(node, name, value, delegate);
|
|
389
367
|
delegate && delegateEvents([name]);
|
|
390
368
|
}
|
|
391
|
-
} else if (prop.slice(0, 5) === "
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
setBoolAttribute(node, prop.slice(5), value);
|
|
395
|
-
} else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
|
|
396
|
-
if (forceProp) prop = prop.slice(5);
|
|
397
|
-
if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[propAlias || prop] = value;
|
|
369
|
+
} else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
|
|
370
|
+
if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
371
|
+
if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
|
|
398
372
|
} else {
|
|
399
373
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
400
374
|
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
|
|
@@ -453,6 +427,7 @@ function eventHandler(e) {
|
|
|
453
427
|
retarget(oriTarget);
|
|
454
428
|
}
|
|
455
429
|
function insertExpression(parent, value, current, marker) {
|
|
430
|
+
if (isHydrating(parent)) return;
|
|
456
431
|
if (value === current) return;
|
|
457
432
|
const t = typeof value,
|
|
458
433
|
multi = marker !== undefined;
|
|
@@ -517,10 +492,10 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
517
492
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
518
493
|
}
|
|
519
494
|
function gatherHydratable(element, root) {
|
|
520
|
-
const templates = element.querySelectorAll(`*[
|
|
495
|
+
const templates = element.querySelectorAll(`*[_hk]`);
|
|
521
496
|
for (let i = 0; i < templates.length; i++) {
|
|
522
497
|
const node = templates[i];
|
|
523
|
-
const key = node.getAttribute("
|
|
498
|
+
const key = node.getAttribute("_hk");
|
|
524
499
|
if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
|
|
525
500
|
}
|
|
526
501
|
}
|
|
@@ -528,7 +503,7 @@ function getHydrationKey() {
|
|
|
528
503
|
return solidJs.sharedConfig.getNextContextId();
|
|
529
504
|
}
|
|
530
505
|
function NoHydration(props) {
|
|
531
|
-
return solidJs.sharedConfig.
|
|
506
|
+
return solidJs.sharedConfig.hydrating ? undefined : props.children;
|
|
532
507
|
}
|
|
533
508
|
function Hydration(props) {
|
|
534
509
|
return props.children;
|
|
@@ -561,8 +536,10 @@ function escape(html) {}
|
|
|
561
536
|
const isServer = false;
|
|
562
537
|
const isDev = false;
|
|
563
538
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
564
|
-
function createElement(tagName, isSVG = false) {
|
|
565
|
-
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName
|
|
539
|
+
function createElement(tagName, isSVG = false, is = undefined) {
|
|
540
|
+
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
|
|
541
|
+
is
|
|
542
|
+
});
|
|
566
543
|
}
|
|
567
544
|
const hydrate = (...args) => {
|
|
568
545
|
solidJs.enableHydration();
|
|
@@ -614,7 +591,7 @@ function createDynamic(component, props) {
|
|
|
614
591
|
return solidJs.untrack(() => component(props));
|
|
615
592
|
case "string":
|
|
616
593
|
const isSvg = SVGElements.has(component);
|
|
617
|
-
const el = solidJs.sharedConfig.
|
|
594
|
+
const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, solidJs.untrack(() => props.is));
|
|
618
595
|
spread(el, props, isSvg);
|
|
619
596
|
return el;
|
|
620
597
|
}
|
|
@@ -661,10 +638,6 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
661
638
|
enumerable: true,
|
|
662
639
|
get: function () { return solidJs.getOwner; }
|
|
663
640
|
});
|
|
664
|
-
Object.defineProperty(exports, "memo", {
|
|
665
|
-
enumerable: true,
|
|
666
|
-
get: function () { return solidJs.createMemo; }
|
|
667
|
-
});
|
|
668
641
|
Object.defineProperty(exports, "mergeProps", {
|
|
669
642
|
enumerable: true,
|
|
670
643
|
get: function () { return solidJs.merge; }
|
|
@@ -700,12 +673,12 @@ exports.getHydrationKey = getHydrationKey;
|
|
|
700
673
|
exports.getNextElement = getNextElement;
|
|
701
674
|
exports.getNextMarker = getNextMarker;
|
|
702
675
|
exports.getNextMatch = getNextMatch;
|
|
703
|
-
exports.getPropAlias = getPropAlias;
|
|
704
676
|
exports.getRequestEvent = voidFn;
|
|
705
677
|
exports.hydrate = hydrate;
|
|
706
678
|
exports.insert = insert;
|
|
707
679
|
exports.isDev = isDev;
|
|
708
680
|
exports.isServer = isServer;
|
|
681
|
+
exports.memo = memo;
|
|
709
682
|
exports.render = render;
|
|
710
683
|
exports.renderToStream = renderToStream;
|
|
711
684
|
exports.renderToString = renderToString;
|
|
@@ -714,8 +687,8 @@ exports.resolveSSRNode = resolveSSRNode;
|
|
|
714
687
|
exports.runHydrationEvents = runHydrationEvents;
|
|
715
688
|
exports.setAttribute = setAttribute;
|
|
716
689
|
exports.setAttributeNS = setAttributeNS;
|
|
717
|
-
exports.setBoolAttribute = setBoolAttribute;
|
|
718
690
|
exports.setProperty = setProperty;
|
|
691
|
+
exports.setStyleProperty = setStyleProperty;
|
|
719
692
|
exports.spread = spread;
|
|
720
693
|
exports.ssr = ssr;
|
|
721
694
|
exports.ssrAttribute = ssrAttribute;
|