solid-js 1.3.0-rc.4 → 1.3.3
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 +20 -18
- package/dist/dev.js +20 -18
- package/dist/server.cjs +1 -1
- package/dist/server.js +1 -1
- package/dist/solid.cjs +17 -18
- package/dist/solid.js +17 -18
- package/package.json +5 -5
- package/store/dist/dev.cjs +3 -5
- package/store/dist/dev.js +3 -5
- package/store/dist/store.cjs +2 -4
- package/store/dist/store.js +2 -4
- package/store/package.json +23 -1
- package/store/types/index.d.ts +1 -1
- package/store/types/modifiers.d.ts +3 -3
- package/store/types/mutable.d.ts +3 -3
- package/store/types/server.d.ts +3 -38
- package/store/types/store.d.ts +27 -55
- package/types/jsx.d.ts +1 -0
- package/universal/package.json +11 -1
- package/web/dist/dev.cjs +9 -5
- package/web/dist/dev.js +10 -6
- package/web/dist/server.cjs +4 -4
- package/web/dist/server.js +4 -4
- package/web/dist/web.cjs +6 -5
- package/web/dist/web.js +6 -5
- package/web/package.json +23 -1
- package/web/types/client.d.ts +1 -1
package/dist/dev.cjs
CHANGED
|
@@ -131,7 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
-
const $DEVCOMP = Symbol(
|
|
134
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
135
135
|
const signalOptions = {
|
|
136
136
|
equals: equalFn
|
|
137
137
|
};
|
|
@@ -249,7 +249,7 @@ function createResource(source, fetcher, options) {
|
|
|
249
249
|
fetcher = source;
|
|
250
250
|
source = true;
|
|
251
251
|
}
|
|
252
|
-
options
|
|
252
|
+
options || (options = {});
|
|
253
253
|
if (options.globalRefetch !== false) {
|
|
254
254
|
Resources || (Resources = new Set());
|
|
255
255
|
Resources.add(load);
|
|
@@ -506,7 +506,7 @@ function startTransition(fn) {
|
|
|
506
506
|
queue: new Set(),
|
|
507
507
|
running: true
|
|
508
508
|
});
|
|
509
|
-
t.done
|
|
509
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
510
510
|
t.running = true;
|
|
511
511
|
}
|
|
512
512
|
batch(fn);
|
|
@@ -949,7 +949,7 @@ function handleError(err) {
|
|
|
949
949
|
fns.forEach(f => f(err));
|
|
950
950
|
}
|
|
951
951
|
function lookup(owner, key) {
|
|
952
|
-
return owner && (owner.context && owner.context[key]
|
|
952
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
953
953
|
}
|
|
954
954
|
function resolveChildren(children) {
|
|
955
955
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1332,6 +1332,9 @@ function lazy(fn) {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
let Comp;
|
|
1334
1334
|
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1335
|
+
Object.assign(Comp, {
|
|
1336
|
+
[$DEVCOMP]: true
|
|
1337
|
+
});
|
|
1335
1338
|
if (!ctx) return Comp(props);
|
|
1336
1339
|
const c = sharedConfig.context;
|
|
1337
1340
|
setHydrateContext(ctx);
|
|
@@ -1508,20 +1511,18 @@ function Suspense(props) {
|
|
|
1508
1511
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1509
1512
|
p = sharedConfig.load(key);
|
|
1510
1513
|
if (p) {
|
|
1511
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1514
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1515
|
+
const [s, set] = createSignal(undefined, {
|
|
1516
|
+
equals: false
|
|
1517
|
+
});
|
|
1518
|
+
flicker = s;
|
|
1519
|
+
p.then(err => {
|
|
1520
|
+
if (error = err) return set();
|
|
1521
|
+
sharedConfig.gather(key);
|
|
1522
|
+
setHydrateContext(ctx);
|
|
1523
|
+
set();
|
|
1524
|
+
setHydrateContext();
|
|
1525
|
+
});
|
|
1525
1526
|
}
|
|
1526
1527
|
}
|
|
1527
1528
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1547,6 +1548,7 @@ function Suspense(props) {
|
|
|
1547
1548
|
dispose && dispose();
|
|
1548
1549
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1549
1550
|
store.resolved = true;
|
|
1551
|
+
ctx = p = undefined;
|
|
1550
1552
|
resumeEffects(store.effects);
|
|
1551
1553
|
return rendered;
|
|
1552
1554
|
}
|
package/dist/dev.js
CHANGED
|
@@ -127,7 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
-
const $DEVCOMP = Symbol(
|
|
130
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
131
131
|
const signalOptions = {
|
|
132
132
|
equals: equalFn
|
|
133
133
|
};
|
|
@@ -245,7 +245,7 @@ function createResource(source, fetcher, options) {
|
|
|
245
245
|
fetcher = source;
|
|
246
246
|
source = true;
|
|
247
247
|
}
|
|
248
|
-
options
|
|
248
|
+
options || (options = {});
|
|
249
249
|
if (options.globalRefetch !== false) {
|
|
250
250
|
Resources || (Resources = new Set());
|
|
251
251
|
Resources.add(load);
|
|
@@ -502,7 +502,7 @@ function startTransition(fn) {
|
|
|
502
502
|
queue: new Set(),
|
|
503
503
|
running: true
|
|
504
504
|
});
|
|
505
|
-
t.done
|
|
505
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
506
506
|
t.running = true;
|
|
507
507
|
}
|
|
508
508
|
batch(fn);
|
|
@@ -945,7 +945,7 @@ function handleError(err) {
|
|
|
945
945
|
fns.forEach(f => f(err));
|
|
946
946
|
}
|
|
947
947
|
function lookup(owner, key) {
|
|
948
|
-
return owner && (owner.context && owner.context[key]
|
|
948
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
949
949
|
}
|
|
950
950
|
function resolveChildren(children) {
|
|
951
951
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1328,6 +1328,9 @@ function lazy(fn) {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
let Comp;
|
|
1330
1330
|
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1331
|
+
Object.assign(Comp, {
|
|
1332
|
+
[$DEVCOMP]: true
|
|
1333
|
+
});
|
|
1331
1334
|
if (!ctx) return Comp(props);
|
|
1332
1335
|
const c = sharedConfig.context;
|
|
1333
1336
|
setHydrateContext(ctx);
|
|
@@ -1504,20 +1507,18 @@ function Suspense(props) {
|
|
|
1504
1507
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1505
1508
|
p = sharedConfig.load(key);
|
|
1506
1509
|
if (p) {
|
|
1507
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
});
|
|
1520
|
-
}
|
|
1510
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1511
|
+
const [s, set] = createSignal(undefined, {
|
|
1512
|
+
equals: false
|
|
1513
|
+
});
|
|
1514
|
+
flicker = s;
|
|
1515
|
+
p.then(err => {
|
|
1516
|
+
if (error = err) return set();
|
|
1517
|
+
sharedConfig.gather(key);
|
|
1518
|
+
setHydrateContext(ctx);
|
|
1519
|
+
set();
|
|
1520
|
+
setHydrateContext();
|
|
1521
|
+
});
|
|
1521
1522
|
}
|
|
1522
1523
|
}
|
|
1523
1524
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1543,6 +1544,7 @@ function Suspense(props) {
|
|
|
1543
1544
|
dispose && dispose();
|
|
1544
1545
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1545
1546
|
store.resolved = true;
|
|
1547
|
+
ctx = p = undefined;
|
|
1546
1548
|
resumeEffects(store.effects);
|
|
1547
1549
|
return rendered;
|
|
1548
1550
|
}
|
package/dist/server.cjs
CHANGED
|
@@ -136,7 +136,7 @@ function runWithOwner(o, fn) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
function lookup(owner, key) {
|
|
139
|
-
return owner && (owner.context && owner.context[key]
|
|
139
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
140
140
|
}
|
|
141
141
|
function resolveChildren(children) {
|
|
142
142
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
package/dist/server.js
CHANGED
|
@@ -132,7 +132,7 @@ function runWithOwner(o, fn) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
function lookup(owner, key) {
|
|
135
|
-
return owner && (owner.context && owner.context[key]
|
|
135
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
136
136
|
}
|
|
137
137
|
function resolveChildren(children) {
|
|
138
138
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
package/dist/solid.cjs
CHANGED
|
@@ -131,7 +131,7 @@ function nextHydrateContext() {
|
|
|
131
131
|
|
|
132
132
|
const equalFn = (a, b) => a === b;
|
|
133
133
|
const $PROXY = Symbol("solid-proxy");
|
|
134
|
-
const $DEVCOMP = Symbol(
|
|
134
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
135
135
|
const signalOptions = {
|
|
136
136
|
equals: equalFn
|
|
137
137
|
};
|
|
@@ -246,7 +246,7 @@ function createResource(source, fetcher, options) {
|
|
|
246
246
|
fetcher = source;
|
|
247
247
|
source = true;
|
|
248
248
|
}
|
|
249
|
-
options
|
|
249
|
+
options || (options = {});
|
|
250
250
|
if (options.globalRefetch !== false) {
|
|
251
251
|
Resources || (Resources = new Set());
|
|
252
252
|
Resources.add(load);
|
|
@@ -503,7 +503,7 @@ function startTransition(fn) {
|
|
|
503
503
|
queue: new Set(),
|
|
504
504
|
running: true
|
|
505
505
|
});
|
|
506
|
-
t.done
|
|
506
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
507
507
|
t.running = true;
|
|
508
508
|
}
|
|
509
509
|
batch(fn);
|
|
@@ -891,7 +891,7 @@ function handleError(err) {
|
|
|
891
891
|
fns.forEach(f => f(err));
|
|
892
892
|
}
|
|
893
893
|
function lookup(owner, key) {
|
|
894
|
-
return owner && (owner.context && owner.context[key]
|
|
894
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
895
895
|
}
|
|
896
896
|
function resolveChildren(children) {
|
|
897
897
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1427,20 +1427,18 @@ function Suspense(props) {
|
|
|
1427
1427
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1428
1428
|
p = sharedConfig.load(key);
|
|
1429
1429
|
if (p) {
|
|
1430
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1430
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1431
|
+
const [s, set] = createSignal(undefined, {
|
|
1432
|
+
equals: false
|
|
1433
|
+
});
|
|
1434
|
+
flicker = s;
|
|
1435
|
+
p.then(err => {
|
|
1436
|
+
if (error = err) return set();
|
|
1437
|
+
sharedConfig.gather(key);
|
|
1438
|
+
setHydrateContext(ctx);
|
|
1439
|
+
set();
|
|
1440
|
+
setHydrateContext();
|
|
1441
|
+
});
|
|
1444
1442
|
}
|
|
1445
1443
|
}
|
|
1446
1444
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1466,6 +1464,7 @@ function Suspense(props) {
|
|
|
1466
1464
|
dispose && dispose();
|
|
1467
1465
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1468
1466
|
store.resolved = true;
|
|
1467
|
+
ctx = p = undefined;
|
|
1469
1468
|
resumeEffects(store.effects);
|
|
1470
1469
|
return rendered;
|
|
1471
1470
|
}
|
package/dist/solid.js
CHANGED
|
@@ -127,7 +127,7 @@ function nextHydrateContext() {
|
|
|
127
127
|
|
|
128
128
|
const equalFn = (a, b) => a === b;
|
|
129
129
|
const $PROXY = Symbol("solid-proxy");
|
|
130
|
-
const $DEVCOMP = Symbol(
|
|
130
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
131
131
|
const signalOptions = {
|
|
132
132
|
equals: equalFn
|
|
133
133
|
};
|
|
@@ -242,7 +242,7 @@ function createResource(source, fetcher, options) {
|
|
|
242
242
|
fetcher = source;
|
|
243
243
|
source = true;
|
|
244
244
|
}
|
|
245
|
-
options
|
|
245
|
+
options || (options = {});
|
|
246
246
|
if (options.globalRefetch !== false) {
|
|
247
247
|
Resources || (Resources = new Set());
|
|
248
248
|
Resources.add(load);
|
|
@@ -499,7 +499,7 @@ function startTransition(fn) {
|
|
|
499
499
|
queue: new Set(),
|
|
500
500
|
running: true
|
|
501
501
|
});
|
|
502
|
-
t.done
|
|
502
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
503
503
|
t.running = true;
|
|
504
504
|
}
|
|
505
505
|
batch(fn);
|
|
@@ -887,7 +887,7 @@ function handleError(err) {
|
|
|
887
887
|
fns.forEach(f => f(err));
|
|
888
888
|
}
|
|
889
889
|
function lookup(owner, key) {
|
|
890
|
-
return owner && (owner.context && owner.context[key]
|
|
890
|
+
return owner && (owner.context && owner.context[key] !== undefined ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
891
891
|
}
|
|
892
892
|
function resolveChildren(children) {
|
|
893
893
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1423,20 +1423,18 @@ function Suspense(props) {
|
|
|
1423
1423
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1424
1424
|
p = sharedConfig.load(key);
|
|
1425
1425
|
if (p) {
|
|
1426
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1426
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1427
|
+
const [s, set] = createSignal(undefined, {
|
|
1428
|
+
equals: false
|
|
1429
|
+
});
|
|
1430
|
+
flicker = s;
|
|
1431
|
+
p.then(err => {
|
|
1432
|
+
if (error = err) return set();
|
|
1433
|
+
sharedConfig.gather(key);
|
|
1434
|
+
setHydrateContext(ctx);
|
|
1435
|
+
set();
|
|
1436
|
+
setHydrateContext();
|
|
1437
|
+
});
|
|
1440
1438
|
}
|
|
1441
1439
|
}
|
|
1442
1440
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1462,6 +1460,7 @@ function Suspense(props) {
|
|
|
1462
1460
|
dispose && dispose();
|
|
1463
1461
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1464
1462
|
store.resolved = true;
|
|
1463
|
+
ctx = p = undefined;
|
|
1465
1464
|
resumeEffects(store.effects);
|
|
1466
1465
|
return rendered;
|
|
1467
1466
|
}
|
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.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -124,9 +124,9 @@
|
|
|
124
124
|
"build": "npm-run-all -cnl build:*",
|
|
125
125
|
"build:link": "symlink-dir . node_modules/solid-js",
|
|
126
126
|
"build:js": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && rollup -c",
|
|
127
|
-
"build:types": "tsc",
|
|
128
|
-
"build:types-store": "tsc --project ./store/tsconfig.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
|
|
129
|
-
"build:types-web": "tsc --project ./web/tsconfig.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
|
|
127
|
+
"build:types": "tsc --project ./tsconfig.build.json",
|
|
128
|
+
"build:types-store": "tsc --project ./store/tsconfig.build.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
|
|
129
|
+
"build:types-web": "tsc --project ./web/tsconfig.build.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
|
|
130
130
|
"build:types-html": "tsc --project ./html/tsconfig.json",
|
|
131
131
|
"build:types-h": "tsc --project ./h/tsconfig.json",
|
|
132
132
|
"build:types-universal": "tsc --project ./universal/tsconfig.json",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "58f98c55a3573b23f683978c8828bbda563ae666"
|
|
148
148
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -103,7 +103,7 @@ const proxyTraps$1 = {
|
|
|
103
103
|
node = nodes[property] || (nodes[property] = createDataNode());
|
|
104
104
|
node();
|
|
105
105
|
}
|
|
106
|
-
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
|
|
106
|
+
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
|
|
107
107
|
},
|
|
108
108
|
set() {
|
|
109
109
|
console.warn("Cannot mutate a Store directly");
|
|
@@ -344,8 +344,7 @@ function reconcile(value, options = {}) {
|
|
|
344
344
|
key = "id"
|
|
345
345
|
} = options,
|
|
346
346
|
v = unwrap(value);
|
|
347
|
-
return
|
|
348
|
-
const state = s;
|
|
347
|
+
return state => {
|
|
349
348
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
350
349
|
applyState(v, {
|
|
351
350
|
state
|
|
@@ -369,8 +368,7 @@ const setterTraps = {
|
|
|
369
368
|
}
|
|
370
369
|
};
|
|
371
370
|
function produce(fn) {
|
|
372
|
-
return
|
|
373
|
-
const state = s;
|
|
371
|
+
return state => {
|
|
374
372
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
375
373
|
return state;
|
|
376
374
|
};
|
package/store/dist/dev.js
CHANGED
|
@@ -99,7 +99,7 @@ const proxyTraps$1 = {
|
|
|
99
99
|
node = nodes[property] || (nodes[property] = createDataNode());
|
|
100
100
|
node();
|
|
101
101
|
}
|
|
102
|
-
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
|
|
102
|
+
return wrappable ? wrap$1(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
|
|
103
103
|
},
|
|
104
104
|
set() {
|
|
105
105
|
console.warn("Cannot mutate a Store directly");
|
|
@@ -340,8 +340,7 @@ function reconcile(value, options = {}) {
|
|
|
340
340
|
key = "id"
|
|
341
341
|
} = options,
|
|
342
342
|
v = unwrap(value);
|
|
343
|
-
return
|
|
344
|
-
const state = s;
|
|
343
|
+
return state => {
|
|
345
344
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
346
345
|
applyState(v, {
|
|
347
346
|
state
|
|
@@ -365,8 +364,7 @@ const setterTraps = {
|
|
|
365
364
|
}
|
|
366
365
|
};
|
|
367
366
|
function produce(fn) {
|
|
368
|
-
return
|
|
369
|
-
const state = s;
|
|
367
|
+
return state => {
|
|
370
368
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
371
369
|
return state;
|
|
372
370
|
};
|
package/store/dist/store.cjs
CHANGED
|
@@ -324,8 +324,7 @@ function reconcile(value, options = {}) {
|
|
|
324
324
|
key = "id"
|
|
325
325
|
} = options,
|
|
326
326
|
v = unwrap(value);
|
|
327
|
-
return
|
|
328
|
-
const state = s;
|
|
327
|
+
return state => {
|
|
329
328
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
330
329
|
applyState(v, {
|
|
331
330
|
state
|
|
@@ -349,8 +348,7 @@ const setterTraps = {
|
|
|
349
348
|
}
|
|
350
349
|
};
|
|
351
350
|
function produce(fn) {
|
|
352
|
-
return
|
|
353
|
-
const state = s;
|
|
351
|
+
return state => {
|
|
354
352
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
355
353
|
return state;
|
|
356
354
|
};
|
package/store/dist/store.js
CHANGED
|
@@ -320,8 +320,7 @@ function reconcile(value, options = {}) {
|
|
|
320
320
|
key = "id"
|
|
321
321
|
} = options,
|
|
322
322
|
v = unwrap(value);
|
|
323
|
-
return
|
|
324
|
-
const state = s;
|
|
323
|
+
return state => {
|
|
325
324
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
326
325
|
applyState(v, {
|
|
327
326
|
state
|
|
@@ -345,8 +344,7 @@ const setterTraps = {
|
|
|
345
344
|
}
|
|
346
345
|
};
|
|
347
346
|
function produce(fn) {
|
|
348
|
-
return
|
|
349
|
-
const state = s;
|
|
347
|
+
return state => {
|
|
350
348
|
if (isWrappable(state)) fn(new Proxy(state, setterTraps));
|
|
351
349
|
return state;
|
|
352
350
|
};
|
package/store/package.json
CHANGED
|
@@ -9,5 +9,27 @@
|
|
|
9
9
|
"unpkg": "./dist/store.cjs",
|
|
10
10
|
"types": "./types/index.d.ts",
|
|
11
11
|
"type": "module",
|
|
12
|
-
"sideEffects": false
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"browser": {
|
|
16
|
+
"development": {
|
|
17
|
+
"import": "./dist/dev.js",
|
|
18
|
+
"require": "./dist/dev.cjs"
|
|
19
|
+
},
|
|
20
|
+
"import": "./dist/store.js",
|
|
21
|
+
"require": "./dist/store.cjs"
|
|
22
|
+
},
|
|
23
|
+
"node": {
|
|
24
|
+
"import": "./dist/server.js",
|
|
25
|
+
"require": "./dist/server.cjs"
|
|
26
|
+
},
|
|
27
|
+
"development": {
|
|
28
|
+
"import": "./dist/dev.js",
|
|
29
|
+
"require": "./dist/dev.cjs"
|
|
30
|
+
},
|
|
31
|
+
"import": "./dist/store.js",
|
|
32
|
+
"require": "./dist/store.cjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
13
35
|
}
|
package/store/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createStore, unwrap, $RAW } from "./store";
|
|
2
|
-
export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, Next,
|
|
2
|
+
export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, Next, WrappableNext, DeepReadonly } from "./store";
|
|
3
3
|
export * from "./mutable";
|
|
4
4
|
export * from "./modifiers";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Store
|
|
1
|
+
import { Store } from "./store";
|
|
2
2
|
export declare type ReconcileOptions = {
|
|
3
3
|
key?: string | null;
|
|
4
4
|
merge?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare function reconcile<T>(value: T
|
|
7
|
-
export declare function produce<T>(fn: (state: T) => void): (state:
|
|
6
|
+
export declare function reconcile<T>(value: T, options?: ReconcileOptions): (state: unknown) => Store<T>;
|
|
7
|
+
export declare function produce<T>(fn: (state: T) => void): (state: Store<T>) => Store<T>;
|
package/store/types/mutable.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoreNode
|
|
2
|
-
export declare function createMutable<T extends StoreNode>(state: T
|
|
1
|
+
import { StoreNode } from "./store";
|
|
2
|
+
export declare function createMutable<T extends StoreNode>(state: T, options?: {
|
|
3
3
|
name?: string;
|
|
4
|
-
}):
|
|
4
|
+
}): T;
|
package/store/types/server.d.ts
CHANGED
|
@@ -1,50 +1,15 @@
|
|
|
1
|
+
import { SetStoreFunction, Store } from "store";
|
|
1
2
|
export declare const $RAW: unique symbol;
|
|
2
|
-
declare type AddSymbolToPrimitive<T> = T extends {
|
|
3
|
-
[Symbol.toPrimitive]: infer V;
|
|
4
|
-
} ? {
|
|
5
|
-
[Symbol.toPrimitive]: V;
|
|
6
|
-
} : {};
|
|
7
|
-
declare type AddCallable<T> = T extends {
|
|
8
|
-
(...x: any[]): infer V;
|
|
9
|
-
} ? {
|
|
10
|
-
(...x: Parameters<T>): V;
|
|
11
|
-
} : {};
|
|
12
|
-
declare type NotWrappable = string | number | boolean | Function | null;
|
|
13
|
-
export declare type Store<T> = {
|
|
14
|
-
[P in keyof T]: T[P] extends object ? Store<T[P]> : T[P];
|
|
15
|
-
} & {
|
|
16
|
-
[$RAW]?: T;
|
|
17
|
-
} & AddSymbolToPrimitive<T> & AddCallable<T>;
|
|
18
3
|
export declare function isWrappable(obj: any): boolean;
|
|
19
4
|
export declare function unwrap<T>(item: any): T;
|
|
20
5
|
export declare function setProperty(state: any, property: string | number, value: any, force?: boolean): void;
|
|
21
6
|
export declare function updatePath(current: any, path: any[], traversed?: (number | string)[]): void;
|
|
22
|
-
declare type StoreSetter<T> = Partial<T> | ((prevState: T extends NotWrappable ? T : Store<T>, traversed?: (string | number)[]) => Partial<T> | void);
|
|
23
|
-
declare type StorePathRange = {
|
|
24
|
-
from?: number;
|
|
25
|
-
to?: number;
|
|
26
|
-
by?: number;
|
|
27
|
-
};
|
|
28
|
-
declare type ArrayFilterFn<T> = (item: T extends any[] ? T[number] : never, index: number) => boolean;
|
|
29
|
-
declare type Part<T> = keyof T | Array<keyof T> | StorePathRange | ArrayFilterFn<T>;
|
|
30
|
-
declare type Next<T, K> = K extends keyof T ? T[K] : K extends Array<keyof T> ? T[K[number]] : T extends any[] ? K extends StorePathRange ? T[number] : K extends ArrayFilterFn<T> ? T[number] : never : never;
|
|
31
|
-
export interface SetStoreFunction<T> {
|
|
32
|
-
<Setter extends StoreSetter<T>>(...args: [Setter]): void;
|
|
33
|
-
<K1 extends Part<T>, Setter extends StoreSetter<Next<T, K1>>>(...args: [K1, Setter]): void;
|
|
34
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, Setter extends StoreSetter<Next<Next<T, K1>, K2>>>(...args: [K1, K2, Setter]): void;
|
|
35
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, K3 extends Part<Next<Next<T, K1>, K2>>, Setter extends StoreSetter<Next<Next<Next<T, K1>, K2>, K3>>>(...args: [K1, K2, K3, Setter]): void;
|
|
36
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, K3 extends Part<Next<Next<T, K1>, K2>>, K4 extends Part<Next<Next<Next<T, K1>, K2>, K3>>, Setter extends StoreSetter<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>>>(...args: [K1, K2, K3, K4, Setter]): void;
|
|
37
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, K3 extends Part<Next<Next<T, K1>, K2>>, K4 extends Part<Next<Next<Next<T, K1>, K2>, K3>>, K5 extends Part<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>>, Setter extends StoreSetter<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>>>(...args: [K1, K2, K3, K4, K5, Setter]): void;
|
|
38
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, K3 extends Part<Next<Next<T, K1>, K2>>, K4 extends Part<Next<Next<Next<T, K1>, K2>, K3>>, K5 extends Part<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>>, K6 extends Part<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>>, Setter extends StoreSetter<Next<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>, K6>>>(...args: [K1, K2, K3, K4, K5, K6, Setter]): void;
|
|
39
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, K3 extends Part<Next<Next<T, K1>, K2>>, K4 extends Part<Next<Next<Next<T, K1>, K2>, K3>>, K5 extends Part<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>>, K6 extends Part<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>>, K7 extends Part<Next<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>, K6>>, Setter extends StoreSetter<Next<Next<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>, K6>, K7>>>(...args: [K1, K2, K3, K4, K5, K6, K7, Setter]): void;
|
|
40
|
-
<K1 extends Part<T>, K2 extends Part<Next<T, K1>>, K3 extends Part<Next<Next<T, K1>, K2>>, K4 extends Part<Next<Next<Next<T, K1>, K2>, K3>>, K5 extends Part<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>>, K6 extends Part<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>>, K7 extends Part<Next<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>, K6>>, K8 extends Part<Next<Next<Next<Next<Next<Next<Next<T, K1>, K2>, K3>, K4>, K5>, K6>, K7>>>(...args: [K1, K2, K3, K4, K5, K6, K7, K8, ...(Part<any> | StoreSetter<any>)[]]): void;
|
|
41
|
-
}
|
|
42
7
|
export declare function createStore<T>(state: T | Store<T>): [Store<T>, SetStoreFunction<T>];
|
|
43
8
|
export declare function createMutable<T>(state: T | Store<T>): Store<T>;
|
|
44
9
|
declare type ReconcileOptions = {
|
|
45
10
|
key?: string | null;
|
|
46
11
|
merge?: boolean;
|
|
47
12
|
};
|
|
48
|
-
export declare function reconcile<T>(value: T | Store<T>, options?: ReconcileOptions): (state:
|
|
49
|
-
export declare function produce<T>(fn: (state: T) => void): (state:
|
|
13
|
+
export declare function reconcile<T>(value: T | Store<T>, options?: ReconcileOptions): (state: Store<T>) => void;
|
|
14
|
+
export declare function produce<T>(fn: (state: T) => void): (state: Store<T>) => Store<T>;
|
|
50
15
|
export {};
|
package/store/types/store.d.ts
CHANGED
|
@@ -1,72 +1,44 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Accessor } from "../..";
|
|
2
2
|
export declare const $RAW: unique symbol, $NODE: unique symbol, $NAME: unique symbol;
|
|
3
|
-
export declare type StoreNode =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[$NAME]?: string;
|
|
7
|
-
[k: string]: any;
|
|
8
|
-
[k: number]: any;
|
|
9
|
-
};
|
|
10
|
-
declare type AddSymbolToPrimitive<T> = T extends {
|
|
11
|
-
[Symbol.toPrimitive]: infer V;
|
|
12
|
-
} ? {
|
|
13
|
-
[Symbol.toPrimitive]: V;
|
|
14
|
-
} : {};
|
|
15
|
-
declare type AddSymbolIterator<T> = T extends {
|
|
16
|
-
[Symbol.iterator]: infer V;
|
|
17
|
-
} ? {
|
|
18
|
-
[Symbol.iterator]: V;
|
|
19
|
-
} : {};
|
|
20
|
-
declare type AddSymbolToStringTag<T> = T extends {
|
|
21
|
-
[Symbol.toStringTag]: infer V;
|
|
22
|
-
} ? {
|
|
23
|
-
[Symbol.toStringTag]: V;
|
|
24
|
-
} : {};
|
|
25
|
-
declare type AddCallable<T> = T extends {
|
|
26
|
-
(...x: any[]): infer V;
|
|
27
|
-
} ? {
|
|
28
|
-
(...x: Parameters<T>): V;
|
|
29
|
-
} : {};
|
|
30
|
-
export declare type NotWrappable = string | number | boolean | Function | null;
|
|
31
|
-
export declare type Store<T> = {
|
|
32
|
-
[P in keyof T]: T[P] extends object ? Store<T[P]> & T[P] : T[P];
|
|
33
|
-
} & {
|
|
34
|
-
[$RAW]?: T;
|
|
35
|
-
} & AddSymbolToPrimitive<T> & AddSymbolIterator<T> & AddSymbolToStringTag<T> & AddCallable<T>;
|
|
3
|
+
export declare type StoreNode = Record<keyof any, any>;
|
|
4
|
+
export declare type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined;
|
|
5
|
+
export declare type Store<T> = DeepReadonly<T>;
|
|
36
6
|
export declare function isWrappable(obj: any): any;
|
|
37
7
|
export declare function unwrap<T extends StoreNode>(item: any, set?: Set<unknown>): T;
|
|
38
8
|
export declare function getDataNodes(target: StoreNode): any;
|
|
39
|
-
export declare function proxyDescriptor(target: StoreNode, property:
|
|
9
|
+
export declare function proxyDescriptor(target: StoreNode, property: keyof any): PropertyDescriptor | undefined;
|
|
40
10
|
export declare function ownKeys(target: StoreNode): (string | symbol)[];
|
|
41
11
|
export declare function createDataNode(): Accessor<void> & {
|
|
42
12
|
$: () => void;
|
|
43
13
|
};
|
|
44
|
-
export declare function setProperty(state: StoreNode, property:
|
|
45
|
-
export declare function updatePath(current: StoreNode, path: any[], traversed?: (
|
|
46
|
-
export declare type
|
|
47
|
-
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
14
|
+
export declare function setProperty(state: StoreNode, property: keyof any, value: any): void;
|
|
15
|
+
export declare function updatePath(current: StoreNode, path: any[], traversed?: (keyof any)[]): void;
|
|
16
|
+
export declare type DeepReadonly<T> = {
|
|
17
|
+
readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepReadonly<T[K]>;
|
|
48
18
|
};
|
|
49
|
-
export declare type
|
|
50
|
-
export declare type StoreSetter<T> = Partial<T> | ((prevState: T extends NotWrappable ? T : Store<DeepReadonly<T>>, traversed?: (string | number)[]) => Partial<T | DeepReadonly<T>> | void);
|
|
19
|
+
export declare type StoreSetter<T> = T | Partial<T> | ((prevState: T, traversed?: (keyof any)[]) => Partial<T> | void);
|
|
51
20
|
export declare type StorePathRange = {
|
|
52
21
|
from?: number;
|
|
53
22
|
to?: number;
|
|
54
23
|
by?: number;
|
|
55
24
|
};
|
|
56
|
-
export declare type ArrayFilterFn<T> = (item: T
|
|
57
|
-
export declare type Part<T> = T extends
|
|
58
|
-
export declare type
|
|
59
|
-
export declare type
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<K1 extends Part<T>, K2 extends Part<
|
|
65
|
-
<K1 extends Part<T>, K2 extends Part<
|
|
66
|
-
<K1 extends Part<T>, K2 extends Part<
|
|
67
|
-
<K1 extends Part<T>, K2 extends Part<
|
|
68
|
-
<K1 extends Part<T>, K2 extends Part<
|
|
69
|
-
<K1 extends Part<T>, K2 extends Part<
|
|
25
|
+
export declare type ArrayFilterFn<T> = (item: T, index: number) => boolean;
|
|
26
|
+
export declare type Part<T> = [T] extends [never] ? never : [keyof T] extends [never] ? never : keyof T | (keyof T)[] | (number extends keyof T ? ArrayFilterFn<T[number]> | StorePathRange : never);
|
|
27
|
+
export declare type Next<T, K extends Part<T>> = [K] extends [never] ? never : K extends keyof T ? T[K] : K extends (keyof T)[] ? T[K[number]] : number extends keyof T ? T[number] : never;
|
|
28
|
+
export declare type WrappableNext<T, K extends Part<T>> = Exclude<Next<T, K>, NotWrappable>;
|
|
29
|
+
declare type DistributeRest<T, K extends Part<T>> = K extends K ? [K, ...Rest<Next<T, K>>] : never;
|
|
30
|
+
export declare type Rest<T> = 0 extends 1 & T ? [...(keyof any)[], any] : [StoreSetter<T>] | (T extends NotWrappable ? never : DistributeRest<T, Part<T>>);
|
|
31
|
+
export declare type SetStoreFunction<T> = _SetStoreFunction<Store<T>>;
|
|
32
|
+
interface _SetStoreFunction<T> {
|
|
33
|
+
<K1 extends Part<T>, K2 extends Part<T1>, K3 extends Part<T2>, K4 extends Part<T3>, K5 extends Part<T4>, K6 extends Part<T5>, K7 extends Part<T6>, T1 extends WrappableNext<T, K1>, T2 extends WrappableNext<T1, K2>, T3 extends WrappableNext<T2, K3>, T4 extends WrappableNext<T3, K4>, T5 extends WrappableNext<T4, K5>, T6 extends WrappableNext<T5, K6>>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, ...rest: Rest<Next<T6, K7>>): void;
|
|
34
|
+
<K1 extends Part<T>, K2 extends Part<T1>, K3 extends Part<T2>, K4 extends Part<T3>, K5 extends Part<T4>, K6 extends Part<T5>, K7 extends Part<T6>, T1 extends WrappableNext<T, K1>, T2 extends WrappableNext<T1, K2>, T3 extends WrappableNext<T2, K3>, T4 extends WrappableNext<T3, K4>, T5 extends WrappableNext<T4, K5>, T6 extends WrappableNext<T5, K6>>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, k7: K7, setter: StoreSetter<Next<T6, K7>>): void;
|
|
35
|
+
<K1 extends Part<T>, K2 extends Part<T1>, K3 extends Part<T2>, K4 extends Part<T3>, K5 extends Part<T4>, K6 extends Part<T5>, T1 extends WrappableNext<T, K1>, T2 extends WrappableNext<T1, K2>, T3 extends WrappableNext<T2, K3>, T4 extends WrappableNext<T3, K4>, T5 extends WrappableNext<T4, K5>>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, setter: StoreSetter<Next<T5, K6>>): void;
|
|
36
|
+
<K1 extends Part<T>, K2 extends Part<T1>, K3 extends Part<T2>, K4 extends Part<T3>, K5 extends Part<T4>, T1 extends WrappableNext<T, K1>, T2 extends WrappableNext<T1, K2>, T3 extends WrappableNext<T2, K3>, T4 extends WrappableNext<T3, K4>>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, setter: StoreSetter<Next<T4, K5>>): void;
|
|
37
|
+
<K1 extends Part<T>, K2 extends Part<T1>, K3 extends Part<T2>, K4 extends Part<T3>, T1 extends WrappableNext<T, K1>, T2 extends WrappableNext<T1, K2>, T3 extends WrappableNext<T2, K3>>(k1: K1, k2: K2, k3: K3, k4: K4, setter: StoreSetter<Next<T3, K4>>): void;
|
|
38
|
+
<K1 extends Part<T>, K2 extends Part<T1>, K3 extends Part<T2>, T1 extends WrappableNext<T, K1>, T2 extends WrappableNext<T1, K2>>(k1: K1, k2: K2, k3: K3, setter: StoreSetter<Next<T2, K3>>): void;
|
|
39
|
+
<K1 extends Part<T>, K2 extends Part<T1>, T1 extends WrappableNext<T, K1>>(k1: K1, k2: K2, setter: StoreSetter<Next<T1, K2>>): void;
|
|
40
|
+
<K extends Part<T>>(k: K, setter: StoreSetter<Next<T, K>>): void;
|
|
41
|
+
(setter: StoreSetter<T>): void;
|
|
70
42
|
}
|
|
71
43
|
/**
|
|
72
44
|
* creates a reactive store that can be read through a proxy object and written with a setter function
|
package/types/jsx.d.ts
CHANGED
package/universal/package.json
CHANGED
|
@@ -4,5 +4,15 @@
|
|
|
4
4
|
"module": "./dist/universal.js",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"sideEffects": false
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"development": {
|
|
11
|
+
"import": "./dist/dev.js",
|
|
12
|
+
"require": "./dist/dev.cjs"
|
|
13
|
+
},
|
|
14
|
+
"import": "./dist/universal.js",
|
|
15
|
+
"require": "./dist/universal.cjs"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
8
18
|
}
|
package/web/dist/dev.cjs
CHANGED
|
@@ -59,7 +59,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
59
59
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
60
60
|
} else if (bEnd === bStart) {
|
|
61
61
|
while (aStart < aEnd) {
|
|
62
|
-
if (!map || !map.has(a[aStart]))
|
|
62
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
63
63
|
aStart++;
|
|
64
64
|
}
|
|
65
65
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -88,7 +88,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
88
88
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
89
89
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
90
90
|
} else aStart++;
|
|
91
|
-
} else
|
|
91
|
+
} else a[aStart++].remove();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -347,6 +347,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
347
347
|
return prevProps;
|
|
348
348
|
}
|
|
349
349
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
350
|
+
if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
|
|
350
351
|
while (typeof current === "function") current = current();
|
|
351
352
|
if (value === current) return current;
|
|
352
353
|
const t = typeof value,
|
|
@@ -403,13 +404,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
403
404
|
}
|
|
404
405
|
current = array;
|
|
405
406
|
} else if (value instanceof Node) {
|
|
406
|
-
if (solidJs.sharedConfig.context) return current = value.parentNode ? value : current;
|
|
407
|
+
if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
407
408
|
if (Array.isArray(current)) {
|
|
408
409
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
409
410
|
cleanChildren(parent, current, null, value);
|
|
410
411
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
411
412
|
parent.appendChild(value);
|
|
412
|
-
} else parent.replaceChild(value,
|
|
413
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
413
414
|
current = value;
|
|
414
415
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
415
416
|
return current;
|
|
@@ -449,7 +450,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
449
450
|
const el = current[i];
|
|
450
451
|
if (node !== el) {
|
|
451
452
|
const isParent = el.parentNode === parent;
|
|
452
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
453
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
453
454
|
} else inserted = true;
|
|
454
455
|
}
|
|
455
456
|
} else parent.insertBefore(node, marker);
|
|
@@ -539,6 +540,9 @@ function Dynamic(props) {
|
|
|
539
540
|
const component = p.component;
|
|
540
541
|
switch (typeof component) {
|
|
541
542
|
case "function":
|
|
543
|
+
Object.assign(component, {
|
|
544
|
+
[solidJs.$DEVCOMP]: true
|
|
545
|
+
});
|
|
542
546
|
return solidJs.untrack(() => component(others));
|
|
543
547
|
case "string":
|
|
544
548
|
const isSvg = SVGElements.has(component);
|
package/web/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo, createRoot, createRenderEffect, sharedConfig, enableHydration, createSignal, onCleanup, splitProps, untrack } from 'solid-js';
|
|
1
|
+
import { createMemo, createRoot, createRenderEffect, sharedConfig, enableHydration, createSignal, onCleanup, splitProps, $DEVCOMP, untrack } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
@@ -56,7 +56,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
56
56
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
57
57
|
} else if (bEnd === bStart) {
|
|
58
58
|
while (aStart < aEnd) {
|
|
59
|
-
if (!map || !map.has(a[aStart]))
|
|
59
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
60
60
|
aStart++;
|
|
61
61
|
}
|
|
62
62
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -85,7 +85,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
85
85
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
86
86
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
87
87
|
} else aStart++;
|
|
88
|
-
} else
|
|
88
|
+
} else a[aStart++].remove();
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -344,6 +344,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
344
344
|
return prevProps;
|
|
345
345
|
}
|
|
346
346
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
347
|
+
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
347
348
|
while (typeof current === "function") current = current();
|
|
348
349
|
if (value === current) return current;
|
|
349
350
|
const t = typeof value,
|
|
@@ -400,13 +401,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
400
401
|
}
|
|
401
402
|
current = array;
|
|
402
403
|
} else if (value instanceof Node) {
|
|
403
|
-
if (sharedConfig.context) return current = value.parentNode ? value : current;
|
|
404
|
+
if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
404
405
|
if (Array.isArray(current)) {
|
|
405
406
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
406
407
|
cleanChildren(parent, current, null, value);
|
|
407
408
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
408
409
|
parent.appendChild(value);
|
|
409
|
-
} else parent.replaceChild(value,
|
|
410
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
410
411
|
current = value;
|
|
411
412
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
412
413
|
return current;
|
|
@@ -446,7 +447,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
446
447
|
const el = current[i];
|
|
447
448
|
if (node !== el) {
|
|
448
449
|
const isParent = el.parentNode === parent;
|
|
449
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
450
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
450
451
|
} else inserted = true;
|
|
451
452
|
}
|
|
452
453
|
} else parent.insertBefore(node, marker);
|
|
@@ -536,6 +537,9 @@ function Dynamic(props) {
|
|
|
536
537
|
const component = p.component;
|
|
537
538
|
switch (typeof component) {
|
|
538
539
|
case "function":
|
|
540
|
+
Object.assign(component, {
|
|
541
|
+
[$DEVCOMP]: true
|
|
542
|
+
});
|
|
539
543
|
return untrack(() => component(others));
|
|
540
544
|
case "string":
|
|
541
545
|
const isSvg = SVGElements.has(component);
|
package/web/dist/server.cjs
CHANGED
|
@@ -575,8 +575,8 @@ function getHydrationKey() {
|
|
|
575
575
|
function generateHydrationScript({
|
|
576
576
|
eventNames = ["click", "input"],
|
|
577
577
|
nonce
|
|
578
|
-
}) {
|
|
579
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script
|
|
578
|
+
} = {}) {
|
|
579
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!--xs-->`;
|
|
580
580
|
}
|
|
581
581
|
function injectAssets(assets, html) {
|
|
582
582
|
for (let i = 0; i < assets.length; i++) {
|
|
@@ -586,7 +586,7 @@ function injectAssets(assets, html) {
|
|
|
586
586
|
}
|
|
587
587
|
function injectScripts(html, scripts, nonce) {
|
|
588
588
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
589
|
-
const index = html.indexOf("
|
|
589
|
+
const index = html.indexOf("<!--xs-->");
|
|
590
590
|
if (index > -1) {
|
|
591
591
|
return html.slice(0, index) + tag + html.slice(index);
|
|
592
592
|
}
|
|
@@ -607,7 +607,7 @@ function waitForFragments(registry, key) {
|
|
|
607
607
|
function serializeSet(registry, key, value) {
|
|
608
608
|
const exist = registry.get(value);
|
|
609
609
|
if (exist) return `_$HY.set("${key}", _$HY.r["${exist}"][0]);`;
|
|
610
|
-
registry.set(value, key);
|
|
610
|
+
value !== null && typeof value === "object" && registry.set(value, key);
|
|
611
611
|
return `_$HY.set("${key}", ${devalue(value)});`;
|
|
612
612
|
}
|
|
613
613
|
function pipeToNodeWritable(code, writable, options = {}) {
|
package/web/dist/server.js
CHANGED
|
@@ -572,8 +572,8 @@ function getHydrationKey() {
|
|
|
572
572
|
function generateHydrationScript({
|
|
573
573
|
eventNames = ["click", "input"],
|
|
574
574
|
nonce
|
|
575
|
-
}) {
|
|
576
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script
|
|
575
|
+
} = {}) {
|
|
576
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!--xs-->`;
|
|
577
577
|
}
|
|
578
578
|
function injectAssets(assets, html) {
|
|
579
579
|
for (let i = 0; i < assets.length; i++) {
|
|
@@ -583,7 +583,7 @@ function injectAssets(assets, html) {
|
|
|
583
583
|
}
|
|
584
584
|
function injectScripts(html, scripts, nonce) {
|
|
585
585
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
586
|
-
const index = html.indexOf("
|
|
586
|
+
const index = html.indexOf("<!--xs-->");
|
|
587
587
|
if (index > -1) {
|
|
588
588
|
return html.slice(0, index) + tag + html.slice(index);
|
|
589
589
|
}
|
|
@@ -604,7 +604,7 @@ function waitForFragments(registry, key) {
|
|
|
604
604
|
function serializeSet(registry, key, value) {
|
|
605
605
|
const exist = registry.get(value);
|
|
606
606
|
if (exist) return `_$HY.set("${key}", _$HY.r["${exist}"][0]);`;
|
|
607
|
-
registry.set(value, key);
|
|
607
|
+
value !== null && typeof value === "object" && registry.set(value, key);
|
|
608
608
|
return `_$HY.set("${key}", ${devalue(value)});`;
|
|
609
609
|
}
|
|
610
610
|
function pipeToNodeWritable(code, writable, options = {}) {
|
package/web/dist/web.cjs
CHANGED
|
@@ -59,7 +59,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
59
59
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
60
60
|
} else if (bEnd === bStart) {
|
|
61
61
|
while (aStart < aEnd) {
|
|
62
|
-
if (!map || !map.has(a[aStart]))
|
|
62
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
63
63
|
aStart++;
|
|
64
64
|
}
|
|
65
65
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -88,7 +88,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
88
88
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
89
89
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
90
90
|
} else aStart++;
|
|
91
|
-
} else
|
|
91
|
+
} else a[aStart++].remove();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -346,6 +346,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
346
346
|
return prevProps;
|
|
347
347
|
}
|
|
348
348
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
349
|
+
if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
|
|
349
350
|
while (typeof current === "function") current = current();
|
|
350
351
|
if (value === current) return current;
|
|
351
352
|
const t = typeof value,
|
|
@@ -402,13 +403,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
402
403
|
}
|
|
403
404
|
current = array;
|
|
404
405
|
} else if (value instanceof Node) {
|
|
405
|
-
if (solidJs.sharedConfig.context) return current = value.parentNode ? value : current;
|
|
406
|
+
if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
406
407
|
if (Array.isArray(current)) {
|
|
407
408
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
408
409
|
cleanChildren(parent, current, null, value);
|
|
409
410
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
410
411
|
parent.appendChild(value);
|
|
411
|
-
} else parent.replaceChild(value,
|
|
412
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
412
413
|
current = value;
|
|
413
414
|
} else ;
|
|
414
415
|
return current;
|
|
@@ -448,7 +449,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
448
449
|
const el = current[i];
|
|
449
450
|
if (node !== el) {
|
|
450
451
|
const isParent = el.parentNode === parent;
|
|
451
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
452
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
452
453
|
} else inserted = true;
|
|
453
454
|
}
|
|
454
455
|
} else parent.insertBefore(node, marker);
|
package/web/dist/web.js
CHANGED
|
@@ -56,7 +56,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
56
56
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
57
57
|
} else if (bEnd === bStart) {
|
|
58
58
|
while (aStart < aEnd) {
|
|
59
|
-
if (!map || !map.has(a[aStart]))
|
|
59
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
60
60
|
aStart++;
|
|
61
61
|
}
|
|
62
62
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -85,7 +85,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
85
85
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
86
86
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
87
87
|
} else aStart++;
|
|
88
|
-
} else
|
|
88
|
+
} else a[aStart++].remove();
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -343,6 +343,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
343
343
|
return prevProps;
|
|
344
344
|
}
|
|
345
345
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
346
|
+
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
346
347
|
while (typeof current === "function") current = current();
|
|
347
348
|
if (value === current) return current;
|
|
348
349
|
const t = typeof value,
|
|
@@ -399,13 +400,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
399
400
|
}
|
|
400
401
|
current = array;
|
|
401
402
|
} else if (value instanceof Node) {
|
|
402
|
-
if (sharedConfig.context) return current = value.parentNode ? value : current;
|
|
403
|
+
if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
403
404
|
if (Array.isArray(current)) {
|
|
404
405
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
405
406
|
cleanChildren(parent, current, null, value);
|
|
406
407
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
407
408
|
parent.appendChild(value);
|
|
408
|
-
} else parent.replaceChild(value,
|
|
409
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
409
410
|
current = value;
|
|
410
411
|
} else ;
|
|
411
412
|
return current;
|
|
@@ -445,7 +446,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
445
446
|
const el = current[i];
|
|
446
447
|
if (node !== el) {
|
|
447
448
|
const isParent = el.parentNode === parent;
|
|
448
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
449
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
449
450
|
} else inserted = true;
|
|
450
451
|
}
|
|
451
452
|
} else parent.insertBefore(node, marker);
|
package/web/package.json
CHANGED
|
@@ -9,5 +9,27 @@
|
|
|
9
9
|
"unpkg": "./dist/web.cjs",
|
|
10
10
|
"types": "./types/index.d.ts",
|
|
11
11
|
"type": "module",
|
|
12
|
-
"sideEffects": false
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"browser": {
|
|
16
|
+
"development": {
|
|
17
|
+
"import": "./dist/dev.js",
|
|
18
|
+
"require": "./dist/dev.cjs"
|
|
19
|
+
},
|
|
20
|
+
"import": "./dist/web.js",
|
|
21
|
+
"require": "./dist/web.cjs"
|
|
22
|
+
},
|
|
23
|
+
"node": {
|
|
24
|
+
"import": "./dist/server.js",
|
|
25
|
+
"require": "./dist/server.cjs"
|
|
26
|
+
},
|
|
27
|
+
"development": {
|
|
28
|
+
"import": "./dist/dev.js",
|
|
29
|
+
"require": "./dist/dev.cjs"
|
|
30
|
+
},
|
|
31
|
+
"import": "./dist/web.js",
|
|
32
|
+
"require": "./dist/web.cjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
13
35
|
}
|
package/web/types/client.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export function dynamicProperty(props: unknown, key: string): unknown;
|
|
|
53
53
|
export function hydrate(
|
|
54
54
|
fn: () => JSX.Element,
|
|
55
55
|
node: MountableElement,
|
|
56
|
-
options
|
|
56
|
+
options?: { renderId?: string }
|
|
57
57
|
): () => void;
|
|
58
58
|
export function getHydrationKey(): string;
|
|
59
59
|
export function getNextElement(template?: HTMLTemplateElement): Element;
|