@solidjs/h 2.0.0-experimental.4 → 2.0.0-experimental.5

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/h.js CHANGED
@@ -1,11 +1,4 @@
1
- import {
2
- spread,
3
- assign,
4
- insert,
5
- createComponent,
6
- dynamicProperty,
7
- SVGElements
8
- } from "@solidjs/web";
1
+ import { spread, assign, insert, createComponent, dynamicProperty, SVGElements } from '@solidjs/web';
9
2
 
10
3
  const $ELEMENT = Symbol("hyper-element");
11
4
  function createHyperScript(r) {
@@ -26,18 +19,9 @@ function createHyperScript(r) {
26
19
  return ret;
27
20
  function item(l) {
28
21
  const type = typeof l;
29
- if (l == null);
30
- else if ("string" === type) {
31
- if (!e) parseClass(l);
32
- else e.appendChild(document.createTextNode(l));
33
- } else if (
34
- "number" === type ||
35
- "boolean" === type ||
36
- "bigint" === type ||
37
- "symbol" === type ||
38
- l instanceof Date ||
39
- l instanceof RegExp
40
- ) {
22
+ if (l == null) ;else if ("string" === type) {
23
+ if (!e) parseClass(l);else e.appendChild(document.createTextNode(l));
24
+ } else if ("number" === type || "boolean" === type || "bigint" === type || "symbol" === type || l instanceof Date || l instanceof RegExp) {
41
25
  e.appendChild(document.createTextNode(l.toString()));
42
26
  } else if (Array.isArray(l)) {
43
27
  for (let i = 0; i < l.length; i++) item(l[i]);
@@ -49,10 +33,7 @@ function createHyperScript(r) {
49
33
  for (const k in d) {
50
34
  if (k === "class" && classes.length !== 0) {
51
35
  const fixedClasses = classes.join(" "),
52
- value =
53
- typeof d["class"].value === "function"
54
- ? () => fixedClasses + " " + d["class"].value()
55
- : fixedClasses + " " + l["class"];
36
+ value = typeof d["class"].value === "function" ? () => fixedClasses + " " + d["class"].value() : fixedClasses + " " + l["class"];
56
37
  Object.defineProperty(l, "class", {
57
38
  ...d[k],
58
39
  value
@@ -64,18 +45,12 @@ function createHyperScript(r) {
64
45
  dynamic = true;
65
46
  } else if (d[k].get) dynamic = true;
66
47
  }
67
- dynamic
68
- ? r.spread(e, l, e instanceof SVGElement, !!args.length)
69
- : r.assign(e, l, e instanceof SVGElement, !!args.length);
48
+ dynamic ? r.spread(e, l, e instanceof SVGElement, !!args.length) : r.assign(e, l, e instanceof SVGElement, !!args.length);
70
49
  } else if ("function" === type) {
71
50
  if (!e) {
72
51
  let props,
73
52
  next = args[0];
74
- if (
75
- next == null ||
76
- (typeof next === "object" && !Array.isArray(next) && !(next instanceof Element))
77
- )
78
- props = args.shift();
53
+ if (next == null || typeof next === "object" && !Array.isArray(next) && !(next instanceof Element)) props = args.shift();
79
54
  props || (props = {});
80
55
  if (args.length) {
81
56
  props.children = args.length > 1 ? args : args[0];
@@ -91,8 +66,7 @@ function createHyperScript(r) {
91
66
  return list;
92
67
  };
93
68
  r.dynamicProperty(props, k);
94
- } else if (typeof d[k].value === "function" && !d[k].value.length)
95
- r.dynamicProperty(props, k);
69
+ } else if (typeof d[k].value === "function" && !d[k].value.length) r.dynamicProperty(props, k);
96
70
  }
97
71
  e = r.createComponent(l, props);
98
72
  args = [];
@@ -109,12 +83,7 @@ function createHyperScript(r) {
109
83
  const v = m[i],
110
84
  s = v.substring(1, v.length);
111
85
  if (!v) continue;
112
- if (!e)
113
- e = r.SVGElements.has(v)
114
- ? document.createElementNS("http://www.w3.org/2000/svg", v)
115
- : document.createElement(v);
116
- else if (v[0] === ".") classes.push(s);
117
- else if (v[0] === "#") e.setAttribute("id", s);
86
+ if (!e) e = r.SVGElements.has(v) ? document.createElementNS("http://www.w3.org/2000/svg", v) : document.createElement(v);else if (v[0] === ".") classes.push(s);else if (v[0] === "#") e.setAttribute("id", s);
118
87
  }
119
88
  }
120
89
  function detectMultiExpression(list) {
@@ -1,4 +1,4 @@
1
- import h from "@solidjs/h";
1
+ import h from '@solidjs/h';
2
2
 
3
3
  function Fragment(props) {
4
4
  return props.children;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@solidjs/h",
3
3
  "description": "A standard (less-optimal) JSX factory for Solid",
4
- "version": "2.0.0-experimental.4",
4
+ "version": "2.0.0-experimental.5",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -46,10 +46,10 @@
46
46
  "./types/*": "./types/*"
47
47
  },
48
48
  "peerDependencies": {
49
- "@solidjs/web": "^2.0.0-experimental.4"
49
+ "@solidjs/web": "^2.0.0-experimental.5"
50
50
  },
51
51
  "devDependencies": {
52
- "@solidjs/web": "2.0.0-experimental.4"
52
+ "@solidjs/web": "2.0.0-experimental.5"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "npm-run-all -nl build:*",