solid-js 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +1 -1
- package/dist/dev.js +534 -299
- package/dist/server.js +170 -75
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +461 -257
- package/h/dist/h.js +34 -8
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +216 -94
- package/html/types/lit.d.ts +47 -31
- package/package.json +7 -3
- package/store/dist/dev.js +114 -42
- package/store/dist/server.js +19 -8
- package/store/dist/store.js +105 -39
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +12 -4
- package/store/types/store.d.ts +218 -61
- package/types/index.d.ts +72 -9
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +228 -140
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +62 -31
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +13 -13
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +166 -95
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.cjs +3 -0
- package/web/dist/dev.js +620 -81
- package/web/dist/server.cjs +17 -5
- package/web/dist/server.js +188 -95
- package/web/dist/storage.cjs +12 -0
- package/web/dist/storage.js +10 -0
- package/web/dist/web.cjs +3 -0
- package/web/dist/web.js +614 -80
- package/web/types/client.d.ts +8 -3
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
- package/web/types/server.d.ts +10 -1
- package/web/types/storage.d.ts +2 -0
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.8.
|
|
4
|
+
"version": "1.8.4",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -159,6 +159,10 @@
|
|
|
159
159
|
"import": "./web/dist/web.js",
|
|
160
160
|
"require": "./web/dist/web.cjs"
|
|
161
161
|
},
|
|
162
|
+
"./web/storage": {
|
|
163
|
+
"import": "./web/dist/storage.js",
|
|
164
|
+
"require": "./web/dist/storage.cjs"
|
|
165
|
+
},
|
|
162
166
|
"./web/dist/*": "./web/dist/*",
|
|
163
167
|
"./universal": {
|
|
164
168
|
"development": {
|
|
@@ -206,7 +210,7 @@
|
|
|
206
210
|
],
|
|
207
211
|
"dependencies": {
|
|
208
212
|
"csstype": "^3.1.0",
|
|
209
|
-
"seroval": "^0.
|
|
213
|
+
"seroval": "^0.12.0"
|
|
210
214
|
},
|
|
211
215
|
"scripts": {
|
|
212
216
|
"build": "npm-run-all -nl build:*",
|
|
@@ -217,7 +221,7 @@
|
|
|
217
221
|
"types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-h.d.ts ./h/jsx-runtime/src/jsx.d.ts",
|
|
218
222
|
"types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts",
|
|
219
223
|
"types:web": "tsc --project ./web/tsconfig.build.json",
|
|
220
|
-
"types:copy-web": "ncp ../../node_modules/dom-expressions/src/client.d.ts ./web/types/client.d.ts && ncp ../../node_modules/dom-expressions/src/server.d.ts ./web/types/server.d.ts",
|
|
224
|
+
"types:copy-web": "ncp ../../node_modules/dom-expressions/src/client.d.ts ./web/types/client.d.ts && ncp ../../node_modules/dom-expressions/src/server.d.ts ./web/types/server.d.ts && ncp ./web/storage/storage.d.ts ./web/types/storage.d.ts",
|
|
221
225
|
"types:store": "tsc --project ./store/tsconfig.build.json",
|
|
222
226
|
"types:html": "tsc --project ./html/tsconfig.json && ncp ../../node_modules/lit-dom-expressions/types/index.d.ts ./html/types/lit.d.ts",
|
|
223
227
|
"types:h": "tsc --project ./h/tsconfig.json && ncp ../../node_modules/hyper-dom-expressions/types/index.d.ts ./h/types/hyperscript.d.ts",
|
package/store/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEV as DEV$1, $PROXY, $TRACK, getListener, batch, createSignal } from
|
|
1
|
+
import { DEV as DEV$1, $PROXY, $TRACK, getListener, batch, createSignal } from "solid-js";
|
|
2
2
|
|
|
3
3
|
const $RAW = Symbol("store-raw"),
|
|
4
4
|
$NODE = Symbol("store-node"),
|
|
@@ -11,7 +11,7 @@ function wrap$1(value) {
|
|
|
11
11
|
let p = value[$PROXY];
|
|
12
12
|
if (!p) {
|
|
13
13
|
Object.defineProperty(value, $PROXY, {
|
|
14
|
-
value: p = new Proxy(value, proxyTraps$1)
|
|
14
|
+
value: (p = new Proxy(value, proxyTraps$1))
|
|
15
15
|
});
|
|
16
16
|
if (!Array.isArray(value)) {
|
|
17
17
|
const keys = Object.keys(value),
|
|
@@ -31,20 +31,29 @@ function wrap$1(value) {
|
|
|
31
31
|
}
|
|
32
32
|
function isWrappable(obj) {
|
|
33
33
|
let proto;
|
|
34
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
obj != null &&
|
|
36
|
+
typeof obj === "object" &&
|
|
37
|
+
(obj[$PROXY] ||
|
|
38
|
+
!(proto = Object.getPrototypeOf(obj)) ||
|
|
39
|
+
proto === Object.prototype ||
|
|
40
|
+
Array.isArray(obj))
|
|
41
|
+
);
|
|
35
42
|
}
|
|
36
43
|
function unwrap(item, set = new Set()) {
|
|
37
44
|
let result, unwrapped, v, prop;
|
|
38
|
-
if (result = item != null && item[$RAW]) return result;
|
|
45
|
+
if ((result = item != null && item[$RAW])) return result;
|
|
39
46
|
if (!isWrappable(item) || set.has(item)) return item;
|
|
40
47
|
if (Array.isArray(item)) {
|
|
41
|
-
if (Object.isFrozen(item)) item = item.slice(0);
|
|
48
|
+
if (Object.isFrozen(item)) item = item.slice(0);
|
|
49
|
+
else set.add(item);
|
|
42
50
|
for (let i = 0, l = item.length; i < l; i++) {
|
|
43
51
|
v = item[i];
|
|
44
52
|
if ((unwrapped = unwrap(v, set)) !== v) item[i] = unwrapped;
|
|
45
53
|
}
|
|
46
54
|
} else {
|
|
47
|
-
if (Object.isFrozen(item)) item = Object.assign({}, item);
|
|
55
|
+
if (Object.isFrozen(item)) item = Object.assign({}, item);
|
|
56
|
+
else set.add(item);
|
|
48
57
|
const keys = Object.keys(item),
|
|
49
58
|
desc = Object.getOwnPropertyDescriptors(item);
|
|
50
59
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
@@ -58,9 +67,10 @@ function unwrap(item, set = new Set()) {
|
|
|
58
67
|
}
|
|
59
68
|
function getNodes(target, symbol) {
|
|
60
69
|
let nodes = target[symbol];
|
|
61
|
-
if (!nodes)
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
if (!nodes)
|
|
71
|
+
Object.defineProperty(target, symbol, {
|
|
72
|
+
value: (nodes = Object.create(null))
|
|
73
|
+
});
|
|
64
74
|
return nodes;
|
|
65
75
|
}
|
|
66
76
|
function getNode(nodes, property, value) {
|
|
@@ -70,11 +80,12 @@ function getNode(nodes, property, value) {
|
|
|
70
80
|
internal: true
|
|
71
81
|
});
|
|
72
82
|
s.$ = set;
|
|
73
|
-
return nodes[property] = s;
|
|
83
|
+
return (nodes[property] = s);
|
|
74
84
|
}
|
|
75
85
|
function proxyDescriptor$1(target, property) {
|
|
76
86
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
77
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE)
|
|
87
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE)
|
|
88
|
+
return desc;
|
|
78
89
|
delete desc.value;
|
|
79
90
|
delete desc.writable;
|
|
80
91
|
desc.get = () => target[$PROXY][property];
|
|
@@ -101,12 +112,25 @@ const proxyTraps$1 = {
|
|
|
101
112
|
if (property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
102
113
|
if (!tracked) {
|
|
103
114
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
104
|
-
if (
|
|
115
|
+
if (
|
|
116
|
+
getListener() &&
|
|
117
|
+
(typeof value !== "function" || target.hasOwnProperty(property)) &&
|
|
118
|
+
!(desc && desc.get)
|
|
119
|
+
)
|
|
120
|
+
value = getNode(nodes, property, value)();
|
|
105
121
|
}
|
|
106
122
|
return isWrappable(value) ? wrap$1(value) : value;
|
|
107
123
|
},
|
|
108
124
|
has(target, property) {
|
|
109
|
-
if (
|
|
125
|
+
if (
|
|
126
|
+
property === $RAW ||
|
|
127
|
+
property === $PROXY ||
|
|
128
|
+
property === $TRACK ||
|
|
129
|
+
property === $NODE ||
|
|
130
|
+
property === $HAS ||
|
|
131
|
+
property === "__proto__"
|
|
132
|
+
)
|
|
133
|
+
return true;
|
|
110
134
|
getListener() && getNode(getNodes(target, $HAS), property)();
|
|
111
135
|
return property in target;
|
|
112
136
|
},
|
|
@@ -135,7 +159,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
135
159
|
}
|
|
136
160
|
let nodes = getNodes(state, $NODE),
|
|
137
161
|
node;
|
|
138
|
-
if (node = getNode(nodes, property, prev)) node.$(() => value);
|
|
162
|
+
if ((node = getNode(nodes, property, prev))) node.$(() => value);
|
|
139
163
|
if (Array.isArray(state) && state.length !== len) {
|
|
140
164
|
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
141
165
|
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
@@ -181,11 +205,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
181
205
|
}
|
|
182
206
|
return;
|
|
183
207
|
} else if (isArray && partType === "object") {
|
|
184
|
-
const {
|
|
185
|
-
from = 0,
|
|
186
|
-
to = current.length - 1,
|
|
187
|
-
by = 1
|
|
188
|
-
} = part;
|
|
208
|
+
const { from = 0, to = current.length - 1, by = 1 } = part;
|
|
189
209
|
for (let i = from; i <= to; i += by) {
|
|
190
210
|
updatePath(current, [i].concat(path), traversed);
|
|
191
211
|
}
|
|
@@ -204,14 +224,17 @@ function updatePath(current, path, traversed = []) {
|
|
|
204
224
|
}
|
|
205
225
|
if (part === undefined && value == undefined) return;
|
|
206
226
|
value = unwrap(value);
|
|
207
|
-
if (part === undefined || isWrappable(prev) && isWrappable(value) && !Array.isArray(value)) {
|
|
227
|
+
if (part === undefined || (isWrappable(prev) && isWrappable(value) && !Array.isArray(value))) {
|
|
208
228
|
mergeStoreNode(prev, value);
|
|
209
229
|
} else setProperty(current, part, value);
|
|
210
230
|
}
|
|
211
231
|
function createStore(...[store, options]) {
|
|
212
232
|
const unwrappedStore = unwrap(store || {});
|
|
213
233
|
const isArray = Array.isArray(unwrappedStore);
|
|
214
|
-
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function")
|
|
234
|
+
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function")
|
|
235
|
+
throw new Error(
|
|
236
|
+
`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`
|
|
237
|
+
);
|
|
215
238
|
const wrappedStore = wrap$1(unwrappedStore);
|
|
216
239
|
DEV$1.registerGraph({
|
|
217
240
|
value: unwrappedStore,
|
|
@@ -219,7 +242,9 @@ function createStore(...[store, options]) {
|
|
|
219
242
|
});
|
|
220
243
|
function setStore(...args) {
|
|
221
244
|
batch(() => {
|
|
222
|
-
isArray && args.length === 1
|
|
245
|
+
isArray && args.length === 1
|
|
246
|
+
? updateArray(unwrappedStore, args[0])
|
|
247
|
+
: updatePath(unwrappedStore, args);
|
|
223
248
|
});
|
|
224
249
|
}
|
|
225
250
|
return [wrappedStore, setStore];
|
|
@@ -227,11 +252,19 @@ function createStore(...[store, options]) {
|
|
|
227
252
|
|
|
228
253
|
function proxyDescriptor(target, property) {
|
|
229
254
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
230
|
-
if (
|
|
255
|
+
if (
|
|
256
|
+
!desc ||
|
|
257
|
+
desc.get ||
|
|
258
|
+
desc.set ||
|
|
259
|
+
!desc.configurable ||
|
|
260
|
+
property === $PROXY ||
|
|
261
|
+
property === $NODE
|
|
262
|
+
)
|
|
263
|
+
return desc;
|
|
231
264
|
delete desc.value;
|
|
232
265
|
delete desc.writable;
|
|
233
266
|
desc.get = () => target[$PROXY][property];
|
|
234
|
-
desc.set = v => target[$PROXY][property] = v;
|
|
267
|
+
desc.set = v => (target[$PROXY][property] = v);
|
|
235
268
|
return desc;
|
|
236
269
|
}
|
|
237
270
|
const proxyTraps = {
|
|
@@ -249,14 +282,24 @@ const proxyTraps = {
|
|
|
249
282
|
if (!tracked) {
|
|
250
283
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
251
284
|
const isFunction = typeof value === "function";
|
|
252
|
-
if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get))
|
|
285
|
+
if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get))
|
|
286
|
+
value = getNode(nodes, property, value)();
|
|
287
|
+
else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
253
288
|
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
254
289
|
}
|
|
255
290
|
}
|
|
256
291
|
return isWrappable(value) ? wrap(value) : value;
|
|
257
292
|
},
|
|
258
293
|
has(target, property) {
|
|
259
|
-
if (
|
|
294
|
+
if (
|
|
295
|
+
property === $RAW ||
|
|
296
|
+
property === $PROXY ||
|
|
297
|
+
property === $TRACK ||
|
|
298
|
+
property === $NODE ||
|
|
299
|
+
property === $HAS ||
|
|
300
|
+
property === "__proto__"
|
|
301
|
+
)
|
|
302
|
+
return true;
|
|
260
303
|
getListener() && getNode(getNodes(target, $HAS), property)();
|
|
261
304
|
return property in target;
|
|
262
305
|
},
|
|
@@ -275,7 +318,7 @@ function wrap(value) {
|
|
|
275
318
|
let p = value[$PROXY];
|
|
276
319
|
if (!p) {
|
|
277
320
|
Object.defineProperty(value, $PROXY, {
|
|
278
|
-
value: p = new Proxy(value, proxyTraps)
|
|
321
|
+
value: (p = new Proxy(value, proxyTraps))
|
|
279
322
|
});
|
|
280
323
|
const keys = Object.keys(value),
|
|
281
324
|
desc = Object.getOwnPropertyDescriptors(value);
|
|
@@ -300,7 +343,10 @@ function wrap(value) {
|
|
|
300
343
|
}
|
|
301
344
|
function createMutable(state, options) {
|
|
302
345
|
const unwrappedStore = unwrap(state || {});
|
|
303
|
-
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function")
|
|
346
|
+
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function")
|
|
347
|
+
throw new Error(
|
|
348
|
+
`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`
|
|
349
|
+
);
|
|
304
350
|
const wrappedStore = wrap(unwrappedStore);
|
|
305
351
|
DEV$1.registerGraph({
|
|
306
352
|
value: unwrappedStore,
|
|
@@ -316,19 +362,39 @@ const $ROOT = Symbol("store-root");
|
|
|
316
362
|
function applyState(target, parent, property, merge, key) {
|
|
317
363
|
const previous = parent[property];
|
|
318
364
|
if (target === previous) return;
|
|
319
|
-
if (
|
|
365
|
+
if (
|
|
366
|
+
property !== $ROOT &&
|
|
367
|
+
(!isWrappable(target) || !isWrappable(previous) || (key && target[key] !== previous[key]))
|
|
368
|
+
) {
|
|
320
369
|
setProperty(parent, property, target);
|
|
321
370
|
return;
|
|
322
371
|
}
|
|
323
372
|
if (Array.isArray(target)) {
|
|
324
|
-
if (
|
|
373
|
+
if (
|
|
374
|
+
target.length &&
|
|
375
|
+
previous.length &&
|
|
376
|
+
(!merge || (key && target[0] && target[0][key] != null))
|
|
377
|
+
) {
|
|
325
378
|
let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
|
|
326
|
-
for (
|
|
379
|
+
for (
|
|
380
|
+
start = 0, end = Math.min(previous.length, target.length);
|
|
381
|
+
start < end &&
|
|
382
|
+
(previous[start] === target[start] ||
|
|
383
|
+
(key && previous[start] && target[start] && previous[start][key] === target[start][key]));
|
|
384
|
+
start++
|
|
385
|
+
) {
|
|
327
386
|
applyState(target[start], previous, start, merge, key);
|
|
328
387
|
}
|
|
329
388
|
const temp = new Array(target.length),
|
|
330
389
|
newIndices = new Map();
|
|
331
|
-
for (
|
|
390
|
+
for (
|
|
391
|
+
end = previous.length - 1, newEnd = target.length - 1;
|
|
392
|
+
end >= start &&
|
|
393
|
+
newEnd >= start &&
|
|
394
|
+
(previous[end] === target[newEnd] ||
|
|
395
|
+
(key && previous[start] && target[start] && previous[end][key] === target[newEnd][key]));
|
|
396
|
+
end--, newEnd--
|
|
397
|
+
) {
|
|
332
398
|
temp[newEnd] = previous[end];
|
|
333
399
|
}
|
|
334
400
|
if (start > newEnd || start > end) {
|
|
@@ -382,16 +448,19 @@ function applyState(target, parent, property, merge, key) {
|
|
|
382
448
|
}
|
|
383
449
|
}
|
|
384
450
|
function reconcile(value, options = {}) {
|
|
385
|
-
const {
|
|
386
|
-
merge,
|
|
387
|
-
key = "id"
|
|
388
|
-
} = options,
|
|
451
|
+
const { merge, key = "id" } = options,
|
|
389
452
|
v = unwrap(value);
|
|
390
453
|
return state => {
|
|
391
454
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
392
|
-
const res = applyState(
|
|
393
|
-
|
|
394
|
-
|
|
455
|
+
const res = applyState(
|
|
456
|
+
v,
|
|
457
|
+
{
|
|
458
|
+
[$ROOT]: state
|
|
459
|
+
},
|
|
460
|
+
$ROOT,
|
|
461
|
+
merge,
|
|
462
|
+
key
|
|
463
|
+
);
|
|
395
464
|
return res === undefined ? state : res;
|
|
396
465
|
};
|
|
397
466
|
}
|
|
@@ -401,7 +470,10 @@ const setterTraps = {
|
|
|
401
470
|
if (property === $RAW) return target;
|
|
402
471
|
const value = target[property];
|
|
403
472
|
let proxy;
|
|
404
|
-
return isWrappable(value)
|
|
473
|
+
return isWrappable(value)
|
|
474
|
+
? producers.get(value) ||
|
|
475
|
+
(producers.set(value, (proxy = new Proxy(value, setterTraps))), proxy)
|
|
476
|
+
: value;
|
|
405
477
|
},
|
|
406
478
|
set(target, property, value) {
|
|
407
479
|
setProperty(target, property, unwrap(value));
|
|
@@ -417,7 +489,7 @@ function produce(fn) {
|
|
|
417
489
|
if (isWrappable(state)) {
|
|
418
490
|
let proxy;
|
|
419
491
|
if (!(proxy = producers.get(state))) {
|
|
420
|
-
producers.set(state, proxy = new Proxy(state, setterTraps));
|
|
492
|
+
producers.set(state, (proxy = new Proxy(state, setterTraps)));
|
|
421
493
|
}
|
|
422
494
|
fn(proxy);
|
|
423
495
|
}
|
|
@@ -429,6 +501,6 @@ const DEV = {
|
|
|
429
501
|
$NODE,
|
|
430
502
|
isWrappable,
|
|
431
503
|
hooks: DevHooks
|
|
432
|
-
}
|
|
504
|
+
};
|
|
433
505
|
|
|
434
506
|
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/dist/server.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
const $RAW = Symbol("state-raw");
|
|
2
2
|
function isWrappable(obj) {
|
|
3
|
-
return
|
|
3
|
+
return (
|
|
4
|
+
obj != null &&
|
|
5
|
+
typeof obj === "object" &&
|
|
6
|
+
(Object.getPrototypeOf(obj) === Object.prototype || Array.isArray(obj))
|
|
7
|
+
);
|
|
4
8
|
}
|
|
5
9
|
function unwrap(item) {
|
|
6
10
|
return item;
|
|
@@ -49,11 +53,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
49
53
|
}
|
|
50
54
|
return;
|
|
51
55
|
} else if (isArray && partType === "object") {
|
|
52
|
-
const {
|
|
53
|
-
from = 0,
|
|
54
|
-
to = current.length - 1,
|
|
55
|
-
by = 1
|
|
56
|
-
} = part;
|
|
56
|
+
const { from = 0, to = current.length - 1, by = 1 } = part;
|
|
57
57
|
for (let i = from; i <= to; i += by) {
|
|
58
58
|
updatePath(current, [i].concat(path), traversed);
|
|
59
59
|
}
|
|
@@ -71,7 +71,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
71
71
|
if (value === next) return;
|
|
72
72
|
}
|
|
73
73
|
if (part === undefined && value == undefined) return;
|
|
74
|
-
if (part === undefined || isWrappable(next) && isWrappable(value) && !Array.isArray(value)) {
|
|
74
|
+
if (part === undefined || (isWrappable(next) && isWrappable(value) && !Array.isArray(value))) {
|
|
75
75
|
mergeStoreNode(next, value);
|
|
76
76
|
} else setProperty(current, part, value);
|
|
77
77
|
}
|
|
@@ -108,4 +108,15 @@ function produce(fn) {
|
|
|
108
108
|
}
|
|
109
109
|
const DEV = undefined;
|
|
110
110
|
|
|
111
|
-
export {
|
|
111
|
+
export {
|
|
112
|
+
$RAW,
|
|
113
|
+
DEV,
|
|
114
|
+
createMutable,
|
|
115
|
+
createStore,
|
|
116
|
+
isWrappable,
|
|
117
|
+
produce,
|
|
118
|
+
reconcile,
|
|
119
|
+
setProperty,
|
|
120
|
+
unwrap,
|
|
121
|
+
updatePath
|
|
122
|
+
};
|