solid-js 1.5.7 → 1.6.0-beta.0

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.
@@ -5,10 +5,16 @@ const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked"
5
5
  const BooleanAttributes = /*#__PURE__*/new Set(booleans);
6
6
  /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
7
7
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
8
- const Aliases = {
9
- className: "class",
10
- htmlFor: "for"
11
- };
8
+ const Aliases = Object.create(null);
9
+ Aliases.className = "class";
10
+ Aliases.htmlFor = "for";
11
+ const PropAliases = Object.create(null);
12
+ PropAliases.class = "className";
13
+ PropAliases.formnovalidate = "formNoValidate";
14
+ PropAliases.ismap = "isMap";
15
+ PropAliases.nomodule = "noModule";
16
+ PropAliases.playsinline = "playsInline";
17
+ PropAliases.readonly = "readOnly";
12
18
 
13
19
  const {
14
20
  hasOwnProperty
@@ -270,6 +276,7 @@ function renderToString(code, options = {}) {
270
276
  assets: [],
271
277
  nonce: options.nonce,
272
278
  writeResource(id, p, error) {
279
+ if (sharedConfig.context.noHydrate) return;
273
280
  if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
274
281
  scripts += `_$HY.set("${id}", ${stringify(p)});`;
275
282
  }
@@ -362,9 +369,11 @@ function renderToStream(code, options = {}) {
362
369
  html = html.replace(html.slice(first, last + placeholder.length + 1), resolveSSRNode(payloadFn()));
363
370
  },
364
371
  writeResource(id, p, error, wait) {
365
- if (error) return pushTask(serializeSet(dedupe, id, p, serializeError));
366
- if (!p || typeof p !== "object" || !("then" in p)) return pushTask(serializeSet(dedupe, id, p));
367
- if (!firstFlushed) wait && blockingResources.push(p);else pushTask(`_$HY.init("${id}")`);
372
+ const serverOnly = sharedConfig.context.noHydrate;
373
+ if (error) return !serverOnly && pushTask(serializeSet(dedupe, id, p, serializeError));
374
+ if (!p || typeof p !== "object" || !("then" in p)) return !serverOnly && pushTask(serializeSet(dedupe, id, p));
375
+ if (!firstFlushed) wait && blockingResources.push(p);else !serverOnly && pushTask(`_$HY.init("${id}")`);
376
+ if (serverOnly) return;
368
377
  p.then(d => {
369
378
  !completed && pushTask(serializeSet(dedupe, id, d));
370
379
  }).catch(() => {
@@ -463,9 +472,6 @@ function renderToStream(code, options = {}) {
463
472
  }
464
473
  };
465
474
  }
466
- function Assets(props) {
467
- useAssets(() => props.children);
468
- }
469
475
  function HydrationScript(props) {
470
476
  const {
471
477
  nonce
@@ -475,13 +481,6 @@ function HydrationScript(props) {
475
481
  ...props
476
482
  }));
477
483
  }
478
- function NoHydration(props) {
479
- const c = sharedConfig.context;
480
- c.noHydrate = true;
481
- const children = props.children;
482
- c.noHydrate = false;
483
- return children;
484
- }
485
484
  function ssr(t, ...nodes) {
486
485
  if (nodes.length) {
487
486
  let result = "";
@@ -503,7 +502,7 @@ function ssrClassList(value) {
503
502
  for (let i = 0, len = classKeys.length; i < len; i++) {
504
503
  const key = classKeys[i],
505
504
  classValue = !!value[key];
506
- if (!key || !classValue) continue;
505
+ if (!key || key === "undefined" || !classValue) continue;
507
506
  i && (result += " ");
508
507
  result += key;
509
508
  }
@@ -516,8 +515,11 @@ function ssrStyle(value) {
516
515
  const k = Object.keys(value);
517
516
  for (let i = 0; i < k.length; i++) {
518
517
  const s = k[i];
519
- if (i) result += ";";
520
- result += `${s}:${escape(value[s], true)}`;
518
+ const v = value[s];
519
+ if (v != undefined) {
520
+ if (i) result += ";";
521
+ result += `${s}:${escape(v, true)}`;
522
+ }
521
523
  }
522
524
  return result;
523
525
  }
@@ -641,6 +643,14 @@ function generateHydrationScript({
641
643
  } = {}) {
642
644
  return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=t=>e.r[t];</script><!--xs-->`;
643
645
  }
646
+ function Hydration(props) {
647
+ sharedConfig.context.noHydrate = false;
648
+ return props.children;
649
+ }
650
+ function NoHydration(props) {
651
+ sharedConfig.context.noHydrate = true;
652
+ return props.children;
653
+ }
644
654
  function injectAssets(assets, html) {
645
655
  if (!assets || !assets.length) return html;
646
656
  let out = "";
@@ -702,6 +712,9 @@ function replacePlaceholder(html, key, value) {
702
712
  }
703
713
  return html.slice(0, first) + value + html.slice(nextRegex.lastIndex);
704
714
  }
715
+ function Assets(props) {
716
+ useAssets(() => props.children);
717
+ }
705
718
  function pipeToNodeWritable(code, writable, options = {}) {
706
719
  if (options.onReady) {
707
720
  options.onCompleteShell = ({
@@ -784,4 +797,4 @@ function Portal(props) {
784
797
  return "";
785
798
  }
786
799
 
787
- export { Assets, Dynamic, HydrationScript, NoHydration, Portal, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, insert, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
800
+ export { Assets, Dynamic, Hydration, HydrationScript, NoHydration, Portal, delegateEvents, escape, generateHydrationScript, getAssets, getHydrationKey, insert, isServer, pipeToNodeWritable, pipeToWritable, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, useAssets };
package/web/dist/web.cjs CHANGED
@@ -7,18 +7,16 @@ var solidJs = require('solid-js');
7
7
  const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
8
8
  const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
9
9
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
10
- const Aliases = {
11
- className: "class",
12
- htmlFor: "for"
13
- };
14
- const PropAliases = {
15
- class: "className",
16
- formnovalidate: "formNoValidate",
17
- ismap: "isMap",
18
- nomodule: "noModule",
19
- playsinline: "playsInline",
20
- readonly: "readOnly"
21
- };
10
+ const Aliases = Object.create(null);
11
+ Aliases.className = "class";
12
+ Aliases.htmlFor = "for";
13
+ const PropAliases = Object.create(null);
14
+ PropAliases.class = "className";
15
+ PropAliases.formnovalidate = "formNoValidate";
16
+ PropAliases.ismap = "isMap";
17
+ PropAliases.nomodule = "noModule";
18
+ PropAliases.playsinline = "playsInline";
19
+ PropAliases.readonly = "readOnly";
22
20
  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"]);
23
21
  const SVGElements = /*#__PURE__*/new Set([
24
22
  "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "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",
@@ -31,12 +29,6 @@ const SVGNamespace = {
31
29
  };
32
30
  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"]);
33
31
 
34
- function memo(fn, equals) {
35
- return solidJs.createMemo(fn, undefined, !equals ? {
36
- equals
37
- } : undefined);
38
- }
39
-
40
32
  function reconcileArrays(parentNode, a, b) {
41
33
  let bLength = b.length,
42
34
  aEnd = a.length,
@@ -95,12 +87,12 @@ function reconcileArrays(parentNode, a, b) {
95
87
  }
96
88
 
97
89
  const $$EVENTS = "_$DX_DELEGATE";
98
- function render(code, element, init) {
90
+ function render(code, element, init, options = {}) {
99
91
  let disposer;
100
92
  solidJs.createRoot(dispose => {
101
93
  disposer = dispose;
102
94
  element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
103
- });
95
+ }, options.owner);
104
96
  return () => {
105
97
  disposer();
106
98
  element.textContent = "";
@@ -189,10 +181,14 @@ function style(node, value, prev) {
189
181
  }
190
182
  return prev;
191
183
  }
192
- function spread(node, accessor, isSVG, skipChildren) {
193
- if (typeof accessor === "function") {
194
- solidJs.createRenderEffect(current => spreadExpression(node, accessor(), current, isSVG, skipChildren));
195
- } else spreadExpression(node, accessor, undefined, isSVG, skipChildren);
184
+ function spread(node, props = {}, isSVG, skipChildren) {
185
+ const prevProps = {};
186
+ if (!skipChildren) {
187
+ solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
188
+ }
189
+ solidJs.createRenderEffect(() => props.ref && props.ref(node));
190
+ solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
191
+ return prevProps;
196
192
  }
197
193
  function dynamicProperty(props, key) {
198
194
  const src = props[key];
@@ -243,7 +239,7 @@ function hydrate$1(code, element, options = {}) {
243
239
  count: 0
244
240
  };
245
241
  gatherHydratable(element, options.renderId);
246
- const dispose = render(code, element, [...element.childNodes]);
242
+ const dispose = render(code, element, [...element.childNodes], options);
247
243
  solidJs.sharedConfig.context = null;
248
244
  return dispose;
249
245
  }
@@ -310,9 +306,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
310
306
  if (prop === "classList") return classList(node, value, prev);
311
307
  if (value === prev) return prev;
312
308
  if (prop === "ref") {
313
- if (!skipRef) {
314
- value(node);
315
- }
309
+ if (!skipRef) value(node);
316
310
  } else if (prop.slice(0, 3) === "on:") {
317
311
  const e = prop.slice(3);
318
312
  prev && node.removeEventListener(e, prev);
@@ -369,15 +363,6 @@ function eventHandler(e) {
369
363
  node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
370
364
  }
371
365
  }
372
- function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
373
- props || (props = {});
374
- if (!skipChildren) {
375
- solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
376
- }
377
- solidJs.createRenderEffect(() => props.ref && props.ref(node));
378
- solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
379
- return prevProps;
380
- }
381
366
  function insertExpression(parent, value, current, marker, unwrapArray) {
382
367
  if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
383
368
  while (typeof current === "function") current = current();
@@ -472,7 +457,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
472
457
  }
473
458
  return dynamic;
474
459
  }
475
- function appendNodes(parent, array, marker) {
460
+ function appendNodes(parent, array, marker = null) {
476
461
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
477
462
  }
478
463
  function cleanChildren(parent, current, marker, replacement) {
@@ -505,6 +490,9 @@ function getHydrationKey() {
505
490
  function NoHydration(props) {
506
491
  return solidJs.sharedConfig.context ? undefined : props.children;
507
492
  }
493
+ function Hydration(props) {
494
+ return props.children;
495
+ }
508
496
  function voidFn() {}
509
497
 
510
498
  function throwInBrowser(func) {
@@ -637,6 +625,10 @@ Object.defineProperty(exports, 'getOwner', {
637
625
  enumerable: true,
638
626
  get: function () { return solidJs.getOwner; }
639
627
  });
628
+ Object.defineProperty(exports, 'memo', {
629
+ enumerable: true,
630
+ get: function () { return solidJs.createMemo; }
631
+ });
640
632
  Object.defineProperty(exports, 'mergeProps', {
641
633
  enumerable: true,
642
634
  get: function () { return solidJs.mergeProps; }
@@ -651,6 +643,7 @@ exports.ChildProperties = ChildProperties;
651
643
  exports.DOMElements = DOMElements;
652
644
  exports.DelegatedEvents = DelegatedEvents;
653
645
  exports.Dynamic = Dynamic;
646
+ exports.Hydration = Hydration;
654
647
  exports.HydrationScript = voidFn;
655
648
  exports.NoHydration = NoHydration;
656
649
  exports.Portal = Portal;
@@ -676,7 +669,6 @@ exports.hydrate = hydrate;
676
669
  exports.innerHTML = innerHTML;
677
670
  exports.insert = insert;
678
671
  exports.isServer = isServer;
679
- exports.memo = memo;
680
672
  exports.render = render;
681
673
  exports.renderToStream = renderToStream;
682
674
  exports.renderToString = renderToString;
package/web/dist/web.js CHANGED
@@ -1,21 +1,19 @@
1
- import { createMemo, createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createSignal, onCleanup, splitProps } from 'solid-js';
2
- export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
1
+ import { createRoot, createRenderEffect, sharedConfig, untrack, enableHydration, createSignal, onCleanup, splitProps, createMemo } from 'solid-js';
2
+ export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, createMemo as memo, mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
5
5
  const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
6
6
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
7
- const Aliases = {
8
- className: "class",
9
- htmlFor: "for"
10
- };
11
- const PropAliases = {
12
- class: "className",
13
- formnovalidate: "formNoValidate",
14
- ismap: "isMap",
15
- nomodule: "noModule",
16
- playsinline: "playsInline",
17
- readonly: "readOnly"
18
- };
7
+ const Aliases = Object.create(null);
8
+ Aliases.className = "class";
9
+ Aliases.htmlFor = "for";
10
+ const PropAliases = Object.create(null);
11
+ PropAliases.class = "className";
12
+ PropAliases.formnovalidate = "formNoValidate";
13
+ PropAliases.ismap = "isMap";
14
+ PropAliases.nomodule = "noModule";
15
+ PropAliases.playsinline = "playsInline";
16
+ PropAliases.readonly = "readOnly";
19
17
  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"]);
20
18
  const SVGElements = /*#__PURE__*/new Set([
21
19
  "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "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",
@@ -28,12 +26,6 @@ const SVGNamespace = {
28
26
  };
29
27
  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"]);
30
28
 
31
- function memo(fn, equals) {
32
- return createMemo(fn, undefined, !equals ? {
33
- equals
34
- } : undefined);
35
- }
36
-
37
29
  function reconcileArrays(parentNode, a, b) {
38
30
  let bLength = b.length,
39
31
  aEnd = a.length,
@@ -92,12 +84,12 @@ function reconcileArrays(parentNode, a, b) {
92
84
  }
93
85
 
94
86
  const $$EVENTS = "_$DX_DELEGATE";
95
- function render(code, element, init) {
87
+ function render(code, element, init, options = {}) {
96
88
  let disposer;
97
89
  createRoot(dispose => {
98
90
  disposer = dispose;
99
91
  element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init);
100
- });
92
+ }, options.owner);
101
93
  return () => {
102
94
  disposer();
103
95
  element.textContent = "";
@@ -186,10 +178,14 @@ function style(node, value, prev) {
186
178
  }
187
179
  return prev;
188
180
  }
189
- function spread(node, accessor, isSVG, skipChildren) {
190
- if (typeof accessor === "function") {
191
- createRenderEffect(current => spreadExpression(node, accessor(), current, isSVG, skipChildren));
192
- } else spreadExpression(node, accessor, undefined, isSVG, skipChildren);
181
+ function spread(node, props = {}, isSVG, skipChildren) {
182
+ const prevProps = {};
183
+ if (!skipChildren) {
184
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
185
+ }
186
+ createRenderEffect(() => props.ref && props.ref(node));
187
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
188
+ return prevProps;
193
189
  }
194
190
  function dynamicProperty(props, key) {
195
191
  const src = props[key];
@@ -240,7 +236,7 @@ function hydrate$1(code, element, options = {}) {
240
236
  count: 0
241
237
  };
242
238
  gatherHydratable(element, options.renderId);
243
- const dispose = render(code, element, [...element.childNodes]);
239
+ const dispose = render(code, element, [...element.childNodes], options);
244
240
  sharedConfig.context = null;
245
241
  return dispose;
246
242
  }
@@ -307,9 +303,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
307
303
  if (prop === "classList") return classList(node, value, prev);
308
304
  if (value === prev) return prev;
309
305
  if (prop === "ref") {
310
- if (!skipRef) {
311
- value(node);
312
- }
306
+ if (!skipRef) value(node);
313
307
  } else if (prop.slice(0, 3) === "on:") {
314
308
  const e = prop.slice(3);
315
309
  prev && node.removeEventListener(e, prev);
@@ -366,15 +360,6 @@ function eventHandler(e) {
366
360
  node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
367
361
  }
368
362
  }
369
- function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
370
- props || (props = {});
371
- if (!skipChildren) {
372
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
373
- }
374
- createRenderEffect(() => props.ref && props.ref(node));
375
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
376
- return prevProps;
377
- }
378
363
  function insertExpression(parent, value, current, marker, unwrapArray) {
379
364
  if (sharedConfig.context && !current) current = [...parent.childNodes];
380
365
  while (typeof current === "function") current = current();
@@ -469,7 +454,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
469
454
  }
470
455
  return dynamic;
471
456
  }
472
- function appendNodes(parent, array, marker) {
457
+ function appendNodes(parent, array, marker = null) {
473
458
  for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
474
459
  }
475
460
  function cleanChildren(parent, current, marker, replacement) {
@@ -502,6 +487,9 @@ function getHydrationKey() {
502
487
  function NoHydration(props) {
503
488
  return sharedConfig.context ? undefined : props.children;
504
489
  }
490
+ function Hydration(props) {
491
+ return props.children;
492
+ }
505
493
  function voidFn() {}
506
494
 
507
495
  function throwInBrowser(func) {
@@ -590,4 +578,4 @@ function Dynamic(props) {
590
578
  });
591
579
  }
592
580
 
593
- export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
581
+ export { Aliases, voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrSpread, ssrStyle, style, template, use, voidFn as useAssets };
@@ -57,15 +57,16 @@ export function dynamicProperty(props: unknown, key: string): unknown;
57
57
  export function hydrate(
58
58
  fn: () => JSX.Element,
59
59
  node: MountableElement,
60
- options?: { renderId?: string }
60
+ options?: { renderId?: string, owner?: unknown }
61
61
  ): () => void;
62
62
  export function getHydrationKey(): string;
63
63
  export function getNextElement(template?: HTMLTemplateElement): Element;
64
64
  export function getNextMatch(start: Node, elementName: string): Element;
65
65
  export function getNextMarker(start: Node): [Node, Array<Node>];
66
- export function useAssets(fn: () => string): void;
66
+ export function useAssets(fn: () => JSX.Element): void;
67
67
  export function getAssets(): string;
68
- export function Assets(props: { children?: JSX.Element }): JSX.Element;
69
68
  export function HydrationScript(): JSX.Element;
70
- export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
71
- export function generateHydrationScript(): string;
69
+ export function generateHydrationScript(): string;
70
+ export function Assets(props: { children?: JSX.Element }): JSX.Element;
71
+ export function Hydration(props: { children?: JSX.Element }): JSX.Element;
72
+ export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
@@ -1,3 +1 @@
1
- import { createRoot, createRenderEffect, createComponent, getOwner, sharedConfig, untrack } from "solid-js";
2
- declare function memo<T>(fn: () => T, equals: boolean): import("solid-js").Accessor<T>;
3
- export { getOwner, createComponent, createRoot as root, createRenderEffect as effect, memo, sharedConfig, untrack };
1
+ export { getOwner, createComponent, createRoot as root, createRenderEffect as effect, createMemo as memo, sharedConfig, untrack, mergeProps } from "solid-js";
@@ -26,18 +26,21 @@ export function renderToStream<T>(
26
26
  pipeTo: (writable: WritableStream) => void;
27
27
  };
28
28
 
29
- export function Assets(props: { children?: JSX.Element }): JSX.Element;
30
29
  export function HydrationScript(props: { nonce?: string; eventNames?: string[] }): JSX.Element;
31
- export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
32
30
  export function ssr(template: string[] | string, ...nodes: any[]): { t: string };
33
- export function ssrElement(name: string, props: any, children: any, needsId: boolean): { t: string };
31
+ export function ssrElement(
32
+ name: string,
33
+ props: any,
34
+ children: any,
35
+ needsId: boolean
36
+ ): { t: string };
34
37
  export function ssrClassList(value: { [k: string]: boolean }): string;
35
38
  export function ssrStyle(value: { [k: string]: string }): string;
36
39
  export function ssrAttribute(key: string, value: any, isBoolean: boolean): string;
37
40
  export function ssrHydrationKey(): string;
38
41
  export function resolveSSRNode(node: any): string;
39
42
  export function escape(html: string): string;
40
- export function useAssets(fn: () => string): void;
43
+ export function useAssets(fn: () => JSX.Element): void;
41
44
  export function getAssets(): string;
42
45
  export function getHydrationKey(): string;
43
46
  export function effect<T>(fn: (prev?: T) => T, init?: T): void;
@@ -47,6 +50,10 @@ export function mergeProps(...sources: unknown[]): unknown;
47
50
  export function getOwner(): unknown;
48
51
  export function generateHydrationScript(options: { nonce?: string; eventNames?: string[] }): string;
49
52
 
53
+ export function Hydration(props: { children?: JSX.Element }): JSX.Element;
54
+ export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
55
+ export function Assets(props: { children?: JSX.Element }): JSX.Element;
56
+
50
57
  // deprecated
51
58
  export type LegacyResults = {
52
59
  write: (text: string) => void;