tinybase 3.0.2 → 3.1.0-beta.1
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/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/tools.d.ts +59 -35
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/tools.d.ts +59 -35
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/queries.js +4 -3
- package/lib/debug/store.js +7 -6
- package/lib/debug/tinybase.js +8 -7
- package/lib/debug/tools.d.ts +59 -35
- package/lib/debug/tools.js +1637 -727
- package/lib/debug/ui-react.js +30 -28
- package/lib/es6/tools.d.ts +59 -35
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/tools.d.ts +59 -35
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.d.ts +59 -35
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.d.ts +59 -35
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +10 -10
- package/readme.md +14 -14
package/lib/debug/ui-react.js
CHANGED
|
@@ -6,17 +6,18 @@ const STRING = getTypeOf(EMPTY_STRING);
|
|
|
6
6
|
const LISTENER = 'Listener';
|
|
7
7
|
const GET = 'get';
|
|
8
8
|
const ADD = 'add';
|
|
9
|
-
const
|
|
10
|
-
const TABLE_IDS = 'TableIds';
|
|
9
|
+
const IDS = 'Ids';
|
|
11
10
|
const TABLE = 'Table';
|
|
12
|
-
const
|
|
13
|
-
const
|
|
11
|
+
const TABLES = TABLE + 's';
|
|
12
|
+
const TABLE_IDS = TABLE + IDS;
|
|
14
13
|
const ROW = 'Row';
|
|
15
|
-
const
|
|
14
|
+
const ROW_IDS = ROW + IDS;
|
|
15
|
+
const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
|
|
16
16
|
const CELL = 'Cell';
|
|
17
|
-
const
|
|
18
|
-
const VALUE_IDS = 'ValueIds';
|
|
17
|
+
const CELL_IDS = CELL + IDS;
|
|
19
18
|
const VALUE = 'Value';
|
|
19
|
+
const VALUES = VALUE + 's';
|
|
20
|
+
const VALUE_IDS = VALUE + IDS;
|
|
20
21
|
|
|
21
22
|
const arrayMap = (array, cb) => array.map(cb);
|
|
22
23
|
const arrayLength = (array) => array.length;
|
|
@@ -34,17 +35,18 @@ const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
|
|
|
34
35
|
const {createContext, useContext} = React;
|
|
35
36
|
const Context = createContext([]);
|
|
36
37
|
const useThing = (id, offset) => {
|
|
37
|
-
const
|
|
38
|
+
const contextValue = useContext(Context);
|
|
38
39
|
return isUndefined(id)
|
|
39
|
-
?
|
|
40
|
-
:
|
|
40
|
+
? contextValue[offset]
|
|
41
|
+
: isString(id)
|
|
42
|
+
? objGet(contextValue[offset + 1], id)
|
|
43
|
+
: id;
|
|
41
44
|
};
|
|
42
45
|
const useThingOrThingId = (thingOrThingId, offset) => {
|
|
43
46
|
const thing = useThing(thingOrThingId, offset);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return thingOrThingId;
|
|
47
|
+
return isUndefined(thingOrThingId) || isString(thingOrThingId)
|
|
48
|
+
? thing
|
|
49
|
+
: thingOrThingId;
|
|
48
50
|
};
|
|
49
51
|
const useStore = (id) => useThing(id, 0);
|
|
50
52
|
const useMetrics = (id) => useThing(id, 2);
|
|
@@ -1084,24 +1086,24 @@ const Provider = ({
|
|
|
1084
1086
|
checkpointsById,
|
|
1085
1087
|
children,
|
|
1086
1088
|
}) => {
|
|
1087
|
-
const
|
|
1089
|
+
const parentValue = useContext$1(Context);
|
|
1088
1090
|
return /* @__PURE__ */ createElement(
|
|
1089
1091
|
Context.Provider,
|
|
1090
1092
|
{
|
|
1091
1093
|
value: useMemo(
|
|
1092
1094
|
() => [
|
|
1093
|
-
store ??
|
|
1094
|
-
{...
|
|
1095
|
-
metrics ??
|
|
1096
|
-
{...
|
|
1097
|
-
indexes ??
|
|
1098
|
-
{...
|
|
1099
|
-
relationships ??
|
|
1100
|
-
{...
|
|
1101
|
-
queries ??
|
|
1102
|
-
{...
|
|
1103
|
-
checkpoints ??
|
|
1104
|
-
{...
|
|
1095
|
+
store ?? parentValue[0],
|
|
1096
|
+
{...parentValue[1], ...storesById},
|
|
1097
|
+
metrics ?? parentValue[2],
|
|
1098
|
+
{...parentValue[3], ...metricsById},
|
|
1099
|
+
indexes ?? parentValue[4],
|
|
1100
|
+
{...parentValue[5], ...indexesById},
|
|
1101
|
+
relationships ?? parentValue[6],
|
|
1102
|
+
{...parentValue[7], ...relationshipsById},
|
|
1103
|
+
queries ?? parentValue[8],
|
|
1104
|
+
{...parentValue[9], ...queriesById},
|
|
1105
|
+
checkpoints ?? parentValue[10],
|
|
1106
|
+
{...parentValue[11], ...checkpointsById},
|
|
1105
1107
|
],
|
|
1106
1108
|
[
|
|
1107
1109
|
store,
|
|
@@ -1116,7 +1118,7 @@ const Provider = ({
|
|
|
1116
1118
|
queriesById,
|
|
1117
1119
|
checkpoints,
|
|
1118
1120
|
checkpointsById,
|
|
1119
|
-
|
|
1121
|
+
parentValue,
|
|
1120
1122
|
],
|
|
1121
1123
|
),
|
|
1122
1124
|
},
|
package/lib/es6/tools.d.ts
CHANGED
|
@@ -272,26 +272,35 @@ export interface Tools {
|
|
|
272
272
|
getStoreValuesSchema(): ValuesSchema;
|
|
273
273
|
|
|
274
274
|
/**
|
|
275
|
-
* The getStoreApi method returns
|
|
276
|
-
*
|
|
275
|
+
* The getStoreApi method returns code-generated .d.ts and .ts(x) files that
|
|
276
|
+
* describe the schema of a Store and React bindings (since v3.1.0) in an ORM
|
|
277
|
+
* style.
|
|
277
278
|
*
|
|
278
|
-
* If the Store does not already have an explicit TablesSchema
|
|
279
|
-
* it, the data in the Store will be scanned to attempt to
|
|
280
|
-
*
|
|
281
|
-
* files) though if no schema can be inferred, the strings will be empty.
|
|
279
|
+
* If the Store does not already have an explicit TablesSchema or ValuesSchema
|
|
280
|
+
* associated with it, the data in the Store will be scanned to attempt to
|
|
281
|
+
* infer new schemas. The method returns four strings (which should be saved
|
|
282
|
+
* as files) though if no schema can be inferred, the strings will be empty.
|
|
282
283
|
*
|
|
283
284
|
* The method takes a single argument which represents the name you want the
|
|
284
|
-
* generated store object to have in code. You are expected to save the
|
|
285
|
-
*
|
|
286
|
-
*
|
|
285
|
+
* generated store object to have in code. You are expected to save the four
|
|
286
|
+
* files yourself, as, respectively:
|
|
287
|
+
*
|
|
288
|
+
* - `[storeName].d.ts`
|
|
289
|
+
* - `[storeName].ts`
|
|
290
|
+
* - `[storeName]-ui-react.d.ts`
|
|
291
|
+
* - `[storeName]-ui-react.tsx`
|
|
292
|
+
*
|
|
293
|
+
* Also you should save these alongside each other so that the .ts(x) files
|
|
294
|
+
* can import types from the .d.ts files.
|
|
287
295
|
*
|
|
288
|
-
* The .d.ts and .ts files that are generated are designed to resemble the
|
|
289
|
-
* main TinyBase
|
|
290
|
-
*
|
|
296
|
+
* The .d.ts and .ts(x) files that are generated are designed to resemble the
|
|
297
|
+
* main TinyBase Store and React binding files, but provide named types and
|
|
298
|
+
* methods that describe the domain of the schema in the store.
|
|
291
299
|
*
|
|
292
300
|
* For example, from a Store that has a `pets` Table, you will get methods
|
|
293
|
-
* like `getPetsTable`,
|
|
294
|
-
* versions of the underlying getTable method or the Row
|
|
301
|
+
* like `getPetsTable`, types like `PetsRow`, and hooks and components that
|
|
302
|
+
* are more specific versions of the underlying getTable method or the Row
|
|
303
|
+
* type, and so on. For example:
|
|
295
304
|
*
|
|
296
305
|
* |Store type|Equivalent generated type|
|
|
297
306
|
* |-|-|
|
|
@@ -321,9 +330,9 @@ export interface Tools {
|
|
|
321
330
|
* directly.
|
|
322
331
|
*
|
|
323
332
|
* @param storeName The name you want to provide to the generated Store, which
|
|
324
|
-
* should also be used to save the `.d.ts
|
|
325
|
-
* @returns A
|
|
326
|
-
* `.ts` files.
|
|
333
|
+
* should also be used to save the `.d.ts`, `.ts`, and `.tsx` files.
|
|
334
|
+
* @returns A set of four strings representing the contents of the `.d.ts`,
|
|
335
|
+
* `.ts`, and `.tsx` files for the generated Store and React modules.
|
|
327
336
|
* @example
|
|
328
337
|
* This example creates a Tools object and generates code for a Store that
|
|
329
338
|
* already has a TablesSchema.
|
|
@@ -333,7 +342,8 @@ export interface Tools {
|
|
|
333
342
|
* price: {type: 'number'},
|
|
334
343
|
* },
|
|
335
344
|
* });
|
|
336
|
-
* const [dTs, ts] =
|
|
345
|
+
* const [dTs, ts, dTsUiReact, tsUiReact] =
|
|
346
|
+
* createTools(store).getStoreApi('shop');
|
|
337
347
|
*
|
|
338
348
|
* const dTsLines = dTs.split('\n');
|
|
339
349
|
* console.log(dTsLines[3]);
|
|
@@ -342,7 +352,7 @@ export interface Tools {
|
|
|
342
352
|
* // -> 'export type PetsRow = {\'price\'?: number;};'
|
|
343
353
|
*
|
|
344
354
|
* const tsLines = ts.split('\n');
|
|
345
|
-
* console.log(tsLines[
|
|
355
|
+
* console.log(tsLines[39]);
|
|
346
356
|
* // -> 'getPetsTable: (): PetsTable => store.getTable(PETS) as PetsTable,'
|
|
347
357
|
* ```
|
|
348
358
|
* @example
|
|
@@ -353,7 +363,8 @@ export interface Tools {
|
|
|
353
363
|
* fido: {price: 5},
|
|
354
364
|
* felix: {price: 4},
|
|
355
365
|
* });
|
|
356
|
-
* const [dTs, ts] =
|
|
366
|
+
* const [dTs, ts, dTsUiReact, tsUiReact] =
|
|
367
|
+
* createTools(store).getStoreApi('shop');
|
|
357
368
|
*
|
|
358
369
|
* const dTsLines = dTs.split('\n');
|
|
359
370
|
* console.log(dTsLines[3]);
|
|
@@ -362,18 +373,18 @@ export interface Tools {
|
|
|
362
373
|
* // -> 'export type PetsRow = {\'price\': number;};'
|
|
363
374
|
*
|
|
364
375
|
* const tsLines = ts.split('\n');
|
|
365
|
-
* console.log(tsLines[
|
|
376
|
+
* console.log(tsLines[41]);
|
|
366
377
|
* // -> 'getPetsTable: (): PetsTable => store.getTable(PETS) as PetsTable,'
|
|
367
378
|
* ```
|
|
368
379
|
* @category Modelling
|
|
369
380
|
* @since v2.2.0
|
|
370
381
|
*/
|
|
371
|
-
getStoreApi(storeName: string): [string, string];
|
|
382
|
+
getStoreApi(storeName: string): [string, string, string, string];
|
|
372
383
|
|
|
373
384
|
/**
|
|
374
385
|
* The getPrettyStoreApi method attempts to returns a prettified
|
|
375
|
-
* code-generated .d.ts
|
|
376
|
-
*
|
|
386
|
+
* code-generated .d.ts and .ts(x) files that describe the schema of a Store
|
|
387
|
+
* and React bindings (since v3.1.0) in an ORM style.
|
|
377
388
|
*
|
|
378
389
|
* This is simply a wrapper around the getStoreApi method that attempts to
|
|
379
390
|
* invoke the `prettier` module (which it hopes you have installed) to format
|
|
@@ -384,17 +395,24 @@ export interface Tools {
|
|
|
384
395
|
* the results as a promise.
|
|
385
396
|
*
|
|
386
397
|
* The method takes a single argument which represents the name you want the
|
|
387
|
-
* generated store object to have in code. You are expected to save the
|
|
388
|
-
*
|
|
389
|
-
*
|
|
398
|
+
* generated store object to have in code. You are expected to save the four
|
|
399
|
+
* files yourself, as, respectively:
|
|
400
|
+
*
|
|
401
|
+
* - `[storeName].d.ts`
|
|
402
|
+
* - `[storeName].ts`
|
|
403
|
+
* - `[storeName]-ui-react.d.ts`
|
|
404
|
+
* - `[storeName]-ui-react.tsx`
|
|
405
|
+
*
|
|
406
|
+
* Also you should save these alongside each other so that the .ts(x) files
|
|
407
|
+
* can import types from the .d.ts files.
|
|
390
408
|
*
|
|
391
409
|
* See the documentation for the getStoreApi method for details of the content
|
|
392
410
|
* of the generated files.
|
|
393
411
|
*
|
|
394
412
|
* @param storeName The name you want to provide to the generated Store, which
|
|
395
|
-
* should also be used to save the `.d.ts
|
|
396
|
-
* @returns A
|
|
397
|
-
* `.ts` files.
|
|
413
|
+
* should also be used to save the `.d.ts`, `.ts`, and `.tsx` files.
|
|
414
|
+
* @returns A set of four strings representing the contents of the `.d.ts`,
|
|
415
|
+
* `.ts`, and `.tsx` files for the generated Store and React modules.
|
|
398
416
|
* @example
|
|
399
417
|
* This example creates a Tools object and generates code for a Store that
|
|
400
418
|
* already has a TablesSchema.
|
|
@@ -405,7 +423,9 @@ export interface Tools {
|
|
|
405
423
|
* },
|
|
406
424
|
* });
|
|
407
425
|
* const tools = createTools(store);
|
|
408
|
-
* const [dTs, ts] = await
|
|
426
|
+
* const [dTs, ts, dTsUiReact, tsUiReact] = await createTools(
|
|
427
|
+
* store,
|
|
428
|
+
* ).getPrettyStoreApi('shop');
|
|
409
429
|
*
|
|
410
430
|
* const dTsLines = dTs.split('\n');
|
|
411
431
|
* console.log(dTsLines[5]);
|
|
@@ -414,7 +434,7 @@ export interface Tools {
|
|
|
414
434
|
* // -> 'export type PetsRow = {price?: number};'
|
|
415
435
|
*
|
|
416
436
|
* const tsLines = ts.split('\n');
|
|
417
|
-
* console.log(tsLines[
|
|
437
|
+
* console.log(tsLines[75]);
|
|
418
438
|
* // -> ' hasPetsTable: (): boolean => store.hasTable(PETS),'
|
|
419
439
|
* ```
|
|
420
440
|
* @example
|
|
@@ -426,7 +446,9 @@ export interface Tools {
|
|
|
426
446
|
* felix: {price: 4},
|
|
427
447
|
* });
|
|
428
448
|
* const tools = createTools(store);
|
|
429
|
-
* const [dTs, ts] = await
|
|
449
|
+
* const [dTs, ts, dTsUiReact, tsUiReact] = await createTools(
|
|
450
|
+
* store,
|
|
451
|
+
* ).getPrettyStoreApi('shop');
|
|
430
452
|
*
|
|
431
453
|
* const dTsLines = dTs.split('\n');
|
|
432
454
|
* console.log(dTsLines[5]);
|
|
@@ -435,13 +457,15 @@ export interface Tools {
|
|
|
435
457
|
* // -> 'export type PetsRow = {price: number};'
|
|
436
458
|
*
|
|
437
459
|
* const tsLines = ts.split('\n');
|
|
438
|
-
* console.log(tsLines[
|
|
460
|
+
* console.log(tsLines[77]);
|
|
439
461
|
* // -> ' hasPetsTable: (): boolean => store.hasTable(PETS),'
|
|
440
462
|
* ```
|
|
441
463
|
* @category Modelling
|
|
442
464
|
* @since v2.2.0
|
|
443
465
|
*/
|
|
444
|
-
getPrettyStoreApi(
|
|
466
|
+
getPrettyStoreApi(
|
|
467
|
+
storeName: string,
|
|
468
|
+
): Promise<[string, string, string, string]>;
|
|
445
469
|
|
|
446
470
|
/**
|
|
447
471
|
* The getStore method returns a reference to the underlying Store that is
|
package/lib/es6/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>typeof e,a="",l=e(a),t=e(!0),o=e(0),n="type",s="default",r=(e,a)=>e.every(a),d=(e,a)=>e.sort(a),$=(e,a)=>e.forEach(a),i=(e,a)=>e.map(a),u=e=>e.length,I=e=>0==u(e),c=(e,...a)=>e.push(...a),b=e=>e.pop(),w=(e,...a)=>e.unshift(...a),h=e=>e.shift(),g=JSON.parse,C=isFinite,V=(e,a)=>e instanceof a,T=e=>null==e,v=e=>e==l||e==t,f=a=>e(a)==l,R=e=>Array.isArray(e),m=a=>{const l=e(a);return v(l)||l==o&&C(a)?l:void 0},p=(e,a)=>{var l;return null!=(l=null==e?void 0:e.has(a))&&l},L=e=>{var a;return[...null!=(a=null==e?void 0:e.values())?a:[]]},y=(e,a)=>null==e?void 0:e.forEach(a),S=(e,a)=>null==e?void 0:e.delete(a),k=e=>new Map(e),J=(e,a)=>null==e?void 0:e.get(a),E=(e,a)=>y(e,((e,l)=>a(l,e))),O=(e,a)=>{var l;return i([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>a(l,e)))},j=(e,a,l)=>T(l)?(S(e,a),e):null==e?void 0:e.set(a,l),x=(e,a,l)=>(p(e,a)||j(e,a,l()),J(e,a)),A=e=>new Set(R(e)||T(e)?e:[e]),P=(e,a)=>null==e?void 0:e.add(a),D=e=>[e,e],N=()=>[k(),k()],G=/[^A-Za-z]+/,z=/[^A-Za-z0-9]+/,F=/^( *)\/\*\* *(.*?) *\*\/$/gm,W=(e,a,l)=>e.substring(a,l),M=e=>e.toUpperCase(),Z=e=>e.toLowerCase(),_=(e,a,l,t=1)=>{const o=`${a}${1==t?"":t}`;return p(e,o)?_(e,a,l,t+1):(j(e,o,l),o)},Q=e=>e.replace(F,((e,a,l)=>{const t=77-U(a);return`${a}/**\n${l.replace(RegExp(`([^\\n]{1,${t}})(\\s|$)`,"g"),a+" * $1\n")}${a} */`})),U=e=>e.length,q=(e,l=a)=>e.join(l),B=e=>e.flat(1e3),H=(e,a=0)=>q(i(e.split(z),((e,l)=>(l>0||a?M:Z)(W(e,0,1))+W(e,1)))),K=e=>M(q((e&&!G.test(e[0])?e:" "+e).split(z),"_")),X=e=>`/** ${e}. */`,Y=()=>{const e=N(),l=k(),t=k(),o=k();return[(...e)=>q(B(e),"\n"),(a,l,...t)=>$(t,(t=>P(x(e[a],l,A),t))),(e,a,t)=>_(l,e,[a,t]),(e,a,l,o,n,s="")=>_(t,e,[a,l,o,n,s]),(e,a,l)=>_(o,e,R(l)?[`(${a}) => {`,l,"}"]:[`(${a}) => ${l}`]),(e,a)=>J(o,e)===a?e:_(o,e,a),l=>[...d(O(e[l],((e,a)=>`import {${q(d(L(e)),", ")}} from '${a}';`))),a],()=>O(l,(([e,l],t)=>[X(l),`export type ${t} = ${e};`,a])),e=>O(t,(([l,t,o,n,s],r)=>{const d=e?[`${r}: ${s}(${l}): ${t} => ${o},`]:[`${r}${s}(${l}): ${t};`];return e||w(d,X(n)),c(d,a),d})),()=>O(o,((e,l)=>(e=R(e)?e:[e],c(e,b(e)+";"),[`const ${l} = ${h(e)}`,e,a])))]},ee=Object,ae=ee.keys,le=ee.freeze,te=e=>V(e,ee)&&e.constructor==ee,oe=(e,a)=>i(ee.entries(e),(([e,l])=>a(l,e))),ne=e=>te(e)&&I(ae(e)),se=e=>{const a=new WeakMap;return l=>(a.has(l)||a.set(l,e(l)),a.get(l))},re="the Store",de="A function for",$e="export",ie="listener",ue=" | undefined",Ie=`Registers a ${ie} that will be called`,ce="Represents",be=" => void",we="the end of the transaction",he="the specified Row",ge="a string serialization of",Ce=(e=0,a=0)=>`the ${De[e]}content of${a?" "+re:""}`,Ve=(e,a=0,l=0)=>`${Ae[e]} ${Ce(a,1)}${l?" when set":""}`,Te=(e,a=0)=>`${ce} a Row when ${a?"s":"g"}etting ${Ce()} the '${e}' Table`,ve=(e,a,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in ${a}`,fe=(e,a)=>`Calls a function for each ${e} in ${a}`,Re=(e,a=re)=>`Gets whether ${e} exists in ${a}`,me=e=>"A function that takes "+e,pe=(e,a=0)=>`${de} listening to changes to ${Pe[e]} in ${Pe[a]}`,Le=(e,l,t=0)=>`${Ie} whenever ${e} in ${l} change`+(t?a:"s"),ye=e=>`the '${e}' Table`,Se=e=>`${he} in ${ye(e)}`,ke=e=>`the '${e}' Cell`,Je=e=>`the '${e}' Value`,Ee=(e,a=0)=>`${Ae[a]} ${Ce()} ${ye(e)}`,Oe=(e,a=0)=>`${Ae[a]} ${Ce()} ${Se(e)}`,je=(e,a,l=0)=>`${Ae[l]} ${ke(a)} for ${Se(e)}`,xe=(e,a=0)=>`${Ae[a]} ${Je(e)}`,Ae=["Gets","Sets","Sets part of","Deletes",ce,"Gets "+ge,"Sets "+ge,Ie+" whenever"],Pe=[re,"Tables","Table Ids","a Table","Row Ids","a Row","Cell Ids","a Cell","invalid Cell changes","Values","Value Ids","a Value","invalid Value changes"],De=["","tabular ","keyed value "],Ne=["DoRollback","Id","IdOrNull","Ids","Json","Store"],Ge=(e,l=a,t=a)=>`store.${e}(${l})${t?" as "+t:a}`,ze=(e,l=a)=>`fluent(() => ${Ge(e,l)})`,Fe=(e,l=a,t=a)=>`store.${e}(${l?l+", ":a}proxy(${ie})${t?", "+t:a})`,We=(e,l,o)=>{if(ne(e)&&ne(l))return D(a);const[r,d,$,i,u,I,b,w,h,g]=Y(),C=`./${H(o)}.d`,V=H(o,1),v=H(V),R=[],m=k(),p=l=>oe(e,((e,t)=>l(t,x(m,t,(()=>{const e=H(t,1);return[$(e+"Table",`{[rowId: Id]: ${e}Row}`,`${ce} the '${t}' Table`),$(e+"Row",`{${q(y(t,((e,l,t)=>`'${e}'${T(t)?"?":a}: ${l};`))," ")}}`,Te(t)),$(e+"RowWhenSet",`{${q(y(t,((e,a)=>`'${e}'?: ${a};`))," ")}}`,Te(t,1)),$(e+"CellId",q(y(t,(e=>`'${e}'`))," | "),`A Cell Id for the '${t}' Table`),$(e+"CellCallback",`(...[cellId, cell]: ${q(y(t,((e,a)=>`[cellId: '${e}', cell: ${a}]`))," | ")})${be}`,me(`a Cell Id and value from a Row in the '${t}' Table`)),$(e+"RowCallback",`(rowId: Id, forEachCell: (cellCallback: ${e}CellCallback)${be})${be}`,me(`a Row Id from the '${t}' Table, and a Cell iterator`))]})),H(t,1),I(K(t),`'${t}'`)))),y=(a,l)=>oe(e[a],((e,a)=>l(a,e[n],e[s],I(K(a),`'${a}'`),H(a,1)))),S=e=>oe(l,((a,l)=>e(l,a[n],a[s],I(K(l),`'${l}'`),H(l,1))));if(d(1,C,V,`create${V} as create${V}Decl`),!ne(e)){const e=$("Tables",`{${q(p(((e,a)=>`'${e}'?: ${a[0]};`))," ")}}`,Ve(4,1)),l=$("TableId",q(p((e=>`'${e}'`))," | "),"A Table Id in "+re),o=$("TableCallback",`(...[tableId, rowCallback]: ${q(p(((e,a)=>`[tableId: '${e}', forEachRow: (rowCallback: ${a[5]})${be}]`))," | ")})${be}`,me("a Table Id, and a Row iterator")),r=$("GetCellChange",`(...[tableId, rowId, cellId]: ${q(p(((e,a)=>`[tableId: '${e}', rowId: Id, cellId: ${a[3]}]`))," | ")}) => CellChange`,de+" returning information about any Cell's changes during a transaction"),u=$("TablesListener",`(${v}: ${V}, getCellChange: ${r}${ue})${be}`,pe(1)),b=$("TableIdsListener",`(${v}: ${V})${be}`,pe(2)),w=$("TableListener",`(${v}: ${V}, tableId: ${l}, getCellChange: ${r}${ue})${be}`,pe(3)),h=$("RowIdsListener",`(${v}: ${V}, tableId: ${l})`+be,pe(4,3)),g=$("RowListener",`(${v}: ${V}, tableId: ${l}, rowId: Id, getCellChange: ${r}${ue})${be}`,pe(5,3)),m=$("CellIdsListener",`(${v}: ${V}, tableId: ${l}, rowId: Id)`+be,pe(6,5)),S=$("CellListener",`(...[${v}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${q(B(p((e=>y(e,((a,l)=>`[${v}: ${V}, tableId: '${e}', rowId: Id, cellId: '${a}', newCell: ${l}${ue}, oldCell: ${l}${ue}, getCellChange: ${r} | undefined]`)))))," | ")})${be}`,pe(7,5)),J=$("InvalidCellListener",`(${v}: ${V}, tableId: Id, rowId: Id, cellId: Id, invalidCells: any[])${be}`,pe(8));i("hasTables",a,t,Ge("hasTables"),Re("any Table")),i("getTables",a,e,Ge("getTables"),Ve(0,1)),i("setTables","tables: "+e,V,ze("setTables","tables"),Ve(1,1)),i("delTables",a,V,ze("delTables"),Ve(3,1)),i("getTableIds",a,l+"[]",Ge("getTableIds",a,l+"[]"),ve("Table",re)),i("forEachTable","tableCallback: "+o,"void",Ge("forEachTable","tableCallback as any"),fe("Table",re));const O=k();p(((e,[l,o,n,s,r,$],u,I)=>{d(1,C,l,o,n,s,r,$),i(`has${u}Table`,a,t,Ge("hasTable",I),Re(ye(e))),i(`get${u}Table`,a,l,Ge("getTable",I,l),Ee(e)),i(`set${u}Table`,"table: "+l,V,ze("setTable",I+", table"),Ee(e,1)),i(`del${u}Table`,a,V,ze("delTable",I),Ee(e,3)),i(`get${u}RowIds`,a,"Ids",Ge("getRowIds",I),ve("Row",ye(e))),i(`get${u}SortedRowIds`,`cellId?: ${s}, descending?: boolean, offset?: number, limit?: number`,"Ids",Ge("getSortedRowIds",I+", cellId, descending, offset, limit"),ve("Row",ye(e),1)),i(`forEach${u}Row`,"rowCallback: "+$,"void",Ge("forEachRow",I+", rowCallback as any"),fe("Row",ye(e))),i(`has${u}Row`,"rowId: Id",t,Ge("hasRow",I+", rowId"),Re(he,ye(e))),i(`get${u}Row`,"rowId: Id",o,Ge("getRow",I+", rowId",o),Oe(e)),i(`set${u}Row`,"rowId: Id, row: "+n,V,ze("setRow",I+", rowId, row"),Oe(e,1)),i(`add${u}Row`,"row: "+n,"Id"+ue,Ge("addRow",I+", row"),"Adds a new Row to "+ye(e)),i(`set${u}PartialRow`,"rowId: Id, partialRow: "+n,V,ze("setPartialRow",I+", rowId, partialRow"),Oe(e,2)),i(`del${u}Row`,"rowId: Id",V,ze("delRow",I+", rowId"),Oe(e,3)),i(`get${u}CellIds`,"rowId: Id",s+"[]",Ge("getCellIds",I+", rowId",s+"[]"),ve("Cell",Se(e))),i(`forEach${u}Cell`,"rowId: Id, cellCallback: "+r,"void",Ge("forEachCell",I+", rowId, cellCallback as any"),fe("Cell",Se(e))),y(e,((l,o,n,s,r)=>{const d="Map"+H(o,1);j(O,o,d),i(`has${u}${r}Cell`,"rowId: Id",t,Ge("hasCell",`${I}, rowId, ${s}`),Re(ke(l),Se(e)));const $=`${o}${T(n)?ue:a}`;i(`get${u}${r}Cell`,"rowId: Id",$,Ge("getCell",`${I}, rowId, ${s}`,$),je(e,l)),i(`set${u}${r}Cell`,`rowId: Id, cell: ${o} | ${d}`,V,ze("setCell",`${I}, rowId, ${s}, cell as any`),je(e,l,1)),i(`del${u}${r}Cell`,"rowId: Id",V,ze("delCell",`${I}, rowId, ${s}`),je(e,l,3))}))})),i("getTablesJson",a,"Json",Ge("getTablesJson"),Ve(5,1)),i("setTablesJson","tablesJson: Json",V,ze("setTablesJson","tablesJson"),Ve(6,1)),i("addTablesListener",`${ie}: ${u}, mutator?: boolean`,"Id",Fe("addTablesListener",a,"mutator"),Ve(7,1)+" changes"),i("addTableIdsListener",`${ie}: ${b}, mutator?: boolean`,"Id",Fe("addTableIdsListener",a,"mutator"),Le("the Table Ids",re,1)),i("addTableListener",`tableId: ${l} | null, ${ie}: ${w}, mutator?: boolean`,"Id",Fe("addTableListener","tableId","mutator"),Le("a Table",re)),i("addRowIdsListener",`tableId: ${l} | null, ${ie}: ${h}, mutator?: boolean`,"Id",Fe("addRowIdsListener","tableId","mutator"),Le("the Row Ids","a Table",1)),i("addRowListener",`tableId: ${l} | null, rowId: IdOrNull, ${ie}: ${g}, mutator?: boolean`,"Id",Fe("addRowListener","tableId, rowId","mutator"),Le("a Row","a Table")),i("addCellIdsListener",`tableId: ${l} | null, rowId: IdOrNull, ${ie}: ${m}, mutator?: boolean`,"Id",Fe("addCellIdsListener","tableId, rowId","mutator"),Le("the Cell Ids","a Row",1)),i("addCellListener",`tableId: ${l} | null, rowId: IdOrNull, cellId: ${q(p(((e,a)=>a[3]))," | ")} | null, ${ie}: ${S}, mutator?: boolean`,"Id",Fe("addCellListener","tableId, rowId, cellId","mutator"),Le("a Cell","a Row")),i("addInvalidCellListener",`tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull, ${ie}: ${J}, mutator?: boolean`,"Id",Fe("addInvalidCellListener","tableId, rowId, cellId","mutator"),Ie+" whenever an invalid Cell change was attempted"),E(O,((e,a)=>$(a,`(cell: ${e}${ue}) => ${e}`,`Takes a ${e} Cell value and returns another`))),d(1,C,e,l,o,u,b,w,h,g,m,S,J,...L(O)),d(0,"tinybase","CellChange"),c(R,".setTablesSchema({",B(p(((e,l,t,o)=>[`[${o}]: {`,...y(e,((e,l,t,o)=>`[${o}]: {[${I(K(n),`'${n}'`)}]: ${I(K(l),`'${l}'`)}${T(t)?a:`, [${I(K(s),`'${s}'`)}]: ${f(t)?I(K(t),`'${t}'`):t}`}},`)),"},"]))),"})")}if(!ne(l)){const e=$("Values",`{${q(S(((e,l,t)=>`'${e}'${T(t)?"?":a}: ${l};`))," ")}}`,Ve(4,2)),l=$("ValuesWhenSet",`{${q(S(((e,a)=>`'${e}'?: ${a};`))," ")}}`,Ve(4,2,1)),o=$("ValueId",q(S((e=>`'${e}'`))," | "),"A Value Id in "+re),r=$("ValueCallback",`(...[valueId, rowCallback]: ${q(S(((e,a)=>`[valueId: '${e}', value: ${a}]`))," | ")})${be}`,me("a Value Id, and value")),u=$("GetValueChange",`(valueId: ${o}) => ValueChange`,de+" returning information about any Value's changes during a transaction"),b=$("ValuesListener",`(${v}: ${V}, getValueChange: ${u}${ue})`+be,pe(9)),w=$("ValueIdsListener",`(${v}: ${V})${be}`,pe(10)),h=$("ValueListener",`(...[${v}, valueId, newValue, oldValue, getValueChange]: ${q(S(((e,a)=>`[${v}: ${V}, valueId: '${e}', newValue: ${a}${ue}, oldValue: ${a}${ue}, getValueChange: ${u} | undefined]`))," | ")})${be}`,pe(11)),g=$("InvalidValueListener",`(${v}: ${V}, valueId: Id, invalidValues: any[])${be}`,pe(12));i("hasValues",a,t,Ge("hasValues"),Re("any Value")),i("getValues",a,e,Ge("getValues",a,e),Ve(0,2)),i("setValues","values: "+l,V,ze("setValues","values"),Ve(1,2)),i("setPartialValues","partialValues: "+l,V,ze("setPartialValues","partialValues"),Ve(2,2)),i("delValues",a,V,ze("delValues"),Ve(3,2)),i("getValueIds",a,o+"[]",Ge("getValueIds",a,o+"[]"),ve("Value",re)),i("forEachValue","valueCallback: "+r,"void",Ge("forEachValue","valueCallback as any"),fe("Value",re)),S(((e,l,o,n,s)=>{i(`has${s}Value`,a,t,Ge("hasValue",n),Re(Je(e))),i(`get${s}Value`,a,l,Ge("getValue",n,l),xe(e)),i(`set${s}Value`,"value: "+l,V,ze("setValue",n+", value"),xe(e,1)),i(`del${s}Value`,a,V,ze("delValue",n),xe(e,3))})),i("getValuesJson",a,"Json",Ge("getValuesJson"),Ve(5,2)),i("setValuesJson","valuesJson: Json",V,ze("setValuesJson","valuesJson"),Ve(6,2)),i("addValuesListener",`${ie}: ${b}, mutator?: boolean`,"Id",Fe("addValuesListener",a,"mutator"),Ve(7,2)+" changes"),i("addValueIdsListener",`${ie}: ${w}, mutator?: boolean`,"Id",Fe("addValueIdsListener",a,"mutator"),Le("the Value Ids",re,1)),i("addValueListener",`valueId: ${o} | null, ${ie}: ${h}, mutator?: boolean`,"Id",Fe("addValueListener","valueId","mutator"),Le("a Value",re)),i("addInvalidValueListener",`valueId: IdOrNull, ${ie}: ${g}, mutator?: boolean`,"Id",Fe("addInvalidValueListener","valueId","mutator"),Ie+" whenever an invalid Cell change was attempted"),d(1,C,e,l,o,r,b,w,h,g),d(0,"tinybase","ValueChange"),c(R,".setValuesSchema({",S(((e,l,t,o)=>[`[${o}]: {[${I(K(n),`'${n}'`)}]: ${I(K(l),`'${l}'`)}${T(t)?a:`, [${I(K(s),`'${s}'`)}]: ${f(t)?I(K(t),`'${t}'`):t}`}},`])),"})")}d(0,"tinybase",...Ne);const J=$("TransactionListener",`(${v}: ${V}, cellsTouched: boolean, valuesTouched: boolean)${be}`,de+" listening to the completion of a transaction");return i("getJson",a,"Json",Ge("getJson"),Ve(5)),i("setJson","json: Json",V,ze("setJson","json"),Ve(6)),i("transaction","actions: () => Return, doRollback?: DoRollback","Return",Ge("transaction","actions, doRollback"),"Execute a transaction to make multiple mutations","<Return>"),i("startTransaction",a,V,ze("startTransaction"),"Explicitly starts a transaction"),i("finishTransaction","doRollback?: DoRollback,",V,ze("finishTransaction","doRollback"),"Explicitly finishes a transaction"),i("addWillFinishTransactionListener",`${ie}: ${J}`,"Id",Fe("addWillFinishTransactionListener"),`${Ie} just before ${we}`),i("addDidFinishTransactionListener",`${ie}: ${J}`,"Id",Fe("addDidFinishTransactionListener"),`${Ie} just after ${we}`),i("callListener",ie+"Id: Id",V,ze("callListener",ie+"Id"),`Manually provoke a ${ie} to be called`),i("delListener",ie+"Id: Id",V,ze("delListener",ie+"Id"),`Remove a ${ie} that was previously added to ${re}`),i("getStore",a,"Store","store",Ae[0]+" the underlying Store object"),d(1,"tinybase","createStore",...Ne),d(1,C,V,`create${V} as create${V}Decl`,J),I("store",["createStore()",...R]),u("fluent","actions: () => Store",["actions();",`return ${v};`]),u("proxy",ie+": any",`(_: Store, ...args: any[]) => ${ie}(${v}, ...args)`),I(v,["{",...h(1),"}"]),[r(...b(0),...w(),`${$e} interface ${V} {`,...h(0),"}",a,X(`Creates a ${V} object`),`${$e} function create${V}(): ${V};`),r(...b(1),`${$e} const create${V}: typeof create${V}Decl = () => {`,...g(),`return Object.freeze(${v});`,"};")]};var Me=Object.defineProperty,Ze=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,Ue=(e,a,l)=>a in e?Me(e,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[a]=l,qe=(e,a)=>{for(var l in a||(a={}))_e.call(a,l)&&Ue(e,l,a[l]);if(Ze)for(var l of Ze(a))Qe.call(a,l)&&Ue(e,l,a[l]);return e},Be=(e,a,l)=>new Promise(((t,o)=>{var n=e=>{try{r(l.next(e))}catch(e){o(e)}},s=e=>{try{r(l.throw(e))}catch(e){o(e)}},r=e=>e.done?t(e.value):Promise.resolve(e.value).then(n,s);r((l=l.apply(e,a)).next())}));const He={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Ke=se((e=>{const a=()=>{const a=g(e.getTablesSchemaJson());return!ne(a)||r(e.getTableIds(),(l=>{const t=e.getRowIds(l),o=k();if(r(t,(a=>r(e.getCellIds(l,a),(t=>{const n=e.getCell(l,a,t),s=x(o,t,(()=>[m(n),k(),[0],0])),[r,d,[$]]=s,i=x(d,n,(()=>0))+1;return i>$&&(s[2]=[i,n]),j(d,n,i),s[3]++,r==m(n)})))))return a[l]={},y(o,(([e,,[,o],r],d)=>{a[l][d]=qe({[n]:e},r==u(t)?{[s]:o}:{})})),1}))?a:{}},l=()=>{const a=g(e.getValuesSchemaJson());return ne(a)&&e.forEachValue(((e,l)=>{a[e]={[n]:m(l)}})),a},t=e=>We(a(),l(),e),o=e=>Be(void 0,null,(function*(){let a;try{a=(yield import("prettier")).format}catch(e){a=e=>e}return i(t(e),(e=>Q(a(e,He))))}));return le({getStoreStats:a=>{let l=0,t=0,o=0;const n={};return e.forEachTable(((e,s)=>{l++;let r=0,d=0;const $={};s(((e,l)=>{r++;let t=0;l((()=>t++)),d+=t,a&&($[e]={rowCells:t})})),t+=r,o+=d,a&&(n[e]={tableRows:r,tableCells:d,rows:$})})),qe({totalTables:l,totalRows:t,totalCells:o,totalValues:u(e.getValueIds()),jsonLength:U(e.getJson())},a?{detail:{tables:n}}:{})},getStoreTablesSchema:a,getStoreValuesSchema:l,getStoreApi:t,getPrettyStoreApi:o,getStore:()=>e})}));export{Ke as createTools};
|
|
1
|
+
const e=e=>typeof e,t="",l=e(t),a=e(!0),n=e(0),o="type",r="default",s="Listener",d="get",c="add",i="Ids",$="Table",u=$+"s",I=$+i,b="Row",h=b+i,p="Sorted"+b+i,f="Cell",g=f+i,v="Value",w=v+"s",C=v+i,m=(e,t)=>e.every(t),y=(e,t)=>e.sort(t),R=(e,t)=>e.forEach(t),S=(e,t)=>e.map(t),k=e=>e.length,V=e=>0==k(e),x=(e,t)=>e.filter(t),O=(e,...t)=>e.push(...t),P=e=>e.pop(),j=(e,...t)=>e.unshift(...t),D=e=>e.shift(),A=JSON.parse,N=isFinite,T=(e,t)=>e instanceof t,E=e=>null==e,M=e=>e==l||e==a,z=t=>e(t)==l,G=e=>Array.isArray(e),J=t=>{const l=e(t);return M(l)||l==n&&N(t)?l:void 0},L=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},W=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},B=(e,t)=>null==e?void 0:e.forEach(t),F=(e,t)=>null==e?void 0:e.delete(t),U=e=>new Map(e),_=(e,t)=>null==e?void 0:e.get(t),Z=(e,t)=>B(e,((e,l)=>t(l,e))),H=(e,t)=>{var l;return S([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},Q=(e,t,l)=>E(l)?(F(e,t),e):null==e?void 0:e.set(t,l),q=(e,t,l)=>(L(e,t)||Q(e,t,l()),_(e,t)),K=e=>e.toUpperCase(),X=e=>e.toLowerCase(),Y="a ",ee="A function for",te="Callback",le="Del",ae="export",ne="Id",oe="Invalid",re="Json",se=X(s),de=" | undefined",ce="Partial",ie=`Registers a ${se} that will be called`,$e="Represents",ue="Set",Ie="[]",be="the Store",he="Transaction",pe=X(he),fe="the end of the "+pe,ge="void",ve=" => "+ge,we=Y+"string serialization of",Ce=" ",me="Gets a callback that can ",ye="the ",Re=(e=0,l=0)=>`the ${Je[e]}content of`+(l?Ce+be:t),Se=(e=0,l,a=0)=>ze[l]+Ce+Re(e,1)+(a?" when set":t),ke=(e,t=0)=>$e+` a Row when ${t?"s":"g"}etting ${Re()} the '${e}' `+$,Ve=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,xe=(e,t)=>`Calls a function for each ${e} in `+t,Oe=e=>"A function that takes "+e,Pe=(e,t=0)=>ee+" listening to changes to "+Ge[e]+" in "+Ge[t],je=(e,l,a=0)=>ie+" whenever "+Ge[e]+" in "+Ge[l]+" change"+(a?t:"s"),De=e=>`the '${e}' `+$,Ae=e=>"the specified Row in "+De(e),Ne=(e,t=0)=>ze[t]+` ${Re()} `+De(e),Te=(e,t=0)=>ze[t]+` ${Re()} `+Ae(e),Ee=(e,t,l=0)=>ze[l]+` the '${t}' Cell for `+Ae(e),Me=(e,t=0)=>ze[t]+` the '${e}' Value`,ze=["Gets","Checks existence of","Sets","Deletes","Sets part of",$e,"Gets "+we,"Sets "+we,ie+" whenever",me+"set",me+"add",me+"set part of",me+"delete"],Ge=[be,u,ye+$+Ce+i,Y+$,ye+b+Ce+i,Y+b,ye+f+Ce+i,Y+f,"invalid Cell changes",w,ye+v+Ce+i,Y+v,"invalid Value changes",ye+"sorted "+b+Ce+i],Je=[t,"tabular ","keyed value "],Le=e=>new Set(G(e)||E(e)?e:[e]),We=(e,t)=>null==e?void 0:e.add(t),Be=/[^A-Za-z]+/,Fe=/[^A-Za-z0-9]+/,Ue=/^( *)\/\*\* *(.*?) *\*\/$/gm,_e=(e,t,l)=>e.substring(t,l),Ze=e=>e.includes(","),He=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return L(e,n)?He(e,t,l,a+1):(Q(e,n,l),n)},Qe=e=>e.replace(Ue,((e,t,l)=>{const a=77-qe(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),qe=e=>e.length,Ke=(e,l=t)=>e.join(l),Xe=e=>e.flat(1e3),Ye=(e,t=0)=>Ke(S(e.split(Fe),((e,l)=>(l>0||t?K:X)(_e(e,0,1))+_e(e,1)))),et=e=>K(Ke((e&&!Be.test(e[0])?e:" "+e).split(Fe),"_")),tt=e=>`/** ${e}. */`,lt=(...e)=>Ke(x(e,(e=>e)),", "),at=()=>{const e=[U(),U(),U(),U()],l=U(),a=U();return[(...e)=>Ke(Xe(e),"\n"),(t,l,...a)=>R(a,(a=>R([0,1],(n=>(null!=t?t:n)==n?We(q(e[n],l,Le),a):0)))),(e,t,a)=>He(l,e,[t,a]),(e,t,l)=>He(a,e,G(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>_(a,e)===t?e:He(a,e,t),(l=0)=>S([...y(H(e[l],((e,t)=>`import {${Ke(y(W(e)),", ")}} from '${t}';`)),((e,t)=>Ze(e)!=Ze(t)?Ze(e)?-1:1:e>t?1:-1)),t],(e=>e.replace("{React}","React"))),()=>H(l,(([e,l],a)=>[tt(l),`${ae} type ${a} = ${e};`,t])),()=>H(a,((e,l)=>(e=G(e)?e:[e],O(e,P(e)+";"),[`const ${l} = ${D(e)}`,e,t])))]},nt=Object,ot=nt.keys,rt=nt.freeze,st=e=>T(e,nt)&&e.constructor==nt,dt=(e,t)=>S(nt.entries(e),(([e,l])=>t(l,e))),ct=e=>st(e)&&V(ot(e)),it=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},$t=(e,t,l)=>[t=>dt(e,((e,a)=>t(a,Ye(a,1),l(et(a),`'${a}'`)))),(t,a)=>dt(e[t],((e,t)=>a(t,e[o],e[r],l(et(t),`'${t}'`),Ye(t,1)))),e=>dt(t,((t,a)=>e(a,t[o],t[r],l(et(a),`'${a}'`),Ye(a,1))))],ut=[d,"has","set","del","set","forEach",c,t],It=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),bt=(e,l=t)=>`fluent(() => ${It(e,l)})`,ht=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,pt=(e,l,n)=>{const[d,m,y,S,k,V,x,P]=at(),[D,A,N]=$t(e,l,k),T=U(),M=(e=0)=>H(T,(([l,a,n,o,r],s)=>{const d=e?[s+`: ${r}(${l}): ${a} => ${n},`]:[s+r+`(${l}): ${a};`];return e||j(d,tt(o)),O(d,t),d})),G=(e,l,a,n,o,r=t)=>He(T,e,[l,a,n,o,r]),J=(e,l,a,n,o,r=t,s=t,d=t)=>G(ut[e]+l+(4==e?ce:t)+a,r,n,(n==F?bt:It)(ut[e]+(4==e?ce:t)+a,s,e?void 0:n),o,d),L=(e,l,a,n=t,o=t,r=1)=>G(c+e+s,(n?n+", ":t)+se+": "+l+(r?", mutator?: boolean":t),ne,ht(c+e+s,o,r?"mutator":t),a),B=`./${Ye(n)}.d`,F=Ye(n,1),q=Ye(F),K=[],X=U();let le=[],ue=[];if(m(1,B,F,`create${F} as create${F}Decl`),!ct(e)){const e=U();D(((l,a)=>{const n=[y(a+$,`{[rowId: Id]: ${a}Row}`,$e+` the '${l}' `+$),y(a+b,`{${Ke(A(l,((e,l,a)=>`'${e}'${E(a)?"?":t}: ${l};`))," ")}}`,ke(l)),y(a+b+"WhenSet",`{${Ke(A(l,((e,t)=>`'${e}'?: ${t};`))," ")}}`,ke(l,1)),y(a+f+ne,Ke(A(l,(e=>`'${e}'`))," | "),`A Cell Id for the '${l}' `+$),y(a+f+te,`(...[cellId, cell]: ${Ke(A(l,((e,t)=>`[cellId: '${e}', cell: ${t}]`))," | ")})`+ve,Oe(`a Cell Id and value from a Row in the '${l}' `+$)),y(a+b+te,`(rowId: Id, forEachCell: (cellCallback: ${a}CellCallback)`+ve+")"+ve,Oe(`a Row Id from the '${l}' Table, and a Cell iterator`))];Q(e,l,n),m(1,B,...n)}));const l=y(u,`{${Ke(D((t=>{var l;return`'${t}'?: ${null==(l=_(e,t))?void 0:l[0]};`}))," ")}}`,Se(1,5)),n=y($+ne,Ke(D((e=>`'${e}'`))," | "),"A "+$+" Id in "+be),d=y($+te,`(...[tableId, rowCallback]: ${Ke(D((t=>{var l;return`[tableId: '${t}', forEachRow: (rowCallback: ${null==(l=_(e,t))?void 0:l[5]})${ve}]`}))," | ")})`+ve,Oe(Y+$+" Id, and a Row iterator")),c=y("GetCellChange",`(...[tableId, rowId, cellId]: ${Ke(D((t=>{var l;return`[tableId: '${t}', rowId: Id, cellId: ${null==(l=_(e,t))?void 0:l[3]}]`}))," | ")}) => CellChange`,ee+" returning information about any Cell's changes during a "+pe),v=y(u+s,`(${q}: ${F}, getCellChange: ${c}${de})`+ve,Pe(1)),w=y(I+s,`(${q}: ${F})`+ve,Pe(2)),C=y($+s,`(${q}: ${F}, tableId: ${n}, getCellChange: ${c}${de})`+ve,Pe(3)),S=y(h+s,`(${q}: ${F}, tableId: ${n})`+ve,Pe(4,3)),V=y(p+s,"("+lt(q+": "+F,"tableId: "+n,"cellId: Id"+de,"descending: boolean","offset: number","limit: number"+de,"sortedRowIds: Ids")+")"+ve,Pe(13,3)),x=y(b+s,`(${q}: ${F}, tableId: ${n}, rowId: Id, getCellChange: ${c}${de})`+ve,Pe(5,3)),P=y(g+s,`(${q}: ${F}, tableId: ${n}, rowId: Id)`+ve,Pe(6,5)),j=y(f+s,`(...[${q}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${Ke(Xe(D((e=>A(e,((t,l)=>`[${q}: ${F}, tableId: '${e}', rowId: Id, cellId: '${t}', newCell: ${l}${de}, oldCell: ${l}${de}, getCellChange: ${c} | undefined]`)))))," | ")})`+ve,Pe(7,5)),N=y(oe+f+s,`(${q}: ${F}, tableId: Id, rowId: Id, cellId: Id, invalidCells: any[])`+ve,Pe(8));le=[l,n,v,w,C,S,V,x,P,j,e],R([[l],[a],[F,"tables: "+l,"tables"],[F]],(([e,l,a],n)=>J(n,t,u,e,Se(1,n),l,a))),J(0,t,I,n+Ie,Ve($,be)),J(5,t,$,ge,xe($,be),"tableCallback: "+d,"tableCallback as any"),D(((l,n,o)=>{const[r,s,d,c,u,I]=_(e,l);R([[r],[a],[F,"table: "+r,", table"],[F]],(([e,a,r=t],s)=>J(s,n,$,e,Ne(l,s),a,o+r))),J(0,n,h,i,Ve(b,De(l)),t,o),J(0,n,p,i,Ve(b,De(l),1),"cellId?: "+c+", descending?: boolean, offset?: number, limit?: number",o+", cellId, descending, offset, limit"),J(5,n,b,ge,xe(b,De(l)),"rowCallback: "+I,o+", rowCallback as any"),R([[s],[a],[F,", row: "+d,", row"],[F],[F,", partialRow: "+d,", partialRow"]],(([e,a=t,r=t],s)=>J(s,n,b,e,Te(l,s),"rowId: Id"+a,o+", rowId"+r))),J(6,n,b,ne+de,"Adds a new Row to "+De(l),"row: "+d,o+", row"),J(0,n,g,c+Ie,Ve(f,Ae(l)),"rowId: "+ne,o+", rowId"),J(5,n,f,ge,xe(f,Ae(l)),"rowId: Id, cellCallback: "+u,o+", rowId, cellCallback as any"),A(l,((e,r,s,d,c)=>{const i="Map"+Ye(r,1);Q(X,r,i);const $=r+(E(s)?de:t);R([[$],[a],[F,`, cell: ${r} | `+i,", cell as any"],[F]],(([a,r=t,s=t],i)=>J(i,n+c,f,a,Ee(l,e,i),"rowId: Id"+r,o+", rowId, "+d+s)))}))})),J(0,t,u+re,re,Se(1,6)),J(2,t,u+re,F,Se(1,7),"tablesJson: "+re,"tables"+re),L(u,v,Se(1,8)+" changes"),L(I,w,je(2,0,1)),L($,C,je(3,0),`tableId: ${n} | null`,"tableId"),L(h,S,je(4,3,1),`tableId: ${n} | null`,"tableId"),L(p,V,je(13,3,1),lt("tableId: "+n,"cellId: Id"+de,"descending: boolean","offset: number","limit: number"+de),lt("tableId","cellId","descending","offset","limit")),L(b,x,je(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),L(g,P,je(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),L(f,j,je(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${Ke(D((l=>{var a,n;return null!=(n=null==(a=_(e,l))?void 0:a[3])?n:t}))," | ")} | null`,"tableId, rowId, cellId"),L(oe+f,N,ie+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),m(1,B,l,n,d,v,w,C,S,V,x,P,j,N,...W(X)),m(0,"tinybase","CellChange"),O(K,".setTablesSchema({",Xe(D(((e,l,a)=>[`[${a}]: {`,...A(e,((e,l,a,n)=>`[${n}]: {[${k(et(o),`'${o}'`)}]: ${k(et(l),`'${l}'`)}${E(a)?t:`, [${k(et(r),`'${r}'`)}]: `+(z(a)?k(et(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(!ct(l)){const e=y(w,"{"+Ke(N(((e,l,a)=>`'${e}'${E(a)?"?":t}: ${l};`))," ")+"}",Se(2,5)),l=y(w+"WhenSet","{"+Ke(N(((e,t)=>`'${e}'?: ${t};`))," ")+"}",Se(2,5,1)),n=y(v+ne,Ke(N((e=>`'${e}'`))," | "),"A Value Id in "+be),d=y(v+te,`(...[valueId, rowCallback]: ${Ke(N(((e,t)=>`[valueId: '${e}', value: ${t}]`))," | ")})`+ve,Oe("a Value Id, and value")),c=y("GetValueChange",`(valueId: ${n}) => ValueChange`,ee+" returning information about any Value's changes during a "+pe),i=y(w+s,`(${q}: ${F}, getValueChange: ${c}${de})`+ve,Pe(9)),$=y(C+s,`(${q}: ${F})`+ve,Pe(10)),u=y(v+s,`(...[${q}, valueId, newValue, oldValue, getValueChange]: ${Ke(N(((e,t)=>`[${q}: ${F}, valueId: '${e}', newValue: ${t}${de}, oldValue: ${t}${de}, getValueChange: ${c} | undefined]`))," | ")})`+ve,Pe(11)),I=y(oe+v+s,`(${q}: ${F}, valueId: Id, invalidValues: any[])`+ve,Pe(12));ue=[e,l,n,i,$,u],R([[e],[a],[F,"values: "+l,"values"],[F],[F,"partialValues: "+l,"partialValues"]],(([e,l,a],n)=>J(n,t,w,e,Se(2,n),l,a))),J(0,t,C,n+Ie,Ve(v,be)),J(5,t,v,"void",xe(v,be),"valueCallback: "+d,"valueCallback as any"),N(((e,l,n,o,r)=>{const s="Map"+Ye(l,1);Q(X,l,s),R([[l],[a],[F,`value: ${l} | `+s,", value as any"],[F]],(([l,a,n=t],s)=>J(s,r,v,l,Me(e,s),a,o+n)))})),J(0,t,w+re,re,Se(2,6)),J(2,t,w+re,F,Se(2,7),"valuesJson: "+re,"values"+re),L(w,i,Se(2,8)+" changes"),L(C,$,je(10,0,1)),L(v,u,je(11,0),`valueId: ${n} | null`,"valueId"),L(oe+v,I,ie+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),m(1,B,e,l,n,d,i,$,u,I),m(0,"tinybase","ValueChange"),O(K,".setValuesSchema({",N(((e,l,a,n)=>[`[${n}]: {[${k(et(o),`'${o}'`)}]: ${k(et(l),`'${l}'`)}${E(a)?t:`, [${k(et(r),`'${r}'`)}]: `+(z(a)?k(et(a),`'${a}'`):a)}},`])),"})")}Z(X,((e,t)=>y(t,`(cell: ${e}${de}) => `+e,`Takes a ${e} Cell value and returns another`))),m(null,"tinybase","DoRollback",ne,"IdOrNull",i,re,"Store");const we=y(he+s,`(${q}: ${F}, cellsTouched: boolean, valuesTouched: boolean)`+ve,ee+" listening to the completion of a "+pe);return J(0,t,re,re,Se(0,6)),J(2,t,re,F,Se(0,7),"json: "+re,"json"),J(7,t,pe,"Return","Execute a "+pe+" to make multiple mutations","actions: () => Return, doRollback?: DoRollback","actions, doRollback","<Return>"),J(7,t,"start"+he,F,"Explicitly starts a "+pe),J(7,t,"finish"+he,F,"Explicitly finishes a "+pe,"doRollback?: DoRollback,","doRollback"),L("WillFinish"+he,we,ie+" just before "+fe,t,t,0),L("DidFinish"+he,we,ie+" just after "+fe,t,t,0),J(7,t,"call"+s,F,"Manually provoke a listener to be called","listenerId: Id","listenerId"),J(3,t,s,F,"Remove a listener that was previously added to "+be,"listenerId: Id","listenerId"),G("getStore",t,"Store","store",ze[0]+" the underlying Store object"),m(1,"tinybase","createStore"),m(1,B,F,`create${F} as create${F}Decl`,we),k("store",["createStore()",...K]),S("fluent","actions: () => Store",["actions();",`return ${q};`]),S("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),k(q,["{",...M(1),"}"]),[d(...V(0),...x(),ae+" interface "+F+" {",...M(0),"}",t,tt(`Creates a ${F} object`),ae+" function create"+F+"(): "+F+";"),d(...V(1),ae+" const create"+F+": typeof create"+F+"Decl = () => {",...P(),`return Object.freeze(${q});`,"};"),le,ue]},ft="Deps",gt=e=>d+e,vt=e=>lt(gt(e),gt(e)+ft),wt="Parameter",Ct=": (parameter: "+wt+", store: Store) => ",mt="const contextValue = useContext(Context);",yt=", and registers a listener so that any changes to that result will cause a re-render",Rt=", based on a parameter",St=": ",kt=wt+"ized"+te+"<"+wt+">",Vt="<"+wt+",>",xt=ft+"?: React.DependencyList",Ot="then"+xt,Pt="then?: (store: Store",jt=lt(Pt+")"+ve,Ot),Dt="then, then"+ft,At="rowId",Nt=At+St+ne,Tt=(e,...t)=>lt(...t,se+": "+e,se+xt,"mutator?: boolean"),Et=(...e)=>lt(...e,se,se+ft,"mutator"),Mt=(e,l,a,n,o)=>{const[r,d,c,m,y,R,S,k]=at(),[V,x,P]=$t(e,l,y),D=`./${Ye(a)}.d`,A=`./${Ye(a)}-ui-react.d`,N="tinybase/ui-react",T=Ye(a,1),M=Ye(T),z=T+"Or"+T+ne,J=M+"Or"+T+ne,L=U(),W=(e,l,a,n,o,r=t)=>(d(1,A,e+" as "+e+"Decl"),He(L,e,[l,a,G(n)?["{",n,"}"]:n,o,r])),B=(e,l,a,n,o,r=t)=>W("use"+e,l,a,n,o,r),F=(e,l,a,n,o=t,r=t,s=t,c=t,i=t)=>{d(1,N,`use${l} as use${l}Core`),B(e,lt(o,X,c),a,ee+`(${J}, use${l}Core, [`+(r||t)+(i?"], ["+i:t)+"])",n,s)},Z=(e,t,l,a)=>W(e,t,1,l,a),Q=(e=0)=>H(L,(([l,a,n,o,r],s)=>{const d=e?[ae+` const ${s}: typeof ${s}Decl = ${r}(${l}): ${1==a?"any":a} =>`,n]:[ae+` function ${s}${r}(${l}): ${1==a?"ComponentReturnType":a};`];return e||j(d,tt(o)),O(d,t),d}));d(null,"tinybase",ne,i,"IdOrNull","Store",te,wt+"ized"+te),d(0,N,"ComponentReturnType"),d(0,D,T);const q=c(z,T+" | "+ne,`Used when you need to refer to a ${T} in a React hook or component`),K=c("ProviderProps",`{readonly ${M}?: ${T}; readonly ${M}ById?: {[${M}Id: Id]: ${T}}}`,`Used with the Provider component, so that a ${T} can be passed into the context of an application`);d(1,"react","React"),d(1,A,q,K);const X=J+"?: "+q;y("{createContext, useContext, useMemo}","React"),y("Context",`createContext<[${T}?, {[${M}Id: Id]: ${T}}?]>([])`),B("Create"+T,`create: () => ${T}, create`+xt,T,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${T} within a React application with convenient memoization`);const Y=B(T,"id?: Id",T+de,[mt,"return id == null ? contextValue[0] : contextValue[1]?.[id];"],`Get a reference to a ${T} from within a Provider component context`),ee=m("useHook",J+`: ${q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${Y}(${J} as Id);`,`return hook(...preParams, ((${J} == null || typeof ${J} == 'string')`,`? ${M} : ${J})?.getStore(), ...postParams)`]);if(!ct(e)){const[e,l,a,o,r,c,v,w,C,m,y]=n;d(null,D,e,l,a,o,r,c,v,w,C,m),d(1,N),d(1,D,T),F(u,u,e,Se(1,0)+yt),F(I,I,l+Ie,Ve($,be)+yt),F(ue+u+te,ue+u+te,kt,Se(1,9)+Rt,lt(gt(u)+Ct+e,gt(u)+xt),vt(u),Vt,lt(Pt,`tables: ${e})`+ve,Ot),Dt),F(le+u+te,le+u+te,te,Se(1,12),t,t,t,jt,Dt),V(((e,l,a)=>{const[n,o,r,s]=_(y,e);d(0,D,n,o,r,s),d(1,D,n,o,r,s),F(l+$,$,n,Ne(e)+yt,t,a),F(l+h,h,i,Ve(b,De(e))+yt,t,a),F(l+p,p,i,Ve(b,De(e),1)+yt,"cellId?: "+s+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit"),F(l+b,b,o,Te(e)+yt,Nt,lt(a,At)),F(l+g,g,s+Ie,Ve(f,Ae(e))+yt,Nt,lt(a,At)),F(ue+l+$+te,ue+$+te,kt,Ne(e,9)+Rt,lt(gt($)+Ct+n,gt($)+xt),lt(a,vt($)),Vt,lt(Pt,`table: ${n})`+ve,Ot),Dt),F(le+l+$+te,le+$+te,te,Ne(e,12),t,a,t,jt,Dt),F(ue+l+b+te,ue+b+te,kt,Te(e,9)+Rt,lt(Nt,gt(b)+Ct+r,gt(b)+xt),lt(a,At,vt(b)),Vt,lt(Pt,`row: ${r})`+ve,Ot),Dt),F("Add"+l+b+te,"Add"+b+te,kt,Te(e,10)+Rt,lt(gt(b)+Ct+r,gt(b)+xt),lt(a,vt(b)),Vt,"then?: ("+lt(Nt+de,"store: Store","row: "+r+")"+ve,"then"+xt),Dt),F(ue+l+ce+b+te,ue+ce+b+te,kt,Te(e,11)+Rt,lt(Nt,gt(ce+b)+Ct+r,gt(ce+b)+xt),lt(a,At,vt(ce+b)),Vt,lt(Pt,`partialRow: ${r})`+ve,Ot),Dt),F(le+l+b+te,le+b+te,te,Te(e,12),Nt,lt(a,At),t,jt,Dt),x(e,((n,o,r,s,c)=>{const i="Map"+Ye(o,1);d(0,D,i),d(1,D,i),F(l+c+f,f,o+(E(r)?de:t),Ee(e,n)+yt,Nt,lt(a,At,s)),F(ue+l+c+f+te,ue+f+te,kt,Ee(e,n,9)+Rt,lt(Nt,gt(f)+Ct+o+" | "+i,gt(f)+xt),lt(a,At,s,vt(f)),Vt,lt(Pt,`cell: ${o} | ${i})`+ve,Ot),Dt),F(le+l+c+f+te,le+f+te,te,Ee(e,n,12),lt(Nt,"forceDel?: boolean"),lt(a,At,s,"forceDel"),t,jt,Dt)}))}));const R=Ke(V((e=>{var l,a;return null!=(a=null==(l=_(y,e))?void 0:l[3])?a:t}))," | ");F(u+s,u+s,ge,Se(1,8)+" changes",Tt(a),Et()),F(I+s,I+s,ge,je(2,0,1),Tt(o),Et()),F($+s,$+s,ge,je(3,0),Tt(r,`tableId: ${l} | null`),Et("tableId")),F(h+s,h+s,ge,je(4,3,1),Tt(c,`tableId: ${l} | null`),Et("tableId")),F(p+s,p+s,ge,je(13,3,1),Tt(v,`tableId: ${l} | null`,"cellId: "+R+de,"descending: boolean","offset: number","limit: number"+de),Et("tableId","cellId","descending","offset","limit")),F(b+s,b+s,ge,je(5,3),Tt(w,`tableId: ${l} | null`,At+": IdOrNull"),Et("tableId",At)),F(g+s,g+s,ge,je(6,5,1),Tt(C,`tableId: ${l} | null`,At+": IdOrNull"),Et("tableId",At)),F(f+s,f+s,ge,je(7,5),Tt(m,`tableId: ${l} | null`,At+": IdOrNull",`cellId: ${R} | null`),Et("tableId",At,"cellId"))}if(!ct(l)){const[e,l,a,n,r,c]=o;d(null,D,...o),F(w,w,e,Se(2,0)+yt),F(C,C,a+Ie,Ve(v,be)+yt),F(ue+w+te,ue+w+te,kt,Se(2,9)+Rt,lt(gt(w)+Ct+l,gt(w)+xt),vt(w),Vt,lt(Pt,`values: ${l})`+ve,Ot),Dt),F(ue+ce+w+te,ue+ce+w+te,kt,Se(2,11)+Rt,lt(gt(ce+w)+Ct+l,gt(ce+w)+xt),vt(ce+w),Vt,lt(Pt,`partialValues: ${l})`+ve,Ot),Dt),F(le+w+te,le+w+te,te,Se(2,12),t,t,t,jt,Dt),P(((e,l,a,n,o)=>{const r="Map"+Ye(l,1);d(0,D,r),d(1,D,r),F(o+v,v,l,Me(e)+yt,t,n),F(ue+o+v+te,ue+v+te,kt,Me(e,9)+Rt,lt(gt(v)+Ct+l+" | "+r,gt(v)+xt),lt(n,vt(v)),Vt,lt(Pt,`value: ${l} | ${r})`+ve,Ot),Dt),F(le+o+v+te,le+v+te,te,Me(e,12),t,n,t,jt,Dt)})),F(w+s,w+s,ge,Se(2,8)+" changes",Tt(n),Et()),F(C+s,C+s,ge,je(10,0,1),Tt(r),Et()),F(v+s,v+s,ge,je(11,0),Tt(c,`valueId: ${a} | null`),Et("valueId"))}return Z("Provider",`{${M}, ${M}ById, children}: `+K+" & {children: React.ReactNode}",[mt,"return (","<Context.Provider","value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}","</Context.Provider>",");"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...R(0),...S(),...Q(0)),r(...R(1),...k(),...Q(1))]},zt=(e,l,a)=>{if(ct(e)&&ct(l))return[t,t,t,t];const[n,o,r,s]=pt(e,l,a);return[n,o,...Mt(e,l,a,r,s)]};var Gt=Object.defineProperty,Jt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Wt=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,Ut=(e,t,l)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,_t=(e,t)=>{for(var l in t||(t={}))Bt.call(t,l)&&Ut(e,l,t[l]);if(Wt)for(var l of Wt(t))Ft.call(t,l)&&Ut(e,l,t[l]);return e},Zt=(e,t)=>Jt(e,Lt(t)),Ht=(e,t,l)=>new Promise(((a,n)=>{var o=e=>{try{s(l.next(e))}catch(e){n(e)}},r=e=>{try{s(l.throw(e))}catch(e){n(e)}},s=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,r);s((l=l.apply(e,t)).next())}));const Qt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},qt=it((e=>{const t=()=>{const t=A(e.getTablesSchemaJson());return!ct(t)||m(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=U();if(m(a,(t=>m(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),r=q(n,a,(()=>[J(o),U(),[0],0])),[s,d,[c]]=r,i=q(d,o,(()=>0))+1;return i>c&&(r[2]=[i,o]),Q(d,o,i),r[3]++,s==J(o)})))))return t[l]={},B(n,(([e,,[,n],s],d)=>{t[l][d]=_t({[o]:e},s==k(a)?{[r]:n}:{})})),1}))?t:{}},l=()=>{const t=A(e.getValuesSchemaJson());return ct(t)&&e.forEachValue(((e,l)=>{t[e]={[o]:J(l)}})),t},a=e=>zt(t(),l(),e),n=e=>Ht(void 0,null,(function*(){const t=["d.ts","ts","d.ts","tsx"];let l;try{l=(yield import("prettier")).format}catch(e){l=e=>e}return S(a(e),((e,a)=>Qe(l(e,Zt(_t({},Qt),{filepath:"_."+t[a]})))))}));return rt({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,r)=>{l++;let s=0,d=0;const c={};r(((e,l)=>{s++;let a=0;l((()=>a++)),d+=a,t&&(c[e]={rowCells:a})})),a+=s,n+=d,t&&(o[e]={tableRows:s,tableCells:d,rows:c})})),_t({totalTables:l,totalRows:a,totalCells:n,totalValues:k(e.getValueIds()),jsonLength:qe(e.getJson())},t?{detail:{tables:o}}:{})},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{qt as createTools};
|
package/lib/es6/tools.js.gz
CHANGED
|
Binary file
|
package/lib/es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as o}from"react";const t=e=>typeof e,r=t(""),l=(e,o)=>e.map(o),d=e=>null==e,s=(e,o,t)=>d(e)?null==t?void 0:t():o(e),n=()=>{},{createContext:u,useContext:a}=e,i=u([]),I=(e,o)=>{const t=a(i);return d(e)?t[o]:((e,o)=>s(e,(e=>e[o])))(t[o+1],e)},c=(e,o)=>{const l=I(e,o);return d(e)||(e=>t(e)==r)(e)?l:e},p=e=>I(e,0),b=e=>I(e,2),v=e=>I(e,4),g=e=>I(e,6),w=e=>I(e,8),R=e=>I(e,10),C=e=>c(e,0),m=e=>c(e,2),y=e=>c(e,4),k=e=>c(e,6),h=e=>c(e,8),f=e=>c(e,10),{useCallback:P,useEffect:T,useMemo:q,useRef:x,useState:S}=e,V=(e,o,t=[])=>{const r=q((()=>o(e)),[e,...t]);return T((()=>()=>r.destroy()),[r]),r},O=(e,o,t,r=[],l)=>{const[,s]=S(),n=P((()=>{var l,d;return null!=(d=null==(l=null==o?void 0:o["get"+e])?void 0:l.call(o,...r))?d:t}),[o,...r]),[u]=S(n),a=x(u);return q((()=>a.current=n()),[n]),B(e,o,((...e)=>{a.current=d(l)?n():e[l],s([])}),[],r),a.current},B=(e,o,t,r=[],l=[],...d)=>T((()=>{var r;const s=null==(r=null==o?void 0:o["add"+e+"Listener"])?void 0:r.call(o,...l,t,...d);return()=>null==o?void 0:o.delListener(s)}),[o,...l,...r,...d]),L=(e,o,t,r=[],l=n,d=[],...u)=>{const a=C(e);return P((e=>s(a,(r=>s(t(e,r),(e=>l(r["set"+o](...u,e),e)))))),[a,o,...r,...d,...u])},j=(e,o,t=n,r=[],...l)=>{const d=C(e);return P((()=>t(null==d?void 0:d["del"+o](...l))),[d,o,...r,...l])},M=(e,o,t)=>{const r=f(e);return P((()=>null==r?void 0:r[o](t)),[r,o,t])},E=(e,o=[])=>q(e,o),A=e=>O("Tables",C(e),{}),D=e=>O("TableIds",C(e),[],[]),F=(e,o)=>O("Table",C(o),{},[e]),z=(e,o)=>O("RowIds",C(o),[],[e]),G=(e,o,t,r=0,l,d)=>O("SortedRowIds",C(d),[],[e,o,t,r,l],6),H=(e,o,t)=>O("Row",C(t),{},[e,o]),J=(e,o,t)=>O("CellIds",C(t),[],[e,o]),K=(e,o,t,r)=>O("Cell",C(r),void 0,[e,o,t],4),N=e=>O("Values",C(e),{}),Q=e=>O("ValueIds",C(e),[],[]),U=(e,o)=>O("Value",C(o),void 0,[e]),W=(e,o,t,r,l)=>L(t,"Tables",e,o,r,l),X=(e,o,t,r,l,d)=>L(r,"Table",o,t,l,d,e),Y=(e,o,t,r,l,d,s)=>L(l,"Row",t,r,d,s,e,o),Z=(e,o,t=[],r,l=n,d=[])=>{const u=C(r);return P((t=>s(u,(r=>s(o(t,r),(o=>l(r.addRow(e,o),r,o)))))),[u,e,...t,...d])},$=(e,o,t,r,l,d,s)=>L(l,"PartialRow",t,r,d,s,e,o),_=(e,o,t,r,l,d,s,n)=>L(d,"Cell",r,l,s,n,e,o,t),ee=(e,o,t,r,l)=>L(t,"Values",e,o,r,l),oe=(e,o,t,r,l)=>L(t,"PartialValues",e,o,r,l),te=(e,o,t,r,l,d)=>L(r,"Value",o,t,l,d,e),re=(e,o,t)=>j(e,"Tables",o,t),le=(e,o,t,r)=>j(o,"Table",t,r,e),de=(e,o,t,r,l)=>j(t,"Row",r,l,e,o),se=(e,o,t,r,l,d,s)=>j(l,"Cell",d,s,e,o,t,r),ne=(e,o,t)=>j(e,"Values",o,t),ue=(e,o,t,r)=>j(o,"Value",t,r,e),ae=(e,o,t,r)=>B("Tables",C(r),e,o,[],t),ie=(e,o,t,r)=>B("TableIds",C(r),e,o,[],t),Ie=(e,o,t,r,l)=>B("Table",C(l),o,t,[e],r),ce=(e,o,t,r,l)=>B("RowIds",C(l),o,t,[e],r),pe=(e,o,t,r,l,d,s,n,u)=>B("SortedRowIds",C(u),d,s,[e,o,t,r,l],n),be=(e,o,t,r,l,d)=>B("Row",C(d),t,r,[e,o],l),ve=(e,o,t,r,l,d)=>B("CellIds",C(d),t,r,[e,o],l),ge=(e,o,t,r,l,d,s)=>B("Cell",C(s),r,l,[e,o,t],d),we=(e,o,t,r)=>B("Values",C(r),e,o,[],t),Re=(e,o,t,r)=>B("ValueIds",C(r),e,o,[],t),Ce=(e,o,t,r,l)=>B("Value",C(l),o,t,[e],r),me=(e,o,t)=>V(e,o,t),ye=(e,o)=>O("Metric",m(o),void 0,[e]),ke=(e,o,t,r)=>B("Metric",m(r),o,t,[e]),he=(e,o,t)=>V(e,o,t),fe=(e,o)=>O("SliceIds",y(o),[],[e]),Pe=(e,o,t)=>O("SliceRowIds",y(t),[],[e,o]),Te=(e,o,t,r)=>B("SliceIds",y(r),o,t,[e]),qe=(e,o,t,r,l)=>B("SliceRowIds",y(l),t,r,[e,o]),xe=(e,o,t)=>V(e,o,t),Se=(e,o,t)=>O("RemoteRowId",k(t),void 0,[e,o]),Ve=(e,o,t)=>O("LocalRowIds",k(t),[],[e,o]),Oe=(e,o,t)=>O("LinkedRowIds",k(t),[],[e,o]),Be=(e,o,t,r,l)=>B("RemoteRowId",k(l),t,r,[e,o]),Le=(e,o,t,r,l)=>B("LocalRowIds",k(l),t,r,[e,o]),je=(e,o,t,r,l)=>B("LinkedRowIds",k(l),t,r,[e,o]),Me=(e,o,t)=>V(e,o,t),Ee=(e,o)=>O("ResultTable",h(o),{},[e]),Ae=(e,o)=>O("ResultRowIds",h(o),[],[e]),De=(e,o,t,r=0,l,d)=>O("ResultSortedRowIds",h(d),[],[e,o,t,r,l],6),Fe=(e,o,t)=>O("ResultRow",h(t),{},[e,o]),ze=(e,o,t)=>O("ResultCellIds",h(t),[],[e,o]),Ge=(e,o,t,r)=>O("ResultCell",h(r),void 0,[e,o,t]),He=(e,o,t,r)=>B("ResultTable",h(r),o,t,[e]),Je=(e,o,t,r)=>B("ResultRowIds",h(r),o,t,[e]),Ke=(e,o,t,r,l,d,s,n)=>B("ResultSortedRowIds",h(n),d,s,[e,o,t,r,l]),Ne=(e,o,t,r,l)=>B("ResultRow",h(l),t,r,[e,o]),Qe=(e,o,t,r,l)=>B("ResultCellIds",h(l),t,r,[e,o]),Ue=(e,o,t,r,l,d)=>B("ResultCell",h(d),r,l,[e,o,t]),We=(e,o,t)=>V(e,o,t),Xe=e=>O("CheckpointIds",f(e),[[],void 0,[]]),Ye=(e,o)=>O("Checkpoint",f(o),void 0,[e]),Ze=(e=n,o=[],t,r=n,l=[])=>{const d=f(t);return P((o=>s(d,(t=>{const l=e(o);r(t.addCheckpoint(l),t,l)}))),[d,...o,...l])},$e=e=>M(e,"goBackward"),_e=e=>M(e,"goForward"),eo=(e,o=[],t,r=n,l=[])=>{const d=f(t);return P((o=>s(d,(t=>s(e(o),(e=>r(t.goTo(e),e)))))),[d,...o,...l])},oo=e=>{var o;const t=f(e),[r,l]=Xe(t);return[(d=r,!(0==(e=>e.length)(d))),$e(t),l,null!=(o=s(l,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""];var d},to=e=>{var o;const t=f(e),[,,[r]]=Xe(t);return[!d(r),_e(t),r,null!=(o=s(r,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""]},ro=(e,o,t)=>B("CheckpointIds",f(t),e,o),lo=(e,o,t,r)=>B("Checkpoint",f(r),o,t,[e]),so=(e,o,t=[],r,l=[])=>{const[,d]=S(),s=q((()=>o(e)),[e,...t]);return T((()=>{var e;return e=function*(){yield null==r?void 0:r(s),d(1)},new Promise(((o,t)=>{var r=o=>{try{d(e.next(o))}catch(e){t(e)}},l=o=>{try{d(e.throw(o))}catch(e){t(e)}},d=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,l);d((e=e.apply(void 0,null)).next())})),()=>{s.destroy()}}),[s,...l]),s};var no=Object.defineProperty,uo=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,io=Object.getOwnPropertySymbols,Io=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,po=(e,o,t)=>o in e?no(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,bo=(e,o)=>{for(var t in o||(o={}))Io.call(o,t)&&po(e,t,o[t]);if(io)for(var t of io(o))co.call(o,t)&&po(e,t,o[t]);return e},vo=(e,o)=>uo(e,ao(o)),go=(e,o)=>{var t={};for(var r in e)Io.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&io)for(var r of io(e))o.indexOf(r)<0&&co.call(e,r)&&(t[r]=e[r]);return t};const{createElement:wo,useMemo:Ro}=e,Co=({tableId:e,store:o,rowComponent:t=xo,getRowComponentProps:r,separator:d,debugIds:s},n)=>To(l(n,(l=>wo(t,vo(bo({},fo(r,l)),{key:l,tableId:e,rowId:l,store:o,debugIds:s})))),d,s,e),mo=({queryId:e,queries:o,resultRowComponent:t=Go,getResultRowComponentProps:r,separator:d,debugIds:s},n)=>To(l(n,(l=>wo(t,vo(bo({},fo(r,l)),{key:l,queryId:e,rowId:l,queries:o,debugIds:s})))),d,s,e),yo=e=>{const o=k(e);return[o,null==o?void 0:o.getStore()]},ko=({relationshipId:e,relationships:o,rowComponent:t=xo,getRowComponentProps:r,separator:d,debugIds:s},n,u)=>{const[a,i]=yo(o),I=null==a?void 0:a.getLocalTableId(e),c=n(e,u,a);return To(l(c,(e=>wo(t,vo(bo({},fo(r,e)),{key:e,tableId:I,rowId:e,store:i,debugIds:s})))),d,s,u)},ho=e=>({checkpoints:o,checkpointComponent:t=Ko,getCheckpointComponentProps:r,separator:d,debugIds:s})=>{const n=f(o);return To(l(e(Xe(n)),(e=>wo(t,vo(bo({},fo(r,e)),{key:e,checkpoints:n,checkpointId:e,debugIds:s})))),d)},fo=(e,o)=>d(e)?{}:e(o),Po=({store:e,storesById:t,metrics:r,metricsById:l,indexes:d,indexesById:s,relationships:n,relationshipsById:u,queries:a,queriesById:I,checkpoints:c,checkpointsById:p,children:b})=>{const v=o(i);return wo(i.Provider,{value:Ro((()=>[null!=e?e:v[0],bo(bo({},v[1]),t),null!=r?r:v[2],bo(bo({},v[3]),l),null!=d?d:v[4],bo(bo({},v[5]),s),null!=n?n:v[6],bo(bo({},v[7]),u),null!=a?a:v[8],bo(bo({},v[9]),I),null!=c?c:v[10],bo(bo({},v[11]),p)]),[e,t,r,l,d,s,n,u,a,I,c,p,v])},b)},To=(e,o,t,r)=>{const s=d(o)||!Array.isArray(e)?e:l(e,((e,t)=>t>0?[o,e]:e));return t?[r,":{",s,"}"]:s},qo=({tableId:e,rowId:o,cellId:t,store:r,debugIds:l})=>{var d;return To(""+(null!=(d=K(e,o,t,r))?d:""),void 0,l,t)},xo=({tableId:e,rowId:o,store:t,cellComponent:r=qo,getCellComponentProps:d,separator:s,debugIds:n})=>To(l(J(e,o,t),(l=>wo(r,vo(bo({},fo(d,l)),{key:l,tableId:e,rowId:o,cellId:l,store:t,debugIds:n})))),s,n,o),So=e=>Co(e,z(e.tableId,e.store)),Vo=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=go(o,["cellId","descending","offset","limit"]);return Co(s,G(s.tableId,t,r,l,d,s.store))},Oo=({store:e,tableComponent:o=So,getTableComponentProps:t,separator:r,debugIds:d})=>To(l(D(e),(r=>wo(o,vo(bo({},fo(t,r)),{key:r,tableId:r,store:e,debugIds:d})))),r),Bo=({valueId:e,store:o,debugIds:t})=>{var r;return To(""+(null!=(r=U(e,o))?r:""),void 0,t,e)},Lo=({store:e,valueComponent:o=Bo,getValueComponentProps:t,separator:r,debugIds:d})=>To(l(Q(e),(r=>wo(o,vo(bo({},fo(t,r)),{key:r,valueId:r,store:e,debugIds:d})))),r),jo=({metricId:e,metrics:o,debugIds:t})=>{var r;return To(null!=(r=ye(e,o))?r:"",void 0,t,e)},Mo=({indexId:e,sliceId:o,indexes:t,rowComponent:r=xo,getRowComponentProps:d,separator:s,debugIds:n})=>{const u=y(t),a=null==u?void 0:u.getStore(),i=null==u?void 0:u.getTableId(e),I=Pe(e,o,u);return To(l(I,(e=>wo(r,vo(bo({},fo(d,e)),{key:e,tableId:i,rowId:e,store:a,debugIds:n})))),s,n,o)},Eo=({indexId:e,indexes:o,sliceComponent:t=Mo,getSliceComponentProps:r,separator:d,debugIds:s})=>To(l(fe(e,o),(l=>wo(t,vo(bo({},fo(r,l)),{key:l,indexId:e,sliceId:l,indexes:o,debugIds:s})))),d,s,e),Ao=({relationshipId:e,localRowId:o,relationships:t,rowComponent:r=xo,getRowComponentProps:l,debugIds:s})=>{const[n,u]=yo(t),a=null==n?void 0:n.getRemoteTableId(e),i=Se(e,o,n);return To(d(a)||d(i)?null:wo(r,vo(bo({},fo(l,i)),{key:i,tableId:a,rowId:i,store:u,debugIds:s})),void 0,s,o)},Do=e=>ko(e,Ve,e.remoteRowId),Fo=e=>ko(e,Oe,e.firstRowId),zo=({queryId:e,rowId:o,cellId:t,queries:r,debugIds:l})=>{var d;return To(""+(null!=(d=Ge(e,o,t,r))?d:""),void 0,l,t)},Go=({queryId:e,rowId:o,queries:t,resultCellComponent:r=zo,getResultCellComponentProps:d,separator:s,debugIds:n})=>To(l(ze(e,o,t),(l=>wo(r,vo(bo({},fo(d,l)),{key:l,queryId:e,rowId:o,cellId:l,queries:t,debugIds:n})))),s,n,o),Ho=e=>mo(e,Ae(e.queryId,e.queries)),Jo=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=go(o,["cellId","descending","offset","limit"]);return mo(s,De(s.queryId,t,r,l,d,s.queries))},Ko=({checkpoints:e,checkpointId:o,debugIds:t})=>{var r;return To(null!=(r=Ye(o,e))?r:"",void 0,t,o)},No=ho((e=>e[0])),Qo=ho((e=>d(e[1])?[]:[e[1]])),Uo=ho((e=>e[2]));export{No as BackwardCheckpointsView,qo as CellView,Ko as CheckpointView,Qo as CurrentCheckpointView,Uo as ForwardCheckpointsView,Eo as IndexView,Fo as LinkedRowsView,Do as LocalRowsView,jo as MetricView,Po as Provider,Ao as RemoteRowView,zo as ResultCellView,Go as ResultRowView,Jo as ResultSortedTableView,Ho as ResultTableView,xo as RowView,Mo as SliceView,Vo as SortedTableView,So as TableView,Oo as TablesView,Bo as ValueView,Lo as ValuesView,Co as tableView,Z as useAddRowCallback,K as useCell,J as useCellIds,ve as useCellIdsListener,ge as useCellListener,Ye as useCheckpoint,Xe as useCheckpointIds,ro as useCheckpointIdsListener,lo as useCheckpointListener,R as useCheckpoints,We as useCreateCheckpoints,he as useCreateIndexes,me as useCreateMetrics,so as useCreatePersister,Me as useCreateQueries,xe as useCreateRelationships,E as useCreateStore,se as useDelCellCallback,de as useDelRowCallback,le as useDelTableCallback,re as useDelTablesCallback,ue as useDelValueCallback,ne as useDelValuesCallback,$e as useGoBackwardCallback,_e as useGoForwardCallback,eo as useGoToCallback,v as useIndexes,Oe as useLinkedRowIds,je as useLinkedRowIdsListener,Ve as useLocalRowIds,Le as useLocalRowIdsListener,ye as useMetric,ke as useMetricListener,b as useMetrics,w as useQueries,to as useRedoInformation,g as useRelationships,Se as useRemoteRowId,Be as useRemoteRowIdListener,Ge as useResultCell,ze as useResultCellIds,Qe as useResultCellIdsListener,Ue as useResultCellListener,Fe as useResultRow,Ae as useResultRowIds,Je as useResultRowIdsListener,Ne as useResultRowListener,De as useResultSortedRowIds,Ke as useResultSortedRowIdsListener,Ee as useResultTable,He as useResultTableListener,H as useRow,z as useRowIds,ce as useRowIdsListener,be as useRowListener,_ as useSetCellCallback,Ze as useSetCheckpointCallback,$ as useSetPartialRowCallback,oe as useSetPartialValuesCallback,Y as useSetRowCallback,X as useSetTableCallback,W as useSetTablesCallback,te as useSetValueCallback,ee as useSetValuesCallback,fe as useSliceIds,Te as useSliceIdsListener,Pe as useSliceRowIds,qe as useSliceRowIdsListener,G as useSortedRowIds,pe as useSortedRowIdsListener,p as useStore,F as useTable,D as useTableIds,ie as useTableIdsListener,Ie as useTableListener,A as useTables,ae as useTablesListener,oo as useUndoInformation,U as useValue,Q as useValueIds,Re as useValueIdsListener,Ce as useValueListener,N as useValues,we as useValuesListener};
|
|
1
|
+
import e,{useContext as o}from"react";const t=e=>typeof e,r=t(""),l=(e,o)=>e.map(o),d=e=>null==e,s=(e,o,t)=>d(e)?null==t?void 0:t():o(e),n=e=>t(e)==r,u=()=>{},{createContext:a,useContext:i}=e,I=a([]),c=(e,o)=>{const t=i(I);return d(e)?t[o]:n(e)?((e,o)=>s(e,(e=>e[o])))(t[o+1],e):e},p=(e,o)=>{const t=c(e,o);return d(e)||n(e)?t:e},b=e=>c(e,0),v=e=>c(e,2),g=e=>c(e,4),w=e=>c(e,6),R=e=>c(e,8),C=e=>c(e,10),m=e=>p(e,0),y=e=>p(e,2),k=e=>p(e,4),h=e=>p(e,6),f=e=>p(e,8),P=e=>p(e,10),{useCallback:T,useEffect:q,useMemo:x,useRef:S,useState:V}=e,O=(e,o,t=[])=>{const r=x((()=>o(e)),[e,...t]);return q((()=>()=>r.destroy()),[r]),r},B=(e,o,t,r=[],l)=>{const[,s]=V(),n=T((()=>{var l,d;return null!=(d=null==(l=null==o?void 0:o["get"+e])?void 0:l.call(o,...r))?d:t}),[o,...r]),[u]=V(n),a=S(u);return x((()=>a.current=n()),[n]),L(e,o,((...e)=>{a.current=d(l)?n():e[l],s([])}),[],r),a.current},L=(e,o,t,r=[],l=[],...d)=>q((()=>{var r;const s=null==(r=null==o?void 0:o["add"+e+"Listener"])?void 0:r.call(o,...l,t,...d);return()=>null==o?void 0:o.delListener(s)}),[o,...l,...r,...d]),j=(e,o,t,r=[],l=u,d=[],...n)=>{const a=m(e);return T((e=>s(a,(r=>s(t(e,r),(e=>l(r["set"+o](...n,e),e)))))),[a,o,...r,...d,...n])},M=(e,o,t=u,r=[],...l)=>{const d=m(e);return T((()=>t(null==d?void 0:d["del"+o](...l))),[d,o,...r,...l])},E=(e,o,t)=>{const r=P(e);return T((()=>null==r?void 0:r[o](t)),[r,o,t])},A=(e,o=[])=>x(e,o),D=e=>B("Tables",m(e),{}),F=e=>B("TableIds",m(e),[],[]),z=(e,o)=>B("Table",m(o),{},[e]),G=(e,o)=>B("RowIds",m(o),[],[e]),H=(e,o,t,r=0,l,d)=>B("SortedRowIds",m(d),[],[e,o,t,r,l],6),J=(e,o,t)=>B("Row",m(t),{},[e,o]),K=(e,o,t)=>B("CellIds",m(t),[],[e,o]),N=(e,o,t,r)=>B("Cell",m(r),void 0,[e,o,t],4),Q=e=>B("Values",m(e),{}),U=e=>B("ValueIds",m(e),[],[]),W=(e,o)=>B("Value",m(o),void 0,[e]),X=(e,o,t,r,l)=>j(t,"Tables",e,o,r,l),Y=(e,o,t,r,l,d)=>j(r,"Table",o,t,l,d,e),Z=(e,o,t,r,l,d,s)=>j(l,"Row",t,r,d,s,e,o),$=(e,o,t=[],r,l=u,d=[])=>{const n=m(r);return T((t=>s(n,(r=>s(o(t,r),(o=>l(r.addRow(e,o),r,o)))))),[n,e,...t,...d])},_=(e,o,t,r,l,d,s)=>j(l,"PartialRow",t,r,d,s,e,o),ee=(e,o,t,r,l,d,s,n)=>j(d,"Cell",r,l,s,n,e,o,t),oe=(e,o,t,r,l)=>j(t,"Values",e,o,r,l),te=(e,o,t,r,l)=>j(t,"PartialValues",e,o,r,l),re=(e,o,t,r,l,d)=>j(r,"Value",o,t,l,d,e),le=(e,o,t)=>M(e,"Tables",o,t),de=(e,o,t,r)=>M(o,"Table",t,r,e),se=(e,o,t,r,l)=>M(t,"Row",r,l,e,o),ne=(e,o,t,r,l,d,s)=>M(l,"Cell",d,s,e,o,t,r),ue=(e,o,t)=>M(e,"Values",o,t),ae=(e,o,t,r)=>M(o,"Value",t,r,e),ie=(e,o,t,r)=>L("Tables",m(r),e,o,[],t),Ie=(e,o,t,r)=>L("TableIds",m(r),e,o,[],t),ce=(e,o,t,r,l)=>L("Table",m(l),o,t,[e],r),pe=(e,o,t,r,l)=>L("RowIds",m(l),o,t,[e],r),be=(e,o,t,r,l,d,s,n,u)=>L("SortedRowIds",m(u),d,s,[e,o,t,r,l],n),ve=(e,o,t,r,l,d)=>L("Row",m(d),t,r,[e,o],l),ge=(e,o,t,r,l,d)=>L("CellIds",m(d),t,r,[e,o],l),we=(e,o,t,r,l,d,s)=>L("Cell",m(s),r,l,[e,o,t],d),Re=(e,o,t,r)=>L("Values",m(r),e,o,[],t),Ce=(e,o,t,r)=>L("ValueIds",m(r),e,o,[],t),me=(e,o,t,r,l)=>L("Value",m(l),o,t,[e],r),ye=(e,o,t)=>O(e,o,t),ke=(e,o)=>B("Metric",y(o),void 0,[e]),he=(e,o,t,r)=>L("Metric",y(r),o,t,[e]),fe=(e,o,t)=>O(e,o,t),Pe=(e,o)=>B("SliceIds",k(o),[],[e]),Te=(e,o,t)=>B("SliceRowIds",k(t),[],[e,o]),qe=(e,o,t,r)=>L("SliceIds",k(r),o,t,[e]),xe=(e,o,t,r,l)=>L("SliceRowIds",k(l),t,r,[e,o]),Se=(e,o,t)=>O(e,o,t),Ve=(e,o,t)=>B("RemoteRowId",h(t),void 0,[e,o]),Oe=(e,o,t)=>B("LocalRowIds",h(t),[],[e,o]),Be=(e,o,t)=>B("LinkedRowIds",h(t),[],[e,o]),Le=(e,o,t,r,l)=>L("RemoteRowId",h(l),t,r,[e,o]),je=(e,o,t,r,l)=>L("LocalRowIds",h(l),t,r,[e,o]),Me=(e,o,t,r,l)=>L("LinkedRowIds",h(l),t,r,[e,o]),Ee=(e,o,t)=>O(e,o,t),Ae=(e,o)=>B("ResultTable",f(o),{},[e]),De=(e,o)=>B("ResultRowIds",f(o),[],[e]),Fe=(e,o,t,r=0,l,d)=>B("ResultSortedRowIds",f(d),[],[e,o,t,r,l],6),ze=(e,o,t)=>B("ResultRow",f(t),{},[e,o]),Ge=(e,o,t)=>B("ResultCellIds",f(t),[],[e,o]),He=(e,o,t,r)=>B("ResultCell",f(r),void 0,[e,o,t]),Je=(e,o,t,r)=>L("ResultTable",f(r),o,t,[e]),Ke=(e,o,t,r)=>L("ResultRowIds",f(r),o,t,[e]),Ne=(e,o,t,r,l,d,s,n)=>L("ResultSortedRowIds",f(n),d,s,[e,o,t,r,l]),Qe=(e,o,t,r,l)=>L("ResultRow",f(l),t,r,[e,o]),Ue=(e,o,t,r,l)=>L("ResultCellIds",f(l),t,r,[e,o]),We=(e,o,t,r,l,d)=>L("ResultCell",f(d),r,l,[e,o,t]),Xe=(e,o,t)=>O(e,o,t),Ye=e=>B("CheckpointIds",P(e),[[],void 0,[]]),Ze=(e,o)=>B("Checkpoint",P(o),void 0,[e]),$e=(e=u,o=[],t,r=u,l=[])=>{const d=P(t);return T((o=>s(d,(t=>{const l=e(o);r(t.addCheckpoint(l),t,l)}))),[d,...o,...l])},_e=e=>E(e,"goBackward"),eo=e=>E(e,"goForward"),oo=(e,o=[],t,r=u,l=[])=>{const d=P(t);return T((o=>s(d,(t=>s(e(o),(e=>r(t.goTo(e),e)))))),[d,...o,...l])},to=e=>{var o;const t=P(e),[r,l]=Ye(t);return[(d=r,!(0==(e=>e.length)(d))),_e(t),l,null!=(o=s(l,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""];var d},ro=e=>{var o;const t=P(e),[,,[r]]=Ye(t);return[!d(r),eo(t),r,null!=(o=s(r,(e=>null==t?void 0:t.getCheckpoint(e))))?o:""]},lo=(e,o,t)=>L("CheckpointIds",P(t),e,o),so=(e,o,t,r)=>L("Checkpoint",P(r),o,t,[e]),no=(e,o,t=[],r,l=[])=>{const[,d]=V(),s=x((()=>o(e)),[e,...t]);return q((()=>{var e;return e=function*(){yield null==r?void 0:r(s),d(1)},new Promise(((o,t)=>{var r=o=>{try{d(e.next(o))}catch(e){t(e)}},l=o=>{try{d(e.throw(o))}catch(e){t(e)}},d=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,l);d((e=e.apply(void 0,null)).next())})),()=>{s.destroy()}}),[s,...l]),s};var uo=Object.defineProperty,ao=Object.defineProperties,io=Object.getOwnPropertyDescriptors,Io=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,bo=(e,o,t)=>o in e?uo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,vo=(e,o)=>{for(var t in o||(o={}))co.call(o,t)&&bo(e,t,o[t]);if(Io)for(var t of Io(o))po.call(o,t)&&bo(e,t,o[t]);return e},go=(e,o)=>ao(e,io(o)),wo=(e,o)=>{var t={};for(var r in e)co.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&Io)for(var r of Io(e))o.indexOf(r)<0&&po.call(e,r)&&(t[r]=e[r]);return t};const{createElement:Ro,useMemo:Co}=e,mo=({tableId:e,store:o,rowComponent:t=So,getRowComponentProps:r,separator:d,debugIds:s},n)=>qo(l(n,(l=>Ro(t,go(vo({},Po(r,l)),{key:l,tableId:e,rowId:l,store:o,debugIds:s})))),d,s,e),yo=({queryId:e,queries:o,resultRowComponent:t=Ho,getResultRowComponentProps:r,separator:d,debugIds:s},n)=>qo(l(n,(l=>Ro(t,go(vo({},Po(r,l)),{key:l,queryId:e,rowId:l,queries:o,debugIds:s})))),d,s,e),ko=e=>{const o=h(e);return[o,null==o?void 0:o.getStore()]},ho=({relationshipId:e,relationships:o,rowComponent:t=So,getRowComponentProps:r,separator:d,debugIds:s},n,u)=>{const[a,i]=ko(o),I=null==a?void 0:a.getLocalTableId(e),c=n(e,u,a);return qo(l(c,(e=>Ro(t,go(vo({},Po(r,e)),{key:e,tableId:I,rowId:e,store:i,debugIds:s})))),d,s,u)},fo=e=>({checkpoints:o,checkpointComponent:t=No,getCheckpointComponentProps:r,separator:d,debugIds:s})=>{const n=P(o);return qo(l(e(Ye(n)),(e=>Ro(t,go(vo({},Po(r,e)),{key:e,checkpoints:n,checkpointId:e,debugIds:s})))),d)},Po=(e,o)=>d(e)?{}:e(o),To=({store:e,storesById:t,metrics:r,metricsById:l,indexes:d,indexesById:s,relationships:n,relationshipsById:u,queries:a,queriesById:i,checkpoints:c,checkpointsById:p,children:b})=>{const v=o(I);return Ro(I.Provider,{value:Co((()=>[null!=e?e:v[0],vo(vo({},v[1]),t),null!=r?r:v[2],vo(vo({},v[3]),l),null!=d?d:v[4],vo(vo({},v[5]),s),null!=n?n:v[6],vo(vo({},v[7]),u),null!=a?a:v[8],vo(vo({},v[9]),i),null!=c?c:v[10],vo(vo({},v[11]),p)]),[e,t,r,l,d,s,n,u,a,i,c,p,v])},b)},qo=(e,o,t,r)=>{const s=d(o)||!Array.isArray(e)?e:l(e,((e,t)=>t>0?[o,e]:e));return t?[r,":{",s,"}"]:s},xo=({tableId:e,rowId:o,cellId:t,store:r,debugIds:l})=>{var d;return qo(""+(null!=(d=N(e,o,t,r))?d:""),void 0,l,t)},So=({tableId:e,rowId:o,store:t,cellComponent:r=xo,getCellComponentProps:d,separator:s,debugIds:n})=>qo(l(K(e,o,t),(l=>Ro(r,go(vo({},Po(d,l)),{key:l,tableId:e,rowId:o,cellId:l,store:t,debugIds:n})))),s,n,o),Vo=e=>mo(e,G(e.tableId,e.store)),Oo=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=wo(o,["cellId","descending","offset","limit"]);return mo(s,H(s.tableId,t,r,l,d,s.store))},Bo=({store:e,tableComponent:o=Vo,getTableComponentProps:t,separator:r,debugIds:d})=>qo(l(F(e),(r=>Ro(o,go(vo({},Po(t,r)),{key:r,tableId:r,store:e,debugIds:d})))),r),Lo=({valueId:e,store:o,debugIds:t})=>{var r;return qo(""+(null!=(r=W(e,o))?r:""),void 0,t,e)},jo=({store:e,valueComponent:o=Lo,getValueComponentProps:t,separator:r,debugIds:d})=>qo(l(U(e),(r=>Ro(o,go(vo({},Po(t,r)),{key:r,valueId:r,store:e,debugIds:d})))),r),Mo=({metricId:e,metrics:o,debugIds:t})=>{var r;return qo(null!=(r=ke(e,o))?r:"",void 0,t,e)},Eo=({indexId:e,sliceId:o,indexes:t,rowComponent:r=So,getRowComponentProps:d,separator:s,debugIds:n})=>{const u=k(t),a=null==u?void 0:u.getStore(),i=null==u?void 0:u.getTableId(e),I=Te(e,o,u);return qo(l(I,(e=>Ro(r,go(vo({},Po(d,e)),{key:e,tableId:i,rowId:e,store:a,debugIds:n})))),s,n,o)},Ao=({indexId:e,indexes:o,sliceComponent:t=Eo,getSliceComponentProps:r,separator:d,debugIds:s})=>qo(l(Pe(e,o),(l=>Ro(t,go(vo({},Po(r,l)),{key:l,indexId:e,sliceId:l,indexes:o,debugIds:s})))),d,s,e),Do=({relationshipId:e,localRowId:o,relationships:t,rowComponent:r=So,getRowComponentProps:l,debugIds:s})=>{const[n,u]=ko(t),a=null==n?void 0:n.getRemoteTableId(e),i=Ve(e,o,n);return qo(d(a)||d(i)?null:Ro(r,go(vo({},Po(l,i)),{key:i,tableId:a,rowId:i,store:u,debugIds:s})),void 0,s,o)},Fo=e=>ho(e,Oe,e.remoteRowId),zo=e=>ho(e,Be,e.firstRowId),Go=({queryId:e,rowId:o,cellId:t,queries:r,debugIds:l})=>{var d;return qo(""+(null!=(d=He(e,o,t,r))?d:""),void 0,l,t)},Ho=({queryId:e,rowId:o,queries:t,resultCellComponent:r=Go,getResultCellComponentProps:d,separator:s,debugIds:n})=>qo(l(Ge(e,o,t),(l=>Ro(r,go(vo({},Po(d,l)),{key:l,queryId:e,rowId:o,cellId:l,queries:t,debugIds:n})))),s,n,o),Jo=e=>yo(e,De(e.queryId,e.queries)),Ko=e=>{var o=e,{cellId:t,descending:r,offset:l,limit:d}=o,s=wo(o,["cellId","descending","offset","limit"]);return yo(s,Fe(s.queryId,t,r,l,d,s.queries))},No=({checkpoints:e,checkpointId:o,debugIds:t})=>{var r;return qo(null!=(r=Ze(o,e))?r:"",void 0,t,o)},Qo=fo((e=>e[0])),Uo=fo((e=>d(e[1])?[]:[e[1]])),Wo=fo((e=>e[2]));export{Qo as BackwardCheckpointsView,xo as CellView,No as CheckpointView,Uo as CurrentCheckpointView,Wo as ForwardCheckpointsView,Ao as IndexView,zo as LinkedRowsView,Fo as LocalRowsView,Mo as MetricView,To as Provider,Do as RemoteRowView,Go as ResultCellView,Ho as ResultRowView,Ko as ResultSortedTableView,Jo as ResultTableView,So as RowView,Eo as SliceView,Oo as SortedTableView,Vo as TableView,Bo as TablesView,Lo as ValueView,jo as ValuesView,mo as tableView,$ as useAddRowCallback,N as useCell,K as useCellIds,ge as useCellIdsListener,we as useCellListener,Ze as useCheckpoint,Ye as useCheckpointIds,lo as useCheckpointIdsListener,so as useCheckpointListener,C as useCheckpoints,Xe as useCreateCheckpoints,fe as useCreateIndexes,ye as useCreateMetrics,no as useCreatePersister,Ee as useCreateQueries,Se as useCreateRelationships,A as useCreateStore,ne as useDelCellCallback,se as useDelRowCallback,de as useDelTableCallback,le as useDelTablesCallback,ae as useDelValueCallback,ue as useDelValuesCallback,_e as useGoBackwardCallback,eo as useGoForwardCallback,oo as useGoToCallback,g as useIndexes,Be as useLinkedRowIds,Me as useLinkedRowIdsListener,Oe as useLocalRowIds,je as useLocalRowIdsListener,ke as useMetric,he as useMetricListener,v as useMetrics,R as useQueries,ro as useRedoInformation,w as useRelationships,Ve as useRemoteRowId,Le as useRemoteRowIdListener,He as useResultCell,Ge as useResultCellIds,Ue as useResultCellIdsListener,We as useResultCellListener,ze as useResultRow,De as useResultRowIds,Ke as useResultRowIdsListener,Qe as useResultRowListener,Fe as useResultSortedRowIds,Ne as useResultSortedRowIdsListener,Ae as useResultTable,Je as useResultTableListener,J as useRow,G as useRowIds,pe as useRowIdsListener,ve as useRowListener,ee as useSetCellCallback,$e as useSetCheckpointCallback,_ as useSetPartialRowCallback,te as useSetPartialValuesCallback,Z as useSetRowCallback,Y as useSetTableCallback,X as useSetTablesCallback,re as useSetValueCallback,oe as useSetValuesCallback,Pe as useSliceIds,qe as useSliceIdsListener,Te as useSliceRowIds,xe as useSliceRowIdsListener,H as useSortedRowIds,be as useSortedRowIdsListener,b as useStore,z as useTable,F as useTableIds,Ie as useTableIdsListener,ce as useTableListener,D as useTables,ie as useTablesListener,to as useUndoInformation,W as useValue,U as useValueIds,Ce as useValueIdsListener,me as useValueListener,Q as useValues,Re as useValuesListener};
|
package/lib/es6/ui-react.js.gz
CHANGED
|
Binary file
|