tinybase 2.1.0 → 2.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +2 -0
- package/lib/checkpoints.d.ts +0 -2
- package/lib/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/debug/checkpoints.d.ts +0 -2
- package/lib/debug/checkpoints.js +4 -2
- package/lib/debug/indexes.d.ts +0 -2
- package/lib/debug/indexes.js +2 -1
- package/lib/debug/metrics.d.ts +0 -2
- package/lib/debug/metrics.js +2 -1
- package/lib/debug/queries.d.ts +0 -2
- package/lib/debug/relationships.d.ts +0 -2
- package/lib/debug/relationships.js +2 -1
- package/lib/debug/store.d.ts +1 -1
- package/lib/debug/store.js +12 -13
- package/lib/debug/tinybase.js +14 -14
- package/lib/debug/tools.d.ts +290 -0
- package/lib/debug/tools.js +955 -0
- package/lib/es6/checkpoints.d.ts +0 -2
- package/lib/es6/checkpoints.js +1 -1
- package/lib/es6/checkpoints.js.gz +0 -0
- package/lib/es6/indexes.d.ts +0 -2
- package/lib/es6/metrics.d.ts +0 -2
- package/lib/es6/queries.d.ts +0 -2
- package/lib/es6/relationships.d.ts +0 -2
- package/lib/es6/store.d.ts +1 -1
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.d.ts +290 -0
- package/lib/es6/tools.js +1 -0
- package/lib/es6/tools.js.gz +0 -0
- package/lib/indexes.d.ts +0 -2
- package/lib/metrics.d.ts +0 -2
- package/lib/queries.d.ts +0 -2
- package/lib/relationships.d.ts +0 -2
- package/lib/store.d.ts +1 -1
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.d.ts +290 -0
- package/lib/tools.js +1 -0
- package/lib/tools.js.gz +0 -0
- package/lib/umd/checkpoints.d.ts +0 -2
- package/lib/umd/checkpoints.js +1 -1
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/common.js +1 -1
- package/lib/umd/common.js.gz +0 -0
- package/lib/umd/indexes.d.ts +0 -2
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/metrics.d.ts +0 -2
- package/lib/umd/metrics.js +1 -1
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/persisters.js +1 -1
- package/lib/umd/persisters.js.gz +0 -0
- package/lib/umd/queries.d.ts +0 -2
- package/lib/umd/queries.js +1 -1
- package/lib/umd/queries.js.gz +0 -0
- package/lib/umd/relationships.d.ts +0 -2
- package/lib/umd/relationships.js +1 -1
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.d.ts +1 -1
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.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 +290 -0
- package/lib/umd/tools.js +1 -0
- 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/checkpoints.d.ts +0 -2
- package/lib/umd-es6/checkpoints.js +1 -1
- package/lib/umd-es6/checkpoints.js.gz +0 -0
- package/lib/umd-es6/common.js +1 -1
- package/lib/umd-es6/common.js.gz +0 -0
- package/lib/umd-es6/indexes.d.ts +0 -2
- package/lib/umd-es6/indexes.js +1 -1
- package/lib/umd-es6/indexes.js.gz +0 -0
- package/lib/umd-es6/metrics.d.ts +0 -2
- package/lib/umd-es6/metrics.js +1 -1
- package/lib/umd-es6/metrics.js.gz +0 -0
- package/lib/umd-es6/persisters.js +1 -1
- package/lib/umd-es6/persisters.js.gz +0 -0
- package/lib/umd-es6/queries.d.ts +0 -2
- package/lib/umd-es6/queries.js +1 -1
- package/lib/umd-es6/queries.js.gz +0 -0
- package/lib/umd-es6/relationships.d.ts +0 -2
- package/lib/umd-es6/relationships.js +1 -1
- package/lib/umd-es6/relationships.js.gz +0 -0
- package/lib/umd-es6/store.d.ts +1 -1
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.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 +290 -0
- package/lib/umd-es6/tools.js +1 -0
- 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 +36 -27
- package/readme.md +12 -12
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tools module of the TinyBase project provides utilities for working with
|
|
3
|
+
* TinyBase during development.
|
|
4
|
+
*
|
|
5
|
+
* This module is not intended to be directly used at runtime in a production
|
|
6
|
+
* environment.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module tools
|
|
10
|
+
* @since v2.2.0
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {Schema, Store} from './store.d';
|
|
14
|
+
import {Id} from './common.d';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The StoreStats type describes a set of statistics about the Store, and
|
|
18
|
+
* is used for debugging purposes.
|
|
19
|
+
*
|
|
20
|
+
* A StoreStats object is returned from the getStoreStats method.
|
|
21
|
+
*
|
|
22
|
+
* @category Statistics
|
|
23
|
+
* @since v2.2.0
|
|
24
|
+
*/
|
|
25
|
+
export type StoreStats = {
|
|
26
|
+
/**
|
|
27
|
+
* The number of Table objects in the Store.
|
|
28
|
+
*/
|
|
29
|
+
totalTables: number;
|
|
30
|
+
/**
|
|
31
|
+
* The number of Row objects in the Store, across all Table objects.
|
|
32
|
+
*/
|
|
33
|
+
totalRows: number;
|
|
34
|
+
/**
|
|
35
|
+
* The number of Cell objects in the Store, across all Row objects, across all
|
|
36
|
+
* Table objects.
|
|
37
|
+
*/
|
|
38
|
+
totalCells: number;
|
|
39
|
+
/**
|
|
40
|
+
* The string length of the Store when serialized to JSON.
|
|
41
|
+
*/
|
|
42
|
+
jsonLength: number;
|
|
43
|
+
/**
|
|
44
|
+
* Additional detailed statistics about the Store if the `detail` flag is
|
|
45
|
+
* specified in the getStoreStats method.
|
|
46
|
+
*/
|
|
47
|
+
detail?: StoreStatsDetail;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The StoreStatsDetail type describes a more detailed set of statistics about
|
|
52
|
+
* the Store, and is used for debugging purposes.
|
|
53
|
+
*
|
|
54
|
+
* A StoreStatsDetail object is added to the StoreStats object (returned from
|
|
55
|
+
* the getStoreStats method) when the `detail` flag is specified.
|
|
56
|
+
*
|
|
57
|
+
* @category Statistics
|
|
58
|
+
* @since v2.2.0
|
|
59
|
+
*/
|
|
60
|
+
export type StoreStatsDetail = {
|
|
61
|
+
/**
|
|
62
|
+
* Information about each Table in the Store.
|
|
63
|
+
*/
|
|
64
|
+
tables: {[tableId: Id]: StoreStatsTableDetail};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The StoreStatsTableDetail type describes a detailed set of statistics about a
|
|
69
|
+
* single Table in the Store, and is used for debugging purposes.
|
|
70
|
+
*
|
|
71
|
+
* @category Statistics
|
|
72
|
+
* @since v2.2.0
|
|
73
|
+
*/
|
|
74
|
+
export type StoreStatsTableDetail = {
|
|
75
|
+
/**
|
|
76
|
+
* The number of Row objects in the Table.
|
|
77
|
+
*/
|
|
78
|
+
tableRows: number;
|
|
79
|
+
/**
|
|
80
|
+
* The number of Cell objects in the Table, across all Row objects.
|
|
81
|
+
*/
|
|
82
|
+
tableCells: number;
|
|
83
|
+
rows: {[rowId: Id]: StoreStatsRowDetail};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The StoreStatsRowDetail type describes statistics about a single Row in the
|
|
88
|
+
* Store, and is used for debugging purposes.
|
|
89
|
+
*
|
|
90
|
+
* @category Statistics
|
|
91
|
+
* @since v2.2.0
|
|
92
|
+
*/
|
|
93
|
+
export type StoreStatsRowDetail = {
|
|
94
|
+
/**
|
|
95
|
+
* The number of Cell objects in the Row.
|
|
96
|
+
*/
|
|
97
|
+
rowCells: number;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* A Tools object lets you run various utilities on, and get certain information
|
|
102
|
+
* about, Store objects in development.
|
|
103
|
+
*
|
|
104
|
+
* @category Tools
|
|
105
|
+
* @since v2.2.0
|
|
106
|
+
*/
|
|
107
|
+
export interface Tools {
|
|
108
|
+
/**
|
|
109
|
+
* The getStoreStats method provides a set of statistics about the Store, and
|
|
110
|
+
* is used for debugging purposes.
|
|
111
|
+
*
|
|
112
|
+
* @param detail An optional boolean that indicates more detailed stats about
|
|
113
|
+
* the inner structure of the Store should be returned.
|
|
114
|
+
* @returns A StoreStats object containing statistics about the Store.
|
|
115
|
+
* @example
|
|
116
|
+
* This example creates a Tools object and gets basic statistics about it.
|
|
117
|
+
* ```js
|
|
118
|
+
* const store = createStore()
|
|
119
|
+
* .setTable('pets', {
|
|
120
|
+
* fido: {species: 'dog', color: 'brown'},
|
|
121
|
+
* felix: {species: 'cat', color: 'black'},
|
|
122
|
+
* cujo: {species: 'dog', color: 'black'},
|
|
123
|
+
* })
|
|
124
|
+
* .setTable('species', {
|
|
125
|
+
* dog: {price: 5},
|
|
126
|
+
* cat: {price: 4},
|
|
127
|
+
* });
|
|
128
|
+
* const tools = createTools(store);
|
|
129
|
+
* console.log(tools.getStoreStats());
|
|
130
|
+
* // -> {totalTables: 2, totalRows: 5, totalCells: 8, jsonLength: 182}
|
|
131
|
+
* ```
|
|
132
|
+
* @example
|
|
133
|
+
* This example creates a Tools object and gets detailed statistics about it.
|
|
134
|
+
* ```js
|
|
135
|
+
* const store = createStore()
|
|
136
|
+
* .setTable('pets', {
|
|
137
|
+
* fido: {species: 'dog', color: 'brown'},
|
|
138
|
+
* felix: {species: 'cat', color: 'black'},
|
|
139
|
+
* cujo: {species: 'dog', color: 'black'},
|
|
140
|
+
* })
|
|
141
|
+
* .setTable('species', {
|
|
142
|
+
* dog: {price: 5},
|
|
143
|
+
* cat: {price: 4},
|
|
144
|
+
* });
|
|
145
|
+
* const stats = createTools(store).getStoreStats(true);
|
|
146
|
+
*
|
|
147
|
+
* console.log(stats.totalTables);
|
|
148
|
+
* // -> 2
|
|
149
|
+
* console.log(stats.totalRows);
|
|
150
|
+
* // -> 5
|
|
151
|
+
* console.log(stats.totalCells);
|
|
152
|
+
* // -> 8
|
|
153
|
+
* console.log(stats.detail.tables.pets.tableRows);
|
|
154
|
+
* // -> 3
|
|
155
|
+
* console.log(stats.detail.tables.pets.tableCells);
|
|
156
|
+
* // -> 6
|
|
157
|
+
* console.log(stats.detail.tables.pets.rows);
|
|
158
|
+
* // -> {fido: {rowCells: 2}, felix: {rowCells: 2}, cujo: {rowCells: 2}}
|
|
159
|
+
* ```
|
|
160
|
+
* @category Statistics
|
|
161
|
+
* @since v2.2.0
|
|
162
|
+
*/
|
|
163
|
+
getStoreStats(detail?: boolean): StoreStats;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The getStoreSchema method returns the Schema of the Store as an object.
|
|
167
|
+
*
|
|
168
|
+
* If the Store does not already have an explicit Schema associated with it,
|
|
169
|
+
* the data in the Store will be scanned to attempt to infer a new Schema.
|
|
170
|
+
*
|
|
171
|
+
* To be successful, this requires all the values of a given Cell across a
|
|
172
|
+
* Table object's Row objects to have a consistent type. If a given Cell Id
|
|
173
|
+
* appears in every Row, then a `default` for that Cell is specified in the
|
|
174
|
+
* Schema, based on the most common value found.
|
|
175
|
+
*
|
|
176
|
+
* @returns A Schema object for the Store.
|
|
177
|
+
* @example
|
|
178
|
+
* This example creates a Tools object and gets basic statistics about a Store
|
|
179
|
+
* that already has a Schema.
|
|
180
|
+
* ```js
|
|
181
|
+
* const store = createStore().setSchema({
|
|
182
|
+
* pets: {
|
|
183
|
+
* species: {type: 'string'},
|
|
184
|
+
* color: {type: 'string'},
|
|
185
|
+
* },
|
|
186
|
+
* species: {
|
|
187
|
+
* price: {type: 'number'},
|
|
188
|
+
* },
|
|
189
|
+
* });
|
|
190
|
+
* const schema = createTools(store).getStoreSchema();
|
|
191
|
+
* console.log(schema.pets);
|
|
192
|
+
* // -> {species: {type: 'string'}, color: {type: 'string'}}
|
|
193
|
+
* ```
|
|
194
|
+
* @example
|
|
195
|
+
* This example creates a Tools object and gets basic statistics about a Store
|
|
196
|
+
* that doesn't already have a Schema.
|
|
197
|
+
* ```js
|
|
198
|
+
* const store = createStore()
|
|
199
|
+
* .setTable('pets', {
|
|
200
|
+
* fido: {species: 'dog', color: 'brown'},
|
|
201
|
+
* felix: {species: 'cat', color: 'black'},
|
|
202
|
+
* cujo: {species: 'dog', color: 'black'},
|
|
203
|
+
* })
|
|
204
|
+
* .setTable('species', {
|
|
205
|
+
* dog: {price: 5, barks: true},
|
|
206
|
+
* cat: {price: 4, purrs: true},
|
|
207
|
+
* });
|
|
208
|
+
* const schema = createTools(store).getStoreSchema();
|
|
209
|
+
* console.log(schema.pets.species);
|
|
210
|
+
* // -> {type: 'string', default: 'dog'}
|
|
211
|
+
* console.log(schema.pets.color);
|
|
212
|
+
* // -> {type: 'string', default: 'black'}
|
|
213
|
+
* console.log(schema.species.price);
|
|
214
|
+
* // -> {type: 'number', default: 5}
|
|
215
|
+
* console.log(schema.species.barks);
|
|
216
|
+
* // -> {type: 'boolean'}
|
|
217
|
+
* console.log(schema.species.purrs);
|
|
218
|
+
* // -> {type: 'boolean'}
|
|
219
|
+
* ```
|
|
220
|
+
* @category Modelling
|
|
221
|
+
* @since v2.2.0
|
|
222
|
+
*/
|
|
223
|
+
getStoreSchema(): Schema;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The getStoreApi method returns a code-generated .d.ts file and a .ts file
|
|
227
|
+
* that wraps the schema of a Store.
|
|
228
|
+
*
|
|
229
|
+
* This is currently in development, and further documentation is to come.
|
|
230
|
+
*
|
|
231
|
+
* @category Modelling
|
|
232
|
+
* @since v2.2.0
|
|
233
|
+
*/
|
|
234
|
+
getStoreApi(storeName: string): [string, string];
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The getStoreApi method attempts to return a prettified code-generated .d.ts
|
|
238
|
+
* file and a .ts file that wraps the schema of a Store.
|
|
239
|
+
*
|
|
240
|
+
* This is currently in development, and further documentation is to come.
|
|
241
|
+
*
|
|
242
|
+
* @category Modelling
|
|
243
|
+
* @since v2.2.0
|
|
244
|
+
*/
|
|
245
|
+
getPrettyStoreApi(storeName: string): Promise<[string, string]>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The createTools function creates a Tools object, and is the main entry point
|
|
250
|
+
* into the tools module.
|
|
251
|
+
*
|
|
252
|
+
* A given Store can only have one Tools object associated with it. If you call
|
|
253
|
+
* this function twice on the same Store, your second call will return a
|
|
254
|
+
* reference to the Tools object created by the first.
|
|
255
|
+
*
|
|
256
|
+
* @param store The Store for which to register tools.
|
|
257
|
+
* @returns A reference to the new Tools object.
|
|
258
|
+
* @example
|
|
259
|
+
* This example creates a Tools object.
|
|
260
|
+
*
|
|
261
|
+
* ```js
|
|
262
|
+
* const store = createStore()
|
|
263
|
+
* .setTable('pets', {
|
|
264
|
+
* fido: {species: 'dog', color: 'brown'},
|
|
265
|
+
* felix: {species: 'cat', color: 'black'},
|
|
266
|
+
* cujo: {species: 'dog', color: 'black'},
|
|
267
|
+
* })
|
|
268
|
+
* .setTable('species', {
|
|
269
|
+
* dog: {price: 5},
|
|
270
|
+
* cat: {price: 4},
|
|
271
|
+
* });
|
|
272
|
+
* const tools = createTools(store);
|
|
273
|
+
* console.log(tools.getStoreStats());
|
|
274
|
+
* // -> {totalTables: 2, totalRows: 5, totalCells: 8, jsonLength: 182}
|
|
275
|
+
* ```
|
|
276
|
+
* @example
|
|
277
|
+
* This example creates a Tools object, and calls the method a second time
|
|
278
|
+
* for the same Store to return the same object.
|
|
279
|
+
*
|
|
280
|
+
* ```js
|
|
281
|
+
* const store = createStore();
|
|
282
|
+
* const tools1 = createTools(store);
|
|
283
|
+
* const tools2 = createTools(store);
|
|
284
|
+
* console.log(tools1 === tools2);
|
|
285
|
+
* // -> true
|
|
286
|
+
* ```
|
|
287
|
+
* @category Creation
|
|
288
|
+
* @since v2.2.0
|
|
289
|
+
*/
|
|
290
|
+
export function createTools(store: Store): Tools;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="",o=t(l),n=t(!0),a=t(0),r="type",s="default",d=(e,t)=>e.every(t),i=(e,t)=>e.sort(t),c=(e,t)=>e.forEach(t),$=(e,t)=>e.map(t),I=e=>e.length,u=(e,...t)=>e.push(...t),b=e=>e.shift(),h=JSON.parse,w=isFinite,f=e=>null==e,g=e=>Array.isArray(e),C=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},p=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},v=(e,t)=>null==e?void 0:e.forEach(t),T=e=>new Map(e),R=(e,t)=>null==e?void 0:e.get(t),m=(e,t)=>{var l;return $([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},y=(e,t,l)=>{return f(l)?(n=t,null==(o=e)||o.delete(n),e):null==e?void 0:e.set(t,l);var o,n},S=(e,t,l)=>(C(e,t)||y(e,t,l()),R(e,t)),L=e=>new Set(g(e)||f(e)?e:[e]),k=/[^A-Za-z0-9]+/,A=/^( *)\/\*\* *(.*?) *\*\/$/gm,j=(e,t,l)=>e.substring(t,l),O=e=>e.toUpperCase(),x=e=>e.toLowerCase(),E=(e,t,l,o=1)=>{const n=`${t}${1==o?"":o}`;return C(e,n)?E(e,t,l,o+1):(y(e,n,l),n)},J=e=>e.length,N=(e,t="")=>e.join(t),P=(e,t=0)=>N($(e.split(k),((e,l)=>(l>0||t?O:x)(j(e,0,1))+j(e,1)))),G=e=>O(N(e.split(k),"_")),z=e=>`/** ${e}. */`,D=()=>{const e=[T(),T()],t=T(),o=T(),n=T();return[(...e)=>{const t=[],l=e=>g(e)?c(e,l):u(t,e);return c(e,l),t.join("\n")},(t,l,...o)=>c(o,(o=>{return n=S(e[t],l,L),a=o,null==n?void 0:n.add(a);var n,a})),(e,l="",o="")=>E(t,e,[l,o]),(e,l,o)=>y(t,e,[l,o]),(e,t,l,n,a,r="")=>E(o,e,[t,l,n,a,r]),(e,t,l)=>E(n,e,g(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>R(n,e)===t?e:E(n,e,t),t=>[...i(m(e[t],((e,t)=>`import {${N(i(p(e)),", ")}} from '${t}';`))),l],()=>m(t,(([e,t],o)=>[z(t),`export type ${o} = ${e};`,l])),e=>m(o,(([t,o,n,a,r],s)=>{const d=e?[`${s}: ${r}(${t}): ${o} => ${n},`]:[`${s}${r}(${t}): ${o};`];return e||((e,...t)=>{e.unshift(...t)})(d,z(a)),u(d,l),d})),()=>m(n,((e,t)=>(e=g(e)?e:[e],u(e,e.pop()+";"),[`const ${t} = ${b(e)}`,e,l])))]},F=Object,M=F.keys,W=F.freeze,_=(e,t)=>{return o=e=>e[t],f(l=e)?null==n?void 0:n():o(l);var l,o,n},B=(e,t)=>c(F.entries(e),(([e,l])=>t(l,e))),Q=e=>{return t=M(e),0==I(t);var t},U=e=>{const l=t(e);return(e=>e==o||e==n)(l)||l==a&&w(e)?l:void 0},Z="the Store",q="the specified Row",H="Registers a listener that will be called",K=(e,t="",l="")=>`store.${e}(${t})${l?" as "+l:""}`,V=(e,t="")=>`fluent(() => ${K(e,t)})`,X=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in ${t}`,Y=(e,t)=>`Calls a function for each ${e} in ${t}`,ee=(e,t=Z)=>`Gets whether ${e} exists in ${t}`,te=e=>"A function that takes "+e,le=(e,t,l=0)=>`${H} whenever ${e} in ${t} change`+(l?"":"s"),oe=(e=0)=>1==e?"Sets":2==e?"Sets part of":3==e?"Deletes":"Gets",ne=(e,l)=>{if(Q(e))return[a="// store has no inferable schema",a];var a;const d=P(l),i=P(l,1),c=P(i),$=`return ${c};`,I=[],b=[],h=[],w=[],g=[],C=[],R=[],m=(e,t="",l="")=>`store.${e}(${t?t+", ":""}proxy(listener)${l?", "+l:""})`,[S,L,k,A,j,O,x,E,J,F,M]=D();L(0,"tinybase","CellChange","ChangedCells","Id","IdOrNull","Ids","InvalidCells","Json","Store"),L(1,"tinybase","ChangedCells","Id","IdOrNull","Ids","InvalidCells","Json","Store","createStore"),O("fluent","actions: () => Store",["actions();",$]),O("proxy","listener: any",`(_: Store, ...args: any[]) => listener(${c}, ...args)`);const W=x(G(r),"'type'"),U=x(G(s),"'default'"),ne=k("Tables"),ae=k("TableId"),re=k("TableCallback"),se=k("GetCellChange"),de=k("TablesListener",`(${c}: ${i}, getCellChange: ${se} | undefined) => void`,"A function for listening to changes to the content of the Store"),ie=k("TableIdsListener",`(${c}: ${i}) => void`,"A function for listening to changes to Table Ids in the Store"),ce=k("TableListener",`(${c}: ${i}, tableId: ${ae}, getCellChange: ${se} | undefined) => void`,"A function for listening to changes to a Table in the Store"),$e=k("RowIdsListener",`(${c}: ${i}, tableId: ${ae}) => void`,"A function for listening to changes to Row Ids in the Store"),Ie=k("RowListener",`(${c}: ${i}, tableId: ${ae}, rowId: Id, getCellChange: ${se} | undefined) => void`,"A function for listening to changes to a Row in the Store"),ue=k("CellIdsListener",`(${c}: ${i}, tableId: ${ae}, rowId: Id) => void`,"A function for listening to changes to Cell Ids in the Store"),be=k("CellListener"),he=k("InvalidCellListener",`(${c}: ${i}, tableId: Id, rowId: Id, cellId: Id, invalidCells: any[]) => void;`,"A function for listening to invalid Cell changes"),we=k("TransactionListener",`(${c}: ${i}, cellsTouched: boolean) => void;`,"A function for listening to the completion of a transaction");L(1,`./${d}.d`,i,`create${i} as create${i}Decl`,ne,ae,re,de,ie,ce,$e,Ie,ue,be,he,we);const fe=(e=0)=>oe(e)+" the content of the Store";j("hasTables","",n,K("hasTables"),ee("any Table")),j("getTables","",ne,K("getTables"),fe()),j("setTables","tables: "+ne,i,V("setTables","tables"),fe(1)),j("delTables","",i,V("delTables"),fe(3)),j("getTableIds","",ae+"[]",K("getTableIds","",ae+"[]"),X("Table",Z)),j("forEachTable","tableCallback: "+re,"void",K("forEachTable","tableCallback as any"),Y("Table",Z));const ge=T();var Ce;return B(e,((e,l)=>{const a=P(l,1),r=x(G(l),`'${l}'`),$=[],p=[],v=[],T=[],m=`the '${l}' Table`,S="the specified Row in "+m,O="the content of "+m,E=(e=0)=>`${oe(e)} the content of ${m}`,J=(e=0)=>`${oe(e)} the content of ${S}`,z=(e=0)=>`Represents a Row when ${e?"s":"g"}etting ${O}`,D=k(a+"Table",`{[rowId: Id]: ${a}Row}`,"Represents "+m),F=k(a+"Row"),M=k(a+"RowWhenSet"),Q=k(a+"CellId"),Z=k(a+"CellCallback"),H=k(a+"RowCallback");L(1,`./${d}.d`,D,F,M,Q,Z,H),j(`has${a}Table`,"",n,K("hasTable",r),ee(m)),j(`get${a}Table`,"",D,K("getTable",r,D),E()),j(`set${a}Table`,"table: "+D,i,V("setTable",r+", table"),E(1)),j(`del${a}Table`,"",i,V("delTable",r),E(3)),j(`get${a}RowIds`,"","Ids",K("getRowIds",r),X("Row",m)),j(`get${a}SortedRowIds`,`cellId?: ${Q}, descending?: boolean, offset?: number, limit?: number`,"Ids",K("getSortedRowIds",r+", cellId, descending, offset, limit"),X("Row",m,1)),j(`forEach${a}Row`,"rowCallback: "+H,"void",K("forEachRow",r+", rowCallback as any"),Y("Row",m)),j(`has${a}Row`,"rowId: Id",n,K("hasRow",r+", rowId"),ee(q,m)),j(`get${a}Row`,"rowId: Id",F,K("getRow",r+", rowId",F),J()),j(`set${a}Row`,"rowId: Id, row: "+M,i,V("setRow",r+", rowId, row"),J(1)),j(`add${a}Row`,"row: "+M,"Id | undefined",K("addRow",r+", row"),"Adds a new Row to "+m),j(`set${a}PartialRow`,"rowId: Id, partialRow: "+M,i,V("setPartialRow",r+", rowId, partialRow"),J(2)),j(`del${a}Row`,"rowId: Id",i,V("delRow",r+", rowId"),J(3)),j(`get${a}CellIds`,"rowId: Id",Q+"[]",K("getCellIds",r+", rowId",Q+"[]"),X("Cell",S)),j(`forEach${a}Cell`,"rowId: Id, cellCallback: "+Z,"void",K("forEachCell",r+", rowId, cellCallback as any"),Y("Cell",S)),u(R,`[${r}]: {`),B(e,((e,d)=>{const I=P(d,1),b=x(G(d),`'${d}'`),h=e.type,w=!f(_(e,s)),C=e.default,m=`the '${d}' Cell`,L=(e=0)=>`${oe(e)} ${m} for ${S}`;var k;u(R,`[${b}]: {[${W}]: ${x(G(h),`'${h}'`)}${w?`, [${U}]: ${k=C,t(k)==o?x(G(C),`'${C}'`):C}`:""}},`),u($,`'${d}'${w?"":"?"}: ${h};`),u(p,`'${d}'?: ${h};`),u(v,`'${d}'`),u(T,`[cellId: '${d}', cell: ${h}]`),u(g,`[${c}: ${i}, tableId: '${l}', rowId: Id, cellId: '${d}', newCell: ${h} | undefined, oldCell: ${h} | undefined, getCellChange: ${se} | undefined]`);const A="Map"+P(h,1);y(ge,h,A),j(`has${a}${I}Cell`,"rowId: Id",n,K("hasCell",`${r}, rowId, ${b}`),ee(m,S));const O=`${h}${w?"":" | undefined"}`;j(`get${a}${I}Cell`,"rowId: Id",O,K("getCell",`${r}, rowId, ${b}`,O),L()),j(`set${a}${I}Cell`,`rowId: Id, cell: ${h} | ${A}`,i,V("setCell",`${r}, rowId, ${b}, cell as any`),L(1)),j(`del${a}${I}Cell`,"rowId: Id",i,V("delCell",`${r}, rowId, ${b}`),L(3))})),u(R,"},"),u(I,`'${l}'?: ${D};`),u(b,`'${l}'`),u(h,`[tableId: '${l}', forEachRow: (rowCallback: ${H}) => void]`),u(w,`[tableId: '${l}', rowId: Id, cellId: ${Q}]`),u(C,Q),A(F,`{${N($," ")}}`,z()),A(M,`{${N(p," ")}}`,z(1)),A(Q,N(v," | "),"A Cell Id for "+m),A(Z,`(...[cellId, cell]: ${N(T," | ")}) => void`,te("a Cell Id and value from a Row in "+m)),A(H,`(rowId: Id, forEachCell: (cellCallback: ${Z}) => void) => void`,te(`a Row Id from ${m}, and a Cell iterator`))})),j("getJson","","Json",K("getJson"),"Gets a a string serialization the content of the Store"),j("setJson","json: Json",i,V("setJson","json"),"Sets the content of the Store from a serialized string"),j("transaction","actions: () => Return, doRollback?: (changedCells: ChangedCells, invalidCells: InvalidCells) => boolean","Return",K("transaction","actions, doRollback"),"Execute a transaction to make multiple mutations","<Return>"),j("startTransaction","",i,V("startTransaction"),"Explicitly starts a transaction"),j("finishTransaction","doRollback?: (changedCells: ChangedCells, invalidCells: InvalidCells) => boolean,",i,V("finishTransaction","doRollback"),"Explicitly finishes a transaction"),j("addTablesListener",`listener: ${de}, mutator?: boolean`,"Id",m("addTablesListener","","mutator"),H+" whenever the content of the Store changes"),j("addTableIdsListener",`listener: ${ie}, mutator?: boolean`,"Id",m("addTableIdsListener","","mutator"),le("the Table Ids",Z,1)),j("addTableListener",`tableId: ${ae} | null, listener: ${ce}, mutator?: boolean`,"Id",m("addTableListener","tableId","mutator"),le("a Table",Z)),j("addRowIdsListener",`tableId: ${ae} | null, listener: ${$e}, mutator?: boolean`,"Id",m("addRowIdsListener","tableId","mutator"),le("the Row Ids","a Table",1)),j("addRowListener",`tableId: ${ae} | null, rowId: IdOrNull, listener: ${Ie}, mutator?: boolean`,"Id",m("addRowListener","tableId, rowId","mutator"),le("a Row","a Table")),j("addCellIdsListener",`tableId: ${ae} | null, rowId: IdOrNull, listener: ${ue}, mutator?: boolean`,"Id",m("addCellIdsListener","tableId, rowId","mutator"),le("the Cell Ids","a Row",1)),j("addCellListener",`tableId: ${ae} | null, rowId: IdOrNull, cellId: ${N(C," | ")} | null, listener: ${be}, mutator?: boolean`,"Id",m("addCellListener","tableId, rowId, cellId","mutator"),le("a Cell","a Row")),j("addInvalidCellListener",`tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull, listener: ${he}, mutator?: boolean`,"Id",m("addCellListener","tableId, rowId, cellId","mutator"),H+" whenever an invalid Cell change was attempted"),j("addWillFinishTransactionListener","listener: "+we,"Id",m("addWillFinishTransactionListener"),H+" just before the end of the transaction"),j("addDidFinishTransactionListener","listener: "+we,"Id",m("addDidFinishTransactionListener"),H+" just after the end of the transaction"),j("callListener","listenerId: Id",i,V("callListener","listenerId"),"Manually provoke a listener to be called"),j("delListener","listenerId: Id",i,V("delListener","listenerId"),"Remove a listener that was previously added to the Store"),j("getStore","","Store","store","Gets the underlying Store object"),A(ne,`{${N(I," ")}}`,"Represents the content of the Store"),A(ae,N(b," | "),"A Table Id in the Store"),A(re,`(...[tableId, rowCallback]: ${N(h," | ")}) => void`,te("a Table Id, and a Row iterator")),A(se,`(...[tableId, rowId, cellId]: ${N(w," | ")}) => CellChange`,"A function that returns information about any Cell's changes during a transaction"),A(be,`(...[${c}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${N(g," | ")}) => void`,"A function for listening to changes to a Cell in the Store"),Ce=(e,t)=>k(t,`(cell: ${e} | undefined) => ${e}`,`Takes a ${e} Cell value and returns another`),v(ge,((e,t)=>Ce(t,e))),L(1,`./${d}.d`,...p(ge)),x("store",["createStore().setSchema({",...R,"})"]),x(c,["{",...F(1),"}"]),[S(...E(0),...J(),`export interface ${i} {`,...F(0),"}","",z(`Creates a ${i} object`),`export function create${i}(): ${i};`),S(...E(1),`export const create${i}: typeof create${i}Decl = () => {`,...M(),`return Object.freeze(${c});`,"};")]};var ae=Object.defineProperty,re=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,ie=(e,t,l)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,ce=(e,t)=>{for(var l in t||(t={}))se.call(t,l)&&ie(e,l,t[l]);if(re)for(var l of re(t))de.call(t,l)&&ie(e,l,t[l]);return e};const $e={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Ie=(e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))})((e=>{const t=()=>{const t=h(e.getSchemaJson());return!Q(t)||d(e.getTableIds(),(l=>{const o=e.getRowIds(l),n=T();if(d(o,(t=>d(e.getCellIds(l,t),(o=>{const a=e.getCell(l,t,o),r=S(n,o,(()=>[U(a),T(),[0],0])),[s,d,[i]]=r,c=S(d,a,(()=>0))+1;return c>i&&(r[2]=[c,a]),y(d,a,c),r[3]++,s==U(a)})))))return t[l]={},v(n,(([e,,[,n],a],d)=>{t[l][d]=ce({[r]:e},a==I(o)?{[s]:n}:{})})),1}))?t:{}},l=e=>ne(t(),e);return W({getStoreStats:t=>{let l=0,o=0,n=0;const a={};return e.forEachTable(((e,r)=>{l++;let s=0,d=0;const i={};r(((e,l)=>{s++;let o=0;l((()=>o++)),d+=o,t&&(i[e]={rowCells:o})})),o+=s,n+=d,t&&(a[e]={tableRows:s,tableCells:d,rows:i})})),ce({totalTables:l,totalRows:o,totalCells:n,jsonLength:J(e.getJson())},t?{detail:{tables:a}}:{})},getStoreSchema:t,getStoreApi:l,getPrettyStoreApi:e=>{return t=void 0,o=null,n=function*(){const t=l(e);try{const{format:e}=yield import("prettier");return $(t,(t=>(e=>e.replace(A,((e,t,l)=>{const o=77-J(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${o}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})))(e(t,$e))))}catch(e){}return t},new Promise(((e,l)=>{var a=e=>{try{s(n.next(e))}catch(e){l(e)}},r=e=>{try{s(n.throw(e))}catch(e){l(e)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,r);s((n=n.apply(t,o)).next())}));var t,o,n}})}));e.createTools=Ie},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
Binary file
|
package/lib/umd-es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Tables",n="TableIds",d="Table",u="RowIds",i="SortedRowIds",a="Row",c="CellIds",I="Cell",w=(e,s)=>e.map(s),R=e=>null==e,p=(e,s,t)=>R(e)?null==t?void 0:t():s(e),b=()=>{},{createContext:C,useContext:k}=s,v=C([]),g=(e,s)=>{const t=k(v);return R(e)?t[s]:((e,s)=>p(e,(e=>e[s])))(t[s+1],e)},m=(e,s)=>{const o=g(e,s);return R(e)||(e=>t(e)==l)(e)?o:e},y=e=>m(e,0),h=e=>m(e,2),f=e=>m(e,4),L=e=>m(e,6),S=e=>m(e,8),T=e=>m(e,10),{useCallback:P,useEffect:x,useMemo:V,useRef:q,useState:O}=s,B=(e,s,t=[])=>{const o=V((()=>s(e)),[e,...t]);return x((()=>()=>o.destroy()),[o]),o},M=(e,s,t,o=[],l)=>{const[,r]=O(),n=P((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[d]=O(n),u=q(d);return V((()=>u.current=n()),[n]),j(e,s,((...e)=>{u.current=R(l)?n():e[l],r([])}),[],o),u.current},j=(e,s,t,o=[],l=[],...r)=>x((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...r]),D=(e,s,t,o=[],l=b,r=[],...n)=>{const d=y(e);return P((e=>p(d,(o=>p(t(e,o),(e=>l(o["set"+s](...n,e),e)))))),[d,s,...o,...r,...n])},A=(e,s,t=b,o=[],...l)=>{const r=y(e);return P((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},E=(e,s,t)=>{const o=T(e);return P((()=>null==o?void 0:o[s](t)),[o,s,t])},F=e=>M(n,y(e),[],[]),G=(e,s)=>M(u,y(s),[],[e]),Q=(e,s,t,o=0,l,r)=>M(i,y(r),[],[e,s,t,o,l],6),U=(e,s,t)=>M(c,y(t),[],[e,s]),_=(e,s,t,o)=>M(I,y(o),void 0,[e,s,t],4),z=(e,s)=>M("Metric",h(s),void 0,[e]),H=(e,s)=>M("SliceIds",f(s),[],[e]),J=(e,s,t)=>M("SliceRowIds",f(t),[],[e,s]),K=(e,s,t)=>M("RemoteRowId",L(t),void 0,[e,s]),N=(e,s,t)=>M("LocalRowIds",L(t),[],[e,s]),W=(e,s,t)=>M("LinkedRowIds",L(t),[],[e,s]),X=(e,s)=>M("ResultRowIds",S(s),[],[e]),Y=(e,s,t,o=0,l,r)=>M("ResultSortedRowIds",S(r),[],[e,s,t,o,l],6),Z=(e,s,t)=>M("ResultCellIds",S(t),[],[e,s]),$=(e,s,t,o)=>M("ResultCell",S(o),void 0,[e,s,t]),ee=e=>M("CheckpointIds",T(e),[[],void 0,[]]),se=(e,s)=>M("Checkpoint",T(s),void 0,[e]),te=e=>E(e,"goBackward"),oe=e=>E(e,"goForward");var le=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,ae=(e,s,t)=>s in e?le(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ce=(e,s)=>{for(var t in s||(s={}))ue.call(s,t)&&ae(e,t,s[t]);if(de)for(var t of de(s))ie.call(s,t)&&ae(e,t,s[t]);return e},Ie=(e,s)=>re(e,ne(s)),we=(e,s)=>{var t={};for(var o in e)ue.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&de)for(var o of de(e))s.indexOf(o)<0&&ie.call(e,o)&&(t[o]=e[o]);return t};const{createElement:Re,useMemo:pe}=s,be=({tableId:e,store:s,rowComponent:t=fe,getRowComponentProps:o,separator:l,debugIds:r},n)=>ye(w(n,(l=>Re(t,Ie(ce({},me(o,l)),{key:l,tableId:e,rowId:l,store:s,debugIds:r})))),l,r,e),Ce=({queryId:e,queries:s,resultRowComponent:t=Pe,getResultRowComponentProps:o,separator:l,debugIds:r},n)=>ye(w(n,(l=>Re(t,Ie(ce({},me(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),ke=e=>{const s=L(e);return[s,null==s?void 0:s.getStore()]},ve=({relationshipId:e,relationships:s,rowComponent:t=fe,getRowComponentProps:o,separator:l,debugIds:r},n,d)=>{const[u,i]=ke(s),a=null==u?void 0:u.getLocalTableId(e),c=n(e,d,u);return ye(w(c,(e=>Re(t,Ie(ce({},me(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,d)},ge=e=>({checkpoints:s,checkpointComponent:t=xe,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const n=T(s);return ye(w(e(ee(n)),(e=>Re(t,Ie(ce({},me(o,e)),{key:e,checkpoints:n,checkpointId:e,debugIds:r})))),l)},me=(e,s)=>R(e)?{}:e(s),ye=(e,s,t,o)=>{const l=R(s)||!Array.isArray(e)?e:w(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},he=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var n;return ye(o+(null!=(n=_(e,s,t,l))?n:o),void 0,r,t)},fe=({tableId:e,rowId:s,store:t,cellComponent:o=he,getCellComponentProps:l,separator:r,debugIds:n})=>ye(w(U(e,s,t),(r=>Re(o,Ie(ce({},me(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),r,n,s),Le=e=>be(e,G(e.tableId,e.store)),Se=({indexId:e,sliceId:s,indexes:t,rowComponent:o=fe,getRowComponentProps:l,separator:r,debugIds:n})=>{const d=f(t),u=null==d?void 0:d.getStore(),i=null==d?void 0:d.getTableId(e),a=J(e,s,d);return ye(w(a,(e=>Re(o,Ie(ce({},me(l,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:n})))),r,n,s)},Te=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var n;return ye(o+(null!=(n=$(e,s,t,l))?n:o),void 0,r,t)},Pe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Te,getResultCellComponentProps:l,separator:r,debugIds:n})=>ye(w(Z(e,s,t),(r=>Re(o,Ie(ce({},me(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:n})))),r,n,s),xe=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return ye(null!=(l=se(s,e))?l:o,void 0,t,s)},Ve=ge((e=>e[0])),qe=ge((e=>R(e[1])?[]:[e[1]])),Oe=ge((e=>e[2]));e.BackwardCheckpointsView=Ve,e.CellView=he,e.CheckpointView=xe,e.CurrentCheckpointView=qe,e.ForwardCheckpointsView=Oe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Se,getSliceComponentProps:o,separator:l,debugIds:r})=>ye(w(H(e,s),(l=>Re(t,Ie(ce({},me(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>ve(e,W,e.firstRowId),e.LocalRowsView=e=>ve(e,N,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return ye(null!=(l=z(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:n,relationships:d,relationshipsById:u,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:w})=>{const R=s.useContext(v);return Re(v.Provider,{value:pe((()=>[null!=e?e:R[0],ce(ce({},R[1]),t),null!=o?o:R[2],ce(ce({},R[3]),l),null!=r?r:R[4],ce(ce({},R[5]),n),null!=d?d:R[6],ce(ce({},R[7]),u),null!=i?i:R[8],ce(ce({},R[9]),a),null!=c?c:R[10],ce(ce({},R[11]),I)]),[e,t,o,l,r,n,d,u,i,a,c,I,R])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=fe,getRowComponentProps:l,debugIds:r})=>{const[n,d]=ke(t),u=null==n?void 0:n.getRemoteTableId(e),i=K(e,s,n);return ye(R(u)||R(i)?null:Re(o,Ie(ce({},me(l,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:r})),void 0,r,s)},e.ResultCellView=Te,e.ResultRowView=Pe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,n=we(s,["cellId","descending","offset","limit"]);return Ce(n,Y(n.queryId,t,o,l,r,n.queries))},e.ResultTableView=e=>Ce(e,X(e.queryId,e.queries)),e.RowView=fe,e.SliceView=Se,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,n=we(s,["cellId","descending","offset","limit"]);return be(n,Q(n.tableId,t,o,l,r,n.store))},e.TableView=Le,e.TablesView=({store:e,tableComponent:s=Le,getTableComponentProps:t,separator:o,debugIds:l})=>ye(w(F(e),(o=>Re(s,Ie(ce({},me(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.tableView=be,e.useAddRowCallback=(e,s,t=[],o,l=b,r=[])=>{const n=y(o);return P((t=>p(n,(o=>p(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[n,e,...t,...r])},e.useCell=_,e.useCellIds=U,e.useCellIdsListener=(e,s,t,o,l,r)=>j(c,y(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,n)=>j(I,y(n),o,l,[e,s,t],r),e.useCheckpoint=se,e.useCheckpointIds=ee,e.useCheckpointIdsListener=(e,s,t)=>j("CheckpointIds",T(t),e,s),e.useCheckpointListener=(e,s,t,o)=>j("Checkpoint",T(o),s,t,[e]),e.useCheckpoints=e=>g(e,10),e.useCreateCheckpoints=(e,s,t)=>B(e,s,t),e.useCreateIndexes=(e,s,t)=>B(e,s,t),e.useCreateMetrics=(e,s,t)=>B(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=O(),n=V((()=>s(e)),[e,...t]);return x((()=>{var e,s,t;return e=void 0,s=null,t=function*(){yield null==o?void 0:o(n),r(1)},new Promise(((o,l)=>{var r=e=>{try{d(t.next(e))}catch(e){l(e)}},n=e=>{try{d(t.throw(e))}catch(e){l(e)}},d=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,n);d((t=t.apply(e,s)).next())})),()=>{n.destroy()}}),[n,...l]),n},e.useCreateQueries=(e,s,t)=>B(e,s,t),e.useCreateRelationships=(e,s,t)=>B(e,s,t),e.useCreateStore=(e,s=[])=>V(e,s),e.useDelCellCallback=(e,s,t,o,l,r,n)=>A(l,I,r,n,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>A(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>A(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>A(e,r,s,t),e.useGoBackwardCallback=te,e.useGoForwardCallback=oe,e.useGoToCallback=(e,s=[],t,o=b,l=[])=>{const r=T(t);return P((s=>p(r,(t=>p(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>g(e,4),e.useLinkedRowIds=W,e.useLinkedRowIdsListener=(e,s,t,o,l)=>j("LinkedRowIds",L(l),t,o,[e,s]),e.useLocalRowIds=N,e.useLocalRowIdsListener=(e,s,t,o,l)=>j("LocalRowIds",L(l),t,o,[e,s]),e.useMetric=z,e.useMetricListener=(e,s,t,o)=>j("Metric",h(o),s,t,[e]),e.useMetrics=e=>g(e,2),e.useQueries=e=>g(e,8),e.useRedoInformation=e=>{var s;const t=T(e),[,,[l]]=ee(t);return[!R(l),oe(t),l,null!=(s=p(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationships=e=>g(e,6),e.useRemoteRowId=K,e.useRemoteRowIdListener=(e,s,t,o,l)=>j("RemoteRowId",L(l),t,o,[e,s]),e.useResultCell=$,e.useResultCellIds=Z,e.useResultCellIdsListener=(e,s,t,o,l)=>j("ResultCellIds",S(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>j("ResultCell",S(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>M("ResultRow",S(t),{},[e,s]),e.useResultRowIds=X,e.useResultRowIdsListener=(e,s,t,o)=>j("ResultRowIds",S(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>j("ResultRow",S(l),t,o,[e,s]),e.useResultSortedRowIds=Y,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>j("ResultSortedRowIds",S(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>M("ResultTable",S(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>j("ResultTable",S(o),s,t,[e]),e.useRow=(e,s,t)=>M(a,y(t),{},[e,s]),e.useRowIds=G,e.useRowIdsListener=(e,s,t,o,l)=>j(u,y(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>j(a,y(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,n,d)=>D(r,I,o,l,n,d,e,s,t),e.useSetCheckpointCallback=(e=b,s=[],t,o=b,l=[])=>{const r=T(t);return P((s=>p(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,n)=>D(l,"PartialRow",t,o,r,n,e,s),e.useSetRowCallback=(e,s,t,o,l,r,n)=>D(l,a,t,o,r,n,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>D(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>D(t,r,e,s,o,l),e.useSliceIds=H,e.useSliceIdsListener=(e,s,t,o)=>j("SliceIds",f(o),s,t,[e]),e.useSliceRowIds=J,e.useSliceRowIdsListener=(e,s,t,o,l)=>j("SliceRowIds",f(l),t,o,[e,s]),e.useSortedRowIds=Q,e.useSortedRowIdsListener=(e,s,t,o,l,r,n,d,u)=>j(i,y(u),r,n,[e,s,t,o,l],d),e.useStore=e=>g(e,0),e.useTable=(e,s)=>M(d,y(s),{},[e]),e.useTableIds=F,e.useTableIdsListener=(e,s,t,o)=>j(n,y(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>j(d,y(l),s,t,[e],o),e.useTables=e=>M(r,y(e),{}),e.useTablesListener=(e,s,t,o)=>j(r,y(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=T(e),[l,r]=ee(t);return[(n=l,!(0==(e=>e.length)(n))),te(t),r,null!=(s=p(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var n},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Tables",n="TableIds",d="Table",u="RowIds",i="SortedRowIds",a="Row",c="CellIds",I="Cell",w=(e,s)=>e.map(s),R=e=>null==e,p=(e,s,t)=>R(e)?null==t?void 0:t():s(e),b=()=>{},{createContext:C,useContext:k}=s,g=C([]),v=(e,s)=>{const t=k(g);return R(e)?t[s]:((e,s)=>p(e,(e=>e[s])))(t[s+1],e)},m=(e,s)=>{const o=v(e,s);return R(e)||(e=>t(e)==l)(e)?o:e},h=e=>m(e,0),y=e=>m(e,2),f=e=>m(e,4),L=e=>m(e,6),S=e=>m(e,8),T=e=>m(e,10),{useCallback:P,useEffect:x,useMemo:V,useRef:q,useState:O}=s,B=(e,s,t=[])=>{const o=V((()=>s(e)),[e,...t]);return x((()=>()=>o.destroy()),[o]),o},M=(e,s,t,o=[],l)=>{const[,r]=O(),n=P((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[d]=O(n),u=q(d);return V((()=>u.current=n()),[n]),j(e,s,((...e)=>{u.current=R(l)?n():e[l],r([])}),[],o),u.current},j=(e,s,t,o=[],l=[],...r)=>x((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...r]),D=(e,s,t,o=[],l=b,r=[],...n)=>{const d=h(e);return P((e=>p(d,(o=>p(t(e,o),(e=>l(o["set"+s](...n,e),e)))))),[d,s,...o,...r,...n])},A=(e,s,t=b,o=[],...l)=>{const r=h(e);return P((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},E=(e,s,t)=>{const o=T(e);return P((()=>null==o?void 0:o[s](t)),[o,s,t])},F=e=>M(n,h(e),[],[]),G=(e,s)=>M(u,h(s),[],[e]),Q=(e,s,t,o=0,l,r)=>M(i,h(r),[],[e,s,t,o,l],6),U=(e,s,t)=>M(c,h(t),[],[e,s]),z=(e,s,t,o)=>M(I,h(o),void 0,[e,s,t],4),H=(e,s)=>M("Metric",y(s),void 0,[e]),J=(e,s)=>M("SliceIds",f(s),[],[e]),K=(e,s,t)=>M("SliceRowIds",f(t),[],[e,s]),N=(e,s,t)=>M("RemoteRowId",L(t),void 0,[e,s]),W=(e,s,t)=>M("LocalRowIds",L(t),[],[e,s]),X=(e,s,t)=>M("LinkedRowIds",L(t),[],[e,s]),Y=(e,s)=>M("ResultRowIds",S(s),[],[e]),Z=(e,s,t,o=0,l,r)=>M("ResultSortedRowIds",S(r),[],[e,s,t,o,l],6),$=(e,s,t)=>M("ResultCellIds",S(t),[],[e,s]),_=(e,s,t,o)=>M("ResultCell",S(o),void 0,[e,s,t]),ee=e=>M("CheckpointIds",T(e),[[],void 0,[]]),se=(e,s)=>M("Checkpoint",T(s),void 0,[e]),te=e=>E(e,"goBackward"),oe=e=>E(e,"goForward");var le=Object.defineProperty,re=Object.defineProperties,ne=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ue=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,ae=(e,s,t)=>s in e?le(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ce=(e,s)=>{for(var t in s||(s={}))ue.call(s,t)&&ae(e,t,s[t]);if(de)for(var t of de(s))ie.call(s,t)&&ae(e,t,s[t]);return e},Ie=(e,s)=>re(e,ne(s)),we=(e,s)=>{var t={};for(var o in e)ue.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&de)for(var o of de(e))s.indexOf(o)<0&&ie.call(e,o)&&(t[o]=e[o]);return t};const{createElement:Re,useMemo:pe}=s,be=({tableId:e,store:s,rowComponent:t=fe,getRowComponentProps:o,separator:l,debugIds:r},n)=>he(w(n,(l=>Re(t,Ie(ce({},me(o,l)),{key:l,tableId:e,rowId:l,store:s,debugIds:r})))),l,r,e),Ce=({queryId:e,queries:s,resultRowComponent:t=Pe,getResultRowComponentProps:o,separator:l,debugIds:r},n)=>he(w(n,(l=>Re(t,Ie(ce({},me(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),ke=e=>{const s=L(e);return[s,null==s?void 0:s.getStore()]},ge=({relationshipId:e,relationships:s,rowComponent:t=fe,getRowComponentProps:o,separator:l,debugIds:r},n,d)=>{const[u,i]=ke(s),a=null==u?void 0:u.getLocalTableId(e),c=n(e,d,u);return he(w(c,(e=>Re(t,Ie(ce({},me(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,d)},ve=e=>({checkpoints:s,checkpointComponent:t=xe,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const n=T(s);return he(w(e(ee(n)),(e=>Re(t,Ie(ce({},me(o,e)),{key:e,checkpoints:n,checkpointId:e,debugIds:r})))),l)},me=(e,s)=>R(e)?{}:e(s),he=(e,s,t,o)=>{const l=R(s)||!Array.isArray(e)?e:w(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},ye=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var n;return he(o+(null!=(n=z(e,s,t,l))?n:o),void 0,r,t)},fe=({tableId:e,rowId:s,store:t,cellComponent:o=ye,getCellComponentProps:l,separator:r,debugIds:n})=>he(w(U(e,s,t),(r=>Re(o,Ie(ce({},me(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),r,n,s),Le=e=>be(e,G(e.tableId,e.store)),Se=({indexId:e,sliceId:s,indexes:t,rowComponent:o=fe,getRowComponentProps:l,separator:r,debugIds:n})=>{const d=f(t),u=null==d?void 0:d.getStore(),i=null==d?void 0:d.getTableId(e),a=K(e,s,d);return he(w(a,(e=>Re(o,Ie(ce({},me(l,e)),{key:e,tableId:i,rowId:e,store:u,debugIds:n})))),r,n,s)},Te=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var n;return he(o+(null!=(n=_(e,s,t,l))?n:o),void 0,r,t)},Pe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Te,getResultCellComponentProps:l,separator:r,debugIds:n})=>he(w($(e,s,t),(r=>Re(o,Ie(ce({},me(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:n})))),r,n,s),xe=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return he(null!=(l=se(s,e))?l:o,void 0,t,s)},Ve=ve((e=>e[0])),qe=ve((e=>R(e[1])?[]:[e[1]])),Oe=ve((e=>e[2]));e.BackwardCheckpointsView=Ve,e.CellView=ye,e.CheckpointView=xe,e.CurrentCheckpointView=qe,e.ForwardCheckpointsView=Oe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Se,getSliceComponentProps:o,separator:l,debugIds:r})=>he(w(J(e,s),(l=>Re(t,Ie(ce({},me(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>ge(e,X,e.firstRowId),e.LocalRowsView=e=>ge(e,W,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return he(null!=(l=H(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:n,relationships:d,relationshipsById:u,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:w})=>{const R=s.useContext(g);return Re(g.Provider,{value:pe((()=>[null!=e?e:R[0],ce(ce({},R[1]),t),null!=o?o:R[2],ce(ce({},R[3]),l),null!=r?r:R[4],ce(ce({},R[5]),n),null!=d?d:R[6],ce(ce({},R[7]),u),null!=i?i:R[8],ce(ce({},R[9]),a),null!=c?c:R[10],ce(ce({},R[11]),I)]),[e,t,o,l,r,n,d,u,i,a,c,I,R])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=fe,getRowComponentProps:l,debugIds:r})=>{const[n,d]=ke(t),u=null==n?void 0:n.getRemoteTableId(e),i=N(e,s,n);return he(R(u)||R(i)?null:Re(o,Ie(ce({},me(l,i)),{key:i,tableId:u,rowId:i,store:d,debugIds:r})),void 0,r,s)},e.ResultCellView=Te,e.ResultRowView=Pe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,n=we(s,["cellId","descending","offset","limit"]);return Ce(n,Z(n.queryId,t,o,l,r,n.queries))},e.ResultTableView=e=>Ce(e,Y(e.queryId,e.queries)),e.RowView=fe,e.SliceView=Se,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,n=we(s,["cellId","descending","offset","limit"]);return be(n,Q(n.tableId,t,o,l,r,n.store))},e.TableView=Le,e.TablesView=({store:e,tableComponent:s=Le,getTableComponentProps:t,separator:o,debugIds:l})=>he(w(F(e),(o=>Re(s,Ie(ce({},me(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.tableView=be,e.useAddRowCallback=(e,s,t=[],o,l=b,r=[])=>{const n=h(o);return P((t=>p(n,(o=>p(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[n,e,...t,...r])},e.useCell=z,e.useCellIds=U,e.useCellIdsListener=(e,s,t,o,l,r)=>j(c,h(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,n)=>j(I,h(n),o,l,[e,s,t],r),e.useCheckpoint=se,e.useCheckpointIds=ee,e.useCheckpointIdsListener=(e,s,t)=>j("CheckpointIds",T(t),e,s),e.useCheckpointListener=(e,s,t,o)=>j("Checkpoint",T(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCreateCheckpoints=(e,s,t)=>B(e,s,t),e.useCreateIndexes=(e,s,t)=>B(e,s,t),e.useCreateMetrics=(e,s,t)=>B(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=O(),n=V((()=>s(e)),[e,...t]);return x((()=>{var e,s,t;return e=void 0,s=null,t=function*(){yield null==o?void 0:o(n),r(1)},new Promise(((o,l)=>{var r=e=>{try{d(t.next(e))}catch(e){l(e)}},n=e=>{try{d(t.throw(e))}catch(e){l(e)}},d=e=>e.done?o(e.value):Promise.resolve(e.value).then(r,n);d((t=t.apply(e,s)).next())})),()=>{n.destroy()}}),[n,...l]),n},e.useCreateQueries=(e,s,t)=>B(e,s,t),e.useCreateRelationships=(e,s,t)=>B(e,s,t),e.useCreateStore=(e,s=[])=>V(e,s),e.useDelCellCallback=(e,s,t,o,l,r,n)=>A(l,I,r,n,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>A(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>A(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>A(e,r,s,t),e.useGoBackwardCallback=te,e.useGoForwardCallback=oe,e.useGoToCallback=(e,s=[],t,o=b,l=[])=>{const r=T(t);return P((s=>p(r,(t=>p(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>v(e,4),e.useLinkedRowIds=X,e.useLinkedRowIdsListener=(e,s,t,o,l)=>j("LinkedRowIds",L(l),t,o,[e,s]),e.useLocalRowIds=W,e.useLocalRowIdsListener=(e,s,t,o,l)=>j("LocalRowIds",L(l),t,o,[e,s]),e.useMetric=H,e.useMetricListener=(e,s,t,o)=>j("Metric",y(o),s,t,[e]),e.useMetrics=e=>v(e,2),e.useQueries=e=>v(e,8),e.useRedoInformation=e=>{var s;const t=T(e),[,,[l]]=ee(t);return[!R(l),oe(t),l,null!=(s=p(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationships=e=>v(e,6),e.useRemoteRowId=N,e.useRemoteRowIdListener=(e,s,t,o,l)=>j("RemoteRowId",L(l),t,o,[e,s]),e.useResultCell=_,e.useResultCellIds=$,e.useResultCellIdsListener=(e,s,t,o,l)=>j("ResultCellIds",S(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>j("ResultCell",S(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>M("ResultRow",S(t),{},[e,s]),e.useResultRowIds=Y,e.useResultRowIdsListener=(e,s,t,o)=>j("ResultRowIds",S(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>j("ResultRow",S(l),t,o,[e,s]),e.useResultSortedRowIds=Z,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>j("ResultSortedRowIds",S(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>M("ResultTable",S(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>j("ResultTable",S(o),s,t,[e]),e.useRow=(e,s,t)=>M(a,h(t),{},[e,s]),e.useRowIds=G,e.useRowIdsListener=(e,s,t,o,l)=>j(u,h(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>j(a,h(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,n,d)=>D(r,I,o,l,n,d,e,s,t),e.useSetCheckpointCallback=(e=b,s=[],t,o=b,l=[])=>{const r=T(t);return P((s=>p(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,n)=>D(l,"PartialRow",t,o,r,n,e,s),e.useSetRowCallback=(e,s,t,o,l,r,n)=>D(l,a,t,o,r,n,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>D(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>D(t,r,e,s,o,l),e.useSliceIds=J,e.useSliceIdsListener=(e,s,t,o)=>j("SliceIds",f(o),s,t,[e]),e.useSliceRowIds=K,e.useSliceRowIdsListener=(e,s,t,o,l)=>j("SliceRowIds",f(l),t,o,[e,s]),e.useSortedRowIds=Q,e.useSortedRowIdsListener=(e,s,t,o,l,r,n,d,u)=>j(i,h(u),r,n,[e,s,t,o,l],d),e.useStore=e=>v(e,0),e.useTable=(e,s)=>M(d,h(s),{},[e]),e.useTableIds=F,e.useTableIdsListener=(e,s,t,o)=>j(n,h(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>j(d,h(l),s,t,[e],o),e.useTables=e=>M(r,h(e),{}),e.useTablesListener=(e,s,t,o)=>j(r,h(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=T(e),[l,r]=ee(t);return[(n=l,!(0==(e=>e.length)(n))),te(t),r,null!=(s=p(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var n}},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-beta.0",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,13 +15,17 @@
|
|
|
15
15
|
],
|
|
16
16
|
"type": "module",
|
|
17
17
|
"files": [
|
|
18
|
-
"lib/**"
|
|
18
|
+
"lib/**",
|
|
19
|
+
"bin/**"
|
|
19
20
|
],
|
|
20
21
|
"exports": {
|
|
21
22
|
".": "./lib/tinybase.js",
|
|
22
23
|
"./package.json": "./package.json",
|
|
23
24
|
"./*": "./lib/*.js"
|
|
24
25
|
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"tinybase": "./bin/cli.js"
|
|
28
|
+
},
|
|
25
29
|
"react-native": "./lib/tinybase.js",
|
|
26
30
|
"typesVersions": {
|
|
27
31
|
"*": {
|
|
@@ -59,44 +63,45 @@
|
|
|
59
63
|
},
|
|
60
64
|
"devDependencies": {
|
|
61
65
|
"@babel/cli": "^7.19.3",
|
|
62
|
-
"@babel/core": "^7.
|
|
63
|
-
"@babel/preset-env": "^7.
|
|
66
|
+
"@babel/core": "^7.20.2",
|
|
67
|
+
"@babel/preset-env": "^7.20.2",
|
|
64
68
|
"@babel/preset-react": "^7.18.6",
|
|
65
69
|
"@babel/preset-typescript": "^7.18.6",
|
|
66
|
-
"@rollup/plugin-replace": "^
|
|
70
|
+
"@rollup/plugin-replace": "^5.0.1",
|
|
71
|
+
"@rollup/plugin-terser": "^0.1.0",
|
|
67
72
|
"@types/asciichart": "^1.5.6",
|
|
68
|
-
"@types/expect-puppeteer": "^5.0.
|
|
73
|
+
"@types/expect-puppeteer": "^5.0.2",
|
|
69
74
|
"@types/http-server": "^0.12.1",
|
|
70
|
-
"@types/jest": "^29.
|
|
71
|
-
"@types/jest-environment-puppeteer": "^5.0.
|
|
75
|
+
"@types/jest": "^29.2.3",
|
|
76
|
+
"@types/jest-environment-puppeteer": "^5.0.3",
|
|
72
77
|
"@types/less": "^3.0.3",
|
|
73
|
-
"@types/node": "^18.
|
|
74
|
-
"@types/puppeteer": "^5.4.
|
|
78
|
+
"@types/node": "^18.11.9",
|
|
79
|
+
"@types/puppeteer": "^5.4.7",
|
|
75
80
|
"@types/react": "^17.0.41",
|
|
76
81
|
"@types/react-dom": "^17.0.14",
|
|
77
82
|
"@types/react-test-renderer": "^17.0.1",
|
|
78
83
|
"@types/tmp": "^0.2.3",
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
80
|
-
"@typescript-eslint/parser": "^5.
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
|
85
|
+
"@typescript-eslint/parser": "^5.43.0",
|
|
81
86
|
"asciichart": "^1.5.25",
|
|
82
87
|
"babel-eslint": "^10.1.0",
|
|
83
|
-
"babel-jest": "^29.1
|
|
88
|
+
"babel-jest": "^29.3.1",
|
|
84
89
|
"babel-preset-minify": "^0.5.2",
|
|
85
90
|
"buffer-replace": "^1.0.0",
|
|
86
91
|
"country-flag-emoji-json": "^2.0.0",
|
|
87
|
-
"cspell": "^6.
|
|
88
|
-
"esbuild": "^0.15.
|
|
89
|
-
"eslint": "^8.
|
|
92
|
+
"cspell": "^6.14.2",
|
|
93
|
+
"esbuild": "^0.15.14",
|
|
94
|
+
"eslint": "^8.27.0",
|
|
90
95
|
"eslint-config-prettier": "^8.5.0",
|
|
91
|
-
"eslint-plugin-jest": "^27.
|
|
92
|
-
"eslint-plugin-jsdoc": "^39.
|
|
93
|
-
"eslint-plugin-react": "^7.31.
|
|
96
|
+
"eslint-plugin-jest": "^27.1.5",
|
|
97
|
+
"eslint-plugin-jsdoc": "^39.6.2",
|
|
98
|
+
"eslint-plugin-react": "^7.31.10",
|
|
94
99
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
95
100
|
"gulp": "^4.0.2",
|
|
96
101
|
"gulp-gzip": "^1.4.2",
|
|
97
102
|
"http-server": "^14.1.1",
|
|
98
|
-
"jest": "^29.1
|
|
99
|
-
"jest-environment-jsdom": "^29.1
|
|
103
|
+
"jest": "^29.3.1",
|
|
104
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
100
105
|
"jest-fetch-mock": "^3.0.3",
|
|
101
106
|
"jest-puppeteer": "^6.1.1",
|
|
102
107
|
"less": "^4.1.3",
|
|
@@ -105,22 +110,26 @@
|
|
|
105
110
|
"react": "^17.0.2",
|
|
106
111
|
"react-dom": "^17.0.2",
|
|
107
112
|
"react-test-renderer": "^17.0.2",
|
|
108
|
-
"rollup": "^
|
|
109
|
-
"rollup-plugin-esbuild": "^
|
|
110
|
-
"rollup-plugin-gzip": "^3.0
|
|
111
|
-
"rollup-plugin-
|
|
112
|
-
"rollup-plugin-
|
|
113
|
+
"rollup": "^3.3.0",
|
|
114
|
+
"rollup-plugin-esbuild": "^5.0.0",
|
|
115
|
+
"rollup-plugin-gzip": "^3.1.0",
|
|
116
|
+
"rollup-plugin-preserve-shebang": "^1.0.1",
|
|
117
|
+
"rollup-plugin-prettier": "^3.0.0",
|
|
113
118
|
"tinydocs": "^0.1.15",
|
|
114
119
|
"tmp": "^0.2.1",
|
|
115
120
|
"ts-unused-exports": "^8.0.0",
|
|
116
|
-
"typescript": "4.
|
|
121
|
+
"typescript": "4.9.3"
|
|
117
122
|
},
|
|
118
123
|
"peerDependencies": {
|
|
124
|
+
"prettier": "^2.0.0",
|
|
119
125
|
"react": "^17.0.0"
|
|
120
126
|
},
|
|
121
127
|
"peerDependenciesMeta": {
|
|
122
128
|
"react": {
|
|
123
129
|
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"prettier": {
|
|
132
|
+
"optional": true
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
135
|
}
|