solid-js 1.9.11 → 2.0.0-beta.0
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 +733 -1678
- package/dist/dev.js +598 -1643
- package/dist/server.cjs +769 -703
- package/dist/server.js +682 -670
- package/dist/solid.cjs +699 -1618
- package/dist/solid.js +563 -1582
- package/package.json +7 -151
- package/types/{render → client}/component.d.ts +1 -38
- package/types/client/core.d.ts +65 -0
- package/types/client/flow.d.ts +100 -0
- package/types/client/hydration.d.ts +76 -0
- package/types/index.d.ts +11 -14
- package/types/jsx.d.ts +1508 -1633
- package/types/server/component.d.ts +66 -0
- package/types/server/core.d.ts +44 -0
- package/types/server/flow.d.ts +60 -0
- package/types/server/hydration.d.ts +21 -0
- package/types/server/index.d.ts +12 -3
- package/types/server/shared.d.ts +45 -0
- package/types/server/signals.d.ts +60 -0
- package/h/dist/h.cjs +0 -115
- package/h/dist/h.js +0 -113
- package/h/jsx-dev-runtime/package.json +0 -8
- package/h/jsx-runtime/dist/jsx.cjs +0 -15
- package/h/jsx-runtime/dist/jsx.js +0 -10
- package/h/jsx-runtime/package.json +0 -8
- package/h/jsx-runtime/types/index.d.ts +0 -11
- package/h/jsx-runtime/types/jsx.d.ts +0 -4242
- package/h/package.json +0 -8
- package/h/types/hyperscript.d.ts +0 -20
- package/h/types/index.d.ts +0 -3
- package/html/dist/html.cjs +0 -583
- package/html/dist/html.js +0 -581
- package/html/package.json +0 -8
- package/html/types/index.d.ts +0 -3
- package/html/types/lit.d.ts +0 -41
- package/store/dist/dev.cjs +0 -458
- package/store/dist/dev.js +0 -449
- package/store/dist/server.cjs +0 -126
- package/store/dist/server.js +0 -114
- package/store/dist/store.cjs +0 -438
- package/store/dist/store.js +0 -429
- package/store/package.json +0 -46
- package/store/types/index.d.ts +0 -12
- package/store/types/modifiers.d.ts +0 -6
- package/store/types/mutable.d.ts +0 -5
- package/store/types/server.d.ts +0 -17
- package/store/types/store.d.ts +0 -107
- package/types/reactive/array.d.ts +0 -44
- package/types/reactive/observable.d.ts +0 -36
- package/types/reactive/scheduler.d.ts +0 -10
- package/types/reactive/signal.d.ts +0 -577
- package/types/render/Suspense.d.ts +0 -26
- package/types/render/flow.d.ts +0 -118
- package/types/render/hydration.d.ts +0 -24
- package/types/render/index.d.ts +0 -4
- package/types/server/reactive.d.ts +0 -98
- package/types/server/rendering.d.ts +0 -159
- package/universal/dist/dev.cjs +0 -245
- package/universal/dist/dev.js +0 -243
- package/universal/dist/universal.cjs +0 -245
- package/universal/dist/universal.js +0 -243
- package/universal/package.json +0 -20
- package/universal/types/index.d.ts +0 -3
- package/universal/types/universal.d.ts +0 -30
- package/web/dist/dev.cjs +0 -894
- package/web/dist/dev.js +0 -782
- package/web/dist/server.cjs +0 -892
- package/web/dist/server.js +0 -782
- package/web/dist/web.cjs +0 -883
- package/web/dist/web.js +0 -771
- package/web/package.json +0 -46
- package/web/storage/dist/storage.cjs +0 -12
- package/web/storage/dist/storage.js +0 -10
- package/web/storage/package.json +0 -15
- package/web/storage/types/index.d.ts +0 -2
- package/web/types/client.d.ts +0 -79
- package/web/types/core.d.ts +0 -2
- package/web/types/index.d.ts +0 -50
- package/web/types/jsx.d.ts +0 -1
- package/web/types/server-mock.d.ts +0 -65
- package/web/types/server.d.ts +0 -177
package/store/dist/store.js
DELETED
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';
|
|
2
|
-
|
|
3
|
-
const $RAW = Symbol("store-raw"),
|
|
4
|
-
$NODE = Symbol("store-node"),
|
|
5
|
-
$HAS = Symbol("store-has"),
|
|
6
|
-
$SELF = Symbol("store-self");
|
|
7
|
-
function wrap$1(value) {
|
|
8
|
-
let p = value[$PROXY];
|
|
9
|
-
if (!p) {
|
|
10
|
-
Object.defineProperty(value, $PROXY, {
|
|
11
|
-
value: p = new Proxy(value, proxyTraps$1)
|
|
12
|
-
});
|
|
13
|
-
if (!Array.isArray(value)) {
|
|
14
|
-
const keys = Object.keys(value),
|
|
15
|
-
desc = Object.getOwnPropertyDescriptors(value);
|
|
16
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
17
|
-
const prop = keys[i];
|
|
18
|
-
if (desc[prop].get) {
|
|
19
|
-
Object.defineProperty(value, prop, {
|
|
20
|
-
enumerable: desc[prop].enumerable,
|
|
21
|
-
get: desc[prop].get.bind(p)
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return p;
|
|
28
|
-
}
|
|
29
|
-
function isWrappable(obj) {
|
|
30
|
-
let proto;
|
|
31
|
-
return obj != null && typeof obj === "object" && (obj[$PROXY] || !(proto = Object.getPrototypeOf(obj)) || proto === Object.prototype || Array.isArray(obj));
|
|
32
|
-
}
|
|
33
|
-
function unwrap(item, set = new Set()) {
|
|
34
|
-
let result, unwrapped, v, prop;
|
|
35
|
-
if (result = item != null && item[$RAW]) return result;
|
|
36
|
-
if (!isWrappable(item) || set.has(item)) return item;
|
|
37
|
-
if (Array.isArray(item)) {
|
|
38
|
-
if (Object.isFrozen(item)) item = item.slice(0);else set.add(item);
|
|
39
|
-
for (let i = 0, l = item.length; i < l; i++) {
|
|
40
|
-
v = item[i];
|
|
41
|
-
if ((unwrapped = unwrap(v, set)) !== v) item[i] = unwrapped;
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
if (Object.isFrozen(item)) item = Object.assign({}, item);else set.add(item);
|
|
45
|
-
const keys = Object.keys(item),
|
|
46
|
-
desc = Object.getOwnPropertyDescriptors(item);
|
|
47
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
48
|
-
prop = keys[i];
|
|
49
|
-
if (desc[prop].get) continue;
|
|
50
|
-
v = item[prop];
|
|
51
|
-
if ((unwrapped = unwrap(v, set)) !== v) item[prop] = unwrapped;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return item;
|
|
55
|
-
}
|
|
56
|
-
function getNodes(target, symbol) {
|
|
57
|
-
let nodes = target[symbol];
|
|
58
|
-
if (!nodes) Object.defineProperty(target, symbol, {
|
|
59
|
-
value: nodes = Object.create(null)
|
|
60
|
-
});
|
|
61
|
-
return nodes;
|
|
62
|
-
}
|
|
63
|
-
function getNode(nodes, property, value) {
|
|
64
|
-
if (nodes[property]) return nodes[property];
|
|
65
|
-
const [s, set] = createSignal(value, {
|
|
66
|
-
equals: false,
|
|
67
|
-
internal: true
|
|
68
|
-
});
|
|
69
|
-
s.$ = set;
|
|
70
|
-
return nodes[property] = s;
|
|
71
|
-
}
|
|
72
|
-
function proxyDescriptor$1(target, property) {
|
|
73
|
-
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
74
|
-
if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
75
|
-
delete desc.value;
|
|
76
|
-
delete desc.writable;
|
|
77
|
-
desc.get = () => target[$PROXY][property];
|
|
78
|
-
return desc;
|
|
79
|
-
}
|
|
80
|
-
function trackSelf(target) {
|
|
81
|
-
getListener() && getNode(getNodes(target, $NODE), $SELF)();
|
|
82
|
-
}
|
|
83
|
-
function ownKeys(target) {
|
|
84
|
-
trackSelf(target);
|
|
85
|
-
return Reflect.ownKeys(target);
|
|
86
|
-
}
|
|
87
|
-
const proxyTraps$1 = {
|
|
88
|
-
get(target, property, receiver) {
|
|
89
|
-
if (property === $RAW) return target;
|
|
90
|
-
if (property === $PROXY) return receiver;
|
|
91
|
-
if (property === $TRACK) {
|
|
92
|
-
trackSelf(target);
|
|
93
|
-
return receiver;
|
|
94
|
-
}
|
|
95
|
-
const nodes = getNodes(target, $NODE);
|
|
96
|
-
const tracked = nodes[property];
|
|
97
|
-
let value = tracked ? tracked() : target[property];
|
|
98
|
-
if (property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
99
|
-
if (!tracked) {
|
|
100
|
-
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
101
|
-
if (getListener() && (typeof value !== "function" || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();
|
|
102
|
-
}
|
|
103
|
-
return isWrappable(value) ? wrap$1(value) : value;
|
|
104
|
-
},
|
|
105
|
-
has(target, property) {
|
|
106
|
-
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return true;
|
|
107
|
-
getListener() && getNode(getNodes(target, $HAS), property)();
|
|
108
|
-
return property in target;
|
|
109
|
-
},
|
|
110
|
-
set() {
|
|
111
|
-
return true;
|
|
112
|
-
},
|
|
113
|
-
deleteProperty() {
|
|
114
|
-
return true;
|
|
115
|
-
},
|
|
116
|
-
ownKeys: ownKeys,
|
|
117
|
-
getOwnPropertyDescriptor: proxyDescriptor$1
|
|
118
|
-
};
|
|
119
|
-
function setProperty(state, property, value, deleting = false) {
|
|
120
|
-
if (!deleting && state[property] === value) return;
|
|
121
|
-
const prev = state[property],
|
|
122
|
-
len = state.length;
|
|
123
|
-
if (value === undefined) {
|
|
124
|
-
delete state[property];
|
|
125
|
-
if (state[$HAS] && state[$HAS][property] && prev !== undefined) state[$HAS][property].$();
|
|
126
|
-
} else {
|
|
127
|
-
state[property] = value;
|
|
128
|
-
if (state[$HAS] && state[$HAS][property] && prev === undefined) state[$HAS][property].$();
|
|
129
|
-
}
|
|
130
|
-
let nodes = getNodes(state, $NODE),
|
|
131
|
-
node;
|
|
132
|
-
if (node = getNode(nodes, property, prev)) node.$(() => value);
|
|
133
|
-
if (Array.isArray(state) && state.length !== len) {
|
|
134
|
-
for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
|
|
135
|
-
(node = getNode(nodes, "length", len)) && node.$(state.length);
|
|
136
|
-
}
|
|
137
|
-
(node = nodes[$SELF]) && node.$();
|
|
138
|
-
}
|
|
139
|
-
function mergeStoreNode(state, value) {
|
|
140
|
-
const keys = Object.keys(value);
|
|
141
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
142
|
-
const key = keys[i];
|
|
143
|
-
setProperty(state, key, value[key]);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function updateArray(current, next) {
|
|
147
|
-
if (typeof next === "function") next = next(current);
|
|
148
|
-
next = unwrap(next);
|
|
149
|
-
if (Array.isArray(next)) {
|
|
150
|
-
if (current === next) return;
|
|
151
|
-
let i = 0,
|
|
152
|
-
len = next.length;
|
|
153
|
-
for (; i < len; i++) {
|
|
154
|
-
const value = next[i];
|
|
155
|
-
if (current[i] !== value) setProperty(current, i, value);
|
|
156
|
-
}
|
|
157
|
-
setProperty(current, "length", len);
|
|
158
|
-
} else mergeStoreNode(current, next);
|
|
159
|
-
}
|
|
160
|
-
function updatePath(current, path, traversed = []) {
|
|
161
|
-
let part,
|
|
162
|
-
prev = current;
|
|
163
|
-
if (path.length > 1) {
|
|
164
|
-
part = path.shift();
|
|
165
|
-
const partType = typeof part,
|
|
166
|
-
isArray = Array.isArray(current);
|
|
167
|
-
if (Array.isArray(part)) {
|
|
168
|
-
for (let i = 0; i < part.length; i++) {
|
|
169
|
-
updatePath(current, [part[i]].concat(path), traversed);
|
|
170
|
-
}
|
|
171
|
-
return;
|
|
172
|
-
} else if (isArray && partType === "function") {
|
|
173
|
-
for (let i = 0; i < current.length; i++) {
|
|
174
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
175
|
-
}
|
|
176
|
-
return;
|
|
177
|
-
} else if (isArray && partType === "object") {
|
|
178
|
-
const {
|
|
179
|
-
from = 0,
|
|
180
|
-
to = current.length - 1,
|
|
181
|
-
by = 1
|
|
182
|
-
} = part;
|
|
183
|
-
for (let i = from; i <= to; i += by) {
|
|
184
|
-
updatePath(current, [i].concat(path), traversed);
|
|
185
|
-
}
|
|
186
|
-
return;
|
|
187
|
-
} else if (path.length > 1) {
|
|
188
|
-
updatePath(current[part], path, [part].concat(traversed));
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
prev = current[part];
|
|
192
|
-
traversed = [part].concat(traversed);
|
|
193
|
-
}
|
|
194
|
-
let value = path[0];
|
|
195
|
-
if (typeof value === "function") {
|
|
196
|
-
value = value(prev, traversed);
|
|
197
|
-
if (value === prev) return;
|
|
198
|
-
}
|
|
199
|
-
if (part === undefined && value == undefined) return;
|
|
200
|
-
value = unwrap(value);
|
|
201
|
-
if (part === undefined || isWrappable(prev) && isWrappable(value) && !Array.isArray(value)) {
|
|
202
|
-
mergeStoreNode(prev, value);
|
|
203
|
-
} else setProperty(current, part, value);
|
|
204
|
-
}
|
|
205
|
-
function createStore(...[store, options]) {
|
|
206
|
-
const unwrappedStore = unwrap(store || {});
|
|
207
|
-
const isArray = Array.isArray(unwrappedStore);
|
|
208
|
-
const wrappedStore = wrap$1(unwrappedStore);
|
|
209
|
-
function setStore(...args) {
|
|
210
|
-
batch(() => {
|
|
211
|
-
isArray && args.length === 1 ? updateArray(unwrappedStore, args[0]) : updatePath(unwrappedStore, args);
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
return [wrappedStore, setStore];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function proxyDescriptor(target, property) {
|
|
218
|
-
const desc = Reflect.getOwnPropertyDescriptor(target, property);
|
|
219
|
-
if (!desc || desc.get || desc.set || !desc.configurable || property === $PROXY || property === $NODE) return desc;
|
|
220
|
-
delete desc.value;
|
|
221
|
-
delete desc.writable;
|
|
222
|
-
desc.get = () => target[$PROXY][property];
|
|
223
|
-
desc.set = v => target[$PROXY][property] = v;
|
|
224
|
-
return desc;
|
|
225
|
-
}
|
|
226
|
-
const proxyTraps = {
|
|
227
|
-
get(target, property, receiver) {
|
|
228
|
-
if (property === $RAW) return target;
|
|
229
|
-
if (property === $PROXY) return receiver;
|
|
230
|
-
if (property === $TRACK) {
|
|
231
|
-
trackSelf(target);
|
|
232
|
-
return receiver;
|
|
233
|
-
}
|
|
234
|
-
const nodes = getNodes(target, $NODE);
|
|
235
|
-
const tracked = nodes[property];
|
|
236
|
-
let value = tracked ? tracked() : target[property];
|
|
237
|
-
if (property === $NODE || property === $HAS || property === "__proto__") return value;
|
|
238
|
-
if (!tracked) {
|
|
239
|
-
const desc = Object.getOwnPropertyDescriptor(target, property);
|
|
240
|
-
const isFunction = typeof value === "function";
|
|
241
|
-
if (getListener() && (!isFunction || target.hasOwnProperty(property)) && !(desc && desc.get)) value = getNode(nodes, property, value)();else if (value != null && isFunction && value === Array.prototype[property]) {
|
|
242
|
-
return (...args) => batch(() => Array.prototype[property].apply(receiver, args));
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return isWrappable(value) ? wrap(value) : value;
|
|
246
|
-
},
|
|
247
|
-
has(target, property) {
|
|
248
|
-
if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === $HAS || property === "__proto__") return true;
|
|
249
|
-
getListener() && getNode(getNodes(target, $HAS), property)();
|
|
250
|
-
return property in target;
|
|
251
|
-
},
|
|
252
|
-
set(target, property, value) {
|
|
253
|
-
batch(() => setProperty(target, property, unwrap(value)));
|
|
254
|
-
return true;
|
|
255
|
-
},
|
|
256
|
-
deleteProperty(target, property) {
|
|
257
|
-
batch(() => setProperty(target, property, undefined, true));
|
|
258
|
-
return true;
|
|
259
|
-
},
|
|
260
|
-
ownKeys: ownKeys,
|
|
261
|
-
getOwnPropertyDescriptor: proxyDescriptor
|
|
262
|
-
};
|
|
263
|
-
function wrap(value) {
|
|
264
|
-
let p = value[$PROXY];
|
|
265
|
-
if (!p) {
|
|
266
|
-
Object.defineProperty(value, $PROXY, {
|
|
267
|
-
value: p = new Proxy(value, proxyTraps)
|
|
268
|
-
});
|
|
269
|
-
const keys = Object.keys(value),
|
|
270
|
-
desc = Object.getOwnPropertyDescriptors(value);
|
|
271
|
-
const proto = Object.getPrototypeOf(value);
|
|
272
|
-
const isClass = proto !== null && value !== null && typeof value === "object" && !Array.isArray(value) && proto !== Object.prototype;
|
|
273
|
-
if (isClass) {
|
|
274
|
-
let curProto = proto;
|
|
275
|
-
while (curProto != null) {
|
|
276
|
-
const descriptors = Object.getOwnPropertyDescriptors(curProto);
|
|
277
|
-
keys.push(...Object.keys(descriptors));
|
|
278
|
-
Object.assign(desc, descriptors);
|
|
279
|
-
curProto = Object.getPrototypeOf(curProto);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
283
|
-
const prop = keys[i];
|
|
284
|
-
if (isClass && prop === "constructor") continue;
|
|
285
|
-
if (desc[prop].get) {
|
|
286
|
-
const get = desc[prop].get.bind(p);
|
|
287
|
-
Object.defineProperty(value, prop, {
|
|
288
|
-
get,
|
|
289
|
-
configurable: true
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
if (desc[prop].set) {
|
|
293
|
-
const og = desc[prop].set,
|
|
294
|
-
set = v => batch(() => og.call(p, v));
|
|
295
|
-
Object.defineProperty(value, prop, {
|
|
296
|
-
set,
|
|
297
|
-
configurable: true
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
return p;
|
|
303
|
-
}
|
|
304
|
-
function createMutable(state, options) {
|
|
305
|
-
const unwrappedStore = unwrap(state || {});
|
|
306
|
-
const wrappedStore = wrap(unwrappedStore);
|
|
307
|
-
return wrappedStore;
|
|
308
|
-
}
|
|
309
|
-
function modifyMutable(state, modifier) {
|
|
310
|
-
batch(() => modifier(unwrap(state)));
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const $ROOT = Symbol("store-root");
|
|
314
|
-
function applyState(target, parent, property, merge, key) {
|
|
315
|
-
const previous = parent[property];
|
|
316
|
-
if (target === previous) return;
|
|
317
|
-
const isArray = Array.isArray(target);
|
|
318
|
-
if (property !== $ROOT && (!isWrappable(target) || !isWrappable(previous) || isArray !== Array.isArray(previous) || key && target[key] !== previous[key])) {
|
|
319
|
-
setProperty(parent, property, target);
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
if (isArray) {
|
|
323
|
-
if (target.length && previous.length && (!merge || key && target[0] && target[0][key] != null)) {
|
|
324
|
-
let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
|
|
325
|
-
for (start = 0, end = Math.min(previous.length, target.length); start < end && (previous[start] === target[start] || key && previous[start] && target[start] && previous[start][key] && previous[start][key] === target[start][key]); start++) {
|
|
326
|
-
applyState(target[start], previous, start, merge, key);
|
|
327
|
-
}
|
|
328
|
-
const temp = new Array(target.length),
|
|
329
|
-
newIndices = new Map();
|
|
330
|
-
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] && previous[end][key] === target[newEnd][key]); end--, newEnd--) {
|
|
331
|
-
temp[newEnd] = previous[end];
|
|
332
|
-
}
|
|
333
|
-
if (start > newEnd || start > end) {
|
|
334
|
-
for (j = start; j <= newEnd; j++) setProperty(previous, j, target[j]);
|
|
335
|
-
for (; j < target.length; j++) {
|
|
336
|
-
setProperty(previous, j, temp[j]);
|
|
337
|
-
applyState(target[j], previous, j, merge, key);
|
|
338
|
-
}
|
|
339
|
-
if (previous.length > target.length) setProperty(previous, "length", target.length);
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
newIndicesNext = new Array(newEnd + 1);
|
|
343
|
-
for (j = newEnd; j >= start; j--) {
|
|
344
|
-
item = target[j];
|
|
345
|
-
keyVal = key && item ? item[key] : item;
|
|
346
|
-
i = newIndices.get(keyVal);
|
|
347
|
-
newIndicesNext[j] = i === undefined ? -1 : i;
|
|
348
|
-
newIndices.set(keyVal, j);
|
|
349
|
-
}
|
|
350
|
-
for (i = start; i <= end; i++) {
|
|
351
|
-
item = previous[i];
|
|
352
|
-
keyVal = key && item ? item[key] : item;
|
|
353
|
-
j = newIndices.get(keyVal);
|
|
354
|
-
if (j !== undefined && j !== -1) {
|
|
355
|
-
temp[j] = previous[i];
|
|
356
|
-
j = newIndicesNext[j];
|
|
357
|
-
newIndices.set(keyVal, j);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
for (j = start; j < target.length; j++) {
|
|
361
|
-
if (j in temp) {
|
|
362
|
-
setProperty(previous, j, temp[j]);
|
|
363
|
-
applyState(target[j], previous, j, merge, key);
|
|
364
|
-
} else setProperty(previous, j, target[j]);
|
|
365
|
-
}
|
|
366
|
-
} else {
|
|
367
|
-
for (let i = 0, len = target.length; i < len; i++) {
|
|
368
|
-
applyState(target[i], previous, i, merge, key);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (previous.length > target.length) setProperty(previous, "length", target.length);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
const targetKeys = Object.keys(target);
|
|
375
|
-
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
376
|
-
applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
|
|
377
|
-
}
|
|
378
|
-
const previousKeys = Object.keys(previous);
|
|
379
|
-
for (let i = 0, len = previousKeys.length; i < len; i++) {
|
|
380
|
-
if (target[previousKeys[i]] === undefined) setProperty(previous, previousKeys[i], undefined);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
function reconcile(value, options = {}) {
|
|
384
|
-
const {
|
|
385
|
-
merge,
|
|
386
|
-
key = "id"
|
|
387
|
-
} = options,
|
|
388
|
-
v = unwrap(value);
|
|
389
|
-
return state => {
|
|
390
|
-
if (!isWrappable(state) || !isWrappable(v)) return v;
|
|
391
|
-
const res = applyState(v, {
|
|
392
|
-
[$ROOT]: state
|
|
393
|
-
}, $ROOT, merge, key);
|
|
394
|
-
return res === undefined ? state : res;
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
const producers = new WeakMap();
|
|
398
|
-
const setterTraps = {
|
|
399
|
-
get(target, property) {
|
|
400
|
-
if (property === $RAW) return target;
|
|
401
|
-
const value = target[property];
|
|
402
|
-
let proxy;
|
|
403
|
-
return isWrappable(value) ? producers.get(value) || (producers.set(value, proxy = new Proxy(value, setterTraps)), proxy) : value;
|
|
404
|
-
},
|
|
405
|
-
set(target, property, value) {
|
|
406
|
-
setProperty(target, property, unwrap(value));
|
|
407
|
-
return true;
|
|
408
|
-
},
|
|
409
|
-
deleteProperty(target, property) {
|
|
410
|
-
setProperty(target, property, undefined, true);
|
|
411
|
-
return true;
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
function produce(fn) {
|
|
415
|
-
return state => {
|
|
416
|
-
if (isWrappable(state)) {
|
|
417
|
-
let proxy;
|
|
418
|
-
if (!(proxy = producers.get(state))) {
|
|
419
|
-
producers.set(state, proxy = new Proxy(state, setterTraps));
|
|
420
|
-
}
|
|
421
|
-
fn(proxy);
|
|
422
|
-
}
|
|
423
|
-
return state;
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
const DEV = undefined;
|
|
428
|
-
|
|
429
|
-
export { $RAW, DEV, createMutable, createStore, modifyMutable, produce, reconcile, unwrap };
|
package/store/package.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "solid-js/store",
|
|
3
|
-
"main": "./dist/server.cjs",
|
|
4
|
-
"module": "./dist/server.js",
|
|
5
|
-
"unpkg": "./dist/store.cjs",
|
|
6
|
-
"types": "./types/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"sideEffects": false,
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"worker": {
|
|
12
|
-
"types": "./types/index.d.ts",
|
|
13
|
-
"import": "./dist/server.js",
|
|
14
|
-
"require": "./dist/server.cjs"
|
|
15
|
-
},
|
|
16
|
-
"browser": {
|
|
17
|
-
"development": {
|
|
18
|
-
"types": "./types/index.d.ts",
|
|
19
|
-
"import": "./dist/dev.js",
|
|
20
|
-
"require": "./dist/dev.cjs"
|
|
21
|
-
},
|
|
22
|
-
"types": "./types/index.d.ts",
|
|
23
|
-
"import": "./dist/store.js",
|
|
24
|
-
"require": "./dist/store.cjs"
|
|
25
|
-
},
|
|
26
|
-
"deno": {
|
|
27
|
-
"types": "./types/index.d.ts",
|
|
28
|
-
"import": "./dist/server.js",
|
|
29
|
-
"require": "./dist/server.cjs"
|
|
30
|
-
},
|
|
31
|
-
"node": {
|
|
32
|
-
"types": "./types/index.d.ts",
|
|
33
|
-
"import": "./dist/server.js",
|
|
34
|
-
"require": "./dist/server.cjs"
|
|
35
|
-
},
|
|
36
|
-
"development": {
|
|
37
|
-
"types": "./types/index.d.ts",
|
|
38
|
-
"import": "./dist/dev.js",
|
|
39
|
-
"require": "./dist/dev.cjs"
|
|
40
|
-
},
|
|
41
|
-
"types": "./types/index.d.ts",
|
|
42
|
-
"import": "./dist/store.js",
|
|
43
|
-
"require": "./dist/store.cjs"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
package/store/types/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { $RAW, createStore, unwrap } from "./store.js";
|
|
2
|
-
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
3
|
-
export * from "./mutable.js";
|
|
4
|
-
export * from "./modifiers.js";
|
|
5
|
-
import { $NODE, isWrappable } from "./store.js";
|
|
6
|
-
export declare const DEV: {
|
|
7
|
-
readonly $NODE: typeof $NODE;
|
|
8
|
-
readonly isWrappable: typeof isWrappable;
|
|
9
|
-
readonly hooks: {
|
|
10
|
-
onStoreNodeUpdate: import("./store.js").OnStoreNodeUpdate | null;
|
|
11
|
-
};
|
|
12
|
-
} | undefined;
|
package/store/types/mutable.d.ts
DELETED
package/store/types/server.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { SetStoreFunction, Store } from "./store.js";
|
|
2
|
-
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
3
|
-
export declare const $RAW: unique symbol;
|
|
4
|
-
export declare function isWrappable(obj: any): boolean;
|
|
5
|
-
export declare function unwrap<T>(item: T): T;
|
|
6
|
-
export declare function setProperty(state: any, property: PropertyKey, value: any, force?: boolean): void;
|
|
7
|
-
export declare function updatePath(current: any, path: any[], traversed?: PropertyKey[]): void;
|
|
8
|
-
export declare function createStore<T>(state: T | Store<T>): [Store<T>, SetStoreFunction<T>];
|
|
9
|
-
export declare function createMutable<T>(state: T | Store<T>): T;
|
|
10
|
-
export declare function modifyMutable<T>(state: T, modifier: (state: T) => T): void;
|
|
11
|
-
type ReconcileOptions = {
|
|
12
|
-
key?: string | null;
|
|
13
|
-
merge?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare function reconcile<T extends U, U extends object>(value: T, options?: ReconcileOptions): (state: U) => T;
|
|
16
|
-
export declare function produce<T>(fn: (state: T) => void): (state: T) => T;
|
|
17
|
-
export declare const DEV: undefined;
|
package/store/types/store.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
export declare const IS_DEV: string | boolean;
|
|
2
|
-
export declare const $RAW: unique symbol, $NODE: unique symbol, $HAS: unique symbol, $SELF: unique symbol;
|
|
3
|
-
export declare const DevHooks: {
|
|
4
|
-
onStoreNodeUpdate: OnStoreNodeUpdate | null;
|
|
5
|
-
};
|
|
6
|
-
type DataNode = {
|
|
7
|
-
(): any;
|
|
8
|
-
$(value?: any): void;
|
|
9
|
-
};
|
|
10
|
-
export type DataNodes = Record<PropertyKey, DataNode | undefined>;
|
|
11
|
-
export type OnStoreNodeUpdate = (state: StoreNode, property: PropertyKey, value: StoreNode | NotWrappable, prev: StoreNode | NotWrappable) => void;
|
|
12
|
-
export interface StoreNode {
|
|
13
|
-
[$NODE]?: DataNodes;
|
|
14
|
-
[key: PropertyKey]: any;
|
|
15
|
-
}
|
|
16
|
-
export declare namespace SolidStore {
|
|
17
|
-
interface Unwrappable {
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
|
|
21
|
-
export type Store<T> = T;
|
|
22
|
-
export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the underlying data in the store without a proxy.
|
|
25
|
-
* @param item store proxy object
|
|
26
|
-
* @example
|
|
27
|
-
* ```js
|
|
28
|
-
* const initial = {z...};
|
|
29
|
-
* const [state, setState] = createStore(initial);
|
|
30
|
-
* initial === state; // => false
|
|
31
|
-
* initial === unwrap(state); // => true
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function unwrap<T>(item: T, set?: Set<unknown>): T;
|
|
35
|
-
export declare function getNodes(target: StoreNode, symbol: typeof $NODE | typeof $HAS): DataNodes;
|
|
36
|
-
export declare function getNode(nodes: DataNodes, property: PropertyKey, value?: any): DataNode;
|
|
37
|
-
export declare function proxyDescriptor(target: StoreNode, property: PropertyKey): TypedPropertyDescriptor<any> | undefined;
|
|
38
|
-
export declare function trackSelf(target: StoreNode): void;
|
|
39
|
-
export declare function ownKeys(target: StoreNode): (string | symbol)[];
|
|
40
|
-
export declare function setProperty(state: StoreNode, property: PropertyKey, value: any, deleting?: boolean): void;
|
|
41
|
-
export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
|
|
42
|
-
/** @deprecated */
|
|
43
|
-
export type DeepReadonly<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
|
|
44
|
-
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
45
|
-
};
|
|
46
|
-
/** @deprecated */
|
|
47
|
-
export type DeepMutable<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
|
|
48
|
-
-readonly [K in keyof T]: DeepMutable<T[K]>;
|
|
49
|
-
};
|
|
50
|
-
export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
|
|
51
|
-
[K in Extract<keyof T, `${number}`>]?: T[K];
|
|
52
|
-
} : {
|
|
53
|
-
[x: number]: T[number];
|
|
54
|
-
} : Partial<T>;
|
|
55
|
-
export type PickMutable<T> = {
|
|
56
|
-
[K in keyof T as (<U>() => U extends {
|
|
57
|
-
[V in K]: T[V];
|
|
58
|
-
} ? 1 : 2) extends <U>() => U extends {
|
|
59
|
-
-readonly [V in K]: T[V];
|
|
60
|
-
} ? 1 : 2 ? K : never]: T[K];
|
|
61
|
-
};
|
|
62
|
-
export type StorePathRange = {
|
|
63
|
-
from?: number;
|
|
64
|
-
to?: number;
|
|
65
|
-
by?: number;
|
|
66
|
-
};
|
|
67
|
-
export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
|
|
68
|
-
export type StoreSetter<T, U extends PropertyKey[] = []> = T | CustomPartial<T> | ((prevState: T, traversed: U) => T | CustomPartial<T>);
|
|
69
|
-
export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
|
|
70
|
-
type W<T> = Exclude<T, NotWrappable>;
|
|
71
|
-
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [
|
|
72
|
-
T
|
|
73
|
-
] extends [readonly unknown[]] ? number : keyof T : keyof T;
|
|
74
|
-
type MutableKeyOf<T> = KeyOf<T> & keyof PickMutable<T>;
|
|
75
|
-
type Rest<T, U extends PropertyKey[], K extends KeyOf<T> = KeyOf<T>> = [T] extends [never] ? never : K extends MutableKeyOf<T> ? [Part<T, K>, ...RestSetterOrContinue<T[K], [K, ...U]>] : K extends KeyOf<T> ? [Part<T, K>, ...RestContinue<T[K], [K, ...U]>] : never;
|
|
76
|
-
type RestContinue<T, U extends PropertyKey[]> = 0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : Rest<W<T>, U>;
|
|
77
|
-
type RestSetterOrContinue<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | RestContinue<T, U>;
|
|
78
|
-
export interface SetStoreFunction<T> {
|
|
79
|
-
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends MutableKeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, setter: StoreSetter<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [
|
|
80
|
-
K7,
|
|
81
|
-
K6,
|
|
82
|
-
K5,
|
|
83
|
-
K4,
|
|
84
|
-
K3,
|
|
85
|
-
K2,
|
|
86
|
-
K1
|
|
87
|
-
]>): void;
|
|
88
|
-
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends MutableKeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, setter: StoreSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6], [K6, K5, K4, K3, K2, K1]>): void;
|
|
89
|
-
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends MutableKeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, setter: StoreSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5], [K5, K4, K3, K2, K1]>): void;
|
|
90
|
-
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends MutableKeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, setter: StoreSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4], [K4, K3, K2, K1]>): void;
|
|
91
|
-
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends MutableKeyOf<W<W<W<T>[K1]>[K2]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, setter: StoreSetter<W<W<W<T>[K1]>[K2]>[K3], [K3, K2, K1]>): void;
|
|
92
|
-
<K1 extends KeyOf<W<T>>, K2 extends MutableKeyOf<W<W<T>[K1]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, setter: StoreSetter<W<W<T>[K1]>[K2], [K2, K1]>): void;
|
|
93
|
-
<K1 extends MutableKeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: StoreSetter<W<T>[K1], [K1]>): void;
|
|
94
|
-
(setter: StoreSetter<T, []>): void;
|
|
95
|
-
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, ...rest: Rest<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [K7, K6, K5, K4, K3, K2, K1]>): void;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Creates a reactive store that can be read through a proxy object and written with a setter function
|
|
99
|
-
*
|
|
100
|
-
* @description https://docs.solidjs.com/reference/store-utilities/create-store
|
|
101
|
-
*/
|
|
102
|
-
export declare function createStore<T extends object = {}>(...[store, options]: {} extends T ? [store?: T | Store<T>, options?: {
|
|
103
|
-
name?: string;
|
|
104
|
-
}] : [store: T | Store<T>, options?: {
|
|
105
|
-
name?: string;
|
|
106
|
-
}]): [get: Store<T>, set: SetStoreFunction<T>];
|
|
107
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Accessor } from "./signal.js";
|
|
2
|
-
/**
|
|
3
|
-
The MIT License (MIT)
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2017 Adam Haile
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
in the Software without restriction, including without limitation the rights
|
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Reactively transforms an array with a callback function - underlying helper for the `<For>` control flow
|
|
27
|
-
*
|
|
28
|
-
* similar to `Array.prototype.map`, but gets the index as accessor, transforms only values that changed and returns an accessor and reactively tracks changes to the list.
|
|
29
|
-
*
|
|
30
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/map-array
|
|
31
|
-
*/
|
|
32
|
-
export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: T, i: Accessor<number>) => U, options?: {
|
|
33
|
-
fallback?: Accessor<any>;
|
|
34
|
-
}): () => U[];
|
|
35
|
-
/**
|
|
36
|
-
* Reactively maps arrays by index instead of value - underlying helper for the `<Index>` control flow
|
|
37
|
-
*
|
|
38
|
-
* similar to `Array.prototype.map`, but gets the value as an accessor, transforms only changed items of the original arrays anew and returns an accessor.
|
|
39
|
-
*
|
|
40
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/index-array
|
|
41
|
-
*/
|
|
42
|
-
export declare function indexArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: number) => U, options?: {
|
|
43
|
-
fallback?: Accessor<any>;
|
|
44
|
-
}): () => U[];
|