@solidjs/web 2.0.0-beta.1 → 2.0.0-beta.10

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/README.md CHANGED
@@ -1,7 +1,30 @@
1
- # Solid Web
1
+ # @solidjs/web
2
2
 
3
- This submodule contains the web specific APIs for Solid that are mostly internal methods imported during compilation. It has all the code to render for the web on the server and the browser.
3
+ Solid 2.0's web platform runtime DOM rendering, hydration, server-side rendering, and the web-only control-flow components (`Portal`, `Dynamic`).
4
4
 
5
- In addition this modules provides the primary entry point methods `render`, `hydrate`, `renderToString`, `renderToStringAsync`, `pipeToNodeWritable`, and `pipeToWritable`. As well as a few web specific control flow components `<Portal>` and `<Dynamic>`.
5
+ > **Solid 2.0 (experimental beta).** In 1.x this package was the `solid-js/web` subpath; in 2.0 it's a separate `@solidjs/web` package.
6
+ >
7
+ > See [`solid-js`'s CHEATSHEET](https://github.com/solidjs/solid/blob/next/packages/solid/CHEATSHEET.md) and [MIGRATION guide](https://github.com/solidjs/solid/blob/next/documentation/solid-2.0/MIGRATION.md) for the 2.0 surface.
6
8
 
7
- Refer to the [website](https://docs.solidjs.com) for documentation.
9
+ ## Entry points
10
+
11
+ ```ts
12
+ // Browser / hydration
13
+ import { render, hydrate, Portal, Dynamic, dynamic } from "@solidjs/web";
14
+
15
+ // Server (SSR)
16
+ import {
17
+ renderToString,
18
+ renderToStringAsync,
19
+ renderToStream,
20
+ isServer
21
+ } from "@solidjs/web";
22
+ ```
23
+
24
+ The control-flow components from `solid-js` (`For`, `Show`, `Switch`/`Match`, `Loading`, `Errored`, `Repeat`, `Reveal`) are also re-exported from `@solidjs/web` for convenience.
25
+
26
+ ## More
27
+
28
+ - [Documentation](https://docs.solidjs.com)
29
+ - [Cheatsheet (2.0 public API)](https://github.com/solidjs/solid/blob/next/packages/solid/CHEATSHEET.md)
30
+ - [Migration guide (1.x → 2.0)](https://github.com/solidjs/solid/blob/next/documentation/solid-2.0/MIGRATION.md)
package/dist/dev.cjs CHANGED
@@ -2,8 +2,34 @@
2
2
 
3
3
  var solidJs = require('solid-js');
4
4
 
5
- const Properties = /*#__PURE__*/new Set([
6
- "value", "checked", "selected", "muted"]);
5
+ const DOMWithState = {
6
+ INPUT: {
7
+ value: 1,
8
+ defaultValue: 2,
9
+ checked: 1,
10
+ defaultChecked: 2
11
+ },
12
+ SELECT: {
13
+ value: 1
14
+ },
15
+ OPTION: {
16
+ value: 1,
17
+ selected: 1,
18
+ defaultSelected: 2
19
+ },
20
+ TEXTAREA: {
21
+ value: 1,
22
+ defaultValue: 2
23
+ },
24
+ VIDEO: {
25
+ muted: 1,
26
+ defaultMuted: 2
27
+ },
28
+ AUDIO: {
29
+ muted: 1,
30
+ defaultMuted: 2
31
+ }
32
+ };
7
33
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
8
34
  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
35
  const SVGElements = /*#__PURE__*/new Set([
@@ -11,17 +37,26 @@ const SVGElements = /*#__PURE__*/new Set([
11
37
  "set", "stop",
12
38
  "svg", "switch", "symbol", "text", "textPath",
13
39
  "tref", "tspan", "use", "view", "vkern"]);
14
- const SVGNamespace = {
40
+ 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"]);
41
+ const Namespaces = {
42
+ svg: "http://www.w3.org/2000/svg",
43
+ mathml: "http://www.w3.org/1998/Math/MathML",
15
44
  xlink: "http://www.w3.org/1999/xlink",
16
45
  xml: "http://www.w3.org/XML/1998/namespace"
17
46
  };
47
+ const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
48
+ const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
18
49
  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
50
  "webview",
20
51
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
21
52
 
22
- const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
53
+ const transparentOptions = {
23
54
  transparent: true
24
- });
55
+ };
56
+ const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
57
+ transparent: true,
58
+ ...options
59
+ } : transparentOptions);
25
60
  const memo = fn => solidJs.createMemo(() => fn());
26
61
 
27
62
  function reconcileArrays(parentNode, a, b) {
@@ -82,32 +117,40 @@ function reconcileArrays(parentNode, a, b) {
82
117
  }
83
118
 
84
119
  const $$EVENTS = "_$DX_DELEGATE";
85
- function render(code, element, init, options = {}) {
120
+ const INNER_OWNED = {};
121
+ function render$1(code, element, init, options = {}) {
86
122
  if (!element) {
87
123
  throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
88
124
  }
125
+ const renderRoot = getChildRoot(element);
89
126
  let disposer;
90
127
  solidJs.createRoot(dispose => {
91
128
  disposer = dispose;
92
- element === document ? solidJs.flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
129
+ if (element === document) {
130
+ const tree = code();
131
+ effect(() => solidJs.flatten(tree), () => {});
132
+ } else {
133
+ const tree = code();
134
+ insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions);
135
+ }
93
136
  }, {
94
137
  id: options.renderId
95
138
  });
96
139
  return () => {
97
140
  disposer();
98
- element.textContent = "";
141
+ renderRoot.textContent = "";
99
142
  };
100
143
  }
101
- function template(html, isImportNode, isSVG, isMathML) {
144
+ function create(html, bypassGuard, flag) {
145
+ if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
146
+ const t = document.createElement("template");
147
+ t.innerHTML = html;
148
+ return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
149
+ }
150
+ function template(html, flag) {
102
151
  let node;
103
- const create = bypassGuard => {
104
- if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
105
- const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
106
- t.innerHTML = html;
107
- return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
108
- };
109
- const fn = isImportNode ? bypassGuard => solidJs.untrack(() => document.importNode(node || (node = create(bypassGuard)), true)) : bypassGuard => (node || (node = create(bypassGuard))).cloneNode(true);
110
- fn._html = html;
152
+ const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
153
+ fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
111
154
  return fn;
112
155
  }
113
156
  function delegateEvents(eventNames, document = window.document) {
@@ -136,16 +179,16 @@ function setAttribute(node, name, value) {
136
179
  }
137
180
  function setAttributeNS(node, namespace, name, value) {
138
181
  if (isHydrating(node)) return;
139
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
182
+ if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
140
183
  }
141
- function className(node, value, isSVG, prev) {
184
+ function className(node, value, prev) {
142
185
  if (isHydrating(node)) return;
143
186
  if (value == null || value === false) {
144
187
  prev && node.removeAttribute("class");
145
188
  return;
146
189
  }
147
190
  if (typeof value === "string") {
148
- value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
191
+ value !== prev && node.setAttribute("class", value);
149
192
  return;
150
193
  }
151
194
  if (typeof prev === "string") {
@@ -188,7 +231,6 @@ function style(node, value, prev) {
188
231
  if (typeof value === "string") return nodeStyle.cssText = value;
189
232
  typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
190
233
  prev || (prev = {});
191
- value || (value = {});
192
234
  let v, s;
193
235
  for (s in value) {
194
236
  v = value[s];
@@ -200,14 +242,9 @@ function style(node, value, prev) {
200
242
  function setStyleProperty(node, name, value) {
201
243
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
202
244
  }
203
- function spread(node, props = {}, isSVG, skipChildren) {
245
+ function spread(node, props = {}, skipChildren) {
204
246
  const prevProps = {};
205
- if (!skipChildren) {
206
- effect(() => normalize(props.children, prevProps.children), value => {
207
- insertExpression(node, value, prevProps.children);
208
- prevProps.children = value;
209
- });
210
- }
247
+ if (!skipChildren) insert(node, () => props.children);
211
248
  effect(() => {
212
249
  const r = props.ref;
213
250
  (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
@@ -219,7 +256,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
219
256
  newProps[prop] = props[prop];
220
257
  }
221
258
  return newProps;
222
- }, props => assign(node, props, isSVG, true, prevProps, true));
259
+ }, props => assign(node, props, true, prevProps, true));
223
260
  return prevProps;
224
261
  }
225
262
  function dynamicProperty(props, key) {
@@ -239,11 +276,12 @@ function ref(fn, element) {
239
276
  const resolved = solidJs.untrack(fn);
240
277
  solidJs.runWithOwner(null, () => applyRef(resolved, element));
241
278
  }
242
- function insert(parent, accessor, marker, initial) {
279
+ function insert(parent, accessor, marker, initial, options) {
280
+ const childRoot = getChildRoot(parent);
243
281
  const multi = marker !== undefined;
244
282
  if (multi && !initial) initial = [];
245
283
  if (isHydrating(parent)) {
246
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
284
+ if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes];
247
285
  if (Array.isArray(initial)) {
248
286
  let j = 0;
249
287
  for (let i = 0; i < initial.length; i++) {
@@ -256,27 +294,61 @@ function insert(parent, accessor, marker, initial) {
256
294
  accessor = normalize(accessor, initial, multi, true);
257
295
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
258
296
  }
259
- effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
260
- }
261
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
297
+ if (multi && initial.length === 0) {
298
+ const placeholder = document.createTextNode("");
299
+ childRoot.insertBefore(placeholder, marker);
300
+ initial = [placeholder];
301
+ }
302
+ let current = initial;
303
+ effect(() => {
304
+ const value = normalize(accessor(), current, multi, true);
305
+ if (typeof value !== "function") return value;
306
+ effect(() => normalize(value, current, multi), inner => {
307
+ insertExpression(parent, inner, current, marker);
308
+ current = inner;
309
+ }, options);
310
+ return INNER_OWNED;
311
+ }, value => {
312
+ if (value === INNER_OWNED) return;
313
+ insertExpression(parent, value, current, marker);
314
+ current = value;
315
+ }, options);
316
+ }
317
+ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
318
+ const nodeName = node.nodeName;
262
319
  props || (props = {});
263
320
  for (const prop in prevProps) {
264
321
  if (!(prop in props)) {
265
322
  if (prop === "children") continue;
266
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
323
+ prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
267
324
  }
268
325
  }
269
326
  for (const prop in props) {
270
327
  if (prop === "children") {
271
- if (!skipChildren) insertExpression(node, props.children);
328
+ if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
272
329
  continue;
273
330
  }
274
- const value = props[prop];
275
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
331
+ prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
332
+ }
333
+ }
334
+ function loadModuleAssets(mapping) {
335
+ const hy = globalThis._$HY;
336
+ if (!hy) return;
337
+ const pending = [];
338
+ for (const moduleUrl in mapping) {
339
+ if (hy.modules[moduleUrl]) continue;
340
+ const entryUrl = mapping[moduleUrl];
341
+ if (!hy.loading[moduleUrl]) {
342
+ hy.loading[moduleUrl] = import(entryUrl).then(mod => {
343
+ hy.modules[moduleUrl] = mod;
344
+ });
345
+ }
346
+ pending.push(hy.loading[moduleUrl]);
276
347
  }
348
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
277
349
  }
278
350
  function hydrate$1(code, element, options = {}) {
279
- if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
351
+ if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options);
280
352
  options.renderId ||= "";
281
353
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
282
354
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -285,6 +357,7 @@ function hydrate$1(code, element, options = {}) {
285
357
  solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
286
358
  solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
287
359
  solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
360
+ solidJs.sharedConfig.loadModuleAssets = loadModuleAssets;
288
361
  solidJs.sharedConfig.cleanupFragment = id => {
289
362
  const tpl = document.getElementById("pl-" + id);
290
363
  if (tpl) {
@@ -306,14 +379,34 @@ function hydrate$1(code, element, options = {}) {
306
379
  {
307
380
  solidJs.sharedConfig.verifyHydration = () => {
308
381
  if (solidJs.sharedConfig.registry && solidJs.sharedConfig.registry.size) {
309
- const orphaned = [...solidJs.sharedConfig.registry.values()];
382
+ const orphaned = [...solidJs.sharedConfig.registry.values()].filter(node => node.isConnected);
383
+ solidJs.sharedConfig.registry.clear();
384
+ if (!orphaned.length) return;
310
385
  console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
311
386
  }
312
387
  };
313
388
  }
389
+ const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
390
+ if (rootMapping && typeof rootMapping === "object") {
391
+ const p = loadModuleAssets(rootMapping);
392
+ if (p) {
393
+ gatherHydratable(element, options.renderId);
394
+ let disposer;
395
+ p.then(() => {
396
+ try {
397
+ disposer = render$1(code, element, [...getChildRoot(element).childNodes], options);
398
+ } finally {
399
+ solidJs.sharedConfig.hydrating = false;
400
+ }
401
+ }, () => {
402
+ solidJs.sharedConfig.hydrating = false;
403
+ });
404
+ return () => disposer && disposer();
405
+ }
406
+ }
314
407
  try {
315
408
  gatherHydratable(element, options.renderId);
316
- return render(code, element, [...element.childNodes], options);
409
+ return render$1(code, element, [...getChildRoot(element).childNodes], options);
317
410
  } finally {
318
411
  solidJs.sharedConfig.hydrating = false;
319
412
  }
@@ -362,7 +455,7 @@ function getNextMarker(start) {
362
455
  return [end, current];
363
456
  }
364
457
  function getFirstChild(node, expectedTag) {
365
- const child = node.firstChild;
458
+ const child = getChildRoot(node).firstChild;
366
459
  if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
367
460
  const isMissing = !child || child.nodeType !== 1;
368
461
  console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
@@ -372,20 +465,21 @@ function getFirstChild(node, expectedTag) {
372
465
  function getNextSibling(node, expectedTag) {
373
466
  const sibling = node.nextSibling;
374
467
  if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
375
- const parent = node.parentElement;
468
+ const parent = node.parentNode;
376
469
  const isMissing = !sibling || sibling.nodeType !== 1;
377
470
  console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
378
471
  }
379
472
  return sibling;
380
473
  }
381
474
  function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
475
+ if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
382
476
  const children = [];
383
- let child = parent.firstChild;
477
+ let child = getChildRoot(parent).firstChild;
384
478
  while (child) {
385
479
  if (child.nodeType === 1) children.push(child);
386
480
  child = child.nextSibling;
387
481
  }
388
- const pTag = parent.localName;
482
+ const pTag = parent.localName || "#fragment";
389
483
  if (isMissing) {
390
484
  const tags = children.map(c => `<${c.localName}>`).join("");
391
485
  return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
@@ -430,6 +524,9 @@ function runHydrationEvents() {
430
524
  function isHydrating(node) {
431
525
  return solidJs.sharedConfig.hydrating && (!node || node.isConnected);
432
526
  }
527
+ function getChildRoot(node) {
528
+ return node && node.localName === "template" ? node.content : node;
529
+ }
433
530
  function toggleClassKey(node, key, value) {
434
531
  const classNames = key.trim().split(/\s+/);
435
532
  for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
@@ -448,18 +545,20 @@ function flattenClassList(list, result) {
448
545
  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;
449
546
  }
450
547
  }
451
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
452
- let forceProp;
548
+ function assignProp(node, prop, value, prev, skipRef, nodeName) {
453
549
  if (prop === "style") return style(node, value, prev), value;
454
- if (prop === "class") return className(node, value, isSVG, prev), value;
455
- if (value === prev) return prev;
550
+ if (prop === "class") return className(node, value, prev), value;
551
+ if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
456
552
  if (prop === "ref") {
457
553
  if (!skipRef && value) ref(() => value, node);
458
- } else if (prop.slice(0, 3) === "on:") {
554
+ return value;
555
+ }
556
+ const hasNamespace = prop.indexOf(":") > -1;
557
+ if (hasNamespace && prop.slice(0, 3) === "on:") {
459
558
  const e = prop.slice(3);
460
559
  prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
461
560
  value && node.addEventListener(e, value, typeof value !== "function" && value);
462
- } else if (prop.slice(0, 2) === "on") {
561
+ } else if (!hasNamespace && prop.slice(0, 2) === "on") {
463
562
  const name = prop.slice(2).toLowerCase();
464
563
  const delegate = DelegatedEvents.has(name);
465
564
  if (!delegate && prev) {
@@ -470,11 +569,11 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
470
569
  addEventListener(node, name, value, delegate);
471
570
  delegate && delegateEvents([name]);
472
571
  }
473
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
474
- if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
475
- if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
572
+ } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
573
+ if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
574
+ if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
476
575
  } else {
477
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
576
+ const ns = hasNamespace && Namespaces[prop.split(":")[0]];
478
577
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
479
578
  }
480
579
  return value;
@@ -532,21 +631,22 @@ function eventHandler(e) {
532
631
  function insertExpression(parent, value, current, marker) {
533
632
  if (isHydrating(parent)) return;
534
633
  if (value === current) return;
634
+ const childRoot = getChildRoot(parent);
535
635
  const t = typeof value,
536
636
  multi = marker !== undefined;
537
637
  if (t === "string" || t === "number") {
538
638
  const tc = typeof current;
539
639
  if (tc === "string" || tc === "number") {
540
- parent.firstChild.data = value;
541
- } else parent.textContent = value;
640
+ childRoot.firstChild.data = value;
641
+ } else childRoot.textContent = value;
542
642
  } else if (value === undefined) {
543
643
  cleanChildren(parent, current, marker);
544
644
  } else if (value.nodeType) {
545
645
  if (Array.isArray(current)) {
546
646
  cleanChildren(parent, current, multi ? marker : null, value);
547
- } else if (current === undefined || !parent.firstChild) {
548
- parent.appendChild(value);
549
- } else parent.replaceChild(value, parent.firstChild);
647
+ } else if (current === undefined || !childRoot.firstChild) {
648
+ childRoot.appendChild(value);
649
+ } else childRoot.replaceChild(value, childRoot.firstChild);
550
650
  } else if (Array.isArray(value)) {
551
651
  const currentArray = current && Array.isArray(current);
552
652
  if (value.length === 0) {
@@ -554,7 +654,7 @@ function insertExpression(parent, value, current, marker) {
554
654
  } else if (currentArray) {
555
655
  if (current.length === 0) {
556
656
  appendNodes(parent, value, marker);
557
- } else reconcileArrays(parent, current, value);
657
+ } else reconcileArrays(childRoot, current, value);
558
658
  } else {
559
659
  current && cleanChildren(parent);
560
660
  appendNodes(parent, value);
@@ -579,9 +679,11 @@ function normalize(value, current, multi, doNotUnwrap) {
579
679
  return value;
580
680
  }
581
681
  function appendNodes(parent, array, marker = null) {
682
+ parent = getChildRoot(parent);
582
683
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
583
684
  }
584
685
  function cleanChildren(parent, current, marker, replacement) {
686
+ parent = getChildRoot(parent);
585
687
  if (marker === undefined) return parent.textContent = "";
586
688
  if (current.length) {
587
689
  let inserted = false;
@@ -630,13 +732,23 @@ function ssrHydrationKey() {}
630
732
  function resolveSSRNode(node) {}
631
733
  function escape(html) {}
632
734
 
735
+ const mergeProps = solidJs.merge;
633
736
  const isServer = false;
634
737
  const isDev = true;
635
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
636
- function createElement(tagName, isSVG = false, is = undefined) {
637
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
638
- is
639
- });
738
+ function render(code, element, init, options = {}) {
739
+ solidJs.enforceLoadingBoundary(true);
740
+ try {
741
+ const dispose = render$1(code, element, init, {
742
+ ...options,
743
+ insertOptions: {
744
+ schedule: true
745
+ }
746
+ });
747
+ solidJs.flush();
748
+ return dispose;
749
+ } finally {
750
+ solidJs.enforceLoadingBoundary(false);
751
+ }
640
752
  }
641
753
  const hydrate = (...args) => {
642
754
  solidJs.enableHydration();
@@ -662,6 +774,36 @@ function Portal(props) {
662
774
  });
663
775
  return treeMarker;
664
776
  }
777
+ function dynamic(source) {
778
+ const cached = solidJs.createMemo(source, {
779
+ lazy: true
780
+ });
781
+ return props => {
782
+ return solidJs.createMemo(() => {
783
+ const component = cached();
784
+ switch (typeof component) {
785
+ case "function":
786
+ Object.assign(component, {
787
+ [solidJs.$DEVCOMP]: true
788
+ });
789
+ return solidJs.untrack(() => component(props));
790
+ case "string":
791
+ const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
792
+ spread(el, props);
793
+ return el;
794
+ }
795
+ });
796
+ };
797
+ }
798
+ function Dynamic(props) {
799
+ const Comp = dynamic(() => props.component);
800
+ return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
801
+ }
802
+ function createElement(tagName, is = undefined) {
803
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
804
+ is
805
+ });
806
+ }
665
807
  function createElementProxy(el, marker) {
666
808
  return new Proxy(el, {
667
809
  get(target, prop) {
@@ -679,28 +821,6 @@ function createElementProxy(el, marker) {
679
821
  }
680
822
  });
681
823
  }
682
- function createDynamic(component, props) {
683
- const cached = solidJs.createMemo(component);
684
- return solidJs.createMemo(() => {
685
- const component = cached();
686
- switch (typeof component) {
687
- case "function":
688
- Object.assign(component, {
689
- [solidJs.$DEVCOMP]: true
690
- });
691
- return solidJs.untrack(() => component(props));
692
- case "string":
693
- const isSvg = SVGElements.has(component);
694
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, solidJs.untrack(() => props.is));
695
- spread(el, props, isSvg);
696
- return el;
697
- }
698
- });
699
- }
700
- function Dynamic(props) {
701
- const others = solidJs.omit(props, "component");
702
- return createDynamic(() => props.component, others);
703
- }
704
824
 
705
825
  Object.defineProperty(exports, "Errored", {
706
826
  enumerable: true,
@@ -726,6 +846,14 @@ Object.defineProperty(exports, "NoHydration", {
726
846
  enumerable: true,
727
847
  get: function () { return solidJs.NoHydration; }
728
848
  });
849
+ Object.defineProperty(exports, "Repeat", {
850
+ enumerable: true,
851
+ get: function () { return solidJs.Repeat; }
852
+ });
853
+ Object.defineProperty(exports, "Reveal", {
854
+ enumerable: true,
855
+ get: function () { return solidJs.Reveal; }
856
+ });
729
857
  Object.defineProperty(exports, "Show", {
730
858
  enumerable: true,
731
859
  get: function () { return solidJs.Show; }
@@ -742,10 +870,6 @@ Object.defineProperty(exports, "getOwner", {
742
870
  enumerable: true,
743
871
  get: function () { return solidJs.getOwner; }
744
872
  });
745
- Object.defineProperty(exports, "mergeProps", {
746
- enumerable: true,
747
- get: function () { return solidJs.merge; }
748
- });
749
873
  Object.defineProperty(exports, "untrack", {
750
874
  enumerable: true,
751
875
  get: function () { return solidJs.untrack; }
@@ -753,21 +877,24 @@ Object.defineProperty(exports, "untrack", {
753
877
  exports.Assets = voidFn;
754
878
  exports.ChildProperties = ChildProperties;
755
879
  exports.DOMElements = DOMElements;
880
+ exports.DOMWithState = DOMWithState;
756
881
  exports.DelegatedEvents = DelegatedEvents;
757
882
  exports.Dynamic = Dynamic;
758
883
  exports.HydrationScript = voidFn;
884
+ exports.MathMLElements = MathMLElements;
885
+ exports.Namespaces = Namespaces;
759
886
  exports.Portal = Portal;
760
- exports.Properties = Properties;
887
+ exports.RawTextElements = RawTextElements;
761
888
  exports.RequestContext = RequestContext;
762
889
  exports.SVGElements = SVGElements;
763
- exports.SVGNamespace = SVGNamespace;
890
+ exports.VoidElements = VoidElements;
764
891
  exports.addEventListener = addEventListener;
765
892
  exports.applyRef = applyRef;
766
893
  exports.assign = assign;
767
894
  exports.className = className;
768
895
  exports.clearDelegatedEvents = clearDelegatedEvents;
769
- exports.createDynamic = createDynamic;
770
896
  exports.delegateEvents = delegateEvents;
897
+ exports.dynamic = dynamic;
771
898
  exports.dynamicProperty = dynamicProperty;
772
899
  exports.effect = effect;
773
900
  exports.escape = escape;
@@ -785,6 +912,7 @@ exports.insert = insert;
785
912
  exports.isDev = isDev;
786
913
  exports.isServer = isServer;
787
914
  exports.memo = memo;
915
+ exports.mergeProps = mergeProps;
788
916
  exports.ref = ref;
789
917
  exports.render = render;
790
918
  exports.renderToStream = renderToStream;