solid-js 1.4.0-beta.6 → 1.4.2
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 +1 -2
- package/dist/dev.js +1 -2
- package/dist/solid.cjs +1 -2
- package/dist/solid.js +1 -2
- package/html/dist/html.cjs +34 -17
- package/html/dist/html.js +34 -17
- package/package.json +4 -4
- package/store/dist/dev.cjs +2 -2
- package/store/dist/dev.js +2 -2
- package/store/dist/store.cjs +2 -2
- package/store/dist/store.js +2 -2
- package/types/reactive/signal.d.ts +19 -10
- package/types/render/component.d.ts +12 -12
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -441,8 +441,7 @@ function untrack(fn) {
|
|
|
441
441
|
Listener = listener;
|
|
442
442
|
return result;
|
|
443
443
|
}
|
|
444
|
-
function on(deps, fn,
|
|
445
|
-
options) {
|
|
444
|
+
function on(deps, fn, options) {
|
|
446
445
|
const isArray = Array.isArray(deps);
|
|
447
446
|
let prevInput;
|
|
448
447
|
let defer = options && options.defer;
|
package/dist/dev.js
CHANGED
|
@@ -437,8 +437,7 @@ function untrack(fn) {
|
|
|
437
437
|
Listener = listener;
|
|
438
438
|
return result;
|
|
439
439
|
}
|
|
440
|
-
function on(deps, fn,
|
|
441
|
-
options) {
|
|
440
|
+
function on(deps, fn, options) {
|
|
442
441
|
const isArray = Array.isArray(deps);
|
|
443
442
|
let prevInput;
|
|
444
443
|
let defer = options && options.defer;
|
package/dist/solid.cjs
CHANGED
|
@@ -438,8 +438,7 @@ function untrack(fn) {
|
|
|
438
438
|
Listener = listener;
|
|
439
439
|
return result;
|
|
440
440
|
}
|
|
441
|
-
function on(deps, fn,
|
|
442
|
-
options) {
|
|
441
|
+
function on(deps, fn, options) {
|
|
443
442
|
const isArray = Array.isArray(deps);
|
|
444
443
|
let prevInput;
|
|
445
444
|
let defer = options && options.defer;
|
package/dist/solid.js
CHANGED
|
@@ -434,8 +434,7 @@ function untrack(fn) {
|
|
|
434
434
|
Listener = listener;
|
|
435
435
|
return result;
|
|
436
436
|
}
|
|
437
|
-
function on(deps, fn,
|
|
438
|
-
options) {
|
|
437
|
+
function on(deps, fn, options) {
|
|
439
438
|
const isArray = Array.isArray(deps);
|
|
440
439
|
let prevInput;
|
|
441
440
|
let defer = options && options.defer;
|
package/html/dist/html.cjs
CHANGED
|
@@ -179,15 +179,15 @@ const attrName = "[ " + spaces + "]+" + almostEverything;
|
|
|
179
179
|
const tagName = "<([A-Za-z$#]+[A-Za-z0-9:_-]*)((?:";
|
|
180
180
|
const attrPartials = "(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|\\([^)]*?\\)|<[^>]*?>|" + almostEverything + "))?)";
|
|
181
181
|
const attrSeeker = new RegExp(tagName + attrName + attrPartials + "+)([ " + spaces + "]*/?>)", "g");
|
|
182
|
-
const findAttributes = new RegExp("(" + attrName + "\\s*=\\s*)(['\"(]
|
|
182
|
+
const findAttributes = new RegExp("(" + attrName + "\\s*=\\s*)(<!--#-->|['\"(]([\\w\\s]*<!--#-->[\\w\\s]*)*['\")])", "gi");
|
|
183
183
|
const selfClosing = new RegExp(tagName + attrName + attrPartials + "*)([ " + spaces + "]*/>)", "g");
|
|
184
184
|
const marker = "<!--#-->";
|
|
185
185
|
const reservedNameSpaces = new Set(["class", "on", "oncapture", "style", "use", "prop", "attr"]);
|
|
186
186
|
function attrReplacer($0, $1, $2, $3) {
|
|
187
187
|
return "<" + $1 + $2.replace(findAttributes, replaceAttributes) + $3;
|
|
188
188
|
}
|
|
189
|
-
function replaceAttributes($0, $1, $2
|
|
190
|
-
return $1 + ($2
|
|
189
|
+
function replaceAttributes($0, $1, $2) {
|
|
190
|
+
return $1 + ($2[0] === '"' || $2[0] === "'" ? $2.replace(/<!--#-->/g, "###") : '"###"');
|
|
191
191
|
}
|
|
192
192
|
function fullClosing($0, $1, $2) {
|
|
193
193
|
return VOID_ELEMENTS.test($1) ? $0 : "<" + $1 + $2 + "></" + $1 + ">";
|
|
@@ -236,9 +236,8 @@ function createHTML(r, {
|
|
|
236
236
|
cache.set(statics, templates);
|
|
237
237
|
return templates;
|
|
238
238
|
}
|
|
239
|
-
function parseKeyValue(tag, name, isSVG, isCE, options) {
|
|
240
|
-
let
|
|
241
|
-
expr = `!doNotWrap ? exprs[${count}]() : exprs[${count}]`,
|
|
239
|
+
function parseKeyValue(tag, name, value, isSVG, isCE, options) {
|
|
240
|
+
let expr = value === "###" ? `!doNotWrap ? exprs[${options.counter}]() : exprs[${options.counter++}]` : value.split("###").map((v, i) => i ? ` + (typeof exprs[${options.counter}] === "function" ? exprs[${options.counter}]() : exprs[${options.counter++}]) + "${v}"` : `"${v}"`).join(""),
|
|
242
241
|
parts,
|
|
243
242
|
namespace;
|
|
244
243
|
if ((parts = name.split(":")) && parts[1] && reservedNameSpaces.has(parts[0])) {
|
|
@@ -263,7 +262,7 @@ function createHTML(r, {
|
|
|
263
262
|
if (ns) options.exprs.push(`r.setAttributeNS(${tag},"${ns}","${name}",${expr})`);else options.exprs.push(`r.setAttribute(${tag},"${r.Aliases[name] || name}",${expr})`);
|
|
264
263
|
}
|
|
265
264
|
}
|
|
266
|
-
function parseAttribute(tag, name, isSVG, isCE, options) {
|
|
265
|
+
function parseAttribute(tag, name, value, isSVG, isCE, options) {
|
|
267
266
|
if (name.slice(0, 2) === "on") {
|
|
268
267
|
if (!name.includes(":")) {
|
|
269
268
|
const lc = name.slice(2).toLowerCase();
|
|
@@ -281,9 +280,18 @@ function createHTML(r, {
|
|
|
281
280
|
exprs: []
|
|
282
281
|
}),
|
|
283
282
|
count = options.counter;
|
|
284
|
-
parseKeyValue(tag, name, isSVG, isCE, childOptions);
|
|
285
|
-
options.decl.push(`_fn${count} = doNotWrap => {\n${childOptions.exprs.join(";\n")};\n}`);
|
|
286
|
-
|
|
283
|
+
parseKeyValue(tag, name, value, isSVG, isCE, childOptions);
|
|
284
|
+
options.decl.push(`_fn${count} = (${value === "###" ? "doNotWrap" : ""}) => {\n${childOptions.exprs.join(";\n")};\n}`);
|
|
285
|
+
if (value === "###") {
|
|
286
|
+
options.exprs.push(`typeof exprs[${count}] === "function" ? r.effect(_fn${count}) : _fn${count}(true)`);
|
|
287
|
+
} else {
|
|
288
|
+
let check = "";
|
|
289
|
+
for (let i = count; i < childOptions.counter; i++) {
|
|
290
|
+
i !== count && (check += " || ");
|
|
291
|
+
check += `typeof exprs[${i}] === "function"`;
|
|
292
|
+
}
|
|
293
|
+
options.exprs.push(check + ` ? r.effect(_fn${count}) : _fn${count}()`);
|
|
294
|
+
}
|
|
287
295
|
options.counter = childOptions.counter;
|
|
288
296
|
options.wrap = false;
|
|
289
297
|
}
|
|
@@ -322,6 +330,7 @@ function createHTML(r, {
|
|
|
322
330
|
}
|
|
323
331
|
options.counter = childOptions.counter;
|
|
324
332
|
options.templateId = childOptions.templateId;
|
|
333
|
+
options.hasCustomElement = options.hasCustomElement || childOptions.hasCustomElement;
|
|
325
334
|
}
|
|
326
335
|
function processComponentProps(propGroups) {
|
|
327
336
|
let result = [];
|
|
@@ -414,16 +423,19 @@ function createHTML(r, {
|
|
|
414
423
|
options.exprs.push(`return [${parts.join(", \n")}]`);
|
|
415
424
|
} else if (node.type === "tag") {
|
|
416
425
|
const tag = `_$el${uuid++}`;
|
|
417
|
-
|
|
426
|
+
const topDecl = !options.decl.length;
|
|
427
|
+
const templateId = options.templateId;
|
|
428
|
+
options.decl.push(topDecl ? "" : `${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`);
|
|
418
429
|
const keys = Object.keys(node.attrs);
|
|
419
430
|
const isSVG = r.SVGElements.has(node.name);
|
|
420
431
|
const isCE = node.name.includes("-");
|
|
432
|
+
options.hasCustomElement = isCE;
|
|
421
433
|
for (let i = 0; i < keys.length; i++) {
|
|
422
434
|
const name = keys[i],
|
|
423
435
|
value = node.attrs[name];
|
|
424
|
-
if (value
|
|
436
|
+
if (value.includes("###")) {
|
|
425
437
|
delete node.attrs[name];
|
|
426
|
-
parseAttribute(tag, name, isSVG, isCE, options);
|
|
438
|
+
parseAttribute(tag, name, value, isSVG, isCE, options);
|
|
427
439
|
} else if (name === "###") {
|
|
428
440
|
delete node.attrs[name];
|
|
429
441
|
options.exprs.push(`r.spread(${tag},exprs[${options.counter++}],${isSVG},${!!node.children.length})`);
|
|
@@ -432,17 +444,22 @@ function createHTML(r, {
|
|
|
432
444
|
options.path = tag;
|
|
433
445
|
options.first = false;
|
|
434
446
|
processChildren(node, options);
|
|
447
|
+
if (topDecl) {
|
|
448
|
+
options.decl[0] = options.hasCustomElement ? `const ${tag} = document.importNode(tmpls[${templateId}].content.firstChild, true)` : `const ${tag} = tmpls[${templateId}].content.firstChild.cloneNode(true)`;
|
|
449
|
+
}
|
|
435
450
|
} else if (node.type === "text") {
|
|
436
451
|
const tag = `_$el${uuid++}`;
|
|
437
452
|
options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`);
|
|
438
453
|
options.path = tag;
|
|
439
454
|
options.first = false;
|
|
440
|
-
} else if (node.type === "comment"
|
|
455
|
+
} else if (node.type === "comment") {
|
|
441
456
|
const tag = `_$el${uuid++}`;
|
|
442
457
|
options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`);
|
|
443
|
-
if (
|
|
444
|
-
|
|
445
|
-
|
|
458
|
+
if (node.content === "#") {
|
|
459
|
+
if (options.multi) {
|
|
460
|
+
options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}], ${tag})`);
|
|
461
|
+
} else options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}])`);
|
|
462
|
+
}
|
|
446
463
|
options.path = tag;
|
|
447
464
|
options.first = false;
|
|
448
465
|
}
|
package/html/dist/html.js
CHANGED
|
@@ -177,15 +177,15 @@ const attrName = "[ " + spaces + "]+" + almostEverything;
|
|
|
177
177
|
const tagName = "<([A-Za-z$#]+[A-Za-z0-9:_-]*)((?:";
|
|
178
178
|
const attrPartials = "(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|\\([^)]*?\\)|<[^>]*?>|" + almostEverything + "))?)";
|
|
179
179
|
const attrSeeker = new RegExp(tagName + attrName + attrPartials + "+)([ " + spaces + "]*/?>)", "g");
|
|
180
|
-
const findAttributes = new RegExp("(" + attrName + "\\s*=\\s*)(['\"(]
|
|
180
|
+
const findAttributes = new RegExp("(" + attrName + "\\s*=\\s*)(<!--#-->|['\"(]([\\w\\s]*<!--#-->[\\w\\s]*)*['\")])", "gi");
|
|
181
181
|
const selfClosing = new RegExp(tagName + attrName + attrPartials + "*)([ " + spaces + "]*/>)", "g");
|
|
182
182
|
const marker = "<!--#-->";
|
|
183
183
|
const reservedNameSpaces = new Set(["class", "on", "oncapture", "style", "use", "prop", "attr"]);
|
|
184
184
|
function attrReplacer($0, $1, $2, $3) {
|
|
185
185
|
return "<" + $1 + $2.replace(findAttributes, replaceAttributes) + $3;
|
|
186
186
|
}
|
|
187
|
-
function replaceAttributes($0, $1, $2
|
|
188
|
-
return $1 + ($2
|
|
187
|
+
function replaceAttributes($0, $1, $2) {
|
|
188
|
+
return $1 + ($2[0] === '"' || $2[0] === "'" ? $2.replace(/<!--#-->/g, "###") : '"###"');
|
|
189
189
|
}
|
|
190
190
|
function fullClosing($0, $1, $2) {
|
|
191
191
|
return VOID_ELEMENTS.test($1) ? $0 : "<" + $1 + $2 + "></" + $1 + ">";
|
|
@@ -234,9 +234,8 @@ function createHTML(r, {
|
|
|
234
234
|
cache.set(statics, templates);
|
|
235
235
|
return templates;
|
|
236
236
|
}
|
|
237
|
-
function parseKeyValue(tag, name, isSVG, isCE, options) {
|
|
238
|
-
let
|
|
239
|
-
expr = `!doNotWrap ? exprs[${count}]() : exprs[${count}]`,
|
|
237
|
+
function parseKeyValue(tag, name, value, isSVG, isCE, options) {
|
|
238
|
+
let expr = value === "###" ? `!doNotWrap ? exprs[${options.counter}]() : exprs[${options.counter++}]` : value.split("###").map((v, i) => i ? ` + (typeof exprs[${options.counter}] === "function" ? exprs[${options.counter}]() : exprs[${options.counter++}]) + "${v}"` : `"${v}"`).join(""),
|
|
240
239
|
parts,
|
|
241
240
|
namespace;
|
|
242
241
|
if ((parts = name.split(":")) && parts[1] && reservedNameSpaces.has(parts[0])) {
|
|
@@ -261,7 +260,7 @@ function createHTML(r, {
|
|
|
261
260
|
if (ns) options.exprs.push(`r.setAttributeNS(${tag},"${ns}","${name}",${expr})`);else options.exprs.push(`r.setAttribute(${tag},"${r.Aliases[name] || name}",${expr})`);
|
|
262
261
|
}
|
|
263
262
|
}
|
|
264
|
-
function parseAttribute(tag, name, isSVG, isCE, options) {
|
|
263
|
+
function parseAttribute(tag, name, value, isSVG, isCE, options) {
|
|
265
264
|
if (name.slice(0, 2) === "on") {
|
|
266
265
|
if (!name.includes(":")) {
|
|
267
266
|
const lc = name.slice(2).toLowerCase();
|
|
@@ -279,9 +278,18 @@ function createHTML(r, {
|
|
|
279
278
|
exprs: []
|
|
280
279
|
}),
|
|
281
280
|
count = options.counter;
|
|
282
|
-
parseKeyValue(tag, name, isSVG, isCE, childOptions);
|
|
283
|
-
options.decl.push(`_fn${count} = doNotWrap => {\n${childOptions.exprs.join(";\n")};\n}`);
|
|
284
|
-
|
|
281
|
+
parseKeyValue(tag, name, value, isSVG, isCE, childOptions);
|
|
282
|
+
options.decl.push(`_fn${count} = (${value === "###" ? "doNotWrap" : ""}) => {\n${childOptions.exprs.join(";\n")};\n}`);
|
|
283
|
+
if (value === "###") {
|
|
284
|
+
options.exprs.push(`typeof exprs[${count}] === "function" ? r.effect(_fn${count}) : _fn${count}(true)`);
|
|
285
|
+
} else {
|
|
286
|
+
let check = "";
|
|
287
|
+
for (let i = count; i < childOptions.counter; i++) {
|
|
288
|
+
i !== count && (check += " || ");
|
|
289
|
+
check += `typeof exprs[${i}] === "function"`;
|
|
290
|
+
}
|
|
291
|
+
options.exprs.push(check + ` ? r.effect(_fn${count}) : _fn${count}()`);
|
|
292
|
+
}
|
|
285
293
|
options.counter = childOptions.counter;
|
|
286
294
|
options.wrap = false;
|
|
287
295
|
}
|
|
@@ -320,6 +328,7 @@ function createHTML(r, {
|
|
|
320
328
|
}
|
|
321
329
|
options.counter = childOptions.counter;
|
|
322
330
|
options.templateId = childOptions.templateId;
|
|
331
|
+
options.hasCustomElement = options.hasCustomElement || childOptions.hasCustomElement;
|
|
323
332
|
}
|
|
324
333
|
function processComponentProps(propGroups) {
|
|
325
334
|
let result = [];
|
|
@@ -412,16 +421,19 @@ function createHTML(r, {
|
|
|
412
421
|
options.exprs.push(`return [${parts.join(", \n")}]`);
|
|
413
422
|
} else if (node.type === "tag") {
|
|
414
423
|
const tag = `_$el${uuid++}`;
|
|
415
|
-
|
|
424
|
+
const topDecl = !options.decl.length;
|
|
425
|
+
const templateId = options.templateId;
|
|
426
|
+
options.decl.push(topDecl ? "" : `${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`);
|
|
416
427
|
const keys = Object.keys(node.attrs);
|
|
417
428
|
const isSVG = r.SVGElements.has(node.name);
|
|
418
429
|
const isCE = node.name.includes("-");
|
|
430
|
+
options.hasCustomElement = isCE;
|
|
419
431
|
for (let i = 0; i < keys.length; i++) {
|
|
420
432
|
const name = keys[i],
|
|
421
433
|
value = node.attrs[name];
|
|
422
|
-
if (value
|
|
434
|
+
if (value.includes("###")) {
|
|
423
435
|
delete node.attrs[name];
|
|
424
|
-
parseAttribute(tag, name, isSVG, isCE, options);
|
|
436
|
+
parseAttribute(tag, name, value, isSVG, isCE, options);
|
|
425
437
|
} else if (name === "###") {
|
|
426
438
|
delete node.attrs[name];
|
|
427
439
|
options.exprs.push(`r.spread(${tag},exprs[${options.counter++}],${isSVG},${!!node.children.length})`);
|
|
@@ -430,17 +442,22 @@ function createHTML(r, {
|
|
|
430
442
|
options.path = tag;
|
|
431
443
|
options.first = false;
|
|
432
444
|
processChildren(node, options);
|
|
445
|
+
if (topDecl) {
|
|
446
|
+
options.decl[0] = options.hasCustomElement ? `const ${tag} = document.importNode(tmpls[${templateId}].content.firstChild, true)` : `const ${tag} = tmpls[${templateId}].content.firstChild.cloneNode(true)`;
|
|
447
|
+
}
|
|
433
448
|
} else if (node.type === "text") {
|
|
434
449
|
const tag = `_$el${uuid++}`;
|
|
435
450
|
options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`);
|
|
436
451
|
options.path = tag;
|
|
437
452
|
options.first = false;
|
|
438
|
-
} else if (node.type === "comment"
|
|
453
|
+
} else if (node.type === "comment") {
|
|
439
454
|
const tag = `_$el${uuid++}`;
|
|
440
455
|
options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`);
|
|
441
|
-
if (
|
|
442
|
-
|
|
443
|
-
|
|
456
|
+
if (node.content === "#") {
|
|
457
|
+
if (options.multi) {
|
|
458
|
+
options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}], ${tag})`);
|
|
459
|
+
} else options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}])`);
|
|
460
|
+
}
|
|
444
461
|
options.path = tag;
|
|
445
462
|
options.first = false;
|
|
446
463
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
"require": "./h/dist/h.cjs"
|
|
115
115
|
},
|
|
116
116
|
"./h/jsx-runtime": {
|
|
117
|
-
"import": "./h/dist/jsx.js",
|
|
118
|
-
"require": "./h/dist/jsx.cjs"
|
|
117
|
+
"import": "./h/jsx-runtime/dist/jsx.js",
|
|
118
|
+
"require": "./h/jsx-runtime/dist/jsx.cjs"
|
|
119
119
|
},
|
|
120
120
|
"./h/dist/*": "./h/dist/*",
|
|
121
121
|
"./html": {
|
|
@@ -151,5 +151,5 @@
|
|
|
151
151
|
"compiler",
|
|
152
152
|
"performance"
|
|
153
153
|
],
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "f17df5c7042425aa8d363be261bd9a9e5345c188"
|
|
155
155
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -227,8 +227,8 @@ const proxyTraps = {
|
|
|
227
227
|
if (property === $NODE || property === "__proto__") return value;
|
|
228
228
|
if (!tracked) {
|
|
229
229
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
230
|
-
const isFunction = typeof value
|
|
231
|
-
if (solidJs.getListener() && (isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
230
|
+
const isFunction = typeof value === "function";
|
|
231
|
+
if (solidJs.getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
232
232
|
return (...args) => solidJs.batch(() => Array.prototype[property].apply(receiver, args));
|
|
233
233
|
}
|
|
234
234
|
}
|
package/store/dist/dev.js
CHANGED
|
@@ -223,8 +223,8 @@ const proxyTraps = {
|
|
|
223
223
|
if (property === $NODE || property === "__proto__") return value;
|
|
224
224
|
if (!tracked) {
|
|
225
225
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
226
|
-
const isFunction = typeof value
|
|
227
|
-
if (getListener() && (isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
226
|
+
const isFunction = typeof value === "function";
|
|
227
|
+
if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
228
228
|
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
229
229
|
}
|
|
230
230
|
}
|
package/store/dist/store.cjs
CHANGED
|
@@ -215,8 +215,8 @@ const proxyTraps = {
|
|
|
215
215
|
if (property === $NODE || property === "__proto__") return value;
|
|
216
216
|
if (!tracked) {
|
|
217
217
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
218
|
-
const isFunction = typeof value
|
|
219
|
-
if (solidJs.getListener() && (isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
218
|
+
const isFunction = typeof value === "function";
|
|
219
|
+
if (solidJs.getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
220
220
|
return (...args) => solidJs.batch(() => Array.prototype[property].apply(receiver, args));
|
|
221
221
|
}
|
|
222
222
|
}
|
package/store/dist/store.js
CHANGED
|
@@ -211,8 +211,8 @@ const proxyTraps = {
|
|
|
211
211
|
if (property === $NODE || property === "__proto__") return value;
|
|
212
212
|
if (!tracked) {
|
|
213
213
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
214
|
-
const isFunction = typeof value
|
|
215
|
-
if (getListener() && (isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
214
|
+
const isFunction = typeof value === "function";
|
|
215
|
+
if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
216
216
|
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -72,7 +72,7 @@ export declare type RootFunction<T> = (dispose: () => void) => T;
|
|
|
72
72
|
*/
|
|
73
73
|
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: Owner): T;
|
|
74
74
|
export declare type Accessor<T> = () => T;
|
|
75
|
-
export declare type Setter<T> = (undefined extends T ? () => undefined : {}) & (<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)) => U);
|
|
75
|
+
export declare type Setter<T> = (undefined extends T ? () => undefined : {}) & (<U extends T>(value: (prev: T) => U) => U) & (<U extends T>(value: Exclude<U, Function>) => U) & (<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)) => U);
|
|
76
76
|
export declare type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
77
77
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
78
78
|
internal?: boolean;
|
|
@@ -314,21 +314,25 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
314
314
|
* @description https://www.solidjs.com/docs/latest/api#untrack
|
|
315
315
|
*/
|
|
316
316
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
/** @deprecated */
|
|
318
|
+
export declare type ReturnTypes<T> = T extends readonly Accessor<unknown>[] ? {
|
|
319
|
+
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
320
|
+
} : T extends Accessor<infer I> ? I : never;
|
|
321
|
+
export declare type AccessorArray<T> = [...Extract<{
|
|
322
|
+
[K in keyof T]: Accessor<T[K]>;
|
|
323
|
+
}, readonly unknown[]>];
|
|
324
|
+
export declare type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (input: S, prevInput: S | undefined, prev: Prev) => Next;
|
|
321
325
|
export interface OnOptions {
|
|
322
326
|
defer?: boolean;
|
|
323
327
|
}
|
|
324
328
|
/**
|
|
325
329
|
* on - make dependencies of a computation explicit
|
|
326
330
|
* ```typescript
|
|
327
|
-
* export function on<
|
|
328
|
-
* deps:
|
|
329
|
-
* fn: (input:
|
|
331
|
+
* export function on<S, U>(
|
|
332
|
+
* deps: Accessor<S> | AccessorArray<S>,
|
|
333
|
+
* fn: (input: S, prevInput: S | undefined, prevValue: U | undefined) => U,
|
|
330
334
|
* options?: { defer?: boolean } = {}
|
|
331
|
-
* ): (prevValue
|
|
335
|
+
* ): (prevValue: U | undefined) => U;
|
|
332
336
|
* ```
|
|
333
337
|
* @param deps list of reactive dependencies or a single reactive dependency
|
|
334
338
|
* @param fn computation on input; the current previous content(s) of input and the previous value are given as arguments and it returns a new value
|
|
@@ -347,7 +351,12 @@ export interface OnOptions {
|
|
|
347
351
|
*
|
|
348
352
|
* @description https://www.solidjs.com/docs/latest/api#on
|
|
349
353
|
*/
|
|
350
|
-
export declare function on<S extends
|
|
354
|
+
export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options?: OnOptions & {
|
|
355
|
+
defer?: false;
|
|
356
|
+
}): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
|
|
357
|
+
export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options: OnOptions & {
|
|
358
|
+
defer: true;
|
|
359
|
+
}): EffectFunction<undefined | NoInfer<Next>>;
|
|
351
360
|
/**
|
|
352
361
|
* onMount - run an effect only after initial render on mount
|
|
353
362
|
* @param fn an effect that should run only once on mount
|
|
@@ -66,19 +66,19 @@ export declare type ComponentProps<T extends keyof JSX.IntrinsicElements | Compo
|
|
|
66
66
|
*/
|
|
67
67
|
export declare type Ref<T> = T | ((val: T) => void);
|
|
68
68
|
export declare function createComponent<T>(Comp: Component<T>, props: T): JSX.Element;
|
|
69
|
-
declare type
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
declare type
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
export declare function mergeProps<T extends
|
|
79
|
-
declare type SplitProps<T, K extends (readonly (keyof T)[])[]> = [
|
|
69
|
+
declare type Override<T, U> = T extends any ? U extends any ? {
|
|
70
|
+
[K in keyof T]: K extends keyof U ? undefined extends U[K] ? Exclude<U[K], undefined> | T[K] : U[K] : T[K];
|
|
71
|
+
} & {
|
|
72
|
+
[K in keyof U]: K extends keyof T ? undefined extends U[K] ? Exclude<U[K], undefined> | T[K] : U[K] : U[K];
|
|
73
|
+
} : T & U : T & U;
|
|
74
|
+
export declare type MergeProps<T extends unknown[], Curr = {}> = T extends [
|
|
75
|
+
infer Next | (() => infer Next),
|
|
76
|
+
...infer Rest
|
|
77
|
+
] ? MergeProps<Rest, Override<Curr, Next>> : Curr;
|
|
78
|
+
export declare function mergeProps<T extends [unknown, ...unknown[]]>(...sources: T): MergeProps<T>;
|
|
79
|
+
export declare type SplitProps<T, K extends (readonly (keyof T)[])[]> = [
|
|
80
80
|
...{
|
|
81
|
-
[P in keyof K]: P extends `${number}` ? Pick<T, Extract<K[P], readonly (keyof T)[]>[number]> :
|
|
81
|
+
[P in keyof K]: P extends `${number}` ? Pick<T, Extract<K[P], readonly (keyof T)[]>[number]> : never;
|
|
82
82
|
},
|
|
83
83
|
Omit<T, K[number][number]>
|
|
84
84
|
];
|
package/web/dist/server.cjs
CHANGED
|
@@ -269,7 +269,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
269
269
|
nonce,
|
|
270
270
|
writeResource(id, p, error) {
|
|
271
271
|
if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
|
|
272
|
-
if (!p || typeof p !== "object" || !("then" in p)) return
|
|
272
|
+
if (!p || typeof p !== "object" || !("then" in p)) return scripts += serializeSet(dedupe, id, p) + ";";
|
|
273
273
|
p.then(d => scripts += serializeSet(dedupe, id, d) + ";").catch(() => scripts += `_$HY.set("${id}", {});`);
|
|
274
274
|
}
|
|
275
275
|
};
|
package/web/dist/server.js
CHANGED
|
@@ -266,7 +266,7 @@ function renderToStringAsync(code, options = {}) {
|
|
|
266
266
|
nonce,
|
|
267
267
|
writeResource(id, p, error) {
|
|
268
268
|
if (error) return scripts += `_$HY.set("${id}", ${serializeError(p)});`;
|
|
269
|
-
if (!p || typeof p !== "object" || !("then" in p)) return
|
|
269
|
+
if (!p || typeof p !== "object" || !("then" in p)) return scripts += serializeSet(dedupe, id, p) + ";";
|
|
270
270
|
p.then(d => scripts += serializeSet(dedupe, id, d) + ";").catch(() => scripts += `_$HY.set("${id}", {});`);
|
|
271
271
|
}
|
|
272
272
|
};
|