solid-js 1.4.0-beta.3 → 1.4.0-beta.4

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/h/dist/h.cjs CHANGED
@@ -2,11 +2,19 @@
2
2
 
3
3
  var web = require('solid-js/web');
4
4
 
5
+ const $ELEMENT = Symbol("hyper-element");
5
6
  function createHyperScript(r) {
6
7
  function h() {
7
8
  let args = [].slice.call(arguments),
8
9
  e,
9
10
  multiExpression = false;
11
+ typeof args[0] === "string" && detectMultiExpression(args);
12
+ const ret = () => {
13
+ while (args.length) item(args.shift());
14
+ return e;
15
+ };
16
+ ret[$ELEMENT] = true;
17
+ return ret;
10
18
  function item(l) {
11
19
  const type = typeof l;
12
20
  if (l == null) ;else if ("string" === type) {
@@ -42,12 +50,12 @@ function createHyperScript(r) {
42
50
  }
43
51
  e = r.createComponent(l, props);
44
52
  args = [];
45
- } else r.insert(e, l, multiExpression ? null : undefined);
53
+ } else {
54
+ while (l[$ELEMENT]) l = l();
55
+ r.insert(e, l, multiExpression ? null : undefined);
56
+ }
46
57
  }
47
58
  }
48
- typeof args[0] === "string" && detectMultiExpression(args);
49
- while (args.length) item(args.shift());
50
- return e;
51
59
  function parseClass(string) {
52
60
  const m = string.split(/([\.#]?[^\s#.]+)/);
53
61
  if (/^\.|#/.test(m[1])) e = document.createElement("div");
package/h/dist/h.js CHANGED
@@ -1,10 +1,18 @@
1
1
  import { spread, assign, insert, createComponent, dynamicProperty, SVGElements } from 'solid-js/web';
2
2
 
3
+ const $ELEMENT = Symbol("hyper-element");
3
4
  function createHyperScript(r) {
4
5
  function h() {
5
6
  let args = [].slice.call(arguments),
6
7
  e,
7
8
  multiExpression = false;
9
+ typeof args[0] === "string" && detectMultiExpression(args);
10
+ const ret = () => {
11
+ while (args.length) item(args.shift());
12
+ return e;
13
+ };
14
+ ret[$ELEMENT] = true;
15
+ return ret;
8
16
  function item(l) {
9
17
  const type = typeof l;
10
18
  if (l == null) ;else if ("string" === type) {
@@ -40,12 +48,12 @@ function createHyperScript(r) {
40
48
  }
41
49
  e = r.createComponent(l, props);
42
50
  args = [];
43
- } else r.insert(e, l, multiExpression ? null : undefined);
51
+ } else {
52
+ while (l[$ELEMENT]) l = l();
53
+ r.insert(e, l, multiExpression ? null : undefined);
54
+ }
44
55
  }
45
56
  }
46
- typeof args[0] === "string" && detectMultiExpression(args);
47
- while (args.length) item(args.shift());
48
- return e;
49
57
  function parseClass(string) {
50
58
  const m = string.split(/([\.#]?[^\s#.]+)/);
51
59
  if (/^\.|#/.test(m[1])) e = document.createElement("div");
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "solid-js/jsx-runtime",
2
+ "name": "solid-js/h/jsx-runtime",
3
3
  "main": "./dist/jsx.cjs",
4
4
  "module": "./dist/jsx.js",
5
5
  "types": "./types/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import h from "solid-js/h";
2
- export type { JSX } from "solid-js";
3
- import type { JSX } from "solid-js";
2
+ export type { JSX } from "./jsx";
3
+ import type { JSX } from "./jsx";
4
4
  declare function Fragment(props: {
5
5
  children: JSX.Element;
6
6
  }): JSX.Element;