tinybase 5.0.0 → 5.0.2
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/@types/ui-react/index.d.cts +62 -45
- package/@types/ui-react/index.d.ts +62 -45
- package/@types/ui-react/with-schemas/index.d.cts +83 -59
- package/@types/ui-react/with-schemas/index.d.ts +83 -59
- package/cjs/es6/min/ui-react/index.cjs +1 -1
- package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/ui-react/index.cjs +14 -34
- package/cjs/es6/ui-react/with-schemas/index.cjs +14 -34
- package/cjs/min/ui-react/index.cjs +1 -1
- package/cjs/min/ui-react/index.cjs.gz +0 -0
- package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/ui-react/index.cjs +12 -12
- package/cjs/ui-react/with-schemas/index.cjs +12 -12
- package/es6/min/ui-react/index.js +1 -1
- package/es6/min/ui-react/index.js.gz +0 -0
- package/es6/min/ui-react/with-schemas/index.js +1 -1
- package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/es6/ui-react/index.js +14 -34
- package/es6/ui-react/with-schemas/index.js +14 -34
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/package.json +1 -1
- package/readme.md +40 -13
- package/releases.md +22 -22
- package/ui-react/index.js +12 -12
- package/ui-react/with-schemas/index.js +12 -12
- package/umd/es6/min/ui-react/index.js +1 -1
- package/umd/es6/min/ui-react/index.js.gz +0 -0
- package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/es6/ui-react/index.js +17 -34
- package/umd/es6/ui-react/with-schemas/index.js +17 -34
- package/umd/min/ui-react/index.js +1 -1
- package/umd/min/ui-react/index.js.gz +0 -0
- package/umd/min/ui-react/with-schemas/index.js +1 -1
- package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/ui-react/index.js +13 -12
- package/umd/ui-react/with-schemas/index.js +13 -12
package/umd/ui-react/index.js
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
49
49
|
const arrayMap = (array, cb) => array.map(cb);
|
|
50
50
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
51
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
51
52
|
|
|
52
53
|
const object = Object;
|
|
53
54
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -215,12 +216,7 @@
|
|
|
215
216
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
216
217
|
[thing, returnType, listenable, ...args],
|
|
217
218
|
);
|
|
218
|
-
|
|
219
|
-
return returnType == 0 /* Object */
|
|
220
|
-
? {...result}
|
|
221
|
-
: returnType < 3 /* CellOrValue */
|
|
222
|
-
? [...result]
|
|
223
|
-
: result;
|
|
219
|
+
return useSyncExternalStore(subscribe, getResult);
|
|
224
220
|
};
|
|
225
221
|
const useListener = (
|
|
226
222
|
listenable,
|
|
@@ -252,9 +248,7 @@
|
|
|
252
248
|
ifNotUndefined(get(parameter, store2), (thing) =>
|
|
253
249
|
then(
|
|
254
250
|
store2['set' + settable](
|
|
255
|
-
...
|
|
256
|
-
isFunction(arg) ? arg(parameter, store2) : arg,
|
|
257
|
-
),
|
|
251
|
+
...argsOrGetArgs(args, store2, parameter),
|
|
258
252
|
thing,
|
|
259
253
|
),
|
|
260
254
|
thing,
|
|
@@ -262,9 +256,13 @@
|
|
|
262
256
|
),
|
|
263
257
|
),
|
|
264
258
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
265
|
-
[store, settable, ...getDeps, ...thenDeps, ...args],
|
|
259
|
+
[store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
|
|
266
260
|
);
|
|
267
261
|
};
|
|
262
|
+
const argsOrGetArgs = (args, store, parameter) =>
|
|
263
|
+
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
264
|
+
const nonFunctionDeps = (args) =>
|
|
265
|
+
arrayFilter(args, (arg) => !isFunction(arg));
|
|
268
266
|
const useDel = (
|
|
269
267
|
storeOrStoreId,
|
|
270
268
|
deletable,
|
|
@@ -274,9 +272,12 @@
|
|
|
274
272
|
) => {
|
|
275
273
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
276
274
|
return useCallback$2(
|
|
277
|
-
() =>
|
|
275
|
+
(parameter) =>
|
|
276
|
+
then(
|
|
277
|
+
store?.['del' + deletable](...argsOrGetArgs(args, store, parameter)),
|
|
278
|
+
),
|
|
278
279
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
279
|
-
[store, deletable, ...thenDeps, ...args],
|
|
280
|
+
[store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
|
|
280
281
|
);
|
|
281
282
|
};
|
|
282
283
|
const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
49
49
|
const arrayMap = (array, cb) => array.map(cb);
|
|
50
50
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
51
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
51
52
|
|
|
52
53
|
const object = Object;
|
|
53
54
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -215,12 +216,7 @@
|
|
|
215
216
|
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
|
216
217
|
[thing, returnType, listenable, ...args],
|
|
217
218
|
);
|
|
218
|
-
|
|
219
|
-
return returnType == 0 /* Object */
|
|
220
|
-
? {...result}
|
|
221
|
-
: returnType < 3 /* CellOrValue */
|
|
222
|
-
? [...result]
|
|
223
|
-
: result;
|
|
219
|
+
return useSyncExternalStore(subscribe, getResult);
|
|
224
220
|
};
|
|
225
221
|
const useListener = (
|
|
226
222
|
listenable,
|
|
@@ -252,9 +248,7 @@
|
|
|
252
248
|
ifNotUndefined(get(parameter, store2), (thing) =>
|
|
253
249
|
then(
|
|
254
250
|
store2['set' + settable](
|
|
255
|
-
...
|
|
256
|
-
isFunction(arg) ? arg(parameter, store2) : arg,
|
|
257
|
-
),
|
|
251
|
+
...argsOrGetArgs(args, store2, parameter),
|
|
258
252
|
thing,
|
|
259
253
|
),
|
|
260
254
|
thing,
|
|
@@ -262,9 +256,13 @@
|
|
|
262
256
|
),
|
|
263
257
|
),
|
|
264
258
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
265
|
-
[store, settable, ...getDeps, ...thenDeps, ...args],
|
|
259
|
+
[store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
|
|
266
260
|
);
|
|
267
261
|
};
|
|
262
|
+
const argsOrGetArgs = (args, store, parameter) =>
|
|
263
|
+
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
264
|
+
const nonFunctionDeps = (args) =>
|
|
265
|
+
arrayFilter(args, (arg) => !isFunction(arg));
|
|
268
266
|
const useDel = (
|
|
269
267
|
storeOrStoreId,
|
|
270
268
|
deletable,
|
|
@@ -274,9 +272,12 @@
|
|
|
274
272
|
) => {
|
|
275
273
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
276
274
|
return useCallback$2(
|
|
277
|
-
() =>
|
|
275
|
+
(parameter) =>
|
|
276
|
+
then(
|
|
277
|
+
store?.['del' + deletable](...argsOrGetArgs(args, store, parameter)),
|
|
278
|
+
),
|
|
278
279
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
279
|
-
[store, deletable, ...thenDeps, ...args],
|
|
280
|
+
[store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
|
|
280
281
|
);
|
|
281
282
|
};
|
|
282
283
|
const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
|