@solidjs/web 2.0.0-experimental.3 → 2.0.0-experimental.5
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 +20 -16
- package/dist/dev.js +94 -634
- package/dist/server.cjs +70 -57
- package/dist/server.js +157 -658
- package/dist/web.cjs +20 -16
- package/dist/web.js +92 -622
- package/package.json +3 -3
- package/storage/dist/storage.js +3 -3
- package/types/client.d.ts +2 -11
- package/types/core.d.ts +2 -11
- package/types/index.d.ts +5 -8
- package/types/server-mock.d.ts +26 -33
package/dist/web.cjs
CHANGED
|
@@ -46,6 +46,8 @@ const SVGNamespace = {
|
|
|
46
46
|
};
|
|
47
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"]);
|
|
48
48
|
|
|
49
|
+
const memo = fn => solidJs.createMemo(() => fn());
|
|
50
|
+
|
|
49
51
|
function reconcileArrays(parentNode, a, b) {
|
|
50
52
|
let bLength = b.length,
|
|
51
53
|
aEnd = a.length,
|
|
@@ -108,8 +110,10 @@ function render(code, element, init, options = {}) {
|
|
|
108
110
|
let disposer;
|
|
109
111
|
solidJs.createRoot(dispose => {
|
|
110
112
|
disposer = dispose;
|
|
111
|
-
element === document ? code
|
|
112
|
-
},
|
|
113
|
+
element === document ? solidJs.flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
|
|
114
|
+
}, {
|
|
115
|
+
id: options.renderId
|
|
116
|
+
});
|
|
113
117
|
return () => {
|
|
114
118
|
disposer();
|
|
115
119
|
element.textContent = "";
|
|
@@ -141,12 +145,15 @@ function clearDelegatedEvents(document = window.document) {
|
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
function setProperty(node, name, value) {
|
|
148
|
+
if (isHydrating(node)) return;
|
|
144
149
|
node[name] = value;
|
|
145
150
|
}
|
|
146
151
|
function setAttribute(node, name, value) {
|
|
152
|
+
if (isHydrating(node)) return;
|
|
147
153
|
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
148
154
|
}
|
|
149
155
|
function setAttributeNS(node, namespace, name, value) {
|
|
156
|
+
if (isHydrating(node)) return;
|
|
150
157
|
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
151
158
|
}
|
|
152
159
|
function setBoolAttribute(node, name, value) {
|
|
@@ -154,6 +161,7 @@ function setBoolAttribute(node, name, value) {
|
|
|
154
161
|
value ? node.setAttribute(name, "") : node.removeAttribute(name);
|
|
155
162
|
}
|
|
156
163
|
function className(node, value, isSVG, prev) {
|
|
164
|
+
if (isHydrating(node)) return;
|
|
157
165
|
if (value == null) {
|
|
158
166
|
prev && node.removeAttribute("class");
|
|
159
167
|
return;
|
|
@@ -271,21 +279,19 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
|
|
|
271
279
|
}
|
|
272
280
|
function hydrate$1(code, element, options = {}) {
|
|
273
281
|
if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
|
|
282
|
+
options.renderId ||= "";
|
|
274
283
|
solidJs.sharedConfig.completed = globalThis._$HY.completed;
|
|
275
284
|
solidJs.sharedConfig.events = globalThis._$HY.events;
|
|
276
285
|
solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
|
|
277
286
|
solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
|
|
278
287
|
solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
|
|
279
288
|
solidJs.sharedConfig.registry = new Map();
|
|
280
|
-
solidJs.sharedConfig.
|
|
281
|
-
id: options.renderId || "",
|
|
282
|
-
count: 0
|
|
283
|
-
};
|
|
289
|
+
solidJs.sharedConfig.hydrating = true;
|
|
284
290
|
try {
|
|
285
291
|
gatherHydratable(element, options.renderId);
|
|
286
292
|
return render(code, element, [...element.childNodes], options);
|
|
287
293
|
} finally {
|
|
288
|
-
solidJs.sharedConfig.
|
|
294
|
+
solidJs.sharedConfig.hydrating = false;
|
|
289
295
|
}
|
|
290
296
|
}
|
|
291
297
|
function getNextElement(template) {
|
|
@@ -346,7 +352,7 @@ function runHydrationEvents() {
|
|
|
346
352
|
}
|
|
347
353
|
}
|
|
348
354
|
function isHydrating(node) {
|
|
349
|
-
return
|
|
355
|
+
return solidJs.sharedConfig.hydrating && !solidJs.sharedConfig.done && (!node || node.isConnected);
|
|
350
356
|
}
|
|
351
357
|
function toggleClassKey(node, key, value) {
|
|
352
358
|
const classNames = key.trim().split(/\s+/);
|
|
@@ -393,7 +399,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
|
|
|
393
399
|
} else if (prop.slice(0, 5) === "bool:") {
|
|
394
400
|
setBoolAttribute(node, prop.slice(5), value);
|
|
395
401
|
} 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);
|
|
402
|
+
if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
|
|
397
403
|
if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[propAlias || prop] = value;
|
|
398
404
|
} else {
|
|
399
405
|
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
@@ -453,6 +459,7 @@ function eventHandler(e) {
|
|
|
453
459
|
retarget(oriTarget);
|
|
454
460
|
}
|
|
455
461
|
function insertExpression(parent, value, current, marker) {
|
|
462
|
+
if (isHydrating(parent)) return;
|
|
456
463
|
if (value === current) return;
|
|
457
464
|
const t = typeof value,
|
|
458
465
|
multi = marker !== undefined;
|
|
@@ -517,10 +524,10 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
517
524
|
} else if (replacement) parent.insertBefore(replacement, marker);
|
|
518
525
|
}
|
|
519
526
|
function gatherHydratable(element, root) {
|
|
520
|
-
const templates = element.querySelectorAll(`*[
|
|
527
|
+
const templates = element.querySelectorAll(`*[_hk]`);
|
|
521
528
|
for (let i = 0; i < templates.length; i++) {
|
|
522
529
|
const node = templates[i];
|
|
523
|
-
const key = node.getAttribute("
|
|
530
|
+
const key = node.getAttribute("_hk");
|
|
524
531
|
if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
|
|
525
532
|
}
|
|
526
533
|
}
|
|
@@ -528,7 +535,7 @@ function getHydrationKey() {
|
|
|
528
535
|
return solidJs.sharedConfig.getNextContextId();
|
|
529
536
|
}
|
|
530
537
|
function NoHydration(props) {
|
|
531
|
-
return solidJs.sharedConfig.
|
|
538
|
+
return solidJs.sharedConfig.hydrating ? undefined : props.children;
|
|
532
539
|
}
|
|
533
540
|
function Hydration(props) {
|
|
534
541
|
return props.children;
|
|
@@ -661,10 +668,6 @@ Object.defineProperty(exports, "getOwner", {
|
|
|
661
668
|
enumerable: true,
|
|
662
669
|
get: function () { return solidJs.getOwner; }
|
|
663
670
|
});
|
|
664
|
-
Object.defineProperty(exports, "memo", {
|
|
665
|
-
enumerable: true,
|
|
666
|
-
get: function () { return solidJs.createMemo; }
|
|
667
|
-
});
|
|
668
671
|
Object.defineProperty(exports, "mergeProps", {
|
|
669
672
|
enumerable: true,
|
|
670
673
|
get: function () { return solidJs.merge; }
|
|
@@ -706,6 +709,7 @@ exports.hydrate = hydrate;
|
|
|
706
709
|
exports.insert = insert;
|
|
707
710
|
exports.isDev = isDev;
|
|
708
711
|
exports.isServer = isServer;
|
|
712
|
+
exports.memo = memo;
|
|
709
713
|
exports.render = render;
|
|
710
714
|
exports.renderToStream = renderToStream;
|
|
711
715
|
exports.renderToString = renderToString;
|