@solidjs/web 2.0.0-experimental.1 → 2.0.0-experimental.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016-2023 Ryan Carniato
3
+ Copyright (c) 2016-2025 Ryan Carniato
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/dev.cjs CHANGED
@@ -2,38 +2,9 @@
2
2
 
3
3
  var solidJs = require('solid-js');
4
4
 
5
- const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
6
- const Properties = /*#__PURE__*/new Set(["value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
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,
@@ -111,8 +86,10 @@ function render(code, element, init, options = {}) {
111
86
  let disposer;
112
87
  solidJs.createRoot(dispose => {
113
88
  disposer = dispose;
114
- element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
115
- }, options.owner);
89
+ element === document ? solidJs.flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
90
+ }, {
91
+ id: options.renderId
92
+ });
116
93
  return () => {
117
94
  disposer();
118
95
  element.textContent = "";
@@ -145,20 +122,20 @@ function clearDelegatedEvents(document = window.document) {
145
122
  }
146
123
  }
147
124
  function setProperty(node, name, value) {
125
+ if (isHydrating(node)) return;
148
126
  node[name] = value;
149
127
  }
150
128
  function setAttribute(node, name, value) {
151
- if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
129
+ if (isHydrating(node)) return;
130
+ if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
152
131
  }
153
132
  function setAttributeNS(node, namespace, name, value) {
154
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
155
- }
156
- function setBoolAttribute(node, name, value) {
157
133
  if (isHydrating(node)) return;
158
- value ? node.setAttribute(name, "") : node.removeAttribute(name);
134
+ if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
159
135
  }
160
136
  function className(node, value, isSVG, prev) {
161
- if (value == null) {
137
+ if (isHydrating(node)) return;
138
+ if (value == null || value === false) {
162
139
  prev && node.removeAttribute("class");
163
140
  return;
164
141
  }
@@ -215,6 +192,9 @@ function style(node, value, prev) {
215
192
  }
216
193
  for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
217
194
  }
195
+ function setStyleProperty(node, name, value) {
196
+ value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
197
+ }
218
198
  function spread(node, props = {}, isSVG, skipChildren) {
219
199
  const prevProps = {};
220
200
  if (!skipChildren) {
@@ -275,21 +255,19 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
275
255
  }
276
256
  function hydrate$1(code, element, options = {}) {
277
257
  if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
258
+ options.renderId ||= "";
278
259
  solidJs.sharedConfig.completed = globalThis._$HY.completed;
279
260
  solidJs.sharedConfig.events = globalThis._$HY.events;
280
261
  solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
281
262
  solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
282
263
  solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
283
264
  solidJs.sharedConfig.registry = new Map();
284
- solidJs.sharedConfig.context = {
285
- id: options.renderId || "",
286
- count: 0
287
- };
265
+ solidJs.sharedConfig.hydrating = true;
288
266
  try {
289
267
  gatherHydratable(element, options.renderId);
290
268
  return render(code, element, [...element.childNodes], options);
291
269
  } finally {
292
- solidJs.sharedConfig.context = null;
270
+ solidJs.sharedConfig.hydrating = false;
293
271
  }
294
272
  }
295
273
  function getNextElement(template) {
@@ -354,7 +332,7 @@ function runHydrationEvents() {
354
332
  }
355
333
  }
356
334
  function isHydrating(node) {
357
- return !!solidJs.sharedConfig.context && !solidJs.sharedConfig.done && (!node || node.isConnected);
335
+ return solidJs.sharedConfig.hydrating && !solidJs.sharedConfig.done && (!node || node.isConnected);
358
336
  }
359
337
  function toggleClassKey(node, key, value) {
360
338
  const classNames = key.trim().split(/\s+/);
@@ -363,16 +341,19 @@ function toggleClassKey(node, key, value) {
363
341
  function classListToObject(classList) {
364
342
  if (Array.isArray(classList)) {
365
343
  const result = {};
366
- for (let i = 0, len = classList.length; i < len; i++) {
367
- const key = classList[i];
368
- if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
369
- }
344
+ flattenClassList(classList, result);
370
345
  return result;
371
346
  }
372
347
  return classList;
373
348
  }
349
+ function flattenClassList(list, result) {
350
+ for (let i = 0, len = list.length; i < len; i++) {
351
+ const item = list[i];
352
+ 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;
353
+ }
354
+ }
374
355
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
375
- let propAlias, forceProp;
356
+ let forceProp;
376
357
  if (prop === "style") return style(node, value, prev), value;
377
358
  if (prop === "class") return className(node, value, isSVG, prev), value;
378
359
  if (value === prev) return prev;
@@ -393,12 +374,9 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
393
374
  addEventListener(node, name, value, delegate);
394
375
  delegate && delegateEvents([name]);
395
376
  }
396
- } else if (prop.slice(0, 5) === "attr:") {
397
- setAttribute(node, prop.slice(5), value);
398
- } else if (prop.slice(0, 5) === "bool:") {
399
- setBoolAttribute(node, prop.slice(5), value);
400
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
401
- if (forceProp) prop = prop.slice(5);else node[propAlias || prop] = value;
377
+ } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
378
+ if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
379
+ if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
402
380
  } else {
403
381
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
404
382
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
@@ -457,6 +435,7 @@ function eventHandler(e) {
457
435
  retarget(oriTarget);
458
436
  }
459
437
  function insertExpression(parent, value, current, marker) {
438
+ if (isHydrating(parent)) return;
460
439
  if (value === current) return;
461
440
  const t = typeof value,
462
441
  multi = marker !== undefined;
@@ -493,7 +472,7 @@ function normalize(value, current, multi, doNotUnwrap) {
493
472
  doNotUnwrap
494
473
  });
495
474
  if (doNotUnwrap && typeof value === "function") return value;
496
- if (multi && value != null && !Array.isArray(value)) value = [value];
475
+ if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
497
476
  if (Array.isArray(value)) {
498
477
  for (let i = 0, len = value.length; i < len; i++) {
499
478
  const item = value[i],
@@ -521,10 +500,10 @@ function cleanChildren(parent, current, marker, replacement) {
521
500
  } else if (replacement) parent.insertBefore(replacement, marker);
522
501
  }
523
502
  function gatherHydratable(element, root) {
524
- const templates = element.querySelectorAll(`*[data-hk]`);
503
+ const templates = element.querySelectorAll(`*[_hk]`);
525
504
  for (let i = 0; i < templates.length; i++) {
526
505
  const node = templates[i];
527
- const key = node.getAttribute("data-hk");
506
+ const key = node.getAttribute("_hk");
528
507
  if ((!root || key.startsWith(root)) && !solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
529
508
  }
530
509
  }
@@ -532,7 +511,7 @@ function getHydrationKey() {
532
511
  return solidJs.sharedConfig.getNextContextId();
533
512
  }
534
513
  function NoHydration(props) {
535
- return solidJs.sharedConfig.context ? undefined : props.children;
514
+ return solidJs.sharedConfig.hydrating ? undefined : props.children;
536
515
  }
537
516
  function Hydration(props) {
538
517
  return props.children;
@@ -565,8 +544,10 @@ function escape(html) {}
565
544
  const isServer = false;
566
545
  const isDev = true;
567
546
  const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
568
- function createElement(tagName, isSVG = false) {
569
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
547
+ function createElement(tagName, isSVG = false, is = undefined) {
548
+ return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
549
+ is
550
+ });
570
551
  }
571
552
  const hydrate = (...args) => {
572
553
  solidJs.enableHydration();
@@ -609,9 +590,8 @@ function createElementProxy(el, marker) {
609
590
  }
610
591
  });
611
592
  }
612
- function Dynamic(props) {
613
- const others = solidJs.omit(props, "component");
614
- const cached = solidJs.createMemo(() => props.component);
593
+ function createDynamic(component, props) {
594
+ const cached = solidJs.createMemo(component);
615
595
  return solidJs.createMemo(() => {
616
596
  const component = cached();
617
597
  switch (typeof component) {
@@ -619,15 +599,19 @@ function Dynamic(props) {
619
599
  Object.assign(component, {
620
600
  [solidJs.$DEVCOMP]: true
621
601
  });
622
- return solidJs.untrack(() => component(others));
602
+ return solidJs.untrack(() => component(props));
623
603
  case "string":
624
604
  const isSvg = SVGElements.has(component);
625
- const el = solidJs.sharedConfig.context ? getNextElement() : createElement(component, isSvg);
626
- spread(el, others, isSvg);
605
+ const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, solidJs.untrack(() => props.is));
606
+ spread(el, props, isSvg);
627
607
  return el;
628
608
  }
629
609
  });
630
610
  }
611
+ function Dynamic(props) {
612
+ const others = solidJs.omit(props, "component");
613
+ return createDynamic(() => props.component, others);
614
+ }
631
615
 
632
616
  Object.defineProperty(exports, "ErrorBoundary", {
633
617
  enumerable: true,
@@ -665,10 +649,6 @@ Object.defineProperty(exports, "getOwner", {
665
649
  enumerable: true,
666
650
  get: function () { return solidJs.getOwner; }
667
651
  });
668
- Object.defineProperty(exports, "memo", {
669
- enumerable: true,
670
- get: function () { return solidJs.createMemo; }
671
- });
672
652
  Object.defineProperty(exports, "mergeProps", {
673
653
  enumerable: true,
674
654
  get: function () { return solidJs.merge; }
@@ -694,6 +674,7 @@ exports.addEventListener = addEventListener;
694
674
  exports.assign = assign;
695
675
  exports.className = className;
696
676
  exports.clearDelegatedEvents = clearDelegatedEvents;
677
+ exports.createDynamic = createDynamic;
697
678
  exports.delegateEvents = delegateEvents;
698
679
  exports.dynamicProperty = dynamicProperty;
699
680
  exports.escape = escape;
@@ -703,12 +684,12 @@ exports.getHydrationKey = getHydrationKey;
703
684
  exports.getNextElement = getNextElement;
704
685
  exports.getNextMarker = getNextMarker;
705
686
  exports.getNextMatch = getNextMatch;
706
- exports.getPropAlias = getPropAlias;
707
687
  exports.getRequestEvent = voidFn;
708
688
  exports.hydrate = hydrate;
709
689
  exports.insert = insert;
710
690
  exports.isDev = isDev;
711
691
  exports.isServer = isServer;
692
+ exports.memo = memo;
712
693
  exports.render = render;
713
694
  exports.renderToStream = renderToStream;
714
695
  exports.renderToString = renderToString;
@@ -717,8 +698,8 @@ exports.resolveSSRNode = resolveSSRNode;
717
698
  exports.runHydrationEvents = runHydrationEvents;
718
699
  exports.setAttribute = setAttribute;
719
700
  exports.setAttributeNS = setAttributeNS;
720
- exports.setBoolAttribute = setBoolAttribute;
721
701
  exports.setProperty = setProperty;
702
+ exports.setStyleProperty = setStyleProperty;
722
703
  exports.spread = spread;
723
704
  exports.ssr = ssr;
724
705
  exports.ssrAttribute = ssrAttribute;
package/dist/dev.js CHANGED
@@ -1,38 +1,9 @@
1
- import { createRoot, untrack, createRenderEffect, sharedConfig, flatten, enableHydration, createMemo, omit, $DEVCOMP } from 'solid-js';
2
- export { ErrorBoundary, For, Match, Show, Suspense, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, merge as mergeProps, untrack } from 'solid-js';
1
+ import { createMemo, createRoot, flatten, untrack, createRenderEffect, sharedConfig, enableHydration, $DEVCOMP, omit } from 'solid-js';
2
+ export { ErrorBoundary, For, Match, Show, Suspense, Switch, createComponent, createRenderEffect as effect, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
3
 
4
- const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
5
- const Properties = /*#__PURE__*/new Set(["value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
4
+ const Properties = /*#__PURE__*/new Set([
5
+ "value", "checked", "selected", "muted"]);
6
6
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
7
- const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
8
- class: "className",
9
- formnovalidate: {
10
- $: "formNoValidate",
11
- BUTTON: 1,
12
- INPUT: 1
13
- },
14
- ismap: {
15
- $: "isMap",
16
- IMG: 1
17
- },
18
- nomodule: {
19
- $: "noModule",
20
- SCRIPT: 1
21
- },
22
- playsinline: {
23
- $: "playsInline",
24
- VIDEO: 1
25
- },
26
- readonly: {
27
- $: "readOnly",
28
- INPUT: 1,
29
- TEXTAREA: 1
30
- }
31
- });
32
- function getPropAlias(prop, tagName) {
33
- const a = PropAliases[prop];
34
- return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
35
- }
36
7
  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"]);
37
8
  const SVGElements = /*#__PURE__*/new Set([
38
9
  "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",
@@ -43,7 +14,11 @@ const SVGNamespace = {
43
14
  xlink: "http://www.w3.org/1999/xlink",
44
15
  xml: "http://www.w3.org/XML/1998/namespace"
45
16
  };
46
- 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"]);
17
+ 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
+ "webview",
19
+ "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
20
+
21
+ const memo = fn => createMemo(() => fn());
47
22
 
48
23
  function reconcileArrays(parentNode, a, b) {
49
24
  let bLength = b.length,
@@ -110,8 +85,10 @@ function render(code, element, init, options = {}) {
110
85
  let disposer;
111
86
  createRoot(dispose => {
112
87
  disposer = dispose;
113
- element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
114
- }, options.owner);
88
+ element === document ? flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
89
+ }, {
90
+ id: options.renderId
91
+ });
115
92
  return () => {
116
93
  disposer();
117
94
  element.textContent = "";
@@ -144,20 +121,20 @@ function clearDelegatedEvents(document = window.document) {
144
121
  }
145
122
  }
146
123
  function setProperty(node, name, value) {
124
+ if (isHydrating(node)) return;
147
125
  node[name] = value;
148
126
  }
149
127
  function setAttribute(node, name, value) {
150
- if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
128
+ if (isHydrating(node)) return;
129
+ if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
151
130
  }
152
131
  function setAttributeNS(node, namespace, name, value) {
153
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
154
- }
155
- function setBoolAttribute(node, name, value) {
156
132
  if (isHydrating(node)) return;
157
- value ? node.setAttribute(name, "") : node.removeAttribute(name);
133
+ if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
158
134
  }
159
135
  function className(node, value, isSVG, prev) {
160
- if (value == null) {
136
+ if (isHydrating(node)) return;
137
+ if (value == null || value === false) {
161
138
  prev && node.removeAttribute("class");
162
139
  return;
163
140
  }
@@ -214,6 +191,9 @@ function style(node, value, prev) {
214
191
  }
215
192
  for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
216
193
  }
194
+ function setStyleProperty(node, name, value) {
195
+ value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
196
+ }
217
197
  function spread(node, props = {}, isSVG, skipChildren) {
218
198
  const prevProps = {};
219
199
  if (!skipChildren) {
@@ -274,21 +254,19 @@ function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = fals
274
254
  }
275
255
  function hydrate$1(code, element, options = {}) {
276
256
  if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
257
+ options.renderId ||= "";
277
258
  sharedConfig.completed = globalThis._$HY.completed;
278
259
  sharedConfig.events = globalThis._$HY.events;
279
260
  sharedConfig.load = id => globalThis._$HY.r[id];
280
261
  sharedConfig.has = id => id in globalThis._$HY.r;
281
262
  sharedConfig.gather = root => gatherHydratable(element, root);
282
263
  sharedConfig.registry = new Map();
283
- sharedConfig.context = {
284
- id: options.renderId || "",
285
- count: 0
286
- };
264
+ sharedConfig.hydrating = true;
287
265
  try {
288
266
  gatherHydratable(element, options.renderId);
289
267
  return render(code, element, [...element.childNodes], options);
290
268
  } finally {
291
- sharedConfig.context = null;
269
+ sharedConfig.hydrating = false;
292
270
  }
293
271
  }
294
272
  function getNextElement(template) {
@@ -353,7 +331,7 @@ function runHydrationEvents() {
353
331
  }
354
332
  }
355
333
  function isHydrating(node) {
356
- return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
334
+ return sharedConfig.hydrating && !sharedConfig.done && (!node || node.isConnected);
357
335
  }
358
336
  function toggleClassKey(node, key, value) {
359
337
  const classNames = key.trim().split(/\s+/);
@@ -362,16 +340,19 @@ function toggleClassKey(node, key, value) {
362
340
  function classListToObject(classList) {
363
341
  if (Array.isArray(classList)) {
364
342
  const result = {};
365
- for (let i = 0, len = classList.length; i < len; i++) {
366
- const key = classList[i];
367
- if (typeof key === "object" && key != null) Object.assign(result, key);else if (key || key === 0) result[key] = true;
368
- }
343
+ flattenClassList(classList, result);
369
344
  return result;
370
345
  }
371
346
  return classList;
372
347
  }
348
+ function flattenClassList(list, result) {
349
+ for (let i = 0, len = list.length; i < len; i++) {
350
+ const item = list[i];
351
+ 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;
352
+ }
353
+ }
373
354
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
374
- let propAlias, forceProp;
355
+ let forceProp;
375
356
  if (prop === "style") return style(node, value, prev), value;
376
357
  if (prop === "class") return className(node, value, isSVG, prev), value;
377
358
  if (value === prev) return prev;
@@ -392,12 +373,9 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
392
373
  addEventListener(node, name, value, delegate);
393
374
  delegate && delegateEvents([name]);
394
375
  }
395
- } else if (prop.slice(0, 5) === "attr:") {
396
- setAttribute(node, prop.slice(5), value);
397
- } else if (prop.slice(0, 5) === "bool:") {
398
- setBoolAttribute(node, prop.slice(5), value);
399
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && (propAlias = getPropAlias(prop, node.tagName)) || Properties.has(prop)) {
400
- if (forceProp) prop = prop.slice(5);else node[propAlias || prop] = value;
376
+ } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
377
+ if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
378
+ if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
401
379
  } else {
402
380
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
403
381
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
@@ -456,6 +434,7 @@ function eventHandler(e) {
456
434
  retarget(oriTarget);
457
435
  }
458
436
  function insertExpression(parent, value, current, marker) {
437
+ if (isHydrating(parent)) return;
459
438
  if (value === current) return;
460
439
  const t = typeof value,
461
440
  multi = marker !== undefined;
@@ -492,7 +471,7 @@ function normalize(value, current, multi, doNotUnwrap) {
492
471
  doNotUnwrap
493
472
  });
494
473
  if (doNotUnwrap && typeof value === "function") return value;
495
- if (multi && value != null && !Array.isArray(value)) value = [value];
474
+ if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
496
475
  if (Array.isArray(value)) {
497
476
  for (let i = 0, len = value.length; i < len; i++) {
498
477
  const item = value[i],
@@ -520,10 +499,10 @@ function cleanChildren(parent, current, marker, replacement) {
520
499
  } else if (replacement) parent.insertBefore(replacement, marker);
521
500
  }
522
501
  function gatherHydratable(element, root) {
523
- const templates = element.querySelectorAll(`*[data-hk]`);
502
+ const templates = element.querySelectorAll(`*[_hk]`);
524
503
  for (let i = 0; i < templates.length; i++) {
525
504
  const node = templates[i];
526
- const key = node.getAttribute("data-hk");
505
+ const key = node.getAttribute("_hk");
527
506
  if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
528
507
  }
529
508
  }
@@ -531,7 +510,7 @@ function getHydrationKey() {
531
510
  return sharedConfig.getNextContextId();
532
511
  }
533
512
  function NoHydration(props) {
534
- return sharedConfig.context ? undefined : props.children;
513
+ return sharedConfig.hydrating ? undefined : props.children;
535
514
  }
536
515
  function Hydration(props) {
537
516
  return props.children;
@@ -564,8 +543,10 @@ function escape(html) {}
564
543
  const isServer = false;
565
544
  const isDev = true;
566
545
  const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
567
- function createElement(tagName, isSVG = false) {
568
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
546
+ function createElement(tagName, isSVG = false, is = undefined) {
547
+ return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
548
+ is
549
+ });
569
550
  }
570
551
  const hydrate = (...args) => {
571
552
  enableHydration();
@@ -608,9 +589,8 @@ function createElementProxy(el, marker) {
608
589
  }
609
590
  });
610
591
  }
611
- function Dynamic(props) {
612
- const others = omit(props, "component");
613
- const cached = createMemo(() => props.component);
592
+ function createDynamic(component, props) {
593
+ const cached = createMemo(component);
614
594
  return createMemo(() => {
615
595
  const component = cached();
616
596
  switch (typeof component) {
@@ -618,14 +598,18 @@ function Dynamic(props) {
618
598
  Object.assign(component, {
619
599
  [$DEVCOMP]: true
620
600
  });
621
- return untrack(() => component(others));
601
+ return untrack(() => component(props));
622
602
  case "string":
623
603
  const isSvg = SVGElements.has(component);
624
- const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
625
- spread(el, others, isSvg);
604
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
605
+ spread(el, props, isSvg);
626
606
  return el;
627
607
  }
628
608
  });
629
609
  }
610
+ function Dynamic(props) {
611
+ const others = omit(props, "component");
612
+ return createDynamic(() => props.component, others);
613
+ }
630
614
 
631
- export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getPropAlias, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setBoolAttribute, setProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, use, voidFn as useAssets };
615
+ export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, use, voidFn as useAssets };