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

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.js CHANGED
@@ -1,8 +1,34 @@
1
- import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, createRoot, flatten, omit, $DEVCOMP, enableHydration } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, merge, createComponent, omit, $DEVCOMP, enableHydration, enforceLoadingBoundary, flush } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
3
3
 
4
- const Properties = /*#__PURE__*/new Set([
5
- "value", "checked", "selected", "muted"]);
4
+ const DOMWithState = {
5
+ INPUT: {
6
+ value: 1,
7
+ defaultValue: 2,
8
+ checked: 1,
9
+ defaultChecked: 2
10
+ },
11
+ SELECT: {
12
+ value: 1
13
+ },
14
+ OPTION: {
15
+ value: 1,
16
+ selected: 1,
17
+ defaultSelected: 2
18
+ },
19
+ TEXTAREA: {
20
+ value: 1,
21
+ defaultValue: 2
22
+ },
23
+ VIDEO: {
24
+ muted: 1,
25
+ defaultMuted: 2
26
+ },
27
+ AUDIO: {
28
+ muted: 1,
29
+ defaultMuted: 2
30
+ }
31
+ };
6
32
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
7
33
  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"]);
8
34
  const SVGElements = /*#__PURE__*/new Set([
@@ -10,18 +36,32 @@ const SVGElements = /*#__PURE__*/new Set([
10
36
  "set", "stop",
11
37
  "svg", "switch", "symbol", "text", "textPath",
12
38
  "tref", "tspan", "use", "view", "vkern"]);
13
- const SVGNamespace = {
39
+ 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"]);
40
+ const Namespaces = {
41
+ svg: "http://www.w3.org/2000/svg",
42
+ mathml: "http://www.w3.org/1998/Math/MathML",
14
43
  xlink: "http://www.w3.org/1999/xlink",
15
44
  xml: "http://www.w3.org/XML/1998/namespace"
16
45
  };
46
+ const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
47
+ const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
17
48
  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
49
  "webview",
19
50
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
20
51
 
21
- const effect = (fn, effectFn, initial) => createRenderEffect(fn, effectFn, initial, {
22
- transparent: true
23
- });
24
- const memo = fn => createMemo(() => fn());
52
+ const transparentOptions = {
53
+ transparent: true,
54
+ sync: true
55
+ };
56
+ const syncOptions = {
57
+ sync: true
58
+ };
59
+ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
60
+ transparent: true,
61
+ sync: true,
62
+ ...options
63
+ } : transparentOptions);
64
+ const memo = fn => createMemo(() => fn(), syncOptions);
25
65
 
26
66
  function reconcileArrays(parentNode, a, b) {
27
67
  let bLength = b.length,
@@ -50,10 +90,12 @@ function reconcileArrays(parentNode, a, b) {
50
90
  aStart++;
51
91
  }
52
92
  } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
53
- const node = a[--aEnd].nextSibling;
54
- parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
55
- parentNode.insertBefore(b[--bEnd], node);
56
- a[aEnd] = b[bEnd];
93
+ const anchor = a[aStart];
94
+ do {
95
+ parentNode.insertBefore(a[--aEnd], anchor);
96
+ bStart++;
97
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
98
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
57
99
  } else {
58
100
  if (!map) {
59
101
  map = new Map();
@@ -81,32 +123,40 @@ function reconcileArrays(parentNode, a, b) {
81
123
  }
82
124
 
83
125
  const $$EVENTS = "_$DX_DELEGATE";
84
- function render(code, element, init, options = {}) {
126
+ const INNER_OWNED = {};
127
+ function render$1(code, element, init, options = {}) {
85
128
  if (!element) {
86
129
  throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
87
130
  }
131
+ const renderRoot = getChildRoot(element);
88
132
  let disposer;
89
133
  createRoot(dispose => {
90
134
  disposer = dispose;
91
- element === document ? flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
135
+ if (element === document) {
136
+ const tree = code();
137
+ effect(() => flatten(tree), () => {});
138
+ } else {
139
+ const tree = code();
140
+ insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions);
141
+ }
92
142
  }, {
93
143
  id: options.renderId
94
144
  });
95
145
  return () => {
96
146
  disposer();
97
- element.textContent = "";
147
+ renderRoot.textContent = "";
98
148
  };
99
149
  }
100
- function template(html, isImportNode, isSVG, isMathML) {
150
+ function create(html, bypassGuard, flag) {
151
+ if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
152
+ const t = document.createElement("template");
153
+ t.innerHTML = html;
154
+ return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
155
+ }
156
+ function template(html, flag) {
101
157
  let node;
102
- const create = bypassGuard => {
103
- if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
104
- const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
105
- t.innerHTML = html;
106
- return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
107
- };
108
- const fn = isImportNode ? bypassGuard => untrack(() => document.importNode(node || (node = create(bypassGuard)), true)) : bypassGuard => (node || (node = create(bypassGuard))).cloneNode(true);
109
- fn._html = html;
158
+ const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
159
+ fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
110
160
  return fn;
111
161
  }
112
162
  function delegateEvents(eventNames, document = window.document) {
@@ -135,16 +185,16 @@ function setAttribute(node, name, value) {
135
185
  }
136
186
  function setAttributeNS(node, namespace, name, value) {
137
187
  if (isHydrating(node)) return;
138
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
188
+ if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
139
189
  }
140
- function className(node, value, isSVG, prev) {
190
+ function className(node, value, prev) {
141
191
  if (isHydrating(node)) return;
142
192
  if (value == null || value === false) {
143
193
  prev && node.removeAttribute("class");
144
194
  return;
145
195
  }
146
196
  if (typeof value === "string") {
147
- value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
197
+ value !== prev && node.setAttribute("class", value);
148
198
  return;
149
199
  }
150
200
  if (typeof prev === "string") {
@@ -158,13 +208,13 @@ function className(node, value, isSVG, prev) {
158
208
  for (i = 0, len = prevKeys.length; i < len; i++) {
159
209
  const key = prevKeys[i];
160
210
  if (!key || key === "undefined" || value[key]) continue;
161
- toggleClassKey(node, key, false);
211
+ node.classList.remove(key);
162
212
  }
163
213
  for (i = 0, len = classKeys.length; i < len; i++) {
164
214
  const key = classKeys[i],
165
215
  classValue = !!value[key];
166
216
  if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
167
- toggleClassKey(node, key, true);
217
+ node.classList.add(key);
168
218
  }
169
219
  }
170
220
  function addEventListener(node, name, handler, delegate) {
@@ -187,7 +237,6 @@ function style(node, value, prev) {
187
237
  if (typeof value === "string") return nodeStyle.cssText = value;
188
238
  typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
189
239
  prev || (prev = {});
190
- value || (value = {});
191
240
  let v, s;
192
241
  for (s in value) {
193
242
  v = value[s];
@@ -199,14 +248,9 @@ function style(node, value, prev) {
199
248
  function setStyleProperty(node, name, value) {
200
249
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
201
250
  }
202
- function spread(node, props = {}, isSVG, skipChildren) {
251
+ function spread(node, props = {}, skipChildren) {
203
252
  const prevProps = {};
204
- if (!skipChildren) {
205
- effect(() => normalize(props.children, prevProps.children), value => {
206
- insertExpression(node, value, prevProps.children);
207
- prevProps.children = value;
208
- });
209
- }
253
+ if (!skipChildren) insert(node, () => props.children);
210
254
  effect(() => {
211
255
  const r = props.ref;
212
256
  (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
@@ -218,7 +262,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
218
262
  newProps[prop] = props[prop];
219
263
  }
220
264
  return newProps;
221
- }, props => assign(node, props, isSVG, true, prevProps, true));
265
+ }, props => assign(node, props, true, prevProps, true));
222
266
  return prevProps;
223
267
  }
224
268
  function dynamicProperty(props, key) {
@@ -238,11 +282,12 @@ function ref(fn, element) {
238
282
  const resolved = untrack(fn);
239
283
  runWithOwner(null, () => applyRef(resolved, element));
240
284
  }
241
- function insert(parent, accessor, marker, initial) {
285
+ function insert(parent, accessor, marker, initial, options) {
286
+ const childRoot = getChildRoot(parent);
242
287
  const multi = marker !== undefined;
243
288
  if (multi && !initial) initial = [];
244
289
  if (isHydrating(parent)) {
245
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
290
+ if (!multi && initial === undefined && parent) initial = [...childRoot.childNodes];
246
291
  if (Array.isArray(initial)) {
247
292
  let j = 0;
248
293
  for (let i = 0; i < initial.length; i++) {
@@ -255,27 +300,64 @@ function insert(parent, accessor, marker, initial) {
255
300
  accessor = normalize(accessor, initial, multi, true);
256
301
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
257
302
  }
258
- effect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
259
- }
260
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
303
+ if (multi && initial.length === 0) {
304
+ const placeholder = document.createTextNode("");
305
+ childRoot.insertBefore(placeholder, marker);
306
+ initial = [placeholder];
307
+ }
308
+ let current = initial;
309
+ effect(prev => {
310
+ const value = normalize(accessor(), current, multi, true);
311
+ if (typeof value !== "function") return value;
312
+ effect(() => normalize(value, current, multi), inner => {
313
+ insertExpression(parent, inner, current, marker);
314
+ current = inner;
315
+ }, prev !== undefined && !(options && options.schedule) ? {
316
+ ...options,
317
+ schedule: true
318
+ } : options);
319
+ return INNER_OWNED;
320
+ }, value => {
321
+ if (value === INNER_OWNED) return;
322
+ insertExpression(parent, value, current, marker);
323
+ current = value;
324
+ }, options);
325
+ }
326
+ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
327
+ const nodeName = node.nodeName;
261
328
  props || (props = {});
262
329
  for (const prop in prevProps) {
263
330
  if (!(prop in props)) {
264
331
  if (prop === "children") continue;
265
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
332
+ prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
266
333
  }
267
334
  }
268
335
  for (const prop in props) {
269
336
  if (prop === "children") {
270
- if (!skipChildren) insertExpression(node, props.children);
337
+ if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
271
338
  continue;
272
339
  }
273
- const value = props[prop];
274
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
340
+ prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
341
+ }
342
+ }
343
+ function loadModuleAssets(mapping) {
344
+ const hy = globalThis._$HY;
345
+ if (!hy) return;
346
+ const pending = [];
347
+ for (const moduleUrl in mapping) {
348
+ if (hy.modules[moduleUrl]) continue;
349
+ const entryUrl = mapping[moduleUrl];
350
+ if (!hy.loading[moduleUrl]) {
351
+ hy.loading[moduleUrl] = import(entryUrl).then(mod => {
352
+ hy.modules[moduleUrl] = mod;
353
+ });
354
+ }
355
+ pending.push(hy.loading[moduleUrl]);
275
356
  }
357
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
276
358
  }
277
359
  function hydrate$1(code, element, options = {}) {
278
- if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
360
+ if (globalThis._$HY.done) return render$1(code, element, [...getChildRoot(element).childNodes], options);
279
361
  options.renderId ||= "";
280
362
  if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
281
363
  if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
@@ -284,6 +366,7 @@ function hydrate$1(code, element, options = {}) {
284
366
  sharedConfig.load = id => globalThis._$HY.r[id];
285
367
  sharedConfig.has = id => id in globalThis._$HY.r;
286
368
  sharedConfig.gather = root => gatherHydratable(element, root);
369
+ sharedConfig.loadModuleAssets = loadModuleAssets;
287
370
  sharedConfig.cleanupFragment = id => {
288
371
  const tpl = document.getElementById("pl-" + id);
289
372
  if (tpl) {
@@ -305,14 +388,34 @@ function hydrate$1(code, element, options = {}) {
305
388
  {
306
389
  sharedConfig.verifyHydration = () => {
307
390
  if (sharedConfig.registry && sharedConfig.registry.size) {
308
- const orphaned = [...sharedConfig.registry.values()];
391
+ const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
392
+ sharedConfig.registry.clear();
393
+ if (!orphaned.length) return;
309
394
  console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
310
395
  }
311
396
  };
312
397
  }
398
+ const rootMapping = globalThis._$HY.r && globalThis._$HY.r["_assets"];
399
+ if (rootMapping && typeof rootMapping === "object") {
400
+ const p = loadModuleAssets(rootMapping);
401
+ if (p) {
402
+ gatherHydratable(element, options.renderId);
403
+ let disposer;
404
+ p.then(() => {
405
+ try {
406
+ disposer = render$1(code, element, [...getChildRoot(element).childNodes], options);
407
+ } finally {
408
+ sharedConfig.hydrating = false;
409
+ }
410
+ }, () => {
411
+ sharedConfig.hydrating = false;
412
+ });
413
+ return () => disposer && disposer();
414
+ }
415
+ }
313
416
  try {
314
417
  gatherHydratable(element, options.renderId);
315
- return render(code, element, [...element.childNodes], options);
418
+ return render$1(code, element, [...getChildRoot(element).childNodes], options);
316
419
  } finally {
317
420
  sharedConfig.hydrating = false;
318
421
  }
@@ -361,7 +464,7 @@ function getNextMarker(start) {
361
464
  return [end, current];
362
465
  }
363
466
  function getFirstChild(node, expectedTag) {
364
- const child = node.firstChild;
467
+ const child = getChildRoot(node).firstChild;
365
468
  if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
366
469
  const isMissing = !child || child.nodeType !== 1;
367
470
  console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
@@ -371,20 +474,21 @@ function getFirstChild(node, expectedTag) {
371
474
  function getNextSibling(node, expectedTag) {
372
475
  const sibling = node.nextSibling;
373
476
  if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
374
- const parent = node.parentElement;
477
+ const parent = node.parentNode;
375
478
  const isMissing = !sibling || sibling.nodeType !== 1;
376
479
  console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
377
480
  }
378
481
  return sibling;
379
482
  }
380
483
  function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
484
+ if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
381
485
  const children = [];
382
- let child = parent.firstChild;
486
+ let child = getChildRoot(parent).firstChild;
383
487
  while (child) {
384
488
  if (child.nodeType === 1) children.push(child);
385
489
  child = child.nextSibling;
386
490
  }
387
- const pTag = parent.localName;
491
+ const pTag = parent.localName || "#fragment";
388
492
  if (isMissing) {
389
493
  const tags = children.map(c => `<${c.localName}>`).join("");
390
494
  return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
@@ -429,14 +533,24 @@ function runHydrationEvents() {
429
533
  function isHydrating(node) {
430
534
  return sharedConfig.hydrating && (!node || node.isConnected);
431
535
  }
432
- function toggleClassKey(node, key, value) {
433
- const classNames = key.trim().split(/\s+/);
434
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
536
+ function getChildRoot(node) {
537
+ return node && node.localName === "template" ? node.content : node;
435
538
  }
436
539
  function classListToObject(classList) {
437
540
  if (Array.isArray(classList)) {
438
541
  const result = {};
439
542
  flattenClassList(classList, result);
543
+ classList = result;
544
+ }
545
+ if (classList && typeof classList === "object") {
546
+ const result = {},
547
+ keys = Object.keys(classList);
548
+ for (let i = 0, len = keys.length; i < len; i++) {
549
+ const key = keys[i];
550
+ if (!classList[key]) continue;
551
+ const classNames = key.trim().split(/\s+/);
552
+ for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
553
+ }
440
554
  return result;
441
555
  }
442
556
  return classList;
@@ -447,18 +561,20 @@ function flattenClassList(list, result) {
447
561
  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;
448
562
  }
449
563
  }
450
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
451
- let forceProp;
564
+ function assignProp(node, prop, value, prev, skipRef, nodeName) {
452
565
  if (prop === "style") return style(node, value, prev), value;
453
- if (prop === "class") return className(node, value, isSVG, prev), value;
454
- if (value === prev) return prev;
566
+ if (prop === "class") return className(node, value, prev), value;
567
+ if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
455
568
  if (prop === "ref") {
456
569
  if (!skipRef && value) ref(() => value, node);
457
- } else if (prop.slice(0, 3) === "on:") {
570
+ return value;
571
+ }
572
+ const hasNamespace = prop.indexOf(":") > -1;
573
+ if (hasNamespace && prop.slice(0, 3) === "on:") {
458
574
  const e = prop.slice(3);
459
575
  prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
460
576
  value && node.addEventListener(e, value, typeof value !== "function" && value);
461
- } else if (prop.slice(0, 2) === "on") {
577
+ } else if (!hasNamespace && prop.slice(0, 2) === "on") {
462
578
  const name = prop.slice(2).toLowerCase();
463
579
  const delegate = DelegatedEvents.has(name);
464
580
  if (!delegate && prev) {
@@ -469,11 +585,11 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
469
585
  addEventListener(node, name, value, delegate);
470
586
  delegate && delegateEvents([name]);
471
587
  }
472
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
473
- if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
474
- if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
588
+ } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
589
+ if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
590
+ if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
475
591
  } else {
476
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
592
+ const ns = hasNamespace && Namespaces[prop.split(":")[0]];
477
593
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
478
594
  }
479
595
  return value;
@@ -531,21 +647,22 @@ function eventHandler(e) {
531
647
  function insertExpression(parent, value, current, marker) {
532
648
  if (isHydrating(parent)) return;
533
649
  if (value === current) return;
650
+ const childRoot = getChildRoot(parent);
534
651
  const t = typeof value,
535
652
  multi = marker !== undefined;
536
653
  if (t === "string" || t === "number") {
537
654
  const tc = typeof current;
538
655
  if (tc === "string" || tc === "number") {
539
- parent.firstChild.data = value;
540
- } else parent.textContent = value;
656
+ childRoot.firstChild.data = value;
657
+ } else childRoot.textContent = value;
541
658
  } else if (value === undefined) {
542
659
  cleanChildren(parent, current, marker);
543
660
  } else if (value.nodeType) {
544
661
  if (Array.isArray(current)) {
545
662
  cleanChildren(parent, current, multi ? marker : null, value);
546
- } else if (current === undefined || !parent.firstChild) {
547
- parent.appendChild(value);
548
- } else parent.replaceChild(value, parent.firstChild);
663
+ } else if (current === undefined || !childRoot.firstChild) {
664
+ childRoot.appendChild(value);
665
+ } else childRoot.replaceChild(value, childRoot.firstChild);
549
666
  } else if (Array.isArray(value)) {
550
667
  const currentArray = current && Array.isArray(current);
551
668
  if (value.length === 0) {
@@ -553,7 +670,7 @@ function insertExpression(parent, value, current, marker) {
553
670
  } else if (currentArray) {
554
671
  if (current.length === 0) {
555
672
  appendNodes(parent, value, marker);
556
- } else reconcileArrays(parent, current, value);
673
+ } else reconcileArrays(childRoot, current, value);
557
674
  } else {
558
675
  current && cleanChildren(parent);
559
676
  appendNodes(parent, value);
@@ -578,9 +695,11 @@ function normalize(value, current, multi, doNotUnwrap) {
578
695
  return value;
579
696
  }
580
697
  function appendNodes(parent, array, marker = null) {
698
+ parent = getChildRoot(parent);
581
699
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
582
700
  }
583
701
  function cleanChildren(parent, current, marker, replacement) {
702
+ parent = getChildRoot(parent);
584
703
  if (marker === undefined) return parent.textContent = "";
585
704
  if (current.length) {
586
705
  let inserted = false;
@@ -629,13 +748,23 @@ function ssrHydrationKey() {}
629
748
  function resolveSSRNode(node) {}
630
749
  function escape(html) {}
631
750
 
751
+ const mergeProps = merge;
632
752
  const isServer = false;
633
753
  const isDev = true;
634
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
635
- function createElement(tagName, isSVG = false, is = undefined) {
636
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
637
- is
638
- });
754
+ function render(code, element, init, options = {}) {
755
+ enforceLoadingBoundary(true);
756
+ try {
757
+ const dispose = render$1(code, element, init, {
758
+ ...options,
759
+ insertOptions: {
760
+ schedule: true
761
+ }
762
+ });
763
+ flush();
764
+ return dispose;
765
+ } finally {
766
+ enforceLoadingBoundary(false);
767
+ }
639
768
  }
640
769
  const hydrate = (...args) => {
641
770
  enableHydration();
@@ -661,6 +790,36 @@ function Portal(props) {
661
790
  });
662
791
  return treeMarker;
663
792
  }
793
+ function dynamic(source) {
794
+ const cached = createMemo(source, {
795
+ lazy: true
796
+ });
797
+ return props => {
798
+ return createMemo(() => {
799
+ const component = cached();
800
+ switch (typeof component) {
801
+ case "function":
802
+ Object.assign(component, {
803
+ [$DEVCOMP]: true
804
+ });
805
+ return untrack(() => component(props));
806
+ case "string":
807
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
808
+ spread(el, props);
809
+ return el;
810
+ }
811
+ });
812
+ };
813
+ }
814
+ function Dynamic(props) {
815
+ const Comp = dynamic(() => props.component);
816
+ return createComponent(Comp, omit(props, "component"));
817
+ }
818
+ function createElement(tagName, is = undefined) {
819
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
820
+ is
821
+ });
822
+ }
664
823
  function createElementProxy(el, marker) {
665
824
  return new Proxy(el, {
666
825
  get(target, prop) {
@@ -678,27 +837,5 @@ function createElementProxy(el, marker) {
678
837
  }
679
838
  });
680
839
  }
681
- function createDynamic(component, props) {
682
- const cached = createMemo(component);
683
- return createMemo(() => {
684
- const component = cached();
685
- switch (typeof component) {
686
- case "function":
687
- Object.assign(component, {
688
- [$DEVCOMP]: true
689
- });
690
- return untrack(() => component(props));
691
- case "string":
692
- const isSvg = SVGElements.has(component);
693
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
694
- spread(el, props, isSvg);
695
- return el;
696
- }
697
- });
698
- }
699
- function Dynamic(props) {
700
- const others = omit(props, "component");
701
- return createDynamic(() => props.component, others);
702
- }
703
840
 
704
- export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, Portal, Properties, RequestContext, SVGElements, SVGNamespace, 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 };
841
+ export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, addEventListener, applyRef, assign, className, clearDelegatedEvents, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, voidFn as getAssets, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, mergeProps, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, voidFn as useAssets };