tinybase 8.5.0-beta.1 → 8.5.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/ui-react-dom-charts/index.d.ts +355 -23
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +406 -39
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom-charts/index.js +1 -1
- package/min/ui-react-dom-charts/index.js.gz +0 -0
- package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
- package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/package.json +13 -13
- package/readme.md +2 -6
- package/releases.md +56 -26
- package/ui-react/index.js +3 -0
- package/ui-react/with-schemas/index.js +3 -0
- package/ui-react-dom/index.js +8 -5
- package/ui-react-dom/with-schemas/index.js +8 -5
- package/ui-react-dom-charts/index.js +1360 -723
- package/ui-react-dom-charts/with-schemas/index.js +1360 -723
- package/ui-react-inspector/index.js +13 -10
- package/ui-react-inspector/with-schemas/index.js +13 -10
- package/ui-svelte/index.js +1 -1
- package/ui-svelte/with-schemas/index.js +1 -1
- package/ui-svelte-dom/index.js +2 -2
- package/ui-svelte-dom/with-schemas/index.js +2 -2
- package/ui-svelte-inspector/index.js +2 -2
- package/ui-svelte-inspector/with-schemas/index.js +2 -2
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The ui-react-dom-charts module of the TinyBase project provides components
|
|
3
|
-
*
|
|
2
|
+
* The ui-react-dom-charts module of the TinyBase project provides components to
|
|
3
|
+
* make it easy to create web-based reactive charts with Store and Queries
|
|
4
4
|
* objects.
|
|
5
5
|
*
|
|
6
6
|
* The components in this module use the react-dom module and so are not
|
|
7
7
|
* appropriate for environments like React Native (although those in the
|
|
8
8
|
* lower-level ui-react module are).
|
|
9
9
|
*
|
|
10
|
-
* For a full list of SVG class names that can be styled with CSS, see the
|
|
11
|
-
*
|
|
10
|
+
* For a full list of SVG class names that can be styled with CSS, see the Using
|
|
11
|
+
* Charts guide.
|
|
12
12
|
* @packageDocumentation
|
|
13
13
|
* @module ui-react-dom-charts
|
|
14
14
|
* @since v8.5.0
|
|
15
15
|
*/
|
|
16
|
+
import type {ReactNode} from 'react';
|
|
16
17
|
import type {
|
|
17
18
|
CellIdFromSchema,
|
|
18
19
|
TableIdFromSchema,
|
|
@@ -26,8 +27,8 @@ import type {Id} from '../../common/with-schemas/index.d.ts';
|
|
|
26
27
|
import type {OptionalSchemas} from '../../store/with-schemas/index.d.ts';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* The ChartProps type describes the props that are used to configure the
|
|
30
|
-
*
|
|
30
|
+
* The ChartProps type describes the props that are used to configure the chart
|
|
31
|
+
* element that renders a chart.
|
|
31
32
|
* @category Configuration
|
|
32
33
|
* @since v8.5.0
|
|
33
34
|
*/
|
|
@@ -43,12 +44,12 @@ export type ChartProps = {
|
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
|
-
* The
|
|
47
|
+
* The TableSourceProps type describes the props that bind a chart to a
|
|
47
48
|
* Table in a Store.
|
|
48
49
|
* @category Configuration
|
|
49
50
|
* @since v8.5.0
|
|
50
51
|
*/
|
|
51
|
-
export type
|
|
52
|
+
export type TableSourceProps<
|
|
52
53
|
Schemas extends OptionalSchemas,
|
|
53
54
|
TableIds extends TableIdFromSchema<Schemas[0]> = TableIdFromSchema<
|
|
54
55
|
Schemas[0]
|
|
@@ -86,12 +87,12 @@ export type ChartTableSourceProps<
|
|
|
86
87
|
: never;
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
|
-
* The
|
|
90
|
+
* The QuerySourceProps type describes the props that bind a chart to a
|
|
90
91
|
* Query in a Queries object.
|
|
91
92
|
* @category Configuration
|
|
92
93
|
* @since v8.5.0
|
|
93
94
|
*/
|
|
94
|
-
export type
|
|
95
|
+
export type QuerySourceProps<Schemas extends OptionalSchemas> = {
|
|
95
96
|
/**
|
|
96
97
|
* The Id of the query in the Queries object to chart.
|
|
97
98
|
* @category Prop
|
|
@@ -120,24 +121,100 @@ export type ChartQuerySourceProps<Schemas extends OptionalSchemas> = {
|
|
|
120
121
|
};
|
|
121
122
|
|
|
122
123
|
/**
|
|
123
|
-
* The
|
|
124
|
-
* values in TinyBase data.
|
|
124
|
+
* The BindingProps type describes the props that bind a LineChart
|
|
125
|
+
* component or BarChart component to Cell values in TinyBase data. An x Cell
|
|
126
|
+
* value can be a finite number, string, or boolean. A y Cell value must be a
|
|
127
|
+
* finite number.
|
|
125
128
|
* @category Configuration
|
|
126
129
|
* @since v8.5.0
|
|
127
130
|
*/
|
|
128
|
-
export type
|
|
131
|
+
export type BindingProps<
|
|
132
|
+
XCellId extends Id = Id,
|
|
133
|
+
YCellId extends Id = Id,
|
|
134
|
+
SortCellId extends Id = XCellId,
|
|
135
|
+
> = {
|
|
129
136
|
/**
|
|
130
|
-
* The Id of the Cell that provides each data point's x value.
|
|
137
|
+
* The Id of the Cell that provides each data point's x value. Finite numbers
|
|
138
|
+
* can be used as continuous x values in line charts, while strings and
|
|
139
|
+
* booleans are used as category values. Boolean category labels are rendered
|
|
140
|
+
* as `true` and `false`.
|
|
141
|
+
* @category Prop
|
|
142
|
+
* @since v8.5.0
|
|
143
|
+
*/
|
|
144
|
+
readonly xCellId: XCellId;
|
|
145
|
+
/**
|
|
146
|
+
* The Id of the Cell that provides each data point's y value. Only finite
|
|
147
|
+
* numbers are charted; rows with missing, non-numeric, or non-finite y values
|
|
148
|
+
* are ignored.
|
|
149
|
+
* @category Prop
|
|
150
|
+
* @since v8.5.0
|
|
151
|
+
*/
|
|
152
|
+
readonly yCellId: YCellId;
|
|
153
|
+
/**
|
|
154
|
+
* The Id of the Cell used to sort the charted rows.
|
|
155
|
+
* @category Prop
|
|
156
|
+
* @since v8.5.0
|
|
157
|
+
*/
|
|
158
|
+
readonly sortCellId?: SortCellId;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the charted rows should be sorted in descending order.
|
|
161
|
+
* @category Prop
|
|
162
|
+
* @since v8.5.0
|
|
163
|
+
*/
|
|
164
|
+
readonly descending?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The number of sorted rows to skip before charting.
|
|
167
|
+
* @category Prop
|
|
168
|
+
* @since v8.5.0
|
|
169
|
+
*/
|
|
170
|
+
readonly offset?: number;
|
|
171
|
+
/**
|
|
172
|
+
* The maximum number of sorted rows to chart.
|
|
173
|
+
* @category Prop
|
|
174
|
+
* @since v8.5.0
|
|
175
|
+
*/
|
|
176
|
+
readonly limit?: number;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The SeriesProps type describes the props that bind a chart series to Cell
|
|
181
|
+
* values in TinyBase data. An x Cell value can be a finite number, string, or
|
|
182
|
+
* boolean. A y Cell value must be a finite number.
|
|
183
|
+
* @category Configuration
|
|
184
|
+
* @since v8.5.0
|
|
185
|
+
*/
|
|
186
|
+
export type SeriesProps<CellId extends Id = Id> = {
|
|
187
|
+
/**
|
|
188
|
+
* An optional string that will be added to the class attribute of the series'
|
|
189
|
+
* SVG group element.
|
|
190
|
+
* @category Prop
|
|
191
|
+
* @since v8.5.0
|
|
192
|
+
*/
|
|
193
|
+
readonly className?: string;
|
|
194
|
+
/**
|
|
195
|
+
* The Id of the Cell that provides each data point's x value. Finite numbers
|
|
196
|
+
* can be used as continuous x values in line series, while strings and
|
|
197
|
+
* booleans are used as category values. Boolean category labels are rendered
|
|
198
|
+
* as `true` and `false`.
|
|
131
199
|
* @category Prop
|
|
132
200
|
* @since v8.5.0
|
|
133
201
|
*/
|
|
134
202
|
readonly xCellId: CellId;
|
|
135
203
|
/**
|
|
136
|
-
* The Id of the Cell that provides each data point's y value.
|
|
204
|
+
* The Id of the Cell that provides each data point's y value. Only finite
|
|
205
|
+
* numbers are charted; rows with missing, non-numeric, or non-finite y values
|
|
206
|
+
* are ignored.
|
|
137
207
|
* @category Prop
|
|
138
208
|
* @since v8.5.0
|
|
139
209
|
*/
|
|
140
210
|
readonly yCellId: CellId;
|
|
211
|
+
/**
|
|
212
|
+
* An optional label to use for the series in axis titles and tooltips,
|
|
213
|
+
* defaulting to the y Cell Id.
|
|
214
|
+
* @category Prop
|
|
215
|
+
* @since v8.5.0
|
|
216
|
+
*/
|
|
217
|
+
readonly label?: string;
|
|
141
218
|
/**
|
|
142
219
|
* The Id of the Cell used to sort the charted rows.
|
|
143
220
|
* @category Prop
|
|
@@ -164,15 +241,161 @@ export type ChartBindingProps<CellId extends Id = Id> = {
|
|
|
164
241
|
readonly limit?: number;
|
|
165
242
|
};
|
|
166
243
|
|
|
167
|
-
|
|
244
|
+
/**
|
|
245
|
+
* The XAxisProps type describes the props that configure the x axis of a
|
|
246
|
+
* CartesianChart component.
|
|
247
|
+
*
|
|
248
|
+
* The x axis is inferred by default. Use an XAxis component child when you want
|
|
249
|
+
* to override its title, numeric bounds, tick values, tick count, tick labels,
|
|
250
|
+
* or SVG class name.
|
|
251
|
+
* @category Configuration
|
|
252
|
+
* @since v8.5.0
|
|
253
|
+
*/
|
|
254
|
+
export type XAxisProps = {
|
|
255
|
+
/**
|
|
256
|
+
* An optional string that will be added to the class attribute of the x-axis
|
|
257
|
+
* SVG group element.
|
|
258
|
+
* @category Prop
|
|
259
|
+
* @since v8.5.0
|
|
260
|
+
*/
|
|
261
|
+
readonly className?: string;
|
|
262
|
+
/**
|
|
263
|
+
* An optional title to use for the x axis, defaulting to the x Cell Id, or to
|
|
264
|
+
* a combined title when multiple series use different x Cell Ids.
|
|
265
|
+
* @category Prop
|
|
266
|
+
* @since v8.5.0
|
|
267
|
+
*/
|
|
268
|
+
readonly title?: string;
|
|
269
|
+
/**
|
|
270
|
+
* An optional minimum x-axis bound for continuous numeric x values.
|
|
271
|
+
*
|
|
272
|
+
* This prop is ignored when the x axis is categorical.
|
|
273
|
+
* @category Prop
|
|
274
|
+
* @since v8.5.0
|
|
275
|
+
*/
|
|
276
|
+
readonly min?: number;
|
|
277
|
+
/**
|
|
278
|
+
* An optional maximum x-axis bound for continuous numeric x values.
|
|
279
|
+
*
|
|
280
|
+
* This prop is ignored when the x axis is categorical.
|
|
281
|
+
* @category Prop
|
|
282
|
+
* @since v8.5.0
|
|
283
|
+
*/
|
|
284
|
+
readonly max?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Optional numeric tick values to use for a continuous x axis.
|
|
287
|
+
*
|
|
288
|
+
* This prop is ignored when the x axis is categorical.
|
|
289
|
+
* @category Prop
|
|
290
|
+
* @since v8.5.0
|
|
291
|
+
*/
|
|
292
|
+
readonly ticks?: readonly number[];
|
|
293
|
+
/**
|
|
294
|
+
* An optional preferred number of ticks to render on a continuous x axis.
|
|
295
|
+
*
|
|
296
|
+
* The actual number of ticks may vary so that labels remain readable.
|
|
297
|
+
* @category Prop
|
|
298
|
+
* @since v8.5.0
|
|
299
|
+
*/
|
|
300
|
+
readonly tickCount?: number;
|
|
301
|
+
/**
|
|
302
|
+
* An optional function for formatting x-axis tick labels.
|
|
303
|
+
*
|
|
304
|
+
* It receives the original tick value, which can be a finite number, string,
|
|
305
|
+
* or boolean.
|
|
306
|
+
* @category Prop
|
|
307
|
+
* @since v8.5.0
|
|
308
|
+
*/
|
|
309
|
+
readonly tickFormatter?: (tick: boolean | number | string) => string;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* The YAxisProps type describes the props that configure the y axis of a
|
|
314
|
+
* CartesianChart component.
|
|
315
|
+
*
|
|
316
|
+
* The y axis is inferred by default. Use a YAxis component child when you want
|
|
317
|
+
* to override its title, numeric bounds, tick values, tick count, tick labels,
|
|
318
|
+
* or SVG class name.
|
|
319
|
+
* @category Configuration
|
|
320
|
+
* @since v8.5.0
|
|
321
|
+
*/
|
|
322
|
+
export type YAxisProps = {
|
|
323
|
+
/**
|
|
324
|
+
* An optional string that will be added to the class attribute of the y-axis
|
|
325
|
+
* SVG group element.
|
|
326
|
+
* @category Prop
|
|
327
|
+
* @since v8.5.0
|
|
328
|
+
*/
|
|
329
|
+
readonly className?: string;
|
|
330
|
+
/**
|
|
331
|
+
* An optional title to use for the y axis, defaulting to the y Cell Id, y
|
|
332
|
+
* series label, or a combined title when multiple series use different y Cell
|
|
333
|
+
* Ids or labels.
|
|
334
|
+
* @category Prop
|
|
335
|
+
* @since v8.5.0
|
|
336
|
+
*/
|
|
337
|
+
readonly title?: string;
|
|
338
|
+
/**
|
|
339
|
+
* An optional minimum y-axis bound.
|
|
340
|
+
* @category Prop
|
|
341
|
+
* @since v8.5.0
|
|
342
|
+
*/
|
|
343
|
+
readonly min?: number;
|
|
344
|
+
/**
|
|
345
|
+
* An optional maximum y-axis bound.
|
|
346
|
+
* @category Prop
|
|
347
|
+
* @since v8.5.0
|
|
348
|
+
*/
|
|
349
|
+
readonly max?: number;
|
|
350
|
+
/**
|
|
351
|
+
* Optional numeric tick values to use for the y axis.
|
|
352
|
+
* @category Prop
|
|
353
|
+
* @since v8.5.0
|
|
354
|
+
*/
|
|
355
|
+
readonly ticks?: readonly number[];
|
|
356
|
+
/**
|
|
357
|
+
* An optional preferred number of ticks to render on the y axis.
|
|
358
|
+
*
|
|
359
|
+
* The actual number of ticks may vary so that labels remain readable.
|
|
360
|
+
* @category Prop
|
|
361
|
+
* @since v8.5.0
|
|
362
|
+
*/
|
|
363
|
+
readonly tickCount?: number;
|
|
364
|
+
/**
|
|
365
|
+
* An optional function for formatting y-axis tick labels.
|
|
366
|
+
*
|
|
367
|
+
* It receives the numeric tick value.
|
|
368
|
+
* @category Prop
|
|
369
|
+
* @since v8.5.0
|
|
370
|
+
*/
|
|
371
|
+
readonly tickFormatter?: (tick: number) => string;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
type NumericCellIdFromSchema<
|
|
375
|
+
Schemas extends OptionalSchemas,
|
|
376
|
+
TableId extends TableIdFromSchema<Schemas[0]>,
|
|
377
|
+
> = {
|
|
378
|
+
[CellId in CellIdFromSchema<
|
|
379
|
+
Schemas[0],
|
|
380
|
+
TableId
|
|
381
|
+
>]: Schemas[0][TableId][CellId] extends {type: 'any' | 'number'}
|
|
382
|
+
? CellId
|
|
383
|
+
: never;
|
|
384
|
+
}[CellIdFromSchema<Schemas[0], TableId>];
|
|
385
|
+
|
|
386
|
+
type TableBindingProps<
|
|
168
387
|
Schemas extends OptionalSchemas,
|
|
169
388
|
TableIds extends TableIdFromSchema<Schemas[0]> = TableIdFromSchema<
|
|
170
389
|
Schemas[0]
|
|
171
390
|
>,
|
|
172
391
|
> = TableIds extends infer TableId
|
|
173
392
|
? TableId extends TableIdFromSchema<Schemas[0]>
|
|
174
|
-
?
|
|
175
|
-
|
|
393
|
+
? TableSourceProps<Schemas, TableId> &
|
|
394
|
+
BindingProps<
|
|
395
|
+
CellIdFromSchema<Schemas[0], TableId>,
|
|
396
|
+
NumericCellIdFromSchema<Schemas, TableId>,
|
|
397
|
+
CellIdFromSchema<Schemas[0], TableId>
|
|
398
|
+
>
|
|
176
399
|
: never
|
|
177
400
|
: never;
|
|
178
401
|
|
|
@@ -184,24 +407,163 @@ type ChartTableBindingProps<
|
|
|
184
407
|
*/
|
|
185
408
|
export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
186
409
|
/**
|
|
187
|
-
* The
|
|
410
|
+
* The CartesianChart component renders a chart frame and provides TinyBase
|
|
411
|
+
* source and layout context to LineSeries component and BarSeries component
|
|
412
|
+
* children.
|
|
413
|
+
*
|
|
414
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
415
|
+
*
|
|
416
|
+
* ```ts override
|
|
417
|
+
* CartesianChart(
|
|
418
|
+
* props: (TableSourceProps | QuerySourceProps) &
|
|
419
|
+
* ChartProps & {readonly children?: ReactNode},
|
|
420
|
+
* ): ComponentReturnType;
|
|
421
|
+
* ```
|
|
422
|
+
*
|
|
423
|
+
* See the Composing Charts (React) demo for this component in action:
|
|
424
|
+
*
|
|
425
|
+
* 
|
|
427
|
+
*
|
|
428
|
+
* The series children declare their own xCellId and yCellId bindings. The
|
|
429
|
+
* optional XAxis component and YAxis component children can be used to
|
|
430
|
+
* configure axis titles, bounds, ticks, and tick formatting.
|
|
188
431
|
* @category Store components
|
|
189
432
|
* @since v8.5.0
|
|
190
433
|
* @example
|
|
191
|
-
* This example creates a
|
|
192
|
-
*
|
|
193
|
-
*
|
|
434
|
+
* This example creates a Store and renders two LineSeries component children
|
|
435
|
+
* in a CartesianChart component.
|
|
436
|
+
*
|
|
437
|
+
* ```jsx
|
|
438
|
+
* import React from 'react';
|
|
439
|
+
* import {createRoot} from 'react-dom/client';
|
|
440
|
+
* import {createStore} from 'tinybase';
|
|
441
|
+
* import {CartesianChart, LineSeries} from 'tinybase/ui-react-dom-charts';
|
|
442
|
+
*
|
|
443
|
+
* const store = createStore().setTable('pets', {
|
|
444
|
+
* hamsters: {order: 1, sold: 12, returned: 1},
|
|
445
|
+
* rabbits: {order: 2, sold: 9, returned: 2},
|
|
446
|
+
* });
|
|
447
|
+
* const App = () => (
|
|
448
|
+
* <CartesianChart store={store} tableId="pets">
|
|
449
|
+
* <LineSeries
|
|
450
|
+
* className="sold"
|
|
451
|
+
* label="Sold pets"
|
|
452
|
+
* xCellId="order"
|
|
453
|
+
* yCellId="sold"
|
|
454
|
+
* />
|
|
455
|
+
* <LineSeries
|
|
456
|
+
* className="returned"
|
|
457
|
+
* label="Returned pets"
|
|
458
|
+
* xCellId="order"
|
|
459
|
+
* yCellId="returned"
|
|
460
|
+
* />
|
|
461
|
+
* </CartesianChart>
|
|
462
|
+
* );
|
|
463
|
+
* const app = document.createElement('div');
|
|
464
|
+
* createRoot(app).render(<App />); // !act
|
|
465
|
+
* console.log(app.firstChild?.nodeName.toLowerCase());
|
|
466
|
+
* // -> 'svg'
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
CartesianChart: {
|
|
470
|
+
(
|
|
471
|
+
props: TableSourceProps<Schemas> &
|
|
472
|
+
ChartProps & {readonly children?: ReactNode},
|
|
473
|
+
): ComponentReturnType;
|
|
474
|
+
(
|
|
475
|
+
props: QuerySourceProps<Schemas> &
|
|
476
|
+
ChartProps & {readonly children?: ReactNode},
|
|
477
|
+
): ComponentReturnType;
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* The XAxis component configures the x axis of a CartesianChart component.
|
|
482
|
+
*
|
|
483
|
+
* It is a configuration child rather than a separately rendered SVG element:
|
|
484
|
+
* include zero or one XAxis component in a CartesianChart component's children.
|
|
485
|
+
* If omitted, the x axis is inferred from the chart's series.
|
|
486
|
+
*
|
|
487
|
+
* See the Axis Overrides (React) demo for this component in action:
|
|
488
|
+
*
|
|
489
|
+
* 
|
|
491
|
+
* @category Store components
|
|
492
|
+
* @since v8.5.0
|
|
493
|
+
*/
|
|
494
|
+
XAxis: (props: XAxisProps) => ComponentReturnType;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* The YAxis component configures the y axis of a CartesianChart component.
|
|
498
|
+
*
|
|
499
|
+
* It is a configuration child rather than a separately rendered SVG element:
|
|
500
|
+
* include zero or one YAxis component in a CartesianChart component's children.
|
|
501
|
+
* If omitted, the y axis is inferred from the chart's series.
|
|
502
|
+
*
|
|
503
|
+
* See the Axis Overrides (React) demo for this component in action:
|
|
504
|
+
*
|
|
505
|
+
* 
|
|
507
|
+
* @category Store components
|
|
508
|
+
* @since v8.5.0
|
|
509
|
+
*/
|
|
510
|
+
YAxis: (props: YAxisProps) => ComponentReturnType;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* The LineSeries component renders a line series in a CartesianChart component.
|
|
514
|
+
* If every x value in every series is a finite number, the x axis is rendered
|
|
515
|
+
* as a continuous numeric scale. If any x value is a string or boolean, the x
|
|
516
|
+
* axis is rendered categorically. When sortCellId is omitted, rows are sorted
|
|
517
|
+
* by xCellId.
|
|
518
|
+
*
|
|
519
|
+
* See the Composing Charts (React) demo for this component in action:
|
|
520
|
+
*
|
|
521
|
+
* 
|
|
523
|
+
* @category Store components
|
|
524
|
+
* @since v8.5.0
|
|
525
|
+
*/
|
|
526
|
+
LineSeries: (props: SeriesProps) => ComponentReturnType;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* The BarSeries component renders a bar series in a CartesianChart component.
|
|
530
|
+
* Its x values are always rendered categorically, even when they are finite
|
|
531
|
+
* numbers. Boolean category labels are rendered as `true` and `false`.
|
|
532
|
+
*
|
|
533
|
+
* See the Composing Charts (React) demo for this component in action:
|
|
534
|
+
*
|
|
535
|
+
* 
|
|
537
|
+
* @category Store components
|
|
538
|
+
* @since v8.5.0
|
|
539
|
+
*/
|
|
540
|
+
BarSeries: (props: SeriesProps) => ComponentReturnType;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* The LineChart component renders a line chart from TinyBase data. If every x
|
|
544
|
+
* value is a finite number, the x axis is rendered as a continuous numeric
|
|
545
|
+
* scale. If any x value is a string or boolean, the x axis is rendered
|
|
546
|
+
* categorically. When sortCellId is omitted, rows are sorted by xCellId.
|
|
194
547
|
*
|
|
195
548
|
* This has schema-based typing. The following is a simplified representation:
|
|
196
549
|
*
|
|
197
550
|
* ```ts override
|
|
198
551
|
* LineChart(
|
|
199
|
-
* props: (
|
|
200
|
-
* ChartBindingProps &
|
|
201
|
-
* ChartProps,
|
|
552
|
+
* props: (TableSourceProps | QuerySourceProps) & BindingProps & ChartProps,
|
|
202
553
|
* ): ComponentReturnType;
|
|
203
554
|
* ```
|
|
204
555
|
*
|
|
556
|
+
* See the <LineChart /> (React) demo for this component in action:
|
|
557
|
+
*
|
|
558
|
+
* 
|
|
560
|
+
* @category Store components
|
|
561
|
+
* @since v8.5.0
|
|
562
|
+
* @example
|
|
563
|
+
* This example creates a Provider context into which a default Store is
|
|
564
|
+
* provided. The LineChart component then renders an SVG chart from Cells in the
|
|
565
|
+
* `pets` Table.
|
|
566
|
+
*
|
|
205
567
|
* ```jsx
|
|
206
568
|
* import React from 'react';
|
|
207
569
|
* import {createRoot} from 'react-dom/client';
|
|
@@ -234,29 +596,34 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
234
596
|
*/
|
|
235
597
|
LineChart: (
|
|
236
598
|
props:
|
|
237
|
-
| (
|
|
238
|
-
| (
|
|
599
|
+
| (TableBindingProps<Schemas> & ChartProps)
|
|
600
|
+
| (QuerySourceProps<Schemas> & BindingProps & ChartProps),
|
|
239
601
|
) => ComponentReturnType;
|
|
240
602
|
|
|
241
603
|
/**
|
|
242
|
-
* The BarChart component renders a bar chart from TinyBase data.
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* @example
|
|
246
|
-
* This example creates a Queries object and provides it through Provider
|
|
247
|
-
* context. The BarChart component then renders an SVG chart from Cells in the
|
|
248
|
-
* `bySpecies` query.
|
|
604
|
+
* The BarChart component renders a bar chart from TinyBase data. Its x values
|
|
605
|
+
* are always rendered categorically, even when they are finite numbers. Boolean
|
|
606
|
+
* category labels are rendered as `true` and `false`.
|
|
249
607
|
*
|
|
250
608
|
* This has schema-based typing. The following is a simplified representation:
|
|
251
609
|
*
|
|
252
610
|
* ```ts override
|
|
253
611
|
* BarChart(
|
|
254
|
-
* props: (
|
|
255
|
-
* ChartBindingProps &
|
|
256
|
-
* ChartProps,
|
|
612
|
+
* props: (TableSourceProps | QuerySourceProps) & BindingProps & ChartProps,
|
|
257
613
|
* ): ComponentReturnType;
|
|
258
614
|
* ```
|
|
259
615
|
*
|
|
616
|
+
* See the Sorting And Types (React) demo for this component in action:
|
|
617
|
+
*
|
|
618
|
+
* 
|
|
620
|
+
* @category Store components
|
|
621
|
+
* @since v8.5.0
|
|
622
|
+
* @example
|
|
623
|
+
* This example creates a Queries object and provides it through Provider
|
|
624
|
+
* context. The BarChart component then renders an SVG chart from Cells in the
|
|
625
|
+
* `bySpecies` query.
|
|
626
|
+
*
|
|
260
627
|
* ```jsx
|
|
261
628
|
* import React from 'react';
|
|
262
629
|
* import {createRoot} from 'react-dom/client';
|
|
@@ -290,7 +657,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
290
657
|
*/
|
|
291
658
|
BarChart: (
|
|
292
659
|
props:
|
|
293
|
-
| (
|
|
294
|
-
| (
|
|
660
|
+
| (TableBindingProps<Schemas> & ChartProps)
|
|
661
|
+
| (QuerySourceProps<Schemas> & BindingProps & ChartProps),
|
|
295
662
|
) => ComponentReturnType;
|
|
296
663
|
};
|
package/min/ui-react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{jsx as t}from"react/jsx-runtime";const r=e=>typeof e,d="",o=r(d),s=r(r),n="Result",i="Has",a="Ids",l="Table",u=l+"s",c=l+a,I="Row",p=I+"Count",g=I+a,b="Sorted"+I+a,m="Cell",h=m+a,C="Value",y=C+"s",w=C+a,f="Transaction",P="Partial",R="Finish",k="Status",q="Metric",v="Slice",x="RemoteRowId",S="Local",B="Linked",T="Checkpoint",V=e=>(t,r,d)=>e(t)?d?.():r(t),L=globalThis,E=e=>null==e,O=e=>void 0===e,j=V(E),z=V(O),A=e=>r(e)==o,F=e=>r(e)==s,M=e=>Array.isArray(e),D=e=>e.length,H=()=>{},J=e=>e,N=(e,t)=>e.every(t),Q=(e,t)=>D(e)===D(t)&&N(e,(e,r)=>t[r]===e),W=(e,t)=>M(e)&&M(t)?Q(e,t):e===t,_=(e,t)=>e.map(t),G=(e,t,r)=>e.with(t,r),K=Object,U=e=>K.getPrototypeOf(e),X=K.entries,Y=e=>!E(e)&&j(U(e),e=>e==K.prototype||E(U(e)),()=>!0),Z=K.keys,$=(e,t)=>z(e,e=>e[t]),ee=(e,t,r=(e,t)=>e===t)=>{const d=X(e);return D(d)===D(Z(t))&&N(d,([e,d])=>Y(d)?!!Y(t[e])&&ee(t[e],d,r):r(d,t[e]))},te=JSON.stringify,{PureComponent:re,createContext:de,useCallback:oe,useContext:se,useEffect:ne,useLayoutEffect:ie,useMemo:ae,useRef:le,useState:ue,useSyncExternalStore:ce}=e,Ie=(e,...t)=>O(e)?{}:e(...t),pe=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],ge="tinybase_uirc",be=L[ge]?L[ge]:L[ge]=de([]),me=(e,t)=>{const r=se(be);return O(e)?r[2*t]:A(e)?$(r[2*t+1],e):e},he=(e,t)=>{const r=me(e,t);return O(e)||A(e)?r:e},Ce=(e,t,r)=>{const{16:d,17:o}=se(be);ne(()=>(d?.(r,e,t),()=>o?.(r,e)),[d,e,t,r,o])},ye=e=>Z(se(be)[2*e+1]??{}),we=0,fe=1,Pe=2,Re=3,ke=4,qe=5,ve=6,xe=7,Se=(e,t,r,d,o)=>[r??t[2*e],{...t[2*e+1],...d,...o[e]}],Be=({store:e,storesById:r,metrics:d,metricsById:o,indexes:s,indexesById:n,relationships:i,relationshipsById:a,queries:l,queriesById:u,checkpoints:c,checkpointsById:I,persister:p,persistersById:g,synchronizer:b,synchronizersById:m,children:h})=>{const C=se(be),[y,w]=ue(()=>_([,,,,,,,,].fill(0),(e,t)=>({}))),f=oe((e,t,r)=>w(d=>$(d[e],t)==r?d:G(d,e,{...d[e],[t]:r})),[]),P=oe((e,t)=>w(r=>((e,t)=>t in e)(r[e],t)?G(r,e,((e,t)=>(delete e[t],e))(r[e],t)):r),[]);return t(be.Provider,{value:ae(()=>[...Se(0,C,e,r,y),...Se(1,C,d,o,y),...Se(2,C,s,n,y),...Se(3,C,i,a,y),...Se(4,C,l,u,y),...Se(5,C,c,I,y),...Se(6,C,p,g,y),...Se(7,C,b,m,y),f,P],[y,e,r,d,o,s,n,i,a,l,u,c,I,p,g,b,m,C,f,P]),children:h})},Te=[],Ve=[{},[],[Te,void 0,Te],{},void 0,void 0,!1,0],Le=(e,t)=>e===t||(Y(e)||M(e))&&te(e)===te(t),Ee=[(e,t)=>ee(e,t,Le),Q,([e,t,r],[d,o,s])=>t===o&&Q(e,d)&&Q(r,s),(e,t)=>ee(e,t,W),W,Le],Oe=(e,t)=>e===t,je=(e,t,r=Te)=>{const[,d]=ue(),[o,s]=ue();return ne(()=>{const r=e?t(e):void 0;return s(r),d([]),r?.destroy},[e,...r]),o},ze=(e,t,...r)=>{const d=e?.["add"+t+"Listener"]?.(...r);return()=>e?.delListener?.(d)},Ae=(e,t,r,o=Te)=>{const s=le(Ve[r]),n=oe(()=>{const d=t?.[(6==r?"has":"get")+e]?.(...o)??Ve[r];return(Ee[r]??Oe)(d,s.current)?s.current:s.current=d},[t,r,e,...o]),a=oe(s=>ze(t,(6==r?i:d)+e,...o,s),[t,r,e,...o]);return ce(a,n,n)},Fe=(e,t,r,d=Te,o=Te,...s)=>ie(()=>ze(t,e,...o,r,...s),[t,e,...o,...d,...s]),Me=(e,t,r,d=Te,o=H,s=Te,n,...i)=>oe(d=>z(e,e=>z(r(d,e),r=>o(e[n+t](...Je(i,e,d),r),r))),[e,t,...d,...s,n,...Ne(i)]),De=(e,t,r,d,o,s,...n)=>Me(Ye(e),t,r,d,o,s,"set",...n),He=(e,t,r,o,s,n,...i)=>Me(Nr(e),t,r,o,s,n,d,...i),Je=(e,t,r)=>_(e,e=>F(e)?e(r,t):e),Ne=e=>{return t=e=>!F(e),e.filter(t);var t},Qe=(e,t,r=H,d=Te,...o)=>{const s=Ye(e);return oe(e=>r(s?.["del"+t](...Je(o,s,e))),[s,t,...d,...Ne(o)])},We=(e,t,r)=>{const d=yd(e);return oe(()=>d?.[t](r),[d,t,r])},_e=(e,t,r,d,o,s,n,i,a)=>Fe(b,Ye(a),s,n,[e,t,r,d,o],i),Ge=(e,t=Te)=>ae(e,t),Ke=()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setParamValue",r,d,s,n,e,t),bd=(e,t,r,d,o,s)=>He(d,"setParamValues",t,r,o,s,e),md=(e,t,r)=>je(e,t,r),hd=()=>ye(5),Cd=e=>me(e,5),yd=e=>he(e,5),wd=(e,t)=>Ce(e,t,5),fd=e=>Ae(T+a,yd(e),2),Pd=(e,t)=>Ae(T,yd(t),5,[e]),Rd=(e=H,t=Te,r,d=H,o=Te)=>{const s=yd(r);return oe(t=>z(s,r=>{const o=e(t);d(r.addCheckpoint(o),r,o)}),[s,...t,...o])},kd=e=>We(e,"goBackward"),qd=e=>We(e,"goForward"),vd=(e,t=Te,r,d=H,o=Te)=>{const s=yd(r);return oe(t=>z(s,r=>z(e(t),e=>d(r.goTo(e),e))),[s,...t,...o])},xd=e=>{const t=yd(e),[r,o]=fd(t);return[(s=r,!(0==D(s))),kd(t),o,z(o,e=>t?.getCheckpoint(e))??d];var s},Sd=e=>{const t=yd(e),[,,[r]]=fd(t);return[!O(r),qd(t),r,z(r,e=>t?.getCheckpoint(e))??d]},Bd=(e,t,r)=>Fe(T+a,yd(r),e,t),Td=(e,t,r,d)=>Fe(T,yd(d),t,r,[e]),Vd=(e,t,r=Te,d,o=Te,s,n=Te)=>{const[,i]=ue(),[a,l]=ue();return ne(()=>{(async()=>{const r=e?await t(e):void 0;l(r),r&&d&&(async()=>{await d(r),i([])})()})()},[e,...r,...o]),ne(()=>()=>{a&&(a.destroy(),s?.(a))},[a,...n]),a},Ld=()=>ye(6),Ed=e=>me(e,6),Od=e=>he(e,6),jd=(e,t)=>Ce(e,t,6),zd=e=>Ae(k,Od(e),7,[]),Ad=(e,t,r)=>Fe(k,Od(r),e,t,[]),Fd=(e,t,r=Te,d,o=Te)=>{const[s,n]=ue();return ne(()=>{(async()=>{const r=e?await t(e):void 0;n(r)})()},[e,...r]),ne(()=>()=>{s&&(s.destroy(),d?.(s))},[s,...o]),s},Md=()=>ye(7),Dd=e=>me(e,7),Hd=e=>he(e,7),Jd=(e,t)=>Ce(e,t,7),Nd=e=>Ae(k,Hd(e),7,[]),Qd=(e,t,r)=>Fe(k,Hd(r),e,t,[]),Wd=({children:e,separator:t,debugIds:r,id:d})=>{const o=O(t)||!M(e)?e:_(e,(e,r)=>r>0?[t,e]:e);return r&&!O(d)?[d,":{",o,"}"]:o},_d=({checkpoints:e,checkpointId:r,debugIds:o})=>t(Wd,{debugIds:o,id:r,children:Pd(r,e)??d}),Gd=({queryId:e,rowId:r,cellId:o,queries:s,debugIds:n})=>t(Wd,{debugIds:n,id:o,children:d+($r(e,r,o,s)??d)}),Kd=({queryId:e,rowId:r,queries:d,resultCellComponent:o=Gd,getResultCellComponentProps:s,separator:n,debugIds:i})=>t(Wd,{separator:n,debugIds:i,id:r,children:_(Zr(e,r,d),n=>t(o,{...Ie(s,n),queryId:e,rowId:r,cellId:n,queries:d,debugIds:i},n))}),Ud=({tableId:e,rowId:r,cellId:o,store:s,debugIds:n})=>t(Wd,{debugIds:n,id:o,children:d+(ht(e,r,o,s)??d)}),Xd=(e,t,r,d)=>{const o=bt(t,r,d);return e??o},Yd=({tableId:e,rowId:r,store:d,cellComponent:o=Ud,getCellComponentProps:s,customCellIds:n,separator:i,debugIds:a})=>t(Wd,{separator:i,debugIds:a,id:r,children:_(Xd(n,e,r,d),n=>t(o,{...Ie(s,n),tableId:e,rowId:r,cellId:n,store:d,debugIds:a},n))}),Zd=({tableId:e,store:r,rowComponent:d=Yd,getRowComponentProps:o,customCellIds:s,separator:n,debugIds:i},a)=>t(Wd,{separator:n,debugIds:i,id:e,children:_(a,n=>t(d,{...Ie(o,n),tableId:e,rowId:n,customCellIds:s,store:r,debugIds:i},n))}),$d=({queryId:e,queries:r,resultRowComponent:d=Kd,getResultRowComponentProps:o,separator:s,debugIds:n},i)=>t(Wd,{separator:s,debugIds:n,id:e,children:_(i,s=>t(d,{...Ie(o,s),queryId:e,rowId:s,queries:r,debugIds:n},s))}),eo=({relationshipId:e,relationships:r,rowComponent:d=Yd,getRowComponentProps:o,separator:s,debugIds:n},i,a)=>{const[l,u,c]=pe(Vr(r),e),I=i(e,a,l);return t(Wd,{separator:s,debugIds:n,id:a,children:_(I,e=>t(d,{...Ie(o,e),tableId:c,rowId:e,store:u,debugIds:n},e))})},to=e=>({checkpoints:r,checkpointComponent:d=_d,getCheckpointComponentProps:o,separator:s,debugIds:n})=>{const i=yd(r);return t(Wd,{separator:s,children:_(e(fd(i)),e=>t(d,{...Ie(o,e),checkpoints:i,checkpointId:e,debugIds:n},e))})},ro=to(e=>e[0]),oo=to(e=>E(e[1])?[]:[e[1]]),so=to(e=>e[2]),no=({indexId:e,sliceId:r,indexes:d,rowComponent:o=Yd,getRowComponentProps:s,separator:n,debugIds:i})=>{const[a,l,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(fr(d),e),c=qr(e,r,a);return t(Wd,{separator:n,debugIds:i,id:r,children:_(c,e=>t(o,{...Ie(s,e),tableId:u,rowId:e,store:l,debugIds:i},e))})},io=({indexId:e,indexes:r,sliceComponent:d=no,getSliceComponentProps:o,separator:s,debugIds:n})=>t(Wd,{separator:s,debugIds:n,id:e,children:_(Rr(e,r),s=>t(d,{...Ie(o,s),indexId:e,sliceId:s,indexes:r,debugIds:n},s))}),ao=e=>eo(e,zr,e.firstRowId),lo=e=>eo(e,jr,e.remoteRowId),uo=({metricId:e,metrics:r,debugIds:o})=>t(Wd,{debugIds:o,id:e,children:mr(e,r)??d}),co=({relationshipId:e,localRowId:r,relationships:d,rowComponent:o=Yd,getRowComponentProps:s,debugIds:n})=>{const[i,a,,l]=pe(Vr(d),e),u=Or(e,r,i);return t(Wd,{debugIds:n,id:r,children:O(l)||O(u)?null:t(o,{...Ie(s,u),tableId:l,rowId:u,store:a,debugIds:n},u)})},Io=({cellId:e,descending:t,offset:r,limit:d,...o})=>$d(o,Xr(o.queryId,e,t,r,d,o.queries)),po=e=>$d(e,Ur(e.queryId,e.queries)),go=({cellId:e,descending:t,offset:r,limit:d,...o})=>Zd(o,ct(o.tableId,e,t,r,d,o.store)),bo=e=>Zd(e,ut(e.tableId,e.store)),mo=({store:e,tableComponent:r=bo,getTableComponentProps:d,separator:o,debugIds:s})=>t(Wd,{separator:o,children:_(dt(e),o=>t(r,{...Ie(d,o),tableId:o,store:e,debugIds:s},o))}),ho=({valueId:e,store:r,debugIds:o})=>t(Wd,{debugIds:o,id:e,children:d+(kt(e,r)??d)}),Co=({store:e,valueComponent:r=ho,getValueComponentProps:d,separator:o,debugIds:s})=>t(Wd,{separator:o,children:_(Pt(e),o=>t(r,{...Ie(d,o),valueId:o,store:e,debugIds:s},o))});export{ro as BackwardCheckpointsView,Ud as CellView,_d as CheckpointView,oo as CurrentCheckpointView,so as ForwardCheckpointsView,io as IndexView,ao as LinkedRowsView,lo as LocalRowsView,uo as MetricView,qe as OFFSET_CHECKPOINTS,Pe as OFFSET_INDEXES,fe as OFFSET_METRICS,ve as OFFSET_PERSISTER,ke as OFFSET_QUERIES,Re as OFFSET_RELATIONSHIPS,we as OFFSET_STORE,xe as OFFSET_SYNCHRONIZER,Be as Provider,co as RemoteRowView,Gd as ResultCellView,Kd as ResultRowView,Io as ResultSortedTableView,po as ResultTableView,Yd as RowView,no as SliceView,go as SortedTableView,bo as TableView,mo as TablesView,ho as ValueView,Co as ValuesView,Bt as useAddRowCallback,ht as useCell,bt as useCellIds,$t as useCellIdsListener,tr as useCellListener,Ct as useCellState,Pd as useCheckpoint,fd as useCheckpointIds,Bd as useCheckpointIdsListener,Td as useCheckpointListener,Cd as useCheckpoints,hd as useCheckpointsIds,yd as useCheckpointsOrCheckpointsById,md as useCreateCheckpoints,Cr as useCreateIndexes,$e as useCreateMergeableStore,ur as useCreateMetrics,Vd as useCreatePersister,Dr as useCreateQueries,Sr as useCreateRelationships,Ge as useCreateStore,Fd as useCreateSynchronizer,Ft as useDelCellCallback,At as useDelRowCallback,zt as useDelTableCallback,jt as useDelTablesCallback,Dt as useDelValueCallback,Mt as useDelValuesCallback,lr as useDidFinishTransactionListener,kd as useGoBackwardCallback,qd as useGoForwardCallback,vd as useGoToCallback,mt as useHasCell,er as useHasCellListener,It as useHasRow,Yt as useHasRowListener,ot as useHasTable,at as useHasTableCell,Gt as useHasTableCellListener,Qt as useHasTableListener,et as useHasTables,Ht as useHasTablesListener,Rt as useHasValue,sr as useHasValueListener,yt as useHasValues,rr as useHasValuesListener,kr as useIndexIds,wr as useIndexes,yr as useIndexesIds,fr as useIndexesOrIndexesById,zr as useLinkedRowIds,Mr as useLinkedRowIdsListener,jr as useLocalRowIds,Fr as useLocalRowIdsListener,mr as useMetric,br as useMetricIds,hr as useMetricListener,Ir as useMetrics,cr as useMetricsIds,pr as useMetricsOrMetricsById,ud as useParamValue,pd as useParamValueListener,cd as useParamValueState,ad as useParamValues,Id as useParamValuesListener,ld as useParamValuesState,Ed as usePersister,Ld as usePersisterIds,Od as usePersisterOrPersisterById,zd as usePersisterStatus,Ad as usePersisterStatusListener,wd as useProvideCheckpoints,Pr as useProvideIndexes,gr as useProvideMetrics,jd as useProvidePersister,Qr as useProvideQueries,Lr as useProvideRelationships,Ze as useProvideStore,Jd as useProvideSynchronizer,Jr as useQueries,Hr as useQueriesIds,Nr as useQueriesOrQueriesById,Wr as useQueryIds,Sd as useRedoInformation,Er as useRelationshipIds,Tr as useRelationships,Br as useRelationshipsIds,Vr as useRelationshipsOrRelationshipsById,Or as useRemoteRowId,Ar as useRemoteRowIdListener,$r as useResultCell,Zr as useResultCellIds,nd as useResultCellIdsListener,id as useResultCellListener,Yr as useResultRow,Kr as useResultRowCount,rd as useResultRowCountListener,Ur as useResultRowIds,dd as useResultRowIdsListener,sd as useResultRowListener,Xr as useResultSortedRowIds,od as useResultSortedRowIdsListener,_r as useResultTable,Gr as useResultTableCellIds,td as useResultTableCellIdsListener,ed as useResultTableListener,pt as useRow,lt as useRowCount,Kt as useRowCountListener,ut as useRowIds,Ut as useRowIdsListener,Zt as useRowListener,gt as useRowState,Vt as useSetCellCallback,Rd as useSetCheckpointCallback,gd as useSetParamValueCallback,bd as useSetParamValuesCallback,Tt as useSetPartialRowCallback,Et as useSetPartialValuesCallback,St as useSetRowCallback,xt as useSetTableCallback,vt as useSetTablesCallback,Ot as useSetValueCallback,Lt as useSetValuesCallback,Rr as useSliceIds,vr as useSliceIdsListener,qr as useSliceRowIds,xr as useSliceRowIdsListener,ct as useSortedRowIds,Xt as useSortedRowIdsListener,_e as useSortedRowIdsListenerImpl,ir as useStartTransactionListener,Ue as useStore,Ke as useStoreIds,Ye as useStoreOrStoreById,Xe as useStores,Dd as useSynchronizer,Md as useSynchronizerIds,Hd as useSynchronizerOrSynchronizerById,Nd as useSynchronizerStatus,Qd as useSynchronizerStatusListener,st as useTable,it as useTableCellIds,_t as useTableCellIdsListener,dt as useTableIds,Nt as useTableIdsListener,Wt as useTableListener,nt as useTableState,tt as useTables,Jt as useTablesListener,rt as useTablesState,xd as useUndoInformation,kt as useValue,Pt as useValueIds,or as useValueIdsListener,nr as useValueListener,qt as useValueState,wt as useValues,dr as useValuesListener,ft as useValuesState,ar as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";import{jsx as t}from"react/jsx-runtime";const r=e=>typeof e,d="",o=r(d),s=r(r),n="Result",i="Has",a="Ids",l="Table",u=l+"s",c=l+a,I="Row",p=I+"Count",g=I+a,b="Sorted"+I+a,m="Cell",h=m+a,C="Value",y=C+"s",w=C+a,f="Transaction",P="Partial",R="Finish",k="Status",q="Metric",v="Slice",x="RemoteRowId",S="Local",B="Linked",V="Checkpoint",T=e=>(t,r,d)=>e(t)?d?.():r(t),L=globalThis,E=e=>null==e,F=e=>void 0===e,O=T(E),j=T(F),z=e=>r(e)==o,A=e=>r(e)==s,M=e=>Array.isArray(e),D=e=>e.length,H=()=>{},J=e=>e,N=(e,t)=>e.every(t),Q=(e,t)=>D(e)===D(t)&&N(e,(e,r)=>t[r]===e),W=(e,t)=>M(e)&&M(t)?Q(e,t):e===t,_=(e,t)=>e.map(t),G=(e,t,r)=>e.with(t,r),K=Object,U=e=>K.getPrototypeOf(e),X=K.entries,Y=e=>!E(e)&&O(U(e),e=>e==K.prototype||E(U(e)),()=>!0),Z=K.keys,$=(e,t)=>j(e,e=>e[t]),ee=(e,t,r=(e,t)=>e===t)=>{const d=X(e);return D(d)===D(Z(t))&&N(d,([e,d])=>Y(d)?!!Y(t[e])&&ee(t[e],d,r):r(d,t[e]))},te=JSON.stringify,{Children:re,Fragment:de,PureComponent:oe,createContext:se,isValidElement:ne,useCallback:ie,useContext:ae,useEffect:le,useLayoutEffect:ue,useMemo:ce,useRef:Ie,useState:pe,useSyncExternalStore:ge}=e,be=(e,...t)=>F(e)?{}:e(...t),me=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],he="tinybase_uirc",Ce=L[he]?L[he]:L[he]=se([]),ye=(e,t)=>{const r=ae(Ce);return F(e)?r[2*t]:z(e)?$(r[2*t+1],e):e},we=(e,t)=>{const r=ye(e,t);return F(e)||z(e)?r:e},fe=(e,t,r)=>{const{16:d,17:o}=ae(Ce);le(()=>(d?.(r,e,t),()=>o?.(r,e)),[d,e,t,r,o])},Pe=e=>Z(ae(Ce)[2*e+1]??{}),Re=0,ke=1,qe=2,ve=3,xe=4,Se=5,Be=6,Ve=7,Te=(e,t,r,d,o)=>[r??t[2*e],{...t[2*e+1],...d,...o[e]}],Le=({store:e,storesById:r,metrics:d,metricsById:o,indexes:s,indexesById:n,relationships:i,relationshipsById:a,queries:l,queriesById:u,checkpoints:c,checkpointsById:I,persister:p,persistersById:g,synchronizer:b,synchronizersById:m,children:h})=>{const C=ae(Ce),[y,w]=pe(()=>_([,,,,,,,,].fill(0),(e,t)=>({}))),f=ie((e,t,r)=>w(d=>$(d[e],t)==r?d:G(d,e,{...d[e],[t]:r})),[]),P=ie((e,t)=>w(r=>((e,t)=>t in e)(r[e],t)?G(r,e,((e,t)=>(delete e[t],e))(r[e],t)):r),[]);return t(Ce.Provider,{value:ce(()=>[...Te(0,C,e,r,y),...Te(1,C,d,o,y),...Te(2,C,s,n,y),...Te(3,C,i,a,y),...Te(4,C,l,u,y),...Te(5,C,c,I,y),...Te(6,C,p,g,y),...Te(7,C,b,m,y),f,P],[y,e,r,d,o,s,n,i,a,l,u,c,I,p,g,b,m,C,f,P]),children:h})},Ee=[],Fe=[{},[],[Ee,void 0,Ee],{},void 0,void 0,!1,0],Oe=(e,t)=>e===t||(Y(e)||M(e))&&te(e)===te(t),je=[(e,t)=>ee(e,t,Oe),Q,([e,t,r],[d,o,s])=>t===o&&Q(e,d)&&Q(r,s),(e,t)=>ee(e,t,W),W,Oe],ze=(e,t)=>e===t,Ae=(e,t,r=Ee)=>{const[,d]=pe(),[o,s]=pe();return le(()=>{const r=e?t(e):void 0;return s(r),d([]),r?.destroy},[e,...r]),o},Me=(e,t,...r)=>{const d=e?.["add"+t+"Listener"]?.(...r);return()=>e?.delListener?.(d)},De=(e,t,r,o=Ee)=>{const s=Ie(Fe[r]),n=ie(()=>{const d=t?.[(6==r?"has":"get")+e]?.(...o)??Fe[r];return(je[r]??ze)(d,s.current)?s.current:s.current=d},[t,r,e,...o]),a=ie(s=>Me(t,(6==r?i:d)+e,...o,s),[t,r,e,...o]);return ge(a,n,n)},He=(e,t,r,d=Ee,o=Ee,...s)=>ue(()=>Me(t,e,...o,r,...s),[t,e,...o,...d,...s]),Je=(e,t,r,d=Ee,o=H,s=Ee,n,...i)=>ie(d=>j(e,e=>j(r(d,e),r=>o(e[n+t](...We(i,e,d),r),r))),[e,t,...d,...s,n,..._e(i)]),Ne=(e,t,r,d,o,s,...n)=>Je(et(e),t,r,d,o,s,"set",...n),Qe=(e,t,r,o,s,n,...i)=>Je(_r(e),t,r,o,s,n,d,...i),We=(e,t,r)=>_(e,e=>A(e)?e(r,t):e),_e=e=>{return t=e=>!A(e),e.filter(t);var t},Ge=(e,t,r=H,d=Ee,...o)=>{const s=et(e);return ie(e=>r(s?.["del"+t](...We(o,s,e))),[s,t,...d,..._e(o)])},Ke=(e,t,r)=>{const d=Pd(e);return ie(()=>d?.[t](r),[d,t,r])},Ue=(e,t,r,d,o,s,n,i,a)=>He(b,et(a),s,n,[e,t,r,d,o],i),Xe=(e,t=Ee)=>ce(e,t),Ye=()=>Pe(0),Ze=e=>ye(e,0),$e=()=>({...ae(Ce)[1]}),et=e=>we(e,0),tt=(e,t)=>fe(e,t,0),rt=(e,t=Ee)=>ce(e,t),dt=e=>De(u,et(e),6,[]),ot=e=>De(u,et(e),0),st=e=>[ot(e),Bt(J,[],e)],nt=e=>De(c,et(e),1),it=(e,t)=>De(l,et(t),6,[e]),at=(e,t)=>De(l,et(t),0,[e]),lt=(e,t)=>[at(e,t),Vt(e,J,[],t)],ut=(e,t)=>De(l+h,et(t),1,[e]),ct=(e,t,r)=>De(l+m,et(r),6,[e,t]),It=(e,t)=>De(p,et(t),7,[e]),pt=(e,t)=>De(g,et(t),1,[e]),gt=(e,t,r,d,o,s)=>((e,t,r,d,o,s)=>De(b,et(s),1,[e,t,r,d,o]))(...Y(e)?[e.tableId,e.cellId,e.descending??!1,e.offset??0,e.limit,t]:[e,t,r,d,o,s]),bt=(e,t,r)=>De(I,et(r),6,[e,t]),mt=(e,t,r)=>De(I,et(r),0,[e,t]),ht=(e,t,r)=>[mt(e,t,r),Tt(e,t,J,[],r)],Ct=(e,t,r)=>De(h,et(r),1,[e,t]),yt=(e,t,r,d)=>De(m,et(d),6,[e,t,r]),wt=(e,t,r,d)=>De(m,et(d),5,[e,t,r]),ft=(e,t,r,d)=>[wt(e,t,r,d),Ft(e,t,r,J,[],d)],Pt=e=>De(y,et(e),6,[]),Rt=e=>De(y,et(e),0),kt=e=>[Rt(e),Ot(J,[],e)],qt=e=>De(w,et(e),1),vt=(e,t)=>De(C,et(t),6,[e]),xt=(e,t)=>De(C,et(t),5,[e]),St=(e,t)=>[xt(e,t),zt(e,J,[],t)],Bt=(e,t,r,d,o)=>Ne(r,u,e,t,d,o),Vt=(e,t,r,d,o,s)=>Ne(d,l,t,r,o,s,e),Tt=(e,t,r,d,o,s,n)=>Ne(o,I,r,d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,o,s,n)=>He(i+m,et(n),d,o,[e,t,r],s),or=(e,t,r,d,o,s,n)=>He(m,et(n),d,o,[e,t,r],s),sr=(e,t,r,d)=>He(i+y,et(d),e,t,[],r),nr=(e,t,r,d)=>He(y,et(d),e,t,Ee,r),ir=(e,t,r,d)=>He(w,et(d),e,t,Ee,r),ar=(e,t,r,d,o)=>He(i+C,et(o),t,r,[e],d),lr=(e,t,r,d,o)=>He(C,et(o),t,r,[e],d),ur=(e,t,r)=>He("Start"+f,et(r),e,t),cr=(e,t,r)=>He("Will"+R+f,et(r),e,t),Ir=(e,t,r)=>He("Did"+R+f,et(r),e,t),pr=(e,t,r)=>Ae(e,t,r),gr=()=>Pe(1),br=e=>ye(e,1),mr=e=>we(e,1),hr=(e,t)=>fe(e,t,1),Cr=e=>De(q+a,mr(e),1),yr=(e,t)=>De(q,mr(t),5,[e]),wr=(e,t,r,d)=>He(q,mr(d),t,r,[e]),fr=(e,t,r)=>Ae(e,t,r),Pr=()=>Pe(2),Rr=e=>ye(e,2),kr=e=>we(e,2),qr=(e,t)=>fe(e,t,2),vr=(e,t)=>De(v+a,kr(t),1,[e]),xr=e=>De("Index"+a,kr(e),1),Sr=(e,t,r)=>De(v+g,kr(r),1,[e,t]),Br=(e,t,r,d)=>He(v+a,kr(d),t,r,[e]),Vr=(e,t,r,d,o)=>He(v+g,kr(o),r,d,[e,t]),Tr=(e,t,r)=>Ae(e,t,r),Lr=()=>Pe(3),Er=e=>ye(e,3),Fr=e=>we(e,3),Or=(e,t)=>fe(e,t,3),jr=e=>De("Relationship"+a,Fr(e),1),zr=(e,t,r)=>De(x,Fr(r),5,[e,t]),Ar=(e,t,r)=>De(S+g,Fr(r),1,[e,t]),Mr=(e,t,r)=>De(B+g,Fr(r),1,[e,t]),Dr=(e,t,r,d,o)=>He(x,Fr(o),r,d,[e,t]),Hr=(e,t,r,d,o)=>He(S+g,Fr(o),r,d,[e,t]),Jr=(e,t,r,d,o)=>He(B+g,Fr(o),r,d,[e,t]),Nr=(e,t,r)=>Ae(e,t,r),Qr=()=>Pe(4),Wr=e=>ye(e,4),_r=e=>we(e,4),Gr=(e,t)=>fe(e,t,4),Kr=e=>De("Query"+a,_r(e),1),Ur=(e,t)=>De(n+l,_r(t),0,[e]),Xr=(e,t)=>De(n+l+h,_r(t),1,[e]),Yr=(e,t)=>De(n+p,_r(t),7,[e]),Zr=(e,t)=>De(n+g,_r(t),1,[e]),$r=(e,t,r,d=0,o,s)=>De(n+b,_r(s),1,[e,t,r,d,o]),ed=(e,t,r)=>De(n+I,_r(r),0,[e,t]),td=(e,t,r)=>De(n+h,_r(r),1,[e,t]),rd=(e,t,r,d)=>De(n+m,_r(d),5,[e,t,r]),dd=(e,t,r,d)=>He(n+l,_r(d),t,r,[e]),od=(e,t,r,d)=>He(n+l+h,_r(d),t,r,[e]),sd=(e,t,r,d)=>He(n+p,_r(d),t,r,[e]),nd=(e,t,r,d)=>He(n+g,_r(d),t,r,[e]),id=(e,t,r,d,o,s,i,a)=>He(n+b,_r(a),s,i,[e,t,r,d,o]),ad=(e,t,r,d,o)=>He(n+I,_r(o),r,d,[e,t]),ld=(e,t,r,d,o)=>He(n+h,_r(o),r,d,[e,t]),ud=(e,t,r,d,o,s)=>He(n+m,_r(s),d,o,[e,t,r]),cd=(e,t)=>De("ParamValues",_r(t),3,[e]),Id=(e,t)=>[cd(e,t),Cd(e,J,[],t)],pd=(e,t,r)=>De("ParamValue",_r(r),4,[e,t]),gd=(e,t,r)=>[pd(e,t,r),hd(e,t,J,[],r)],bd=(e,t,r,d)=>He("ParamValues",_r(d),t,r,[e]),md=(e,t,r,d,o)=>He("ParamValue",_r(o),r,d,[e,t]),hd=(e,t,r,d,o,s,n)=>Qe(o,"setParamValue",r,d,s,n,e,t),Cd=(e,t,r,d,o,s)=>Qe(d,"setParamValues",t,r,o,s,e),yd=(e,t,r)=>Ae(e,t,r),wd=()=>Pe(5),fd=e=>ye(e,5),Pd=e=>we(e,5),Rd=(e,t)=>fe(e,t,5),kd=e=>De(V+a,Pd(e),2),qd=(e,t)=>De(V,Pd(t),5,[e]),vd=(e=H,t=Ee,r,d=H,o=Ee)=>{const s=Pd(r);return ie(t=>j(s,r=>{const o=e(t);d(r.addCheckpoint(o),r,o)}),[s,...t,...o])},xd=e=>Ke(e,"goBackward"),Sd=e=>Ke(e,"goForward"),Bd=(e,t=Ee,r,d=H,o=Ee)=>{const s=Pd(r);return ie(t=>j(s,r=>j(e(t),e=>d(r.goTo(e),e))),[s,...t,...o])},Vd=e=>{const t=Pd(e),[r,o]=kd(t);return[(s=r,!(0==D(s))),xd(t),o,j(o,e=>t?.getCheckpoint(e))??d];var s},Td=e=>{const t=Pd(e),[,,[r]]=kd(t);return[!F(r),Sd(t),r,j(r,e=>t?.getCheckpoint(e))??d]},Ld=(e,t,r)=>He(V+a,Pd(r),e,t),Ed=(e,t,r,d)=>He(V,Pd(d),t,r,[e]),Fd=(e,t,r=Ee,d,o=Ee,s,n=Ee)=>{const[,i]=pe(),[a,l]=pe();return le(()=>{(async()=>{const r=e?await t(e):void 0;l(r),r&&d&&(async()=>{await d(r),i([])})()})()},[e,...r,...o]),le(()=>()=>{a&&(a.destroy(),s?.(a))},[a,...n]),a},Od=()=>Pe(6),jd=e=>ye(e,6),zd=e=>we(e,6),Ad=(e,t)=>fe(e,t,6),Md=e=>De(k,zd(e),7,[]),Dd=(e,t,r)=>He(k,zd(r),e,t,[]),Hd=(e,t,r=Ee,d,o=Ee)=>{const[s,n]=pe();return le(()=>{(async()=>{const r=e?await t(e):void 0;n(r)})()},[e,...r]),le(()=>()=>{s&&(s.destroy(),d?.(s))},[s,...o]),s},Jd=()=>Pe(7),Nd=e=>ye(e,7),Qd=e=>we(e,7),Wd=(e,t)=>fe(e,t,7),_d=e=>De(k,Qd(e),7,[]),Gd=(e,t,r)=>He(k,Qd(r),e,t,[]),Kd=({children:e,separator:t,debugIds:r,id:d})=>{const o=F(t)||!M(e)?e:_(e,(e,r)=>r>0?[t,e]:e);return r&&!F(d)?[d,":{",o,"}"]:o},Ud=({checkpoints:e,checkpointId:r,debugIds:o})=>t(Kd,{debugIds:o,id:r,children:qd(r,e)??d}),Xd=({queryId:e,rowId:r,cellId:o,queries:s,debugIds:n})=>t(Kd,{debugIds:n,id:o,children:d+(rd(e,r,o,s)??d)}),Yd=({queryId:e,rowId:r,queries:d,resultCellComponent:o=Xd,getResultCellComponentProps:s,separator:n,debugIds:i})=>t(Kd,{separator:n,debugIds:i,id:r,children:_(td(e,r,d),n=>t(o,{...be(s,n),queryId:e,rowId:r,cellId:n,queries:d,debugIds:i},n))}),Zd=({tableId:e,rowId:r,cellId:o,store:s,debugIds:n})=>t(Kd,{debugIds:n,id:o,children:d+(wt(e,r,o,s)??d)}),$d=(e,t,r,d)=>{const o=Ct(t,r,d);return e??o},eo=({tableId:e,rowId:r,store:d,cellComponent:o=Zd,getCellComponentProps:s,customCellIds:n,separator:i,debugIds:a})=>t(Kd,{separator:i,debugIds:a,id:r,children:_($d(n,e,r,d),n=>t(o,{...be(s,n),tableId:e,rowId:r,cellId:n,store:d,debugIds:a},n))}),to=({tableId:e,store:r,rowComponent:d=eo,getRowComponentProps:o,customCellIds:s,separator:n,debugIds:i},a)=>t(Kd,{separator:n,debugIds:i,id:e,children:_(a,n=>t(d,{...be(o,n),tableId:e,rowId:n,customCellIds:s,store:r,debugIds:i},n))}),ro=({queryId:e,queries:r,resultRowComponent:d=Yd,getResultRowComponentProps:o,separator:s,debugIds:n},i)=>t(Kd,{separator:s,debugIds:n,id:e,children:_(i,s=>t(d,{...be(o,s),queryId:e,rowId:s,queries:r,debugIds:n},s))}),oo=({relationshipId:e,relationships:r,rowComponent:d=eo,getRowComponentProps:o,separator:s,debugIds:n},i,a)=>{const[l,u,c]=me(Fr(r),e),I=i(e,a,l);return t(Kd,{separator:s,debugIds:n,id:a,children:_(I,e=>t(d,{...be(o,e),tableId:c,rowId:e,store:u,debugIds:n},e))})},so=e=>({checkpoints:r,checkpointComponent:d=Ud,getCheckpointComponentProps:o,separator:s,debugIds:n})=>{const i=Pd(r);return t(Kd,{separator:s,children:_(e(kd(i)),e=>t(d,{...be(o,e),checkpoints:i,checkpointId:e,debugIds:n},e))})},no=so(e=>e[0]),io=so(e=>E(e[1])?[]:[e[1]]),ao=so(e=>e[2]),lo=({indexId:e,sliceId:r,indexes:d,rowComponent:o=eo,getRowComponentProps:s,separator:n,debugIds:i})=>{const[a,l,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(kr(d),e),c=Sr(e,r,a);return t(Kd,{separator:n,debugIds:i,id:r,children:_(c,e=>t(o,{...be(s,e),tableId:u,rowId:e,store:l,debugIds:i},e))})},uo=({indexId:e,indexes:r,sliceComponent:d=lo,getSliceComponentProps:o,separator:s,debugIds:n})=>t(Kd,{separator:s,debugIds:n,id:e,children:_(vr(e,r),s=>t(d,{...be(o,s),indexId:e,sliceId:s,indexes:r,debugIds:n},s))}),co=e=>oo(e,Mr,e.firstRowId),Io=e=>oo(e,Ar,e.remoteRowId),po=({metricId:e,metrics:r,debugIds:o})=>t(Kd,{debugIds:o,id:e,children:yr(e,r)??d}),go=({relationshipId:e,localRowId:r,relationships:d,rowComponent:o=eo,getRowComponentProps:s,debugIds:n})=>{const[i,a,,l]=me(Fr(d),e),u=zr(e,r,i);return t(Kd,{debugIds:n,id:r,children:F(l)||F(u)?null:t(o,{...be(s,u),tableId:l,rowId:u,store:a,debugIds:n},u)})},bo=({cellId:e,descending:t,offset:r,limit:d,...o})=>ro(o,$r(o.queryId,e,t,r,d,o.queries)),mo=e=>ro(e,Zr(e.queryId,e.queries)),ho=({cellId:e,descending:t,offset:r,limit:d,...o})=>to(o,gt(o.tableId,e,t,r,d,o.store)),Co=e=>to(e,pt(e.tableId,e.store)),yo=({store:e,tableComponent:r=Co,getTableComponentProps:d,separator:o,debugIds:s})=>t(Kd,{separator:o,children:_(nt(e),o=>t(r,{...be(d,o),tableId:o,store:e,debugIds:s},o))}),wo=({valueId:e,store:r,debugIds:o})=>t(Kd,{debugIds:o,id:e,children:d+(xt(e,r)??d)}),fo=({store:e,valueComponent:r=wo,getValueComponentProps:d,separator:o,debugIds:s})=>t(Kd,{separator:o,children:_(qt(e),o=>t(r,{...be(d,o),valueId:o,store:e,debugIds:s},o))});export{no as BackwardCheckpointsView,Zd as CellView,Ud as CheckpointView,io as CurrentCheckpointView,ao as ForwardCheckpointsView,uo as IndexView,co as LinkedRowsView,Io as LocalRowsView,po as MetricView,Se as OFFSET_CHECKPOINTS,qe as OFFSET_INDEXES,ke as OFFSET_METRICS,Be as OFFSET_PERSISTER,xe as OFFSET_QUERIES,ve as OFFSET_RELATIONSHIPS,Re as OFFSET_STORE,Ve as OFFSET_SYNCHRONIZER,Le as Provider,go as RemoteRowView,Xd as ResultCellView,Yd as ResultRowView,bo as ResultSortedTableView,mo as ResultTableView,eo as RowView,lo as SliceView,ho as SortedTableView,Co as TableView,yo as TablesView,wo as ValueView,fo as ValuesView,Lt as useAddRowCallback,wt as useCell,Ct as useCellIds,rr as useCellIdsListener,or as useCellListener,ft as useCellState,qd as useCheckpoint,kd as useCheckpointIds,Ld as useCheckpointIdsListener,Ed as useCheckpointListener,fd as useCheckpoints,wd as useCheckpointsIds,Pd as useCheckpointsOrCheckpointsById,yd as useCreateCheckpoints,fr as useCreateIndexes,rt as useCreateMergeableStore,pr as useCreateMetrics,Fd as useCreatePersister,Nr as useCreateQueries,Tr as useCreateRelationships,Xe as useCreateStore,Hd as useCreateSynchronizer,Ht as useDelCellCallback,Dt as useDelRowCallback,Mt as useDelTableCallback,At as useDelTablesCallback,Nt as useDelValueCallback,Jt as useDelValuesCallback,Ir as useDidFinishTransactionListener,xd as useGoBackwardCallback,Sd as useGoForwardCallback,Bd as useGoToCallback,yt as useHasCell,dr as useHasCellListener,bt as useHasRow,er as useHasRowListener,it as useHasTable,ct as useHasTableCell,Xt as useHasTableCellListener,Gt as useHasTableListener,dt as useHasTables,Qt as useHasTablesListener,vt as useHasValue,ar as useHasValueListener,Pt as useHasValues,sr as useHasValuesListener,xr as useIndexIds,Rr as useIndexes,Pr as useIndexesIds,kr as useIndexesOrIndexesById,Mr as useLinkedRowIds,Jr as useLinkedRowIdsListener,Ar as useLocalRowIds,Hr as useLocalRowIdsListener,yr as useMetric,Cr as useMetricIds,wr as useMetricListener,br as useMetrics,gr as useMetricsIds,mr as useMetricsOrMetricsById,pd as useParamValue,md as useParamValueListener,gd as useParamValueState,cd as useParamValues,bd as useParamValuesListener,Id as useParamValuesState,jd as usePersister,Od as usePersisterIds,zd as usePersisterOrPersisterById,Md as usePersisterStatus,Dd as usePersisterStatusListener,Rd as useProvideCheckpoints,qr as useProvideIndexes,hr as useProvideMetrics,Ad as useProvidePersister,Gr as useProvideQueries,Or as useProvideRelationships,tt as useProvideStore,Wd as useProvideSynchronizer,Wr as useQueries,Qr as useQueriesIds,_r as useQueriesOrQueriesById,Kr as useQueryIds,Td as useRedoInformation,jr as useRelationshipIds,Er as useRelationships,Lr as useRelationshipsIds,Fr as useRelationshipsOrRelationshipsById,zr as useRemoteRowId,Dr as useRemoteRowIdListener,rd as useResultCell,td as useResultCellIds,ld as useResultCellIdsListener,ud as useResultCellListener,ed as useResultRow,Yr as useResultRowCount,sd as useResultRowCountListener,Zr as useResultRowIds,nd as useResultRowIdsListener,ad as useResultRowListener,$r as useResultSortedRowIds,id as useResultSortedRowIdsListener,Ur as useResultTable,Xr as useResultTableCellIds,od as useResultTableCellIdsListener,dd as useResultTableListener,mt as useRow,It as useRowCount,Yt as useRowCountListener,pt as useRowIds,Zt as useRowIdsListener,tr as useRowListener,ht as useRowState,Ft as useSetCellCallback,vd as useSetCheckpointCallback,hd as useSetParamValueCallback,Cd as useSetParamValuesCallback,Et as useSetPartialRowCallback,jt as useSetPartialValuesCallback,Tt as useSetRowCallback,Vt as useSetTableCallback,Bt as useSetTablesCallback,zt as useSetValueCallback,Ot as useSetValuesCallback,vr as useSliceIds,Br as useSliceIdsListener,Sr as useSliceRowIds,Vr as useSliceRowIdsListener,gt as useSortedRowIds,$t as useSortedRowIdsListener,Ue as useSortedRowIdsListenerImpl,ur as useStartTransactionListener,Ze as useStore,Ye as useStoreIds,et as useStoreOrStoreById,$e as useStores,Nd as useSynchronizer,Jd as useSynchronizerIds,Qd as useSynchronizerOrSynchronizerById,_d as useSynchronizerStatus,Gd as useSynchronizerStatusListener,at as useTable,ut as useTableCellIds,Ut as useTableCellIdsListener,nt as useTableIds,_t as useTableIdsListener,Kt as useTableListener,lt as useTableState,ot as useTables,Wt as useTablesListener,st as useTablesState,Vd as useUndoInformation,xt as useValue,qt as useValueIds,ir as useValueIdsListener,lr as useValueListener,St as useValueState,Rt as useValues,nr as useValuesListener,kt as useValuesState,cr as useWillFinishTransactionListener};
|
package/min/ui-react/index.js.gz
CHANGED
|
Binary file
|