solid-js 1.6.15 → 1.7.0-beta.1
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 +60 -101
- package/dist/dev.js +60 -102
- package/dist/server.cjs +63 -45
- package/dist/server.js +63 -45
- package/dist/solid.cjs +37 -21
- package/dist/solid.js +37 -22
- package/html/dist/html.cjs +7 -7
- package/html/dist/html.js +8 -8
- package/html/types/lit.d.ts +1 -1
- package/package.json +1 -1
- package/store/dist/dev.cjs +26 -34
- package/store/dist/dev.js +26 -33
- package/store/dist/store.cjs +6 -7
- package/store/dist/store.js +6 -7
- package/store/types/index.d.ts +8 -7
- package/store/types/store.d.ts +4 -5
- package/types/index.d.ts +6 -7
- package/types/jsx.d.ts +1 -4
- package/types/reactive/signal.d.ts +25 -18
- package/types/render/flow.d.ts +21 -19
- package/types/server/reactive.d.ts +7 -3
- package/types/server/rendering.d.ts +8 -4
- package/web/dist/dev.cjs +45 -17
- package/web/dist/dev.js +46 -18
- package/web/dist/server.cjs +2 -1
- package/web/dist/server.js +2 -1
- package/web/dist/web.cjs +45 -17
- package/web/dist/web.js +46 -18
- package/web/types/client.d.ts +1 -1
- package/web/types/index.d.ts +2 -2
package/html/dist/html.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { effect, style, insert, untrack, spread, createComponent, delegateEvents, classList, mergeProps, dynamicProperty, setAttribute, setAttributeNS, addEventListener, Aliases,
|
|
1
|
+
import { effect, style, insert, untrack, spread, createComponent, delegateEvents, classList, mergeProps, dynamicProperty, setAttribute, setAttributeNS, addEventListener, Aliases, getPropAlias, Properties, ChildProperties, DelegatedEvents, SVGElements, SVGNamespace } from 'solid-js/web';
|
|
2
2
|
|
|
3
3
|
const tagRE = /(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g;
|
|
4
4
|
const attrRE = /(?:\s(?<boolean>[^/\s><=]+?)(?=[\s/>]))|(?:(?<name>\S+?)(?:\s*=\s*(?:(['"])(?<quotedValue>[\s\S]*?)\3|(?<unquotedValue>[^\s>]+))))/g;
|
|
@@ -208,7 +208,7 @@ function createHTML(r, {
|
|
|
208
208
|
cache.set(statics, templates);
|
|
209
209
|
return templates;
|
|
210
210
|
}
|
|
211
|
-
function parseKeyValue(tag, name, value, isSVG, isCE, options) {
|
|
211
|
+
function parseKeyValue(node, tag, name, value, isSVG, isCE, options) {
|
|
212
212
|
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(""),
|
|
213
213
|
parts,
|
|
214
214
|
namespace;
|
|
@@ -226,15 +226,15 @@ function createHTML(r, {
|
|
|
226
226
|
const prev = `_$v${uuid++}`;
|
|
227
227
|
options.decl.push(`${prev}={}`);
|
|
228
228
|
options.exprs.push(`r.classList(${tag},${expr},${prev})`);
|
|
229
|
-
} else if (namespace !== "attr" && (isChildProp || !isSVG && (r.
|
|
229
|
+
} else if (namespace !== "attr" && (isChildProp || !isSVG && (r.getPropAlias(name, node.name.toUpperCase()) || isProp) || isCE || namespace === "prop")) {
|
|
230
230
|
if (isCE && !isChildProp && !isProp && namespace !== "prop") name = toPropertyName(name);
|
|
231
|
-
options.exprs.push(`${tag}.${r.
|
|
231
|
+
options.exprs.push(`${tag}.${r.getPropAlias(name, node.name.toUpperCase()) || name} = ${expr}`);
|
|
232
232
|
} else {
|
|
233
233
|
const ns = isSVG && name.indexOf(":") > -1 && r.SVGNamespace[name.split(":")[0]];
|
|
234
234
|
if (ns) options.exprs.push(`r.setAttributeNS(${tag},"${ns}","${name}",${expr})`);else options.exprs.push(`r.setAttribute(${tag},"${r.Aliases[name] || name}",${expr})`);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
function parseAttribute(tag, name, value, isSVG, isCE, options) {
|
|
237
|
+
function parseAttribute(node, tag, name, value, isSVG, isCE, options) {
|
|
238
238
|
if (name.slice(0, 2) === "on") {
|
|
239
239
|
if (!name.includes(":")) {
|
|
240
240
|
const lc = name.slice(2).toLowerCase();
|
|
@@ -252,7 +252,7 @@ function createHTML(r, {
|
|
|
252
252
|
exprs: []
|
|
253
253
|
}),
|
|
254
254
|
count = options.counter;
|
|
255
|
-
parseKeyValue(tag, name, value, isSVG, isCE, childOptions);
|
|
255
|
+
parseKeyValue(node, tag, name, value, isSVG, isCE, childOptions);
|
|
256
256
|
options.decl.push(`_fn${count} = (${value === "###" ? "doNotWrap" : ""}) => {\n${childOptions.exprs.join(";\n")};\n}`);
|
|
257
257
|
if (value === "###") {
|
|
258
258
|
options.exprs.push(`typeof exprs[${count}] === "function" ? r.effect(_fn${count}) : _fn${count}(true)`);
|
|
@@ -433,7 +433,7 @@ function createHTML(r, {
|
|
|
433
433
|
value = node.attrs[name];
|
|
434
434
|
if (value.includes("###")) {
|
|
435
435
|
delete node.attrs[name];
|
|
436
|
-
parseAttribute(tag, name, value, isSVG, isCE, options);
|
|
436
|
+
parseAttribute(node, tag, name, value, isSVG, isCE, options);
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
}
|
|
@@ -511,7 +511,7 @@ var index = createHTML({
|
|
|
511
511
|
setAttributeNS,
|
|
512
512
|
addEventListener,
|
|
513
513
|
Aliases,
|
|
514
|
-
|
|
514
|
+
getPropAlias,
|
|
515
515
|
Properties,
|
|
516
516
|
ChildProperties,
|
|
517
517
|
DelegatedEvents,
|
package/html/types/lit.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ interface Runtime {
|
|
|
22
22
|
setAttribute(node: Element, name: string, value: any): void;
|
|
23
23
|
setAttributeNS(node: Element, namespace: string, name: string, value: any): void;
|
|
24
24
|
Aliases: Record<string, string>;
|
|
25
|
-
|
|
25
|
+
getPropAlias(prop: string, tagName: string): string | undefined;
|
|
26
26
|
Properties: Set<string>;
|
|
27
27
|
ChildProperties: Set<string>;
|
|
28
28
|
DelegatedEvents: Set<string>;
|
package/package.json
CHANGED
package/store/dist/dev.cjs
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
|
|
5
5
|
const $RAW = Symbol("store-raw"),
|
|
6
|
-
$NODE = Symbol("store-node")
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
$NODE = Symbol("store-node");
|
|
7
|
+
const DevHooks = {
|
|
8
|
+
onStoreNodeUpdate: null
|
|
9
|
+
};
|
|
10
|
+
function wrap$1(value) {
|
|
9
11
|
let p = value[solidJs.$PROXY];
|
|
10
12
|
if (!p) {
|
|
11
13
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -24,9 +26,6 @@ function wrap$1(value, name) {
|
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
28
|
-
value: name
|
|
29
|
-
});
|
|
30
29
|
}
|
|
31
30
|
return p;
|
|
32
31
|
}
|
|
@@ -69,7 +68,7 @@ function getDataNode(nodes, property, value) {
|
|
|
69
68
|
}
|
|
70
69
|
function proxyDescriptor$1(target, property) {
|
|
71
70
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
72
|
-
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
71
|
+
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
73
72
|
delete desc.value;
|
|
74
73
|
delete desc.writable;
|
|
75
74
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -109,7 +108,7 @@ const proxyTraps$1 = {
|
|
|
109
108
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
110
109
|
if (solidJs.getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();
|
|
111
110
|
}
|
|
112
|
-
return isWrappable(value) ? wrap$1(value
|
|
111
|
+
return isWrappable(value) ? wrap$1(value) : value;
|
|
113
112
|
},
|
|
114
113
|
has(target, property) {
|
|
115
114
|
if (property === $RAW || property === solidJs.$PROXY || property === solidJs.$TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -131,7 +130,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
131
130
|
if (!deleting && state[property] === value) return;
|
|
132
131
|
const prev = state[property],
|
|
133
132
|
len = state.length;
|
|
134
|
-
|
|
133
|
+
DevHooks.onStoreNodeUpdate && DevHooks.onStoreNodeUpdate(state, property, value, prev);
|
|
135
134
|
if (value === undefined) delete state[property];else state[property] = value;
|
|
136
135
|
let nodes = getDataNodes(state),
|
|
137
136
|
node;
|
|
@@ -209,13 +208,11 @@ function createStore(...[store, options]) {
|
|
|
209
208
|
const unwrappedStore = unwrap(store || {});
|
|
210
209
|
const isArray = Array.isArray(unwrappedStore);
|
|
211
210
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
|
|
212
|
-
const wrappedStore = wrap$1(unwrappedStore
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
218
|
-
}
|
|
211
|
+
const wrappedStore = wrap$1(unwrappedStore);
|
|
212
|
+
solidJs.DEV.registerGraph({
|
|
213
|
+
value: unwrappedStore,
|
|
214
|
+
name: options && options.name
|
|
215
|
+
});
|
|
219
216
|
function setStore(...args) {
|
|
220
217
|
solidJs.batch(() => {
|
|
221
218
|
isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
|
|
@@ -226,7 +223,7 @@ function createStore(...[store, options]) {
|
|
|
226
223
|
|
|
227
224
|
function proxyDescriptor(target, property) {
|
|
228
225
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
229
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
226
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
230
227
|
delete desc.value;
|
|
231
228
|
delete desc.writable;
|
|
232
229
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -252,7 +249,7 @@ const proxyTraps = {
|
|
|
252
249
|
return (...args) => solidJs.batch(() => Array.prototype[property].apply(receiver, args));
|
|
253
250
|
}
|
|
254
251
|
}
|
|
255
|
-
return isWrappable(value) ? wrap(value
|
|
252
|
+
return isWrappable(value) ? wrap(value) : value;
|
|
256
253
|
},
|
|
257
254
|
has(target, property) {
|
|
258
255
|
if (property === $RAW || property === solidJs.$PROXY || property === solidJs.$TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -270,7 +267,7 @@ const proxyTraps = {
|
|
|
270
267
|
ownKeys: ownKeys,
|
|
271
268
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
272
269
|
};
|
|
273
|
-
function wrap(value
|
|
270
|
+
function wrap(value) {
|
|
274
271
|
let p = value[solidJs.$PROXY];
|
|
275
272
|
if (!p) {
|
|
276
273
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -294,22 +291,17 @@ function wrap(value, name) {
|
|
|
294
291
|
});
|
|
295
292
|
}
|
|
296
293
|
}
|
|
297
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
298
|
-
value: name
|
|
299
|
-
});
|
|
300
294
|
}
|
|
301
295
|
return p;
|
|
302
296
|
}
|
|
303
297
|
function createMutable(state, options) {
|
|
304
298
|
const unwrappedStore = unwrap(state || {});
|
|
305
299
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`);
|
|
306
|
-
const wrappedStore = wrap(unwrappedStore
|
|
307
|
-
{
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
});
|
|
312
|
-
}
|
|
300
|
+
const wrappedStore = wrap(unwrappedStore);
|
|
301
|
+
solidJs.DEV.registerGraph({
|
|
302
|
+
value: unwrappedStore,
|
|
303
|
+
name: options && options.name
|
|
304
|
+
});
|
|
313
305
|
return wrappedStore;
|
|
314
306
|
}
|
|
315
307
|
function modifyMutable(state, modifier) {
|
|
@@ -429,14 +421,14 @@ function produce(fn) {
|
|
|
429
421
|
};
|
|
430
422
|
}
|
|
431
423
|
|
|
432
|
-
|
|
433
|
-
|
|
424
|
+
exports.DEV = void 0;
|
|
425
|
+
exports.DEV = {
|
|
434
426
|
$NODE,
|
|
435
|
-
isWrappable
|
|
436
|
-
|
|
427
|
+
isWrappable,
|
|
428
|
+
hooks: DevHooks
|
|
429
|
+
};
|
|
437
430
|
|
|
438
431
|
exports.$RAW = $RAW;
|
|
439
|
-
exports.DEV = DEV;
|
|
440
432
|
exports.createMutable = createMutable;
|
|
441
433
|
exports.createStore = createStore;
|
|
442
434
|
exports.modifyMutable = modifyMutable;
|
package/store/dist/dev.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { $PROXY, DEV as DEV$1, $TRACK, getListener, batch, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
|
-
$NODE = Symbol("store-node")
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
$NODE = Symbol("store-node");
|
|
5
|
+
const DevHooks = {
|
|
6
|
+
onStoreNodeUpdate: null
|
|
7
|
+
};
|
|
8
|
+
function wrap$1(value) {
|
|
7
9
|
let p = value[$PROXY];
|
|
8
10
|
if (!p) {
|
|
9
11
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -22,9 +24,6 @@ function wrap$1(value, name) {
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
26
|
-
value: name
|
|
27
|
-
});
|
|
28
27
|
}
|
|
29
28
|
return p;
|
|
30
29
|
}
|
|
@@ -67,7 +66,7 @@ function getDataNode(nodes, property, value) {
|
|
|
67
66
|
}
|
|
68
67
|
function proxyDescriptor$1(target, property) {
|
|
69
68
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
70
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE
|
|
69
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
71
70
|
delete desc.value;
|
|
72
71
|
delete desc.writable;
|
|
73
72
|
desc.get = () => target[$PROXY][property];
|
|
@@ -107,7 +106,7 @@ const proxyTraps$1 = {
|
|
|
107
106
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
108
107
|
if (getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getDataNode(nodes, property, value)();
|
|
109
108
|
}
|
|
110
|
-
return isWrappable(value) ? wrap$1(value
|
|
109
|
+
return isWrappable(value) ? wrap$1(value) : value;
|
|
111
110
|
},
|
|
112
111
|
has(target, property) {
|
|
113
112
|
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -129,7 +128,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
129
128
|
if (!deleting && state[property] === value) return;
|
|
130
129
|
const prev = state[property],
|
|
131
130
|
len = state.length;
|
|
132
|
-
|
|
131
|
+
DevHooks.onStoreNodeUpdate && DevHooks.onStoreNodeUpdate(state, property, value, prev);
|
|
133
132
|
if (value === undefined) delete state[property];else state[property] = value;
|
|
134
133
|
let nodes = getDataNodes(state),
|
|
135
134
|
node;
|
|
@@ -207,13 +206,11 @@ function createStore(...[store, options]) {
|
|
|
207
206
|
const unwrappedStore = unwrap(store || {});
|
|
208
207
|
const isArray = Array.isArray(unwrappedStore);
|
|
209
208
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
|
|
210
|
-
const wrappedStore = wrap$1(unwrappedStore
|
|
211
|
-
{
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
});
|
|
216
|
-
}
|
|
209
|
+
const wrappedStore = wrap$1(unwrappedStore);
|
|
210
|
+
DEV$1.registerGraph({
|
|
211
|
+
value: unwrappedStore,
|
|
212
|
+
name: options && options.name
|
|
213
|
+
});
|
|
217
214
|
function setStore(...args) {
|
|
218
215
|
batch(() => {
|
|
219
216
|
isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
|
|
@@ -224,7 +221,7 @@ function createStore(...[store, options]) {
|
|
|
224
221
|
|
|
225
222
|
function proxyDescriptor(target, property) {
|
|
226
223
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
227
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE
|
|
224
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
228
225
|
delete desc.value;
|
|
229
226
|
delete desc.writable;
|
|
230
227
|
desc.get = () => target[$PROXY][property];
|
|
@@ -250,7 +247,7 @@ const proxyTraps = {
|
|
|
250
247
|
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
251
248
|
}
|
|
252
249
|
}
|
|
253
|
-
return isWrappable(value) ? wrap(value
|
|
250
|
+
return isWrappable(value) ? wrap(value) : value;
|
|
254
251
|
},
|
|
255
252
|
has(target, property) {
|
|
256
253
|
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__") return true;
|
|
@@ -268,7 +265,7 @@ const proxyTraps = {
|
|
|
268
265
|
ownKeys: ownKeys,
|
|
269
266
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
270
267
|
};
|
|
271
|
-
function wrap(value
|
|
268
|
+
function wrap(value) {
|
|
272
269
|
let p = value[$PROXY];
|
|
273
270
|
if (!p) {
|
|
274
271
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -292,22 +289,17 @@ function wrap(value, name) {
|
|
|
292
289
|
});
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
|
-
if (name) Object.defineProperty(value, $NAME, {
|
|
296
|
-
value: name
|
|
297
|
-
});
|
|
298
292
|
}
|
|
299
293
|
return p;
|
|
300
294
|
}
|
|
301
295
|
function createMutable(state, options) {
|
|
302
296
|
const unwrappedStore = unwrap(state || {});
|
|
303
297
|
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`);
|
|
304
|
-
const wrappedStore = wrap(unwrappedStore
|
|
305
|
-
{
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
310
|
-
}
|
|
298
|
+
const wrappedStore = wrap(unwrappedStore);
|
|
299
|
+
DEV$1.registerGraph({
|
|
300
|
+
value: unwrappedStore,
|
|
301
|
+
name: options && options.name
|
|
302
|
+
});
|
|
311
303
|
return wrappedStore;
|
|
312
304
|
}
|
|
313
305
|
function modifyMutable(state, modifier) {
|
|
@@ -427,10 +419,11 @@ function produce(fn) {
|
|
|
427
419
|
};
|
|
428
420
|
}
|
|
429
421
|
|
|
430
|
-
|
|
431
|
-
|
|
422
|
+
let DEV;
|
|
423
|
+
DEV = {
|
|
432
424
|
$NODE,
|
|
433
|
-
isWrappable
|
|
434
|
-
|
|
425
|
+
isWrappable,
|
|
426
|
+
hooks: DevHooks
|
|
427
|
+
};
|
|
435
428
|
|
|
436
429
|
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/dist/store.cjs
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
4
|
|
|
5
5
|
const $RAW = Symbol("store-raw"),
|
|
6
|
-
$NODE = Symbol("store-node")
|
|
7
|
-
|
|
8
|
-
function wrap$1(value, name) {
|
|
6
|
+
$NODE = Symbol("store-node");
|
|
7
|
+
function wrap$1(value) {
|
|
9
8
|
let p = value[solidJs.$PROXY];
|
|
10
9
|
if (!p) {
|
|
11
10
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -66,7 +65,7 @@ function getDataNode(nodes, property, value) {
|
|
|
66
65
|
}
|
|
67
66
|
function proxyDescriptor$1(target, property) {
|
|
68
67
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
69
|
-
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
68
|
+
if (!desc || desc.get || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
70
69
|
delete desc.value;
|
|
71
70
|
delete desc.writable;
|
|
72
71
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -213,7 +212,7 @@ function createStore(...[store, options]) {
|
|
|
213
212
|
|
|
214
213
|
function proxyDescriptor(target, property) {
|
|
215
214
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
216
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE
|
|
215
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === solidJs.$PROXY || property === $NODE) return desc;
|
|
217
216
|
delete desc.value;
|
|
218
217
|
delete desc.writable;
|
|
219
218
|
desc.get = () => target[solidJs.$PROXY][property];
|
|
@@ -257,7 +256,7 @@ const proxyTraps = {
|
|
|
257
256
|
ownKeys: ownKeys,
|
|
258
257
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
259
258
|
};
|
|
260
|
-
function wrap(value
|
|
259
|
+
function wrap(value) {
|
|
261
260
|
let p = value[solidJs.$PROXY];
|
|
262
261
|
if (!p) {
|
|
263
262
|
Object.defineProperty(value, solidJs.$PROXY, {
|
|
@@ -406,7 +405,7 @@ function produce(fn) {
|
|
|
406
405
|
};
|
|
407
406
|
}
|
|
408
407
|
|
|
409
|
-
|
|
408
|
+
let DEV;
|
|
410
409
|
|
|
411
410
|
exports.$RAW = $RAW;
|
|
412
411
|
exports.DEV = DEV;
|
package/store/dist/store.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
|
-
$NODE = Symbol("store-node")
|
|
5
|
-
|
|
6
|
-
function wrap$1(value, name) {
|
|
4
|
+
$NODE = Symbol("store-node");
|
|
5
|
+
function wrap$1(value) {
|
|
7
6
|
let p = value[$PROXY];
|
|
8
7
|
if (!p) {
|
|
9
8
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -64,7 +63,7 @@ function getDataNode(nodes, property, value) {
|
|
|
64
63
|
}
|
|
65
64
|
function proxyDescriptor$1(target, property) {
|
|
66
65
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
67
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE
|
|
66
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
68
67
|
delete desc.value;
|
|
69
68
|
delete desc.writable;
|
|
70
69
|
desc.get = () => target[$PROXY][property];
|
|
@@ -211,7 +210,7 @@ function createStore(...[store, options]) {
|
|
|
211
210
|
|
|
212
211
|
function proxyDescriptor(target, property) {
|
|
213
212
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
214
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE
|
|
213
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
215
214
|
delete desc.value;
|
|
216
215
|
delete desc.writable;
|
|
217
216
|
desc.get = () => target[$PROXY][property];
|
|
@@ -255,7 +254,7 @@ const proxyTraps = {
|
|
|
255
254
|
ownKeys: ownKeys,
|
|
256
255
|
getOwnPropertyDescriptor: proxyDescriptor
|
|
257
256
|
};
|
|
258
|
-
function wrap(value
|
|
257
|
+
function wrap(value) {
|
|
259
258
|
let p = value[$PROXY];
|
|
260
259
|
if (!p) {
|
|
261
260
|
Object.defineProperty(value, $PROXY, {
|
|
@@ -404,6 +403,6 @@ function produce(fn) {
|
|
|
404
403
|
};
|
|
405
404
|
}
|
|
406
405
|
|
|
407
|
-
|
|
406
|
+
let DEV;
|
|
408
407
|
|
|
409
408
|
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { createStore, unwrap
|
|
2
|
-
export type {
|
|
1
|
+
export { $RAW, createStore, unwrap } from "./store.js";
|
|
2
|
+
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
3
3
|
export * from "./mutable.js";
|
|
4
4
|
export * from "./modifiers.js";
|
|
5
|
-
import { $
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { $NODE, isWrappable, DevHooks } from "./store.js";
|
|
6
|
+
declare let DEV: {
|
|
7
|
+
$NODE: typeof $NODE;
|
|
8
|
+
isWrappable: typeof isWrappable;
|
|
9
|
+
hooks: typeof DevHooks;
|
|
10
10
|
} | undefined;
|
|
11
|
+
export { DEV };
|
package/store/types/store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const $RAW: unique symbol, $NODE: unique symbol
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export declare const $RAW: unique symbol, $NODE: unique symbol;
|
|
2
|
+
export declare const DevHooks: {
|
|
3
|
+
onStoreNodeUpdate: OnStoreNodeUpdate | null;
|
|
4
|
+
};
|
|
5
5
|
type DataNode = {
|
|
6
6
|
(): any;
|
|
7
7
|
$(value?: any): void;
|
|
@@ -9,7 +9,6 @@ type DataNode = {
|
|
|
9
9
|
type DataNodes = Record<PropertyKey, DataNode>;
|
|
10
10
|
export type OnStoreNodeUpdate = (state: StoreNode, property: PropertyKey, value: StoreNode | NotWrappable, prev: StoreNode | NotWrappable) => void;
|
|
11
11
|
export interface StoreNode {
|
|
12
|
-
[$NAME]?: string;
|
|
13
12
|
[$NODE]?: DataNodes;
|
|
14
13
|
[key: PropertyKey]: any;
|
|
15
14
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $DEVCOMP, $PROXY, $TRACK, batch, children, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, enableExternalSource, enableScheduling, equalFn, getListener, getOwner, on, onCleanup, onError, onMount, runWithOwner, startTransition, untrack, useContext, useTransition } from "./reactive/signal.js";
|
|
1
|
+
export { $DEVCOMP, $PROXY, $TRACK, batch, children, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, enableExternalSource, enableScheduling, equalFn, getListener, getOwner, on, onCleanup, onError, catchError, onMount, runWithOwner, startTransition, untrack, useContext, useTransition } from "./reactive/signal.js";
|
|
2
2
|
export type { Accessor, AccessorArray, ChildrenReturn, Context, EffectFunction, EffectOptions, InitializedResource, InitializedResourceOptions, InitializedResourceReturn, MemoOptions, NoInfer, OnEffectFunction, OnOptions, Owner, Resource, ResourceActions, ResourceFetcher, ResourceFetcherInfo, ResourceOptions, ResourceReturn, ResourceSource, ReturnTypes, Setter, Signal, SignalOptions } from "./reactive/signal.js";
|
|
3
3
|
export * from "./reactive/observable.js";
|
|
4
4
|
export * from "./reactive/scheduler.js";
|
|
@@ -7,13 +7,12 @@ export * from "./render/index.js";
|
|
|
7
7
|
import type { JSX } from "./jsx.js";
|
|
8
8
|
type JSXElement = JSX.Element;
|
|
9
9
|
export type { JSXElement, JSX };
|
|
10
|
-
import {
|
|
10
|
+
import { registerGraph, writeSignal, DevHooks } from "./reactive/signal.js";
|
|
11
11
|
declare let DEV: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
registerGraph: typeof registerGraph;
|
|
15
|
-
|
|
16
|
-
};
|
|
12
|
+
readonly hooks: typeof DevHooks;
|
|
13
|
+
readonly writeSignal: typeof writeSignal;
|
|
14
|
+
readonly registerGraph: typeof registerGraph;
|
|
15
|
+
} | undefined;
|
|
17
16
|
export { DEV };
|
|
18
17
|
declare global {
|
|
19
18
|
var Solid$$: boolean;
|
package/types/jsx.d.ts
CHANGED
|
@@ -12,16 +12,12 @@ export namespace JSX {
|
|
|
12
12
|
type Element =
|
|
13
13
|
| Node
|
|
14
14
|
| ArrayElement
|
|
15
|
-
| FunctionElement
|
|
16
15
|
| (string & {})
|
|
17
16
|
| number
|
|
18
17
|
| boolean
|
|
19
18
|
| null
|
|
20
19
|
| undefined;
|
|
21
20
|
interface ArrayElement extends Array<Element> {}
|
|
22
|
-
interface FunctionElement {
|
|
23
|
-
(): Element;
|
|
24
|
-
}
|
|
25
21
|
interface ElementClass {
|
|
26
22
|
// empty, libs can define requirements downstream
|
|
27
23
|
}
|
|
@@ -803,6 +799,7 @@ export namespace JSX {
|
|
|
803
799
|
checked?: boolean;
|
|
804
800
|
crossorigin?: HTMLCrossorigin;
|
|
805
801
|
disabled?: boolean;
|
|
802
|
+
enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
806
803
|
form?: string;
|
|
807
804
|
formaction?: string;
|
|
808
805
|
formenctype?: HTMLFormEncType;
|
|
@@ -31,13 +31,15 @@ export declare const $DEVCOMP: unique symbol;
|
|
|
31
31
|
export declare var Owner: Owner | null;
|
|
32
32
|
export declare let Transition: TransitionState | null;
|
|
33
33
|
declare let ExternalSourceFactory: ExternalSourceFactory | null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/** Object storing callbacks for debugging during development */
|
|
35
|
+
export declare const DevHooks: {
|
|
36
|
+
afterUpdate: (() => void) | null;
|
|
37
|
+
afterCreateOwner: ((owner: Owner) => void) | null;
|
|
38
|
+
};
|
|
38
39
|
export type ComputationState = 0 | 1 | 2;
|
|
39
40
|
export interface SourceMapValue {
|
|
40
41
|
value: unknown;
|
|
42
|
+
name?: string;
|
|
41
43
|
graph?: Owner;
|
|
42
44
|
}
|
|
43
45
|
export interface SignalState<T> extends SourceMapValue {
|
|
@@ -46,16 +48,14 @@ export interface SignalState<T> extends SourceMapValue {
|
|
|
46
48
|
observerSlots: number[] | null;
|
|
47
49
|
tValue?: T;
|
|
48
50
|
comparator?: (prev: T, next: T) => boolean;
|
|
49
|
-
name?: string;
|
|
50
51
|
}
|
|
51
52
|
export interface Owner {
|
|
52
53
|
owned: Computation<any>[] | null;
|
|
53
54
|
cleanups: (() => void)[] | null;
|
|
54
55
|
owner: Owner | null;
|
|
55
56
|
context: any | null;
|
|
56
|
-
sourceMap?:
|
|
57
|
+
sourceMap?: SourceMapValue[];
|
|
57
58
|
name?: string;
|
|
58
|
-
componentName?: string;
|
|
59
59
|
}
|
|
60
60
|
export interface Computation<Init, Next extends Init = Init> extends Owner {
|
|
61
61
|
fn: EffectFunction<Init, Next>;
|
|
@@ -441,6 +441,17 @@ export declare function onMount(fn: () => void): void;
|
|
|
441
441
|
*/
|
|
442
442
|
export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
443
443
|
/**
|
|
444
|
+
* catchError - run an effect whenever an error is thrown within the context of the child scopes
|
|
445
|
+
* @param fn boundary for the error
|
|
446
|
+
* @param handler an error handler that receives the error
|
|
447
|
+
*
|
|
448
|
+
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
449
|
+
*
|
|
450
|
+
* @description https://www.solidjs.com/docs/latest/api#catcherror
|
|
451
|
+
*/
|
|
452
|
+
export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
444
455
|
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
445
456
|
* @param fn an error handler that receives the error
|
|
446
457
|
*
|
|
@@ -448,7 +459,7 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
448
459
|
*
|
|
449
460
|
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
450
461
|
*/
|
|
451
|
-
export declare function onError(fn: (err:
|
|
462
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
452
463
|
export declare function getListener(): Computation<any, any> | null;
|
|
453
464
|
export declare function getOwner(): Owner | null;
|
|
454
465
|
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
@@ -473,17 +484,13 @@ export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
|
473
484
|
*/
|
|
474
485
|
export declare function useTransition(): Transition;
|
|
475
486
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
476
|
-
export interface DevComponent<T> extends Memo<
|
|
487
|
+
export interface DevComponent<T> extends Memo<unknown> {
|
|
477
488
|
props: T;
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
export declare function devComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
481
|
-
export declare function hashValue(v: any): string;
|
|
482
|
-
export declare function registerGraph(name: string, value: SourceMapValue): string;
|
|
483
|
-
interface GraphRecord {
|
|
484
|
-
[k: string]: GraphRecord | unknown;
|
|
489
|
+
name: string;
|
|
490
|
+
component: (props: T) => unknown;
|
|
485
491
|
}
|
|
486
|
-
export declare function
|
|
492
|
+
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
493
|
+
export declare function registerGraph(value: SourceMapValue): void;
|
|
487
494
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
488
495
|
value: T;
|
|
489
496
|
}>;
|
|
@@ -522,7 +529,7 @@ export declare function createContext<T>(defaultValue: T, options?: EffectOption
|
|
|
522
529
|
* @description https://www.solidjs.com/docs/latest/api#usecontext
|
|
523
530
|
*/
|
|
524
531
|
export declare function useContext<T>(context: Context<T>): T;
|
|
525
|
-
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement
|
|
532
|
+
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
526
533
|
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
527
534
|
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
528
535
|
toArray: () => ResolvedJSXElement[];
|