solid-js 1.3.6 → 1.3.9

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 CHANGED
@@ -124,7 +124,7 @@ function setHydrateContext(context) {
124
124
  }
125
125
  function nextHydrateContext() {
126
126
  return { ...sharedConfig.context,
127
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}.`,
127
+ id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
128
128
  count: 0
129
129
  };
130
130
  }
@@ -158,14 +158,13 @@ let Effects = null;
158
158
  let ExecCount = 0;
159
159
  let rootCount = 0;
160
160
  function createRoot(fn, detachedOwner) {
161
- detachedOwner && (Owner = detachedOwner);
162
161
  const listener = Listener,
163
162
  owner = Owner,
164
163
  root = fn.length === 0 && !"_SOLID_DEV_" ? UNOWNED : {
165
164
  owned: null,
166
165
  cleanups: null,
167
166
  context: null,
168
- owner
167
+ owner: detachedOwner || owner
169
168
  };
170
169
  if (owner) root.name = `${owner.name}-r${rootCount++}`;
171
170
  Owner = root;
@@ -405,7 +404,8 @@ function createSelector(source, fn = equalFn, options) {
405
404
  let l;
406
405
  if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
407
406
  onCleanup(() => {
408
- l.size > 1 ? l.delete(listener) : subs.delete(key);
407
+ l.delete(listener);
408
+ !l.size && subs.delete(key);
409
409
  });
410
410
  }
411
411
  return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
@@ -1015,7 +1015,7 @@ function observable(input) {
1015
1015
  if (!(observer instanceof Object) || observer == null) {
1016
1016
  throw new TypeError("Expected the observer to be an object.");
1017
1017
  }
1018
- const handler = "next" in observer ? observer.next : observer;
1018
+ const handler = "next" in observer ? observer.next.bind(observer) : observer;
1019
1019
  let complete = false;
1020
1020
  createComputed(() => {
1021
1021
  if (complete) return;
@@ -1353,7 +1353,7 @@ function lazy(fn) {
1353
1353
  let counter = 0;
1354
1354
  function createUniqueId() {
1355
1355
  const ctx = sharedConfig.context;
1356
- return ctx ? `${ctx.id}${ctx.count++}` : `cl:${counter++}`;
1356
+ return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1357
1357
  }
1358
1358
 
1359
1359
  function For(props) {
package/dist/dev.js CHANGED
@@ -120,7 +120,7 @@ function setHydrateContext(context) {
120
120
  }
121
121
  function nextHydrateContext() {
122
122
  return { ...sharedConfig.context,
123
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}.`,
123
+ id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
124
124
  count: 0
125
125
  };
126
126
  }
@@ -154,14 +154,13 @@ let Effects = null;
154
154
  let ExecCount = 0;
155
155
  let rootCount = 0;
156
156
  function createRoot(fn, detachedOwner) {
157
- detachedOwner && (Owner = detachedOwner);
158
157
  const listener = Listener,
159
158
  owner = Owner,
160
159
  root = fn.length === 0 && !"_SOLID_DEV_" ? UNOWNED : {
161
160
  owned: null,
162
161
  cleanups: null,
163
162
  context: null,
164
- owner
163
+ owner: detachedOwner || owner
165
164
  };
166
165
  if (owner) root.name = `${owner.name}-r${rootCount++}`;
167
166
  Owner = root;
@@ -401,7 +400,8 @@ function createSelector(source, fn = equalFn, options) {
401
400
  let l;
402
401
  if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
403
402
  onCleanup(() => {
404
- l.size > 1 ? l.delete(listener) : subs.delete(key);
403
+ l.delete(listener);
404
+ !l.size && subs.delete(key);
405
405
  });
406
406
  }
407
407
  return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
@@ -1011,7 +1011,7 @@ function observable(input) {
1011
1011
  if (!(observer instanceof Object) || observer == null) {
1012
1012
  throw new TypeError("Expected the observer to be an object.");
1013
1013
  }
1014
- const handler = "next" in observer ? observer.next : observer;
1014
+ const handler = "next" in observer ? observer.next.bind(observer) : observer;
1015
1015
  let complete = false;
1016
1016
  createComputed(() => {
1017
1017
  if (complete) return;
@@ -1349,7 +1349,7 @@ function lazy(fn) {
1349
1349
  let counter = 0;
1350
1350
  function createUniqueId() {
1351
1351
  const ctx = sharedConfig.context;
1352
- return ctx ? `${ctx.id}${ctx.count++}` : `cl:${counter++}`;
1352
+ return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1353
1353
  }
1354
1354
 
1355
1355
  function For(props) {
package/dist/server.cjs CHANGED
@@ -231,7 +231,7 @@ function setHydrateContext(context) {
231
231
  }
232
232
  function nextHydrateContext() {
233
233
  return sharedConfig.context ? { ...sharedConfig.context,
234
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}.`,
234
+ id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
235
235
  count: 0
236
236
  } : undefined;
237
237
  }
package/dist/server.js CHANGED
@@ -227,7 +227,7 @@ function setHydrateContext(context) {
227
227
  }
228
228
  function nextHydrateContext() {
229
229
  return sharedConfig.context ? { ...sharedConfig.context,
230
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}.`,
230
+ id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
231
231
  count: 0
232
232
  } : undefined;
233
233
  }
package/dist/solid.cjs CHANGED
@@ -124,7 +124,7 @@ function setHydrateContext(context) {
124
124
  }
125
125
  function nextHydrateContext() {
126
126
  return { ...sharedConfig.context,
127
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}.`,
127
+ id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
128
128
  count: 0
129
129
  };
130
130
  }
@@ -157,14 +157,13 @@ let Updates = null;
157
157
  let Effects = null;
158
158
  let ExecCount = 0;
159
159
  function createRoot(fn, detachedOwner) {
160
- detachedOwner && (Owner = detachedOwner);
161
160
  const listener = Listener,
162
161
  owner = Owner,
163
162
  root = fn.length === 0 && !false ? UNOWNED : {
164
163
  owned: null,
165
164
  cleanups: null,
166
165
  context: null,
167
- owner
166
+ owner: detachedOwner || owner
168
167
  };
169
168
  Owner = root;
170
169
  Listener = null;
@@ -402,7 +401,8 @@ function createSelector(source, fn = equalFn, options) {
402
401
  let l;
403
402
  if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
404
403
  onCleanup(() => {
405
- l.size > 1 ? l.delete(listener) : subs.delete(key);
404
+ l.delete(listener);
405
+ !l.size && subs.delete(key);
406
406
  });
407
407
  }
408
408
  return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
@@ -934,7 +934,7 @@ function observable(input) {
934
934
  if (!(observer instanceof Object) || observer == null) {
935
935
  throw new TypeError("Expected the observer to be an object.");
936
936
  }
937
- const handler = "next" in observer ? observer.next : observer;
937
+ const handler = "next" in observer ? observer.next.bind(observer) : observer;
938
938
  let complete = false;
939
939
  createComputed(() => {
940
940
  if (complete) return;
@@ -1269,7 +1269,7 @@ function lazy(fn) {
1269
1269
  let counter = 0;
1270
1270
  function createUniqueId() {
1271
1271
  const ctx = sharedConfig.context;
1272
- return ctx ? `${ctx.id}${ctx.count++}` : `cl:${counter++}`;
1272
+ return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1273
1273
  }
1274
1274
 
1275
1275
  function For(props) {
package/dist/solid.js CHANGED
@@ -120,7 +120,7 @@ function setHydrateContext(context) {
120
120
  }
121
121
  function nextHydrateContext() {
122
122
  return { ...sharedConfig.context,
123
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}.`,
123
+ id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
124
124
  count: 0
125
125
  };
126
126
  }
@@ -153,14 +153,13 @@ let Updates = null;
153
153
  let Effects = null;
154
154
  let ExecCount = 0;
155
155
  function createRoot(fn, detachedOwner) {
156
- detachedOwner && (Owner = detachedOwner);
157
156
  const listener = Listener,
158
157
  owner = Owner,
159
158
  root = fn.length === 0 && !false ? UNOWNED : {
160
159
  owned: null,
161
160
  cleanups: null,
162
161
  context: null,
163
- owner
162
+ owner: detachedOwner || owner
164
163
  };
165
164
  Owner = root;
166
165
  Listener = null;
@@ -398,7 +397,8 @@ function createSelector(source, fn = equalFn, options) {
398
397
  let l;
399
398
  if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
400
399
  onCleanup(() => {
401
- l.size > 1 ? l.delete(listener) : subs.delete(key);
400
+ l.delete(listener);
401
+ !l.size && subs.delete(key);
402
402
  });
403
403
  }
404
404
  return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
@@ -930,7 +930,7 @@ function observable(input) {
930
930
  if (!(observer instanceof Object) || observer == null) {
931
931
  throw new TypeError("Expected the observer to be an object.");
932
932
  }
933
- const handler = "next" in observer ? observer.next : observer;
933
+ const handler = "next" in observer ? observer.next.bind(observer) : observer;
934
934
  let complete = false;
935
935
  createComputed(() => {
936
936
  if (complete) return;
@@ -1265,7 +1265,7 @@ function lazy(fn) {
1265
1265
  let counter = 0;
1266
1266
  function createUniqueId() {
1267
1267
  const ctx = sharedConfig.context;
1268
- return ctx ? `${ctx.id}${ctx.count++}` : `cl:${counter++}`;
1268
+ return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1269
1269
  }
1270
1270
 
1271
1271
  function For(props) {
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.6",
4
+ "version": "1.3.9",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -144,5 +144,5 @@
144
144
  "compiler",
145
145
  "performance"
146
146
  ],
147
- "gitHead": "10183a0ee2de5c685e4d4558cbe1b78a6ca4c48e"
147
+ "gitHead": "939e87af354cdd5f4fcc85d2e1c5df86eecec773"
148
148
  }
@@ -147,12 +147,12 @@ function updatePath(current, path, traversed = []) {
147
147
  isArray = Array.isArray(current);
148
148
  if (Array.isArray(part)) {
149
149
  for (let i = 0; i < part.length; i++) {
150
- updatePath(current, [part[i]].concat(path), [part[i]].concat(traversed));
150
+ updatePath(current, [part[i]].concat(path), traversed);
151
151
  }
152
152
  return;
153
153
  } else if (isArray && partType === "function") {
154
154
  for (let i = 0; i < current.length; i++) {
155
- if (part(current[i], i)) updatePath(current, [i].concat(path), [i].concat(traversed));
155
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
156
156
  }
157
157
  return;
158
158
  } else if (isArray && partType === "object") {
@@ -162,7 +162,7 @@ function updatePath(current, path, traversed = []) {
162
162
  by = 1
163
163
  } = part;
164
164
  for (let i = from; i <= to; i += by) {
165
- updatePath(current, [i].concat(path), [i].concat(traversed));
165
+ updatePath(current, [i].concat(path), traversed);
166
166
  }
167
167
  return;
168
168
  } else if (path.length > 1) {
@@ -215,7 +215,7 @@ const proxyTraps = {
215
215
  node = nodes[property] || (nodes[property] = createDataNode());
216
216
  node();
217
217
  }
218
- return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
218
+ return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
219
219
  },
220
220
  set(target, property, value) {
221
221
  setProperty(target, property, unwrap(value));
package/store/dist/dev.js CHANGED
@@ -143,12 +143,12 @@ function updatePath(current, path, traversed = []) {
143
143
  isArray = Array.isArray(current);
144
144
  if (Array.isArray(part)) {
145
145
  for (let i = 0; i < part.length; i++) {
146
- updatePath(current, [part[i]].concat(path), [part[i]].concat(traversed));
146
+ updatePath(current, [part[i]].concat(path), traversed);
147
147
  }
148
148
  return;
149
149
  } else if (isArray && partType === "function") {
150
150
  for (let i = 0; i < current.length; i++) {
151
- if (part(current[i], i)) updatePath(current, [i].concat(path), [i].concat(traversed));
151
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
152
152
  }
153
153
  return;
154
154
  } else if (isArray && partType === "object") {
@@ -158,7 +158,7 @@ function updatePath(current, path, traversed = []) {
158
158
  by = 1
159
159
  } = part;
160
160
  for (let i = from; i <= to; i += by) {
161
- updatePath(current, [i].concat(path), [i].concat(traversed));
161
+ updatePath(current, [i].concat(path), traversed);
162
162
  }
163
163
  return;
164
164
  } else if (path.length > 1) {
@@ -211,7 +211,7 @@ const proxyTraps = {
211
211
  node = nodes[property] || (nodes[property] = createDataNode());
212
212
  node();
213
213
  }
214
- return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
214
+ return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
215
215
  },
216
216
  set(target, property, value) {
217
217
  setProperty(target, property, unwrap(value));
@@ -31,12 +31,12 @@ function updatePath(current, path, traversed = []) {
31
31
  isArray = Array.isArray(current);
32
32
  if (Array.isArray(part)) {
33
33
  for (let i = 0; i < part.length; i++) {
34
- updatePath(current, [part[i]].concat(path), [part[i]].concat(traversed));
34
+ updatePath(current, [part[i]].concat(path), traversed);
35
35
  }
36
36
  return;
37
37
  } else if (isArray && partType === "function") {
38
38
  for (let i = 0; i < current.length; i++) {
39
- if (part(current[i], i)) updatePath(current, [i].concat(path), [i].concat(traversed));
39
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
40
40
  }
41
41
  return;
42
42
  } else if (isArray && partType === "object") {
@@ -46,7 +46,7 @@ function updatePath(current, path, traversed = []) {
46
46
  by = 1
47
47
  } = part;
48
48
  for (let i = from; i <= to; i += by) {
49
- updatePath(current, [i].concat(path), [i].concat(traversed));
49
+ updatePath(current, [i].concat(path), traversed);
50
50
  }
51
51
  return;
52
52
  } else if (path.length > 1) {
@@ -77,7 +77,7 @@ function createMutable(state) {
77
77
  }
78
78
  function reconcile(value, options = {}) {
79
79
  return state => {
80
- if (!isWrappable(state)) return value;
80
+ if (!isWrappable(state) || !isWrappable(value)) return value;
81
81
  const targetKeys = Object.keys(value);
82
82
  for (let i = 0, len = targetKeys.length; i < len; i++) {
83
83
  const key = targetKeys[i];
@@ -87,6 +87,7 @@ function reconcile(value, options = {}) {
87
87
  for (let i = 0, len = previousKeys.length; i < len; i++) {
88
88
  if (value[previousKeys[i]] === undefined) setProperty(state, previousKeys[i], undefined);
89
89
  }
90
+ return state;
90
91
  };
91
92
  }
92
93
  function produce(fn) {
@@ -27,12 +27,12 @@ function updatePath(current, path, traversed = []) {
27
27
  isArray = Array.isArray(current);
28
28
  if (Array.isArray(part)) {
29
29
  for (let i = 0; i < part.length; i++) {
30
- updatePath(current, [part[i]].concat(path), [part[i]].concat(traversed));
30
+ updatePath(current, [part[i]].concat(path), traversed);
31
31
  }
32
32
  return;
33
33
  } else if (isArray && partType === "function") {
34
34
  for (let i = 0; i < current.length; i++) {
35
- if (part(current[i], i)) updatePath(current, [i].concat(path), [i].concat(traversed));
35
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
36
36
  }
37
37
  return;
38
38
  } else if (isArray && partType === "object") {
@@ -42,7 +42,7 @@ function updatePath(current, path, traversed = []) {
42
42
  by = 1
43
43
  } = part;
44
44
  for (let i = from; i <= to; i += by) {
45
- updatePath(current, [i].concat(path), [i].concat(traversed));
45
+ updatePath(current, [i].concat(path), traversed);
46
46
  }
47
47
  return;
48
48
  } else if (path.length > 1) {
@@ -73,7 +73,7 @@ function createMutable(state) {
73
73
  }
74
74
  function reconcile(value, options = {}) {
75
75
  return state => {
76
- if (!isWrappable(state)) return value;
76
+ if (!isWrappable(state) || !isWrappable(value)) return value;
77
77
  const targetKeys = Object.keys(value);
78
78
  for (let i = 0, len = targetKeys.length; i < len; i++) {
79
79
  const key = targetKeys[i];
@@ -83,6 +83,7 @@ function reconcile(value, options = {}) {
83
83
  for (let i = 0, len = previousKeys.length; i < len; i++) {
84
84
  if (value[previousKeys[i]] === undefined) setProperty(state, previousKeys[i], undefined);
85
85
  }
86
+ return state;
86
87
  };
87
88
  }
88
89
  function produce(fn) {
@@ -142,12 +142,12 @@ function updatePath(current, path, traversed = []) {
142
142
  isArray = Array.isArray(current);
143
143
  if (Array.isArray(part)) {
144
144
  for (let i = 0; i < part.length; i++) {
145
- updatePath(current, [part[i]].concat(path), [part[i]].concat(traversed));
145
+ updatePath(current, [part[i]].concat(path), traversed);
146
146
  }
147
147
  return;
148
148
  } else if (isArray && partType === "function") {
149
149
  for (let i = 0; i < current.length; i++) {
150
- if (part(current[i], i)) updatePath(current, [i].concat(path), [i].concat(traversed));
150
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
151
151
  }
152
152
  return;
153
153
  } else if (isArray && partType === "object") {
@@ -157,7 +157,7 @@ function updatePath(current, path, traversed = []) {
157
157
  by = 1
158
158
  } = part;
159
159
  for (let i = from; i <= to; i += by) {
160
- updatePath(current, [i].concat(path), [i].concat(traversed));
160
+ updatePath(current, [i].concat(path), traversed);
161
161
  }
162
162
  return;
163
163
  } else if (path.length > 1) {
@@ -138,12 +138,12 @@ function updatePath(current, path, traversed = []) {
138
138
  isArray = Array.isArray(current);
139
139
  if (Array.isArray(part)) {
140
140
  for (let i = 0; i < part.length; i++) {
141
- updatePath(current, [part[i]].concat(path), [part[i]].concat(traversed));
141
+ updatePath(current, [part[i]].concat(path), traversed);
142
142
  }
143
143
  return;
144
144
  } else if (isArray && partType === "function") {
145
145
  for (let i = 0; i < current.length; i++) {
146
- if (part(current[i], i)) updatePath(current, [i].concat(path), [i].concat(traversed));
146
+ if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
147
147
  }
148
148
  return;
149
149
  } else if (isArray && partType === "object") {
@@ -153,7 +153,7 @@ function updatePath(current, path, traversed = []) {
153
153
  by = 1
154
154
  } = part;
155
155
  for (let i = from; i <= to; i += by) {
156
- updatePath(current, [i].concat(path), [i].concat(traversed));
156
+ updatePath(current, [i].concat(path), traversed);
157
157
  }
158
158
  return;
159
159
  } else if (path.length > 1) {
@@ -1,4 +1,4 @@
1
1
  export { createStore, unwrap, $RAW } from "./store";
2
- export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, Next, WrappableNext, DeepReadonly } from "./store";
2
+ export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store";
3
3
  export * from "./mutable";
4
4
  export * from "./modifiers";
@@ -1,7 +1,7 @@
1
- import { Store } from "./store";
1
+ import { DeepMutable, NotWrappable } 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, options?: ReconcileOptions): (state: unknown) => Store<T>;
7
- export declare function produce<T>(fn: (state: T) => void): (state: Store<T>) => Store<T>;
6
+ export declare function reconcile<T extends U, U>(value: T, options?: ReconcileOptions): (state: U) => T;
7
+ export declare function produce<T>(fn: (state: DeepMutable<Exclude<T, NotWrappable>>) => void): (state: T) => T;
@@ -1,15 +1,15 @@
1
- import { SetStoreFunction, Store } from "store";
1
+ import type { DeepMutable, SetStoreFunction, Store } from "store";
2
2
  export declare const $RAW: unique symbol;
3
3
  export declare function isWrappable(obj: any): boolean;
4
4
  export declare function unwrap<T>(item: any): T;
5
- export declare function setProperty(state: any, property: string | number, value: any, force?: boolean): void;
6
- export declare function updatePath(current: any, path: any[], traversed?: (number | string)[]): void;
5
+ export declare function setProperty(state: any, property: PropertyKey, value: any, force?: boolean): void;
6
+ export declare function updatePath(current: any, path: any[], traversed?: PropertyKey[]): void;
7
7
  export declare function createStore<T>(state: T | Store<T>): [Store<T>, SetStoreFunction<T>];
8
- export declare function createMutable<T>(state: T | Store<T>): Store<T>;
8
+ export declare function createMutable<T>(state: T | Store<T>): T;
9
9
  declare type ReconcileOptions = {
10
10
  key?: string | null;
11
11
  merge?: boolean;
12
12
  };
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>;
13
+ export declare function reconcile<T extends U, U>(value: T, options?: ReconcileOptions): (state: U) => T;
14
+ export declare function produce<T>(fn: (state: DeepMutable<T>) => void): (state: T) => T;
15
15
  export {};
@@ -1,44 +1,45 @@
1
1
  import { Accessor } from "../..";
2
2
  export declare const $RAW: unique symbol, $NODE: unique symbol, $NAME: unique symbol;
3
- export declare type StoreNode = Record<keyof any, any>;
3
+ export declare type StoreNode = Record<PropertyKey, any>;
4
4
  export declare type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined;
5
5
  export declare type Store<T> = DeepReadonly<T>;
6
6
  export declare function isWrappable(obj: any): any;
7
7
  export declare function unwrap<T extends StoreNode>(item: any, set?: Set<unknown>): T;
8
8
  export declare function getDataNodes(target: StoreNode): any;
9
- export declare function proxyDescriptor(target: StoreNode, property: keyof any): PropertyDescriptor | undefined;
9
+ export declare function proxyDescriptor(target: StoreNode, property: PropertyKey): PropertyDescriptor | undefined;
10
10
  export declare function ownKeys(target: StoreNode): (string | symbol)[];
11
11
  export declare function createDataNode(): Accessor<void> & {
12
12
  $: () => void;
13
13
  };
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> = {
14
+ export declare function setProperty(state: StoreNode, property: PropertyKey, value: any): void;
15
+ export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
16
+ export declare type DeepReadonly<T> = 0 extends 1 & T ? T : {
17
17
  readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepReadonly<T[K]>;
18
18
  };
19
- export declare type StoreSetter<T> = T | Partial<T> | ((prevState: T, traversed?: (keyof any)[]) => Partial<T> | void);
19
+ export declare type DeepMutable<T> = 0 extends 1 & T ? T : {
20
+ -readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepMutable<T[K]>;
21
+ };
20
22
  export declare type StorePathRange = {
21
23
  from?: number;
22
24
  to?: number;
23
25
  by?: number;
24
26
  };
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;
27
+ export declare type ArrayFilterFn<T> = (item: DeepReadonly<T>, index: number) => boolean;
28
+ export declare type StoreSetter<T, U extends PropertyKey[] = []> = ((prevState: DeepReadonly<T>, traversed: U) => DeepReadonly<T> | Partial<DeepReadonly<T>> | void) | DeepReadonly<T> | Partial<DeepReadonly<T>>;
29
+ export declare type Part<T, K extends KeyOf<T> = KeyOf<T>> = [K] extends [never] ? never : K | readonly K[] | (number extends K ? ArrayFilterFn<T[number]> | StorePathRange : never);
30
+ declare type W<T> = Exclude<T, NotWrappable>;
31
+ declare type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : number : keyof T;
32
+ declare type Rest<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | (0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : DistributeRest<W<T>, KeyOf<W<T>>, U>);
33
+ declare type DistributeRest<T, K, U extends PropertyKey[]> = [T] extends [never] ? never : K extends KeyOf<T> ? [Part<T, K>, ...Rest<T[K], [K, ...U]>] : never;
34
+ export interface SetStoreFunction<T> {
35
+ <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;
36
+ <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]>>>(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;
37
+ <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]>>>(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;
38
+ <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]>>>(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;
39
+ <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<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;
40
+ <K1 extends KeyOf<W<T>>, K2 extends KeyOf<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;
41
+ <K1 extends KeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: StoreSetter<W<T>[K1], [K1]>): void;
42
+ (setter: StoreSetter<T, []>): void;
42
43
  }
43
44
  /**
44
45
  * creates a reactive store that can be read through a proxy object and written with a setter function
@@ -437,6 +437,8 @@ export declare function createContext<T>(defaultValue: T): Context<T>;
437
437
  * @description https://www.solidjs.com/docs/latest/api#usecontext
438
438
  */
439
439
  export declare function useContext<T>(context: Context<T>): T;
440
+ export declare type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement | JSX.FunctionElement>;
441
+ export declare type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
440
442
  /**
441
443
  * Resolves child elements to help interact with children
442
444
  *
@@ -445,7 +447,7 @@ export declare function useContext<T>(context: Context<T>): T;
445
447
  *
446
448
  * @description https://www.solidjs.com/docs/latest/api#children
447
449
  */
448
- export declare function children(fn: Accessor<JSX.Element>): Accessor<JSX.Element>;
450
+ export declare function children(fn: Accessor<JSX.Element>): Accessor<ResolvedChildren>;
449
451
  export declare type SuspenseContextType = {
450
452
  increment?: () => void;
451
453
  decrement?: () => void;
package/web/dist/dev.cjs CHANGED
@@ -385,14 +385,14 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
385
385
  solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
386
386
  return () => current;
387
387
  }
388
- if (solidJs.sharedConfig.context && current && current.length) {
388
+ if (solidJs.sharedConfig.context) {
389
389
  for (let i = 0; i < array.length; i++) {
390
390
  if (array[i].parentNode) return current = array;
391
391
  }
392
- return current;
393
392
  }
394
393
  if (array.length === 0) {
395
- cleanChildren(parent, current, marker);
394
+ current = cleanChildren(parent, current, marker);
395
+ if (multi) return current;
396
396
  } else if (Array.isArray(current)) {
397
397
  if (current.length === 0) {
398
398
  appendNodes(parent, array, marker);
@@ -403,7 +403,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
403
403
  }
404
404
  current = array;
405
405
  } else if (value instanceof Node) {
406
- if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
406
+ if (solidJs.sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
407
407
  if (Array.isArray(current)) {
408
408
  if (multi) return current = cleanChildren(parent, current, marker, value);
409
409
  cleanChildren(parent, current, null, value);
package/web/dist/dev.js CHANGED
@@ -382,14 +382,14 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
382
382
  createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
383
383
  return () => current;
384
384
  }
385
- if (sharedConfig.context && current && current.length) {
385
+ if (sharedConfig.context) {
386
386
  for (let i = 0; i < array.length; i++) {
387
387
  if (array[i].parentNode) return current = array;
388
388
  }
389
- return current;
390
389
  }
391
390
  if (array.length === 0) {
392
- cleanChildren(parent, current, marker);
391
+ current = cleanChildren(parent, current, marker);
392
+ if (multi) return current;
393
393
  } else if (Array.isArray(current)) {
394
394
  if (current.length === 0) {
395
395
  appendNodes(parent, array, marker);
@@ -400,7 +400,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
400
400
  }
401
401
  current = array;
402
402
  } else if (value instanceof Node) {
403
- if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
403
+ if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
404
404
  if (Array.isArray(current)) {
405
405
  if (multi) return current = cleanChildren(parent, current, marker, value);
406
406
  cleanChildren(parent, current, null, value);
package/web/dist/web.cjs CHANGED
@@ -384,14 +384,14 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
384
384
  solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
385
385
  return () => current;
386
386
  }
387
- if (solidJs.sharedConfig.context && current && current.length) {
387
+ if (solidJs.sharedConfig.context) {
388
388
  for (let i = 0; i < array.length; i++) {
389
389
  if (array[i].parentNode) return current = array;
390
390
  }
391
- return current;
392
391
  }
393
392
  if (array.length === 0) {
394
- cleanChildren(parent, current, marker);
393
+ current = cleanChildren(parent, current, marker);
394
+ if (multi) return current;
395
395
  } else if (Array.isArray(current)) {
396
396
  if (current.length === 0) {
397
397
  appendNodes(parent, array, marker);
@@ -402,7 +402,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
402
402
  }
403
403
  current = array;
404
404
  } else if (value instanceof Node) {
405
- if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
405
+ if (solidJs.sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
406
406
  if (Array.isArray(current)) {
407
407
  if (multi) return current = cleanChildren(parent, current, marker, value);
408
408
  cleanChildren(parent, current, null, value);
package/web/dist/web.js CHANGED
@@ -381,14 +381,14 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
381
381
  createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
382
382
  return () => current;
383
383
  }
384
- if (sharedConfig.context && current && current.length) {
384
+ if (sharedConfig.context) {
385
385
  for (let i = 0; i < array.length; i++) {
386
386
  if (array[i].parentNode) return current = array;
387
387
  }
388
- return current;
389
388
  }
390
389
  if (array.length === 0) {
391
- cleanChildren(parent, current, marker);
390
+ current = cleanChildren(parent, current, marker);
391
+ if (multi) return current;
392
392
  } else if (Array.isArray(current)) {
393
393
  if (current.length === 0) {
394
394
  appendNodes(parent, array, marker);
@@ -399,7 +399,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
399
399
  }
400
400
  current = array;
401
401
  } else if (value instanceof Node) {
402
- if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
402
+ if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
403
403
  if (Array.isArray(current)) {
404
404
  if (multi) return current = cleanChildren(parent, current, marker, value);
405
405
  cleanChildren(parent, current, null, value);