solid-js 1.4.0-beta.1 → 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/dist/dev.cjs CHANGED
@@ -273,9 +273,9 @@ function createResource(source, fetcher, options) {
273
273
  if (pr === p) {
274
274
  pr = null;
275
275
  resolved = true;
276
- if (initP && p === initP && options.onHydrated) options.onHydrated(key, {
276
+ if (initP && (p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
277
277
  value: v
278
- });
278
+ }));
279
279
  initP = null;
280
280
  setError(err = e);
281
281
  if (Transition && p && loadedUnderTransition) {
@@ -1228,17 +1228,16 @@ function enableHydration() {
1228
1228
  hydrationEnabled = true;
1229
1229
  }
1230
1230
  function createComponent(Comp, props) {
1231
- if (props == null || typeof props !== "object") props = {};
1232
1231
  if (hydrationEnabled) {
1233
1232
  if (sharedConfig.context) {
1234
1233
  const c = sharedConfig.context;
1235
1234
  setHydrateContext(nextHydrateContext());
1236
- const r = devComponent(Comp, props) ;
1235
+ const r = devComponent(Comp, props || {}) ;
1237
1236
  setHydrateContext(c);
1238
1237
  return r;
1239
1238
  }
1240
1239
  }
1241
- return devComponent(Comp, props);
1240
+ return devComponent(Comp, props || {});
1242
1241
  }
1243
1242
  function trueFn() {
1244
1243
  return true;
@@ -1269,7 +1268,7 @@ const propTraps = {
1269
1268
  }
1270
1269
  };
1271
1270
  function resolveSource(s) {
1272
- return (s = typeof s === "function" ? s() : s) == null || typeof s !== "object" ? {} : s;
1271
+ return (s = typeof s === "function" ? s() : s) == null ? {} : s;
1273
1272
  }
1274
1273
  function mergeProps(...sources) {
1275
1274
  return new Proxy({
package/dist/dev.js CHANGED
@@ -269,9 +269,9 @@ function createResource(source, fetcher, options) {
269
269
  if (pr === p) {
270
270
  pr = null;
271
271
  resolved = true;
272
- if (initP && p === initP && options.onHydrated) options.onHydrated(key, {
272
+ if (initP && (p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
273
273
  value: v
274
- });
274
+ }));
275
275
  initP = null;
276
276
  setError(err = e);
277
277
  if (Transition && p && loadedUnderTransition) {
@@ -1224,17 +1224,16 @@ function enableHydration() {
1224
1224
  hydrationEnabled = true;
1225
1225
  }
1226
1226
  function createComponent(Comp, props) {
1227
- if (props == null || typeof props !== "object") props = {};
1228
1227
  if (hydrationEnabled) {
1229
1228
  if (sharedConfig.context) {
1230
1229
  const c = sharedConfig.context;
1231
1230
  setHydrateContext(nextHydrateContext());
1232
- const r = devComponent(Comp, props) ;
1231
+ const r = devComponent(Comp, props || {}) ;
1233
1232
  setHydrateContext(c);
1234
1233
  return r;
1235
1234
  }
1236
1235
  }
1237
- return devComponent(Comp, props);
1236
+ return devComponent(Comp, props || {});
1238
1237
  }
1239
1238
  function trueFn() {
1240
1239
  return true;
@@ -1265,7 +1264,7 @@ const propTraps = {
1265
1264
  }
1266
1265
  };
1267
1266
  function resolveSource(s) {
1268
- return (s = typeof s === "function" ? s() : s) == null || typeof s !== "object" ? {} : s;
1267
+ return (s = typeof s === "function" ? s() : s) == null ? {} : s;
1269
1268
  }
1270
1269
  function mergeProps(...sources) {
1271
1270
  return new Proxy({
package/dist/server.cjs CHANGED
@@ -246,15 +246,14 @@ function createUniqueId() {
246
246
  return `${ctx.id}${ctx.count++}`;
247
247
  }
248
248
  function createComponent(Comp, props) {
249
- if (props == null || typeof props !== "object") props = {};
250
249
  if (sharedConfig.context && !sharedConfig.context.noHydrate) {
251
250
  const c = sharedConfig.context;
252
251
  setHydrateContext(nextHydrateContext());
253
- const r = Comp(props);
252
+ const r = Comp(props || {});
254
253
  setHydrateContext(c);
255
254
  return r;
256
255
  }
257
- return Comp(props);
256
+ return Comp(props || {});
258
257
  }
259
258
  function mergeProps(...sources) {
260
259
  const target = {};
@@ -401,7 +400,7 @@ function createResource(source, fetcher, options = {}) {
401
400
  }
402
401
  if (p && "then" in p) {
403
402
  read.loading = true;
404
- if (ctx.writeResource) ctx.writeResource(id, p);
403
+ if (ctx.writeResource) ctx.writeResource(id, p, undefined, options.deferStream);
405
404
  return p.then(res => {
406
405
  read.loading = false;
407
406
  ctx.resources[id].data = res;
package/dist/server.js CHANGED
@@ -242,15 +242,14 @@ function createUniqueId() {
242
242
  return `${ctx.id}${ctx.count++}`;
243
243
  }
244
244
  function createComponent(Comp, props) {
245
- if (props == null || typeof props !== "object") props = {};
246
245
  if (sharedConfig.context && !sharedConfig.context.noHydrate) {
247
246
  const c = sharedConfig.context;
248
247
  setHydrateContext(nextHydrateContext());
249
- const r = Comp(props);
248
+ const r = Comp(props || {});
250
249
  setHydrateContext(c);
251
250
  return r;
252
251
  }
253
- return Comp(props);
252
+ return Comp(props || {});
254
253
  }
255
254
  function mergeProps(...sources) {
256
255
  const target = {};
@@ -397,7 +396,7 @@ function createResource(source, fetcher, options = {}) {
397
396
  }
398
397
  if (p && "then" in p) {
399
398
  read.loading = true;
400
- if (ctx.writeResource) ctx.writeResource(id, p);
399
+ if (ctx.writeResource) ctx.writeResource(id, p, undefined, options.deferStream);
401
400
  return p.then(res => {
402
401
  read.loading = false;
403
402
  ctx.resources[id].data = res;
package/dist/solid.cjs CHANGED
@@ -270,9 +270,9 @@ function createResource(source, fetcher, options) {
270
270
  if (pr === p) {
271
271
  pr = null;
272
272
  resolved = true;
273
- if (initP && p === initP && options.onHydrated) options.onHydrated(key, {
273
+ if (initP && (p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
274
274
  value: v
275
- });
275
+ }));
276
276
  initP = null;
277
277
  setError(err = e);
278
278
  if (Transition && p && loadedUnderTransition) {
@@ -1147,17 +1147,16 @@ function enableHydration() {
1147
1147
  hydrationEnabled = true;
1148
1148
  }
1149
1149
  function createComponent(Comp, props) {
1150
- if (props == null || typeof props !== "object") props = {};
1151
1150
  if (hydrationEnabled) {
1152
1151
  if (sharedConfig.context) {
1153
1152
  const c = sharedConfig.context;
1154
1153
  setHydrateContext(nextHydrateContext());
1155
- const r = untrack(() => Comp(props));
1154
+ const r = untrack(() => Comp(props || {}));
1156
1155
  setHydrateContext(c);
1157
1156
  return r;
1158
1157
  }
1159
1158
  }
1160
- return untrack(() => Comp(props));
1159
+ return untrack(() => Comp(props || {}));
1161
1160
  }
1162
1161
  function trueFn() {
1163
1162
  return true;
@@ -1188,7 +1187,7 @@ const propTraps = {
1188
1187
  }
1189
1188
  };
1190
1189
  function resolveSource(s) {
1191
- return (s = typeof s === "function" ? s() : s) == null || typeof s !== "object" ? {} : s;
1190
+ return (s = typeof s === "function" ? s() : s) == null ? {} : s;
1192
1191
  }
1193
1192
  function mergeProps(...sources) {
1194
1193
  return new Proxy({
package/dist/solid.js CHANGED
@@ -266,9 +266,9 @@ function createResource(source, fetcher, options) {
266
266
  if (pr === p) {
267
267
  pr = null;
268
268
  resolved = true;
269
- if (initP && p === initP && options.onHydrated) options.onHydrated(key, {
269
+ if (initP && (p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
270
270
  value: v
271
- });
271
+ }));
272
272
  initP = null;
273
273
  setError(err = e);
274
274
  if (Transition && p && loadedUnderTransition) {
@@ -1143,17 +1143,16 @@ function enableHydration() {
1143
1143
  hydrationEnabled = true;
1144
1144
  }
1145
1145
  function createComponent(Comp, props) {
1146
- if (props == null || typeof props !== "object") props = {};
1147
1146
  if (hydrationEnabled) {
1148
1147
  if (sharedConfig.context) {
1149
1148
  const c = sharedConfig.context;
1150
1149
  setHydrateContext(nextHydrateContext());
1151
- const r = untrack(() => Comp(props));
1150
+ const r = untrack(() => Comp(props || {}));
1152
1151
  setHydrateContext(c);
1153
1152
  return r;
1154
1153
  }
1155
1154
  }
1156
- return untrack(() => Comp(props));
1155
+ return untrack(() => Comp(props || {}));
1157
1156
  }
1158
1157
  function trueFn() {
1159
1158
  return true;
@@ -1184,7 +1183,7 @@ const propTraps = {
1184
1183
  }
1185
1184
  };
1186
1185
  function resolveSource(s) {
1187
- return (s = typeof s === "function" ? s() : s) == null || typeof s !== "object" ? {} : s;
1186
+ return (s = typeof s === "function" ? s() : s) == null ? {} : s;
1188
1187
  }
1189
1188
  function mergeProps(...sources) {
1190
1189
  return new Proxy({
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");
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var h = require('solid-js/h');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var h__default = /*#__PURE__*/_interopDefaultLegacy(h);
10
+
11
+ function Fragment(props) {
12
+ return props.children;
13
+ }
14
+
15
+ Object.defineProperty(exports, 'jsx', {
16
+ enumerable: true,
17
+ get: function () { return h__default["default"]; }
18
+ });
19
+ Object.defineProperty(exports, 'jsxDEV', {
20
+ enumerable: true,
21
+ get: function () { return h__default["default"]; }
22
+ });
23
+ Object.defineProperty(exports, 'jsxs', {
24
+ enumerable: true,
25
+ get: function () { return h__default["default"]; }
26
+ });
27
+ exports.Fragment = Fragment;
@@ -0,0 +1,7 @@
1
+ export { default as jsx, default as jsxDEV, default as jsxs } from 'solid-js/h';
2
+
3
+ function Fragment(props) {
4
+ return props.children;
5
+ }
6
+
7
+ export { Fragment };
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "solid-js/h/jsx-runtime",
3
+ "main": "./dist/jsx.cjs",
4
+ "module": "./dist/jsx.js",
5
+ "types": "./types/index.d.ts",
6
+ "type": "module",
7
+ "sideEffects": false
8
+ }
@@ -0,0 +1,7 @@
1
+ import h from "solid-js/h";
2
+ export type { JSX } from "./jsx";
3
+ import type { JSX } from "./jsx";
4
+ declare function Fragment(props: {
5
+ children: JSX.Element;
6
+ }): JSX.Element;
7
+ export { h as jsx, h as jsxs, h as jsxDEV, Fragment };