solid-js 1.9.6 → 1.9.7
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 +18 -8
- package/dist/dev.js +326 -557
- package/dist/server.js +81 -178
- package/dist/solid.cjs +18 -8
- package/dist/solid.js +282 -486
- package/h/dist/h.js +9 -40
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -219
- package/html/types/lit.d.ts +33 -52
- package/package.json +3 -3
- package/store/dist/dev.js +43 -123
- package/store/dist/server.js +8 -20
- package/store/dist/store.js +40 -114
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +5 -25
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +11 -78
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +16 -22
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +145 -236
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +37 -73
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +45 -76
- package/types/server/rendering.d.ts +98 -169
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.js +90 -644
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +110 -647
- package/web/dist/web.js +88 -632
- package/web/storage/dist/storage.js +3 -3
- package/web/types/core.d.ts +1 -9
- package/web/types/index.d.ts +11 -31
- package/web/types/server-mock.d.ts +32 -47
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.9.
|
|
4
|
+
"version": "1.9.7",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -215,8 +215,8 @@
|
|
|
215
215
|
],
|
|
216
216
|
"dependencies": {
|
|
217
217
|
"csstype": "^3.1.0",
|
|
218
|
-
"seroval": "
|
|
219
|
-
"seroval-plugins": "
|
|
218
|
+
"seroval": "~1.3.0",
|
|
219
|
+
"seroval-plugins": "~1.3.0"
|
|
220
220
|
},
|
|
221
221
|
"scripts": {
|
|
222
222
|
"build": "npm-run-all -nl build:*",
|
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:
|
|
14
|
+
value: p = new Proxy(value, proxyTraps$1)
|
|
15
15
|
});
|
|
16
16
|
if (!Array.isArray(value)) {
|
|
17
17
|
const keys = Object.keys(value),
|
|
@@ -31,29 +31,20 @@ function wrap$1(value) {
|
|
|
31
31
|
}
|
|
32
32
|
function isWrappable(obj) {
|
|
33
33
|
let proto;
|
|
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
|
-
);
|
|
34
|
+
return obj != null && typeof obj === "object" && (obj[$PROXY] || !(proto = Object.getPrototypeOf(obj)) || proto === Object.prototype || Array.isArray(obj));
|
|
42
35
|
}
|
|
43
36
|
function unwrap(item, set = new Set()) {
|
|
44
37
|
let result, unwrapped, v, prop;
|
|
45
|
-
if (
|
|
38
|
+
if (result = item != null && item[$RAW]) return result;
|
|
46
39
|
if (!isWrappable(item) || set.has(item)) return item;
|
|
47
40
|
if (Array.isArray(item)) {
|
|
48
|
-
if (Object.isFrozen(item)) item = item.slice(0);
|
|
49
|
-
else set.add(item);
|
|
41
|
+
if (Object.isFrozen(item)) item = item.slice(0);else set.add(item);
|
|
50
42
|
for (let i = 0, l = item.length; i < l; i++) {
|
|
51
43
|
v = item[i];
|
|
52
44
|
if ((unwrapped = unwrap(v, set)) !== v) item[i] = unwrapped;
|
|
53
45
|
}
|
|
54
46
|
} else {
|
|
55
|
-
if (Object.isFrozen(item)) item = Object.assign({}, item);
|
|
56
|
-
else set.add(item);
|
|
47
|
+
if (Object.isFrozen(item)) item = Object.assign({}, item);else set.add(item);
|
|
57
48
|
const keys = Object.keys(item),
|
|
58
49
|
desc = Object.getOwnPropertyDescriptors(item);
|
|
59
50
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
@@ -67,10 +58,9 @@ function unwrap(item, set = new Set()) {
|
|
|
67
58
|
}
|
|
68
59
|
function getNodes(target, symbol) {
|
|
69
60
|
let nodes = target[symbol];
|
|
70
|
-
if (!nodes)
|
|
71
|
-
Object.
|
|
72
|
-
|
|
73
|
-
});
|
|
61
|
+
if (!nodes) Object.defineProperty(target, symbol, {
|
|
62
|
+
value: nodes = Object.create(null)
|
|
63
|
+
});
|
|
74
64
|
return nodes;
|
|
75
65
|
}
|
|
76
66
|
function getNode(nodes, property, value) {
|
|
@@ -80,12 +70,11 @@ function getNode(nodes, property, value) {
|
|
|
80
70
|
internal: true
|
|
81
71
|
});
|
|
82
72
|
s.$ = set;
|
|
83
|
-
return
|
|
73
|
+
return nodes[property] = s;
|
|
84
74
|
}
|
|
85
75
|
function proxyDescriptor$1(target, property) {
|
|
86
76
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
87
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE)
|
|
88
|
-
return desc;
|
|
77
|
+
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
89
78
|
delete desc.value;
|
|
90
79
|
delete desc.writable;
|
|
91
80
|
desc.get = () => target[$PROXY][property];
|
|
@@ -112,25 +101,12 @@ const proxyTraps$1 = {
|
|
|
112
101
|
if (property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
113
102
|
if (!tracked) {
|
|
114
103
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
115
|
-
if (
|
|
116
|
-
getListener() &&
|
|
117
|
-
(typeof value !== "function" || target.hasOwnProperty(property)) &&
|
|
118
|
-
!(desc && desc.get)
|
|
119
|
-
)
|
|
120
|
-
value = getNode(nodes, property, value)();
|
|
104
|
+
if (getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();
|
|
121
105
|
}
|
|
122
106
|
return isWrappable(value) ? wrap$1(value) : value;
|
|
123
107
|
},
|
|
124
108
|
has(target, property) {
|
|
125
|
-
if (
|
|
126
|
-
property === $RAW ||
|
|
127
|
-
property === $PROXY ||
|
|
128
|
-
property === $TRACK ||
|
|
129
|
-
property === $NODE ||
|
|
130
|
-
property === $HAS ||
|
|
131
|
-
property === "__proto__"
|
|
132
|
-
)
|
|
133
|
-
return true;
|
|
109
|
+
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return true;
|
|
134
110
|
getListener() && getNode(getNodes(target, $HAS), property)();
|
|
135
111
|
return property in target;
|
|
136
112
|
},
|
|
@@ -159,7 +135,7 @@ function setProperty(state, property, value, deleting = false) {
|
|
|
159
135
|
}
|
|
160
136
|
let nodes = getNodes(state, $NODE),
|
|
161
137
|
node;
|
|
162
|
-
if (
|
|
138
|
+
if (node = getNode(nodes, property, prev)) node.$(() => value);
|
|
163
139
|
if (Array.isArray(state) && state.length !== len) {
|
|
164
140
|
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
165
141
|
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
@@ -205,7 +181,11 @@ function updatePath(current, path, traversed = []) {
|
|
|
205
181
|
}
|
|
206
182
|
return;
|
|
207
183
|
} else if (isArray && partType === "object") {
|
|
208
|
-
const {
|
|
184
|
+
const {
|
|
185
|
+
from = 0,
|
|
186
|
+
to = current.length - 1,
|
|
187
|
+
by = 1
|
|
188
|
+
} = part;
|
|
209
189
|
for (let i = from; i <= to; i += by) {
|
|
210
190
|
updatePath(current, [i].concat(path), traversed);
|
|
211
191
|
}
|
|
@@ -224,17 +204,14 @@ function updatePath(current, path, traversed = []) {
|
|
|
224
204
|
}
|
|
225
205
|
if (part === undefined && value == undefined) return;
|
|
226
206
|
value = unwrap(value);
|
|
227
|
-
if (part === undefined ||
|
|
207
|
+
if (part === undefined || isWrappable(prev) && isWrappable(value) && !Array.isArray(value)) {
|
|
228
208
|
mergeStoreNode(prev, value);
|
|
229
209
|
} else setProperty(current, part, value);
|
|
230
210
|
}
|
|
231
211
|
function createStore(...[store, options]) {
|
|
232
212
|
const unwrappedStore = unwrap(store || {});
|
|
233
213
|
const isArray = Array.isArray(unwrappedStore);
|
|
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
|
-
);
|
|
214
|
+
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createStore'. Expected an object.`);
|
|
238
215
|
const wrappedStore = wrap$1(unwrappedStore);
|
|
239
216
|
DEV$1.registerGraph({
|
|
240
217
|
value: unwrappedStore,
|
|
@@ -242,9 +219,7 @@ function createStore(...[store, options]) {
|
|
|
242
219
|
});
|
|
243
220
|
function setStore(...args) {
|
|
244
221
|
batch(() => {
|
|
245
|
-
isArray && args.length === 1
|
|
246
|
-
? updateArray(unwrappedStore, args[0])
|
|
247
|
-
: updatePath(unwrappedStore, args);
|
|
222
|
+
isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
|
|
248
223
|
});
|
|
249
224
|
}
|
|
250
225
|
return [wrappedStore, setStore];
|
|
@@ -252,19 +227,11 @@ function createStore(...[store, options]) {
|
|
|
252
227
|
|
|
253
228
|
function proxyDescriptor(target, property) {
|
|
254
229
|
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
255
|
-
if (
|
|
256
|
-
!desc ||
|
|
257
|
-
desc.get ||
|
|
258
|
-
desc.set ||
|
|
259
|
-
!desc.configurable ||
|
|
260
|
-
property === $PROXY ||
|
|
261
|
-
property === $NODE
|
|
262
|
-
)
|
|
263
|
-
return desc;
|
|
230
|
+
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
264
231
|
delete desc.value;
|
|
265
232
|
delete desc.writable;
|
|
266
233
|
desc.get = () => target[$PROXY][property];
|
|
267
|
-
desc.set = v =>
|
|
234
|
+
desc.set = v => target[$PROXY][property] = v;
|
|
268
235
|
return desc;
|
|
269
236
|
}
|
|
270
237
|
const proxyTraps = {
|
|
@@ -282,24 +249,14 @@ const proxyTraps = {
|
|
|
282
249
|
if (!tracked) {
|
|
283
250
|
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
284
251
|
const isFunction = typeof value === "function";
|
|
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]) {
|
|
252
|
+
if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
288
253
|
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
289
254
|
}
|
|
290
255
|
}
|
|
291
256
|
return isWrappable(value) ? wrap(value) : value;
|
|
292
257
|
},
|
|
293
258
|
has(target, property) {
|
|
294
|
-
if (
|
|
295
|
-
property === $RAW ||
|
|
296
|
-
property === $PROXY ||
|
|
297
|
-
property === $TRACK ||
|
|
298
|
-
property === $NODE ||
|
|
299
|
-
property === $HAS ||
|
|
300
|
-
property === "__proto__"
|
|
301
|
-
)
|
|
302
|
-
return true;
|
|
259
|
+
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return true;
|
|
303
260
|
getListener() && getNode(getNodes(target, $HAS), property)();
|
|
304
261
|
return property in target;
|
|
305
262
|
},
|
|
@@ -318,17 +275,12 @@ function wrap(value) {
|
|
|
318
275
|
let p = value[$PROXY];
|
|
319
276
|
if (!p) {
|
|
320
277
|
Object.defineProperty(value, $PROXY, {
|
|
321
|
-
value:
|
|
278
|
+
value: p = new Proxy(value, proxyTraps)
|
|
322
279
|
});
|
|
323
280
|
const keys = Object.keys(value),
|
|
324
281
|
desc = Object.getOwnPropertyDescriptors(value);
|
|
325
282
|
const proto = Object.getPrototypeOf(value);
|
|
326
|
-
const isClass =
|
|
327
|
-
proto !== null &&
|
|
328
|
-
value !== null &&
|
|
329
|
-
typeof value === "object" &&
|
|
330
|
-
!Array.isArray(value) &&
|
|
331
|
-
proto !== Object.prototype;
|
|
283
|
+
const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
|
|
332
284
|
if (isClass) {
|
|
333
285
|
const descriptors = Object.getOwnPropertyDescriptors(proto);
|
|
334
286
|
keys.push(...Object.keys(descriptors));
|
|
@@ -358,10 +310,7 @@ function wrap(value) {
|
|
|
358
310
|
}
|
|
359
311
|
function createMutable(state, options) {
|
|
360
312
|
const unwrappedStore = unwrap(state || {});
|
|
361
|
-
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function")
|
|
362
|
-
throw new Error(
|
|
363
|
-
`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`
|
|
364
|
-
);
|
|
313
|
+
if (typeof unwrappedStore !== "object" && typeof unwrappedStore !== "function") throw new Error(`Unexpected type ${typeof unwrappedStore} received when initializing 'createMutable'. Expected an object.`);
|
|
365
314
|
const wrappedStore = wrap(unwrappedStore);
|
|
366
315
|
DEV$1.registerGraph({
|
|
367
316
|
value: unwrappedStore,
|
|
@@ -378,42 +327,19 @@ function applyState(target, parent, property, merge, key) {
|
|
|
378
327
|
const previous = parent[property];
|
|
379
328
|
if (target === previous) return;
|
|
380
329
|
const isArray = Array.isArray(target);
|
|
381
|
-
if (
|
|
382
|
-
property !== $ROOT &&
|
|
383
|
-
(!isWrappable(target) ||
|
|
384
|
-
!isWrappable(previous) ||
|
|
385
|
-
isArray !== Array.isArray(previous) ||
|
|
386
|
-
(key && target[key] !== previous[key]))
|
|
387
|
-
) {
|
|
330
|
+
if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || isArray !== Array.isArray(previous) || key && target[key] !== previous[key])) {
|
|
388
331
|
setProperty(parent, property, target);
|
|
389
332
|
return;
|
|
390
333
|
}
|
|
391
334
|
if (isArray) {
|
|
392
|
-
if (
|
|
393
|
-
target.length &&
|
|
394
|
-
previous.length &&
|
|
395
|
-
(!merge || (key && target[0] && target[0][key] != null))
|
|
396
|
-
) {
|
|
335
|
+
if (target.length && previous.length && (!merge || key && target[0] && target[0][key] != null)) {
|
|
397
336
|
let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
|
|
398
|
-
for (
|
|
399
|
-
start = 0, end = Math.min(previous.length, target.length);
|
|
400
|
-
start < end &&
|
|
401
|
-
(previous[start] === target[start] ||
|
|
402
|
-
(key && previous[start] && target[start] && previous[start][key] === target[start][key]));
|
|
403
|
-
start++
|
|
404
|
-
) {
|
|
337
|
+
for (start = 0, end = Math.min(previous.length, target.length); start < end && (previous[start] === target[start] || key && previous[start] && target[start] && previous[start][key] === target[start][key]); start++) {
|
|
405
338
|
applyState(target[start], previous, start, merge, key);
|
|
406
339
|
}
|
|
407
340
|
const temp = new Array(target.length),
|
|
408
341
|
newIndices = new Map();
|
|
409
|
-
for (
|
|
410
|
-
end = previous.length - 1, newEnd = target.length - 1;
|
|
411
|
-
end >= start &&
|
|
412
|
-
newEnd >= start &&
|
|
413
|
-
(previous[end] === target[newEnd] ||
|
|
414
|
-
(key && previous[end] && target[newEnd] && previous[end][key] === target[newEnd][key]));
|
|
415
|
-
end--, newEnd--
|
|
416
|
-
) {
|
|
342
|
+
for (end = previous.length - 1, newEnd = target.length - 1; end >= start && newEnd >= start && (previous[end] === target[newEnd] || key && previous[end] && target[newEnd] && previous[end][key] === target[newEnd][key]); end--, newEnd--) {
|
|
417
343
|
temp[newEnd] = previous[end];
|
|
418
344
|
}
|
|
419
345
|
if (start > newEnd || start > end) {
|
|
@@ -467,19 +393,16 @@ function applyState(target, parent, property, merge, key) {
|
|
|
467
393
|
}
|
|
468
394
|
}
|
|
469
395
|
function reconcile(value, options = {}) {
|
|
470
|
-
const {
|
|
396
|
+
const {
|
|
397
|
+
merge,
|
|
398
|
+
key = "id"
|
|
399
|
+
} = options,
|
|
471
400
|
v = unwrap(value);
|
|
472
401
|
return state => {
|
|
473
402
|
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
474
|
-
const res = applyState(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
[$ROOT]: state
|
|
478
|
-
},
|
|
479
|
-
$ROOT,
|
|
480
|
-
merge,
|
|
481
|
-
key
|
|
482
|
-
);
|
|
403
|
+
const res = applyState(v, {
|
|
404
|
+
[$ROOT]: state
|
|
405
|
+
}, $ROOT, merge, key);
|
|
483
406
|
return res === undefined ? state : res;
|
|
484
407
|
};
|
|
485
408
|
}
|
|
@@ -489,10 +412,7 @@ const setterTraps = {
|
|
|
489
412
|
if (property === $RAW) return target;
|
|
490
413
|
const value = target[property];
|
|
491
414
|
let proxy;
|
|
492
|
-
return isWrappable(value)
|
|
493
|
-
? producers.get(value) ||
|
|
494
|
-
(producers.set(value, (proxy = new Proxy(value, setterTraps))), proxy)
|
|
495
|
-
: value;
|
|
415
|
+
return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
|
|
496
416
|
},
|
|
497
417
|
set(target, property, value) {
|
|
498
418
|
setProperty(target, property, unwrap(value));
|
|
@@ -508,7 +428,7 @@ function produce(fn) {
|
|
|
508
428
|
if (isWrappable(state)) {
|
|
509
429
|
let proxy;
|
|
510
430
|
if (!(proxy = producers.get(state))) {
|
|
511
|
-
producers.set(state,
|
|
431
|
+
producers.set(state, proxy = new Proxy(state, setterTraps));
|
|
512
432
|
}
|
|
513
433
|
fn(proxy);
|
|
514
434
|
}
|
|
@@ -520,6 +440,6 @@ const DEV = {
|
|
|
520
440
|
$NODE,
|
|
521
441
|
isWrappable,
|
|
522
442
|
hooks: DevHooks
|
|
523
|
-
};
|
|
443
|
+
} ;
|
|
524
444
|
|
|
525
445
|
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/dist/server.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
const $RAW = Symbol("state-raw");
|
|
2
2
|
function isWrappable(obj) {
|
|
3
|
-
return (
|
|
4
|
-
obj != null &&
|
|
5
|
-
typeof obj === "object" &&
|
|
6
|
-
(Object.getPrototypeOf(obj) === Object.prototype || Array.isArray(obj))
|
|
7
|
-
);
|
|
3
|
+
return obj != null && typeof obj === "object" && (Object.getPrototypeOf(obj) === Object.prototype || Array.isArray(obj));
|
|
8
4
|
}
|
|
9
5
|
function unwrap(item) {
|
|
10
6
|
return item;
|
|
@@ -53,7 +49,11 @@ function updatePath(current, path, traversed = []) {
|
|
|
53
49
|
}
|
|
54
50
|
return;
|
|
55
51
|
} else if (isArray && partType === "object") {
|
|
56
|
-
const {
|
|
52
|
+
const {
|
|
53
|
+
from = 0,
|
|
54
|
+
to = current.length - 1,
|
|
55
|
+
by = 1
|
|
56
|
+
} = 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 ||
|
|
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
|
}
|
|
@@ -111,16 +111,4 @@ function produce(fn) {
|
|
|
111
111
|
}
|
|
112
112
|
const DEV = undefined;
|
|
113
113
|
|
|
114
|
-
export {
|
|
115
|
-
$RAW,
|
|
116
|
-
DEV,
|
|
117
|
-
createMutable,
|
|
118
|
-
createStore,
|
|
119
|
-
isWrappable,
|
|
120
|
-
modifyMutable,
|
|
121
|
-
produce,
|
|
122
|
-
reconcile,
|
|
123
|
-
setProperty,
|
|
124
|
-
unwrap,
|
|
125
|
-
updatePath
|
|
126
|
-
};
|
|
114
|
+
export { $RAW, DEV, createMutable, createStore, isWrappable, modifyMutable, produce, reconcile, setProperty, unwrap, updatePath };
|