@solidjs/web 2.0.0-beta.8 → 2.0.0-beta.9

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/server.js CHANGED
@@ -1,8 +1,7 @@
1
- import { createRenderEffect, createMemo as createMemo$1, sharedConfig, createRoot, ssrHandleError, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, createRoot, ssrHandleError, createComponent, omit, getOwner, getNextChildId, createOwner, runWithOwner } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, ssrRunInScope, untrack } from 'solid-js';
3
3
  import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
4
4
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
5
- import { createMemo } from '@solidjs/signals';
6
5
 
7
6
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
8
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"]);
@@ -18,6 +17,8 @@ const Namespaces = {
18
17
  xlink: "http://www.w3.org/1999/xlink",
19
18
  xml: "http://www.w3.org/XML/1998/namespace"
20
19
  };
20
+ const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
21
+ const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
21
22
  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",
22
23
  "webview",
23
24
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
@@ -29,9 +30,7 @@ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, optio
29
30
  transparent: true,
30
31
  ...options
31
32
  } : transparentOptions);
32
- const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), {
33
- transparent: true
34
- }) : createMemo$1(() => fn());
33
+ const memo = fn => createMemo(() => fn());
35
34
 
36
35
  const ES2017FLAG = Feature.AggregateError |
37
36
  Feature.BigIntTypedArray;
@@ -609,7 +608,7 @@ function ssrClassName(value) {
609
608
  classValue = !!value[key];
610
609
  if (!key || key === "undefined" || !classValue) continue;
611
610
  i && (result += " ");
612
- result += escape(key);
611
+ result += escape(key, true);
613
612
  }
614
613
  return result;
615
614
  }
@@ -619,8 +618,8 @@ function ssrStyle(value) {
619
618
  let result = "";
620
619
  const k = Object.keys(value);
621
620
  for (let i = 0; i < k.length; i++) {
622
- const s = k[i];
623
- const v = value[s];
621
+ const s = escape(k[i], true);
622
+ const v = value[k[i]];
624
623
  if (v != undefined) {
625
624
  if (i) result += ";";
626
625
  const r = escape(v, true);
@@ -762,7 +761,7 @@ function generateHydrationScript({
762
761
  eventNames = ["click", "input"],
763
762
  nonce
764
763
  } = {}) {
765
- return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('", "')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
764
+ return `<script${nonce ? ` nonce="${nonce}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:{},fe(){}});</script><!--xs-->`;
766
765
  }
767
766
  function queue(fn) {
768
767
  return Promise.resolve().then(fn);
@@ -929,26 +928,28 @@ function notSup() {
929
928
 
930
929
  const isServer = true;
931
930
  const isDev = false;
932
- function createDynamic(component, props) {
931
+ function dynamic(source) {
933
932
  const o = getOwner();
934
933
  if (o?.id != null) getNextChildId(o);
935
- const memoOwner = createOwner();
936
- return runWithOwner(memoOwner, () => {
937
- const comp = component(),
938
- t = typeof comp;
939
- if (comp) {
940
- if (t === "function") return comp(props);else if (t === "string") {
941
- return ssrElement(comp, props, undefined, true);
934
+ return props => {
935
+ const memoOwner = createOwner();
936
+ return runWithOwner(memoOwner, () => {
937
+ const comp = source(),
938
+ t = typeof comp;
939
+ if (comp) {
940
+ if (t === "function") return comp(props);else if (t === "string") {
941
+ return ssrElement(comp, props, undefined, true);
942
+ }
942
943
  }
943
- }
944
- });
944
+ });
945
+ };
945
946
  }
946
947
  function Dynamic(props) {
947
- const others = omit(props, "component");
948
- return createDynamic(() => props.component, others);
948
+ const Comp = dynamic(() => props.component);
949
+ return createComponent(Comp, omit(props, "component"));
949
950
  }
950
951
  function Portal(props) {
951
952
  throw new Error("Portal is not supported on the server");
952
953
  }
953
954
 
954
- export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className, createDynamic, notSup as delegateEvents, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
955
+ export { ChildProperties, DOMElements, DelegatedEvents, Dynamic, HydrationScript, MathMLElements, Namespaces, Portal, RawTextElements, RequestContext, SVGElements, VoidElements, notSup as addEventListener, applyRef, notSup as assign, notSup as className, notSup as delegateEvents, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, getAssets, getHydrationKey, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, notSup as hydrate, notSup as insert, isDev, isServer, memo, mergeProps, notSup as render, renderToStream, renderToString, renderToStringAsync, notSup as runHydrationEvents, notSup as setAttribute, notSup as setAttributeNS, notSup as setProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrHydrationKey, ssrStyle, ssrStyleProperty, notSup as style, notSup as template, useAssets };
package/dist/web.cjs CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var solidJs = require('solid-js');
4
- var signals = require('@solidjs/signals');
5
4
 
6
5
  const DOMWithState = {
7
6
  INPUT: {
@@ -45,6 +44,8 @@ const Namespaces = {
45
44
  xlink: "http://www.w3.org/1999/xlink",
46
45
  xml: "http://www.w3.org/XML/1998/namespace"
47
46
  };
47
+ const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
48
+ const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
48
49
  const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
49
50
  "webview",
50
51
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
@@ -56,9 +57,7 @@ const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectF
56
57
  transparent: true,
57
58
  ...options
58
59
  } : transparentOptions);
59
- const memo = (fn, transparent) => transparent ? fn.$r ? fn : signals.createMemo(() => fn(), {
60
- transparent: true
61
- }) : solidJs.createMemo(() => fn());
60
+ const memo = fn => solidJs.createMemo(() => fn());
62
61
 
63
62
  function reconcileArrays(parentNode, a, b) {
64
63
  let bLength = b.length,
@@ -118,12 +117,18 @@ function reconcileArrays(parentNode, a, b) {
118
117
  }
119
118
 
120
119
  const $$EVENTS = "_$DX_DELEGATE";
120
+ const INNER_OWNED = {};
121
121
  function render$1(code, element, init, options = {}) {
122
122
  const renderRoot = getChildRoot(element);
123
123
  let disposer;
124
124
  solidJs.createRoot(dispose => {
125
125
  disposer = dispose;
126
- element === document ? solidJs.flatten(code) : insert(element, code(), renderRoot.firstChild ? null : undefined, init);
126
+ if (element === document) {
127
+ solidJs.flatten(code);
128
+ } else {
129
+ const tree = code();
130
+ insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions);
131
+ }
127
132
  }, {
128
133
  id: options.renderId
129
134
  });
@@ -168,7 +173,7 @@ function setAttribute(node, name, value) {
168
173
  }
169
174
  function setAttributeNS(node, namespace, name, value) {
170
175
  if (isHydrating(node)) return;
171
- if (value == null || value === false) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
176
+ if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
172
177
  }
173
178
  function className(node, value, prev) {
174
179
  if (isHydrating(node)) return;
@@ -220,7 +225,6 @@ function style(node, value, prev) {
220
225
  if (typeof value === "string") return nodeStyle.cssText = value;
221
226
  typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
222
227
  prev || (prev = {});
223
- value || (value = {});
224
228
  let v, s;
225
229
  for (s in value) {
226
230
  v = value[s];
@@ -284,13 +288,25 @@ function insert(parent, accessor, marker, initial, options) {
284
288
  accessor = normalize(accessor, initial, multi, true);
285
289
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
286
290
  }
287
- accessor = memo(accessor, true);
288
291
  if (multi && initial.length === 0) {
289
292
  const placeholder = document.createTextNode("");
290
293
  childRoot.insertBefore(placeholder, marker);
291
294
  initial = [placeholder];
292
295
  }
293
- effect((prev = initial) => normalize(accessor, prev, multi), (value, current = initial) => insertExpression(parent, value, current, marker), options);
296
+ let current = initial;
297
+ effect(() => {
298
+ const value = normalize(accessor(), current, multi, true);
299
+ if (typeof value !== "function") return value;
300
+ effect(() => normalize(value, current, multi), inner => {
301
+ insertExpression(parent, inner, current, marker);
302
+ current = inner;
303
+ }, options);
304
+ return INNER_OWNED;
305
+ }, value => {
306
+ if (value === INNER_OWNED) return;
307
+ insertExpression(parent, value, current, marker);
308
+ current = value;
309
+ }, options);
294
310
  }
295
311
  function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
296
312
  const nodeName = node.nodeName;
@@ -661,30 +677,17 @@ function escape(html) {}
661
677
  const isServer = false;
662
678
  const isDev = false;
663
679
  function render(code, element, init, options = {}) {
664
- const renderRoot = element.localName === "template" ? element.content : element;
665
- let disposer;
666
- solidJs.createRoot(dispose => {
667
- disposer = dispose;
668
- if (element === document) {
669
- solidJs.flatten(code);
670
- return;
671
- }
672
- const marker = renderRoot.firstChild ? null : undefined;
673
- try {
674
- const tree = code();
675
- insert(element, () => tree, marker, init, {
680
+ try {
681
+ const dispose = render$1(code, element, init, {
682
+ ...options,
683
+ insertOptions: {
676
684
  schedule: true
677
- });
678
- } finally {
679
- }
680
- }, {
681
- id: options.renderId
682
- });
683
- solidJs.flush();
684
- return () => {
685
- disposer();
686
- renderRoot.textContent = "";
687
- };
685
+ }
686
+ });
687
+ solidJs.flush();
688
+ return dispose;
689
+ } finally {
690
+ }
688
691
  }
689
692
  const hydrate = (...args) => {
690
693
  solidJs.enableHydration();
@@ -710,23 +713,27 @@ function Portal(props) {
710
713
  });
711
714
  return treeMarker;
712
715
  }
713
- function createDynamic(component, props) {
714
- const cached = solidJs.createMemo(component);
715
- return solidJs.createMemo(() => {
716
- const component = cached();
717
- switch (typeof component) {
718
- case "function":
719
- return solidJs.untrack(() => component(props));
720
- case "string":
721
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
722
- spread(el, props);
723
- return el;
724
- }
716
+ function dynamic(source) {
717
+ const cached = solidJs.createMemo(source, {
718
+ lazy: true
725
719
  });
720
+ return props => {
721
+ return solidJs.createMemo(() => {
722
+ const component = cached();
723
+ switch (typeof component) {
724
+ case "function":
725
+ return solidJs.untrack(() => component(props));
726
+ case "string":
727
+ const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
728
+ spread(el, props);
729
+ return el;
730
+ }
731
+ });
732
+ };
726
733
  }
727
734
  function Dynamic(props) {
728
- const others = solidJs.omit(props, "component");
729
- return createDynamic(() => props.component, others);
735
+ const Comp = dynamic(() => props.component);
736
+ return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
730
737
  }
731
738
  function createElement(tagName, is = undefined) {
732
739
  return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
@@ -817,15 +824,17 @@ exports.HydrationScript = voidFn;
817
824
  exports.MathMLElements = MathMLElements;
818
825
  exports.Namespaces = Namespaces;
819
826
  exports.Portal = Portal;
827
+ exports.RawTextElements = RawTextElements;
820
828
  exports.RequestContext = RequestContext;
821
829
  exports.SVGElements = SVGElements;
830
+ exports.VoidElements = VoidElements;
822
831
  exports.addEventListener = addEventListener;
823
832
  exports.applyRef = applyRef;
824
833
  exports.assign = assign;
825
834
  exports.className = className;
826
835
  exports.clearDelegatedEvents = clearDelegatedEvents;
827
- exports.createDynamic = createDynamic;
828
836
  exports.delegateEvents = delegateEvents;
837
+ exports.dynamic = dynamic;
829
838
  exports.dynamicProperty = dynamicProperty;
830
839
  exports.effect = effect;
831
840
  exports.escape = escape;
package/dist/web.js CHANGED
@@ -1,6 +1,5 @@
1
- import { createRenderEffect, createMemo as createMemo$1, sharedConfig, untrack, runWithOwner, flatten, createRoot, omit, enableHydration, flush } from 'solid-js';
1
+ import { createRenderEffect, createMemo, sharedConfig, untrack, runWithOwner, flatten, createRoot, createComponent, omit, enableHydration, flush } from 'solid-js';
2
2
  export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
- import { createMemo } from '@solidjs/signals';
4
3
 
5
4
  const DOMWithState = {
6
5
  INPUT: {
@@ -44,6 +43,8 @@ const Namespaces = {
44
43
  xlink: "http://www.w3.org/1999/xlink",
45
44
  xml: "http://www.w3.org/XML/1998/namespace"
46
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"]);
47
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",
48
49
  "webview",
49
50
  "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
@@ -55,9 +56,7 @@ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, optio
55
56
  transparent: true,
56
57
  ...options
57
58
  } : transparentOptions);
58
- const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), {
59
- transparent: true
60
- }) : createMemo$1(() => fn());
59
+ const memo = fn => createMemo(() => fn());
61
60
 
62
61
  function reconcileArrays(parentNode, a, b) {
63
62
  let bLength = b.length,
@@ -117,12 +116,18 @@ function reconcileArrays(parentNode, a, b) {
117
116
  }
118
117
 
119
118
  const $$EVENTS = "_$DX_DELEGATE";
119
+ const INNER_OWNED = {};
120
120
  function render$1(code, element, init, options = {}) {
121
121
  const renderRoot = getChildRoot(element);
122
122
  let disposer;
123
123
  createRoot(dispose => {
124
124
  disposer = dispose;
125
- element === document ? flatten(code) : insert(element, code(), renderRoot.firstChild ? null : undefined, init);
125
+ if (element === document) {
126
+ flatten(code);
127
+ } else {
128
+ const tree = code();
129
+ insert(element, () => tree, renderRoot.firstChild ? null : undefined, init, options.insertOptions);
130
+ }
126
131
  }, {
127
132
  id: options.renderId
128
133
  });
@@ -167,7 +172,7 @@ function setAttribute(node, name, value) {
167
172
  }
168
173
  function setAttributeNS(node, namespace, name, value) {
169
174
  if (isHydrating(node)) return;
170
- if (value == null || value === false) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
175
+ if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
171
176
  }
172
177
  function className(node, value, prev) {
173
178
  if (isHydrating(node)) return;
@@ -219,7 +224,6 @@ function style(node, value, prev) {
219
224
  if (typeof value === "string") return nodeStyle.cssText = value;
220
225
  typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
221
226
  prev || (prev = {});
222
- value || (value = {});
223
227
  let v, s;
224
228
  for (s in value) {
225
229
  v = value[s];
@@ -283,13 +287,25 @@ function insert(parent, accessor, marker, initial, options) {
283
287
  accessor = normalize(accessor, initial, multi, true);
284
288
  if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
285
289
  }
286
- accessor = memo(accessor, true);
287
290
  if (multi && initial.length === 0) {
288
291
  const placeholder = document.createTextNode("");
289
292
  childRoot.insertBefore(placeholder, marker);
290
293
  initial = [placeholder];
291
294
  }
292
- effect((prev = initial) => normalize(accessor, prev, multi), (value, current = initial) => insertExpression(parent, value, current, marker), options);
295
+ let current = initial;
296
+ effect(() => {
297
+ const value = normalize(accessor(), current, multi, true);
298
+ if (typeof value !== "function") return value;
299
+ effect(() => normalize(value, current, multi), inner => {
300
+ insertExpression(parent, inner, current, marker);
301
+ current = inner;
302
+ }, options);
303
+ return INNER_OWNED;
304
+ }, value => {
305
+ if (value === INNER_OWNED) return;
306
+ insertExpression(parent, value, current, marker);
307
+ current = value;
308
+ }, options);
293
309
  }
294
310
  function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
295
311
  const nodeName = node.nodeName;
@@ -660,30 +676,17 @@ function escape(html) {}
660
676
  const isServer = false;
661
677
  const isDev = false;
662
678
  function render(code, element, init, options = {}) {
663
- const renderRoot = element.localName === "template" ? element.content : element;
664
- let disposer;
665
- createRoot(dispose => {
666
- disposer = dispose;
667
- if (element === document) {
668
- flatten(code);
669
- return;
670
- }
671
- const marker = renderRoot.firstChild ? null : undefined;
672
- try {
673
- const tree = code();
674
- insert(element, () => tree, marker, init, {
679
+ try {
680
+ const dispose = render$1(code, element, init, {
681
+ ...options,
682
+ insertOptions: {
675
683
  schedule: true
676
- });
677
- } finally {
678
- }
679
- }, {
680
- id: options.renderId
681
- });
682
- flush();
683
- return () => {
684
- disposer();
685
- renderRoot.textContent = "";
686
- };
684
+ }
685
+ });
686
+ flush();
687
+ return dispose;
688
+ } finally {
689
+ }
687
690
  }
688
691
  const hydrate = (...args) => {
689
692
  enableHydration();
@@ -694,7 +697,7 @@ function Portal(props) {
694
697
  startMarker = document.createTextNode(""),
695
698
  endMarker = document.createTextNode(""),
696
699
  mount = () => createElementProxy(props.mount || document.body, treeMarker);
697
- let content = createMemo$1(() => [startMarker, props.children]);
700
+ let content = createMemo(() => [startMarker, props.children]);
698
701
  createRenderEffect(() => [mount(), content()], ([m, c]) => {
699
702
  m.appendChild(endMarker);
700
703
  insert(m, c, endMarker);
@@ -709,23 +712,27 @@ function Portal(props) {
709
712
  });
710
713
  return treeMarker;
711
714
  }
712
- function createDynamic(component, props) {
713
- const cached = createMemo$1(component);
714
- return createMemo$1(() => {
715
- const component = cached();
716
- switch (typeof component) {
717
- case "function":
718
- return untrack(() => component(props));
719
- case "string":
720
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
721
- spread(el, props);
722
- return el;
723
- }
715
+ function dynamic(source) {
716
+ const cached = createMemo(source, {
717
+ lazy: true
724
718
  });
719
+ return props => {
720
+ return createMemo(() => {
721
+ const component = cached();
722
+ switch (typeof component) {
723
+ case "function":
724
+ return untrack(() => component(props));
725
+ case "string":
726
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
727
+ spread(el, props);
728
+ return el;
729
+ }
730
+ });
731
+ };
725
732
  }
726
733
  function Dynamic(props) {
727
- const others = omit(props, "component");
728
- return createDynamic(() => props.component, others);
734
+ const Comp = dynamic(() => props.component);
735
+ return createComponent(Comp, omit(props, "component"));
729
736
  }
730
737
  function createElement(tagName, is = undefined) {
731
738
  return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
@@ -750,4 +757,4 @@ function createElementProxy(el, marker) {
750
757
  });
751
758
  }
752
759
 
753
- export { voidFn as Assets, ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, RequestContext, SVGElements, 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 };
760
+ 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, ref, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, voidFn as useAssets };
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@solidjs/web",
3
- "description": "Solid's web runtime for the browser and the server",
4
- "version": "2.0.0-beta.8",
3
+ "description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
4
+ "version": "2.0.0-beta.9",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/solidjs/solid-web"
10
+ "url": "git+https://github.com/solidjs/solid.git",
11
+ "directory": "packages/solid-web"
11
12
  },
12
13
  "publishConfig": {
13
14
  "access": "public"
@@ -116,12 +117,10 @@
116
117
  "seroval-plugins": "^1.1.0"
117
118
  },
118
119
  "peerDependencies": {
119
- "@solidjs/signals": "^2.0.0-beta.8",
120
- "solid-js": "^2.0.0-beta.8"
120
+ "solid-js": "^2.0.0-beta.9"
121
121
  },
122
122
  "devDependencies": {
123
- "@solidjs/signals": "2.0.0-beta.8",
124
- "solid-js": "2.0.0-beta.8"
123
+ "solid-js": "2.0.0-beta.9"
125
124
  },
126
125
  "scripts": {
127
126
  "build": "npm-run-all -nl build:*",