@solidjs/web 2.0.0-experimental.5 → 2.0.0-experimental.7

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/web.js CHANGED
@@ -1,38 +1,9 @@
1
1
  import { createMemo, createRoot, flatten, untrack, createRenderEffect, sharedConfig, enableHydration, omit } from 'solid-js';
2
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,9 @@ 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"]);
47
20
 
48
21
  const memo = fn => createMemo(() => fn());
49
22
 
@@ -149,19 +122,15 @@ function setProperty(node, name, value) {
149
122
  }
150
123
  function setAttribute(node, name, value) {
151
124
  if (isHydrating(node)) return;
152
- if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
125
+ if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
153
126
  }
154
127
  function setAttributeNS(node, namespace, name, value) {
155
128
  if (isHydrating(node)) return;
156
129
  if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
157
130
  }
158
- function setBoolAttribute(node, name, value) {
159
- if (isHydrating(node)) return;
160
- value ? node.setAttribute(name, "") : node.removeAttribute(name);
161
- }
162
131
  function className(node, value, isSVG, prev) {
163
132
  if (isHydrating(node)) return;
164
- if (value == null) {
133
+ if (value == null || value === false) {
165
134
  prev && node.removeAttribute("class");
166
135
  return;
167
136
  }
@@ -218,6 +187,9 @@ function style(node, value, prev) {
218
187
  }
219
188
  for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
220
189
  }
190
+ function setStyleProperty(node, name, value) {
191
+ value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
192
+ }
221
193
  function spread(node, props = {}, isSVG, skipChildren) {
222
194
  const prevProps = {};
223
195
  if (!skipChildren) {
@@ -372,7 +344,7 @@ function flattenClassList(list, result) {
372
344
  }
373
345
  }
374
346
  function assignProp(node, prop, value, prev, isSVG, skipRef) {
375
- let propAlias, forceProp;
347
+ let forceProp;
376
348
  if (prop === "style") return style(node, value, prev), value;
377
349
  if (prop === "class") return className(node, value, isSVG, prev), value;
378
350
  if (value === prev) return prev;
@@ -393,13 +365,9 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
393
365
  addEventListener(node, name, value, delegate);
394
366
  delegate && delegateEvents([name]);
395
367
  }
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)) {
368
+ } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
401
369
  if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
402
- if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[propAlias || prop] = value;
370
+ if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
403
371
  } else {
404
372
  const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
405
373
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
@@ -567,8 +535,10 @@ function escape(html) {}
567
535
  const isServer = false;
568
536
  const isDev = false;
569
537
  const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
570
- function createElement(tagName, isSVG = false) {
571
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
538
+ function createElement(tagName, isSVG = false, is = undefined) {
539
+ return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
540
+ is
541
+ });
572
542
  }
573
543
  const hydrate = (...args) => {
574
544
  enableHydration();
@@ -620,7 +590,7 @@ function createDynamic(component, props) {
620
590
  return untrack(() => component(props));
621
591
  case "string":
622
592
  const isSvg = SVGElements.has(component);
623
- const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg);
593
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
624
594
  spread(el, props, isSvg);
625
595
  return el;
626
596
  }
@@ -631,4 +601,4 @@ function Dynamic(props) {
631
601
  return createDynamic(() => props.component, others);
632
602
  }
633
603
 
634
- 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, getPropAlias, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setBoolAttribute, setProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, use, voidFn as useAssets };
604
+ 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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solidjs/web",
3
3
  "description": "Solid's web runtime for the browser and the server",
4
- "version": "2.0.0-experimental.5",
4
+ "version": "2.0.0-experimental.7",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -75,10 +75,10 @@
75
75
  "seroval-plugins": "^1.1.0"
76
76
  },
77
77
  "peerDependencies": {
78
- "solid-js": "^2.0.0-experimental.5"
78
+ "solid-js": "^2.0.0-experimental.7"
79
79
  },
80
80
  "devDependencies": {
81
- "solid-js": "2.0.0-experimental.5"
81
+ "solid-js": "2.0.0-experimental.7"
82
82
  },
83
83
  "scripts": {
84
84
  "build": "npm-run-all -nl build:*",
package/types/client.d.ts CHANGED
@@ -5,7 +5,6 @@ export const DelegatedEvents: Set<string>;
5
5
  export const DOMElements: Set<string>;
6
6
  export const SVGElements: Set<string>;
7
7
  export const SVGNamespace: Record<string, string>;
8
- export function getPropAlias(prop: string, tagName: string): string | undefined;
9
8
 
10
9
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
11
10
  export function render(code: () => JSX.Element, element: MountableElement): () => void;
@@ -31,7 +30,6 @@ export function spread<T>(
31
30
  export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
32
31
  export function setAttribute(node: Element, name: string, value: string): void;
33
32
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
34
- export function setBoolAttribute(node: Element, name: string, value: any): void;
35
33
  type ClassList =
36
34
  | Record<string, boolean>
37
35
  | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
package/types/server.d.ts CHANGED
@@ -5,7 +5,6 @@ export const DelegatedEvents: Set<string>;
5
5
  export const DOMElements: Set<string>;
6
6
  export const SVGElements: Set<string>;
7
7
  export const SVGNamespace: Record<string, string>;
8
- export function getPropAlias(prop: string, tagName: string): string | undefined;
9
8
 
10
9
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
11
10