tinybase 8.5.0-beta.2 → 8.5.0-beta.4

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.
Files changed (151) hide show
  1. package/@types/ui-react-dom-charts/index.d.ts +369 -49
  2. package/@types/ui-react-dom-charts/with-schemas/index.d.ts +396 -70
  3. package/common/index.js +1 -1
  4. package/common/with-schemas/index.js +1 -1
  5. package/index.js +3 -2
  6. package/mergeable-store/index.js +3 -2
  7. package/mergeable-store/with-schemas/index.js +3 -2
  8. package/min/index.js +1 -1
  9. package/min/index.js.gz +0 -0
  10. package/min/mergeable-store/index.js +1 -1
  11. package/min/mergeable-store/index.js.gz +0 -0
  12. package/min/mergeable-store/with-schemas/index.js +1 -1
  13. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  14. package/min/omni/index.js +1 -1
  15. package/min/omni/index.js.gz +0 -0
  16. package/min/omni/with-schemas/index.js +1 -1
  17. package/min/omni/with-schemas/index.js.gz +0 -0
  18. package/min/persisters/index.js +1 -1
  19. package/min/persisters/index.js.gz +0 -0
  20. package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
  21. package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
  22. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
  23. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
  24. package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
  25. package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
  26. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
  27. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
  28. package/min/persisters/persister-electric-sql/index.js +1 -1
  29. package/min/persisters/persister-electric-sql/index.js.gz +0 -0
  30. package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
  31. package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
  32. package/min/persisters/persister-expo-sqlite/index.js +1 -1
  33. package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  34. package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  35. package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  36. package/min/persisters/persister-libsql/index.js +1 -1
  37. package/min/persisters/persister-libsql/index.js.gz +0 -0
  38. package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
  39. package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
  40. package/min/persisters/persister-pglite/index.js +1 -1
  41. package/min/persisters/persister-pglite/index.js.gz +0 -0
  42. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  43. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  44. package/min/persisters/persister-postgres/index.js +1 -1
  45. package/min/persisters/persister-postgres/index.js.gz +0 -0
  46. package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
  47. package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
  48. package/min/persisters/persister-powersync/index.js +1 -1
  49. package/min/persisters/persister-powersync/index.js.gz +0 -0
  50. package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
  51. package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
  52. package/min/persisters/persister-react-native-sqlite/index.js +1 -1
  53. package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
  54. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
  55. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
  56. package/min/persisters/persister-remote/index.js +1 -1
  57. package/min/persisters/persister-remote/index.js.gz +0 -0
  58. package/min/persisters/persister-remote/with-schemas/index.js +1 -1
  59. package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
  60. package/min/persisters/persister-sqlite-bun/index.js +1 -1
  61. package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
  62. package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
  63. package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
  64. package/min/persisters/persister-sqlite-wasm/index.js +1 -1
  65. package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
  66. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
  67. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
  68. package/min/persisters/persister-sqlite3/index.js +1 -1
  69. package/min/persisters/persister-sqlite3/index.js.gz +0 -0
  70. package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
  71. package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
  72. package/min/persisters/with-schemas/index.js +1 -1
  73. package/min/persisters/with-schemas/index.js.gz +0 -0
  74. package/min/synchronizers/index.js +1 -1
  75. package/min/synchronizers/index.js.gz +0 -0
  76. package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  77. package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  78. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  79. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  80. package/min/synchronizers/synchronizer-local/index.js +1 -1
  81. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  82. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  83. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  84. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  85. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  86. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  87. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  88. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  89. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  90. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  91. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  92. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
  93. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
  94. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
  95. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
  96. package/min/synchronizers/with-schemas/index.js +1 -1
  97. package/min/synchronizers/with-schemas/index.js.gz +0 -0
  98. package/min/ui-react-dom-charts/index.js +1 -1
  99. package/min/ui-react-dom-charts/index.js.gz +0 -0
  100. package/min/ui-react-dom-charts/with-schemas/index.js +1 -1
  101. package/min/ui-react-dom-charts/with-schemas/index.js.gz +0 -0
  102. package/min/with-schemas/index.js +1 -1
  103. package/min/with-schemas/index.js.gz +0 -0
  104. package/omni/index.js +7 -6
  105. package/omni/with-schemas/index.js +7 -6
  106. package/package.json +10 -10
  107. package/persisters/index.js +1 -1
  108. package/persisters/persister-cr-sqlite-wasm/index.js +1 -1
  109. package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
  110. package/persisters/persister-durable-object-sql-storage/index.js +1 -1
  111. package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
  112. package/persisters/persister-electric-sql/index.js +1 -1
  113. package/persisters/persister-electric-sql/with-schemas/index.js +1 -1
  114. package/persisters/persister-expo-sqlite/index.js +1 -1
  115. package/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  116. package/persisters/persister-libsql/index.js +1 -1
  117. package/persisters/persister-libsql/with-schemas/index.js +1 -1
  118. package/persisters/persister-pglite/index.js +1 -1
  119. package/persisters/persister-pglite/with-schemas/index.js +1 -1
  120. package/persisters/persister-postgres/index.js +1 -1
  121. package/persisters/persister-postgres/with-schemas/index.js +1 -1
  122. package/persisters/persister-powersync/index.js +1 -1
  123. package/persisters/persister-powersync/with-schemas/index.js +1 -1
  124. package/persisters/persister-react-native-sqlite/index.js +1 -1
  125. package/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
  126. package/persisters/persister-remote/index.js +3 -3
  127. package/persisters/persister-remote/with-schemas/index.js +3 -3
  128. package/persisters/persister-sqlite-bun/index.js +1 -1
  129. package/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
  130. package/persisters/persister-sqlite-wasm/index.js +1 -1
  131. package/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
  132. package/persisters/persister-sqlite3/index.js +1 -1
  133. package/persisters/persister-sqlite3/with-schemas/index.js +1 -1
  134. package/persisters/with-schemas/index.js +1 -1
  135. package/readme.md +13 -13
  136. package/releases.md +57 -57
  137. package/synchronizers/index.js +2 -1
  138. package/synchronizers/synchronizer-broadcast-channel/index.js +2 -1
  139. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +2 -1
  140. package/synchronizers/synchronizer-local/index.js +2 -1
  141. package/synchronizers/synchronizer-local/with-schemas/index.js +2 -1
  142. package/synchronizers/synchronizer-ws-client/index.js +2 -1
  143. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +2 -1
  144. package/synchronizers/synchronizer-ws-server/index.js +2 -1
  145. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +2 -1
  146. package/synchronizers/synchronizer-ws-server-durable-object/index.js +2 -1
  147. package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +2 -1
  148. package/synchronizers/with-schemas/index.js +2 -1
  149. package/ui-react-dom-charts/index.js +753 -306
  150. package/ui-react-dom-charts/with-schemas/index.js +753 -306
  151. package/with-schemas/index.js +3 -2
@@ -1,14 +1,14 @@
1
1
  /**
2
- * The ui-react-dom-charts module of the TinyBase project provides components
3
- * to make it easy to create web-based reactive charts with Store and Queries
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
- * Using Charts guide.
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
@@ -22,8 +22,8 @@ import type {
22
22
  } from '../ui-react/index.d.ts';
23
23
 
24
24
  /**
25
- * The ChartProps type describes the props that are used to configure the
26
- * chart element that renders a chart.
25
+ * The ChartProps type describes the props that are used to configure the chart
26
+ * element that renders a chart.
27
27
  * @category Configuration
28
28
  * @since v8.5.0
29
29
  */
@@ -39,12 +39,12 @@ export type ChartProps = {
39
39
  };
40
40
 
41
41
  /**
42
- * The ChartTableSourceProps type describes the props that bind a chart to a
42
+ * The TableSourceProps type describes the props that bind a chart to a
43
43
  * Table in a Store.
44
44
  * @category Configuration
45
45
  * @since v8.5.0
46
46
  */
47
- export type ChartTableSourceProps = {
47
+ export type TableSourceProps = {
48
48
  /**
49
49
  * The Id of the Table in the Store to chart.
50
50
  * @category Prop
@@ -73,12 +73,12 @@ export type ChartTableSourceProps = {
73
73
  };
74
74
 
75
75
  /**
76
- * The ChartQuerySourceProps type describes the props that bind a chart to a
76
+ * The QuerySourceProps type describes the props that bind a chart to a
77
77
  * Query in a Queries object.
78
78
  * @category Configuration
79
79
  * @since v8.5.0
80
80
  */
81
- export type ChartQuerySourceProps = {
81
+ export type QuerySourceProps = {
82
82
  /**
83
83
  * The Id of the query in the Queries object to chart.
84
84
  * @category Prop
@@ -107,18 +107,20 @@ export type ChartQuerySourceProps = {
107
107
  };
108
108
 
109
109
  /**
110
- * The ChartBindingProps type describes the props that bind a LineChart or
111
- * BarChart component to Cell values in TinyBase data. An x Cell value can be a
112
- * finite number, string, or boolean. A y Cell value must be a finite number.
110
+ * The BindingProps type describes the props that bind a LineChart
111
+ * component or BarChart component to Cell values in TinyBase data. An x Cell
112
+ * value can be a finite number, string, or boolean. A y Cell value must be a
113
+ * finite number.
113
114
  * @category Configuration
114
115
  * @since v8.5.0
115
116
  */
116
- export type ChartBindingProps = {
117
+ export type BindingProps = {
117
118
  /**
118
119
  * The Id of the Cell that provides each data point's x value. Finite numbers
119
- * can be used as continuous x values in line charts, while strings and
120
- * booleans are used as category values. Boolean category labels are rendered
121
- * as `true` and `false`.
120
+ * can be used as continuous linear x values in line charts, ISO date strings
121
+ * can be used as time x values, and other strings and booleans are used as
122
+ * category values. Boolean category labels are rendered as `true` and
123
+ * `false`.
122
124
  * @category Prop
123
125
  * @since v8.5.0
124
126
  */
@@ -158,13 +160,13 @@ export type ChartBindingProps = {
158
160
  };
159
161
 
160
162
  /**
161
- * The ChartSeriesProps type describes the props that bind a chart series to
162
- * Cell values in TinyBase data. An x Cell value can be a finite number,
163
- * string, or boolean. A y Cell value must be a finite number.
163
+ * The SeriesProps type describes the props that bind a chart series to Cell
164
+ * values in TinyBase data. An x Cell value can be a finite number, string, or
165
+ * boolean. A y Cell value must be a finite number.
164
166
  * @category Configuration
165
167
  * @since v8.5.0
166
168
  */
167
- export type ChartSeriesProps = {
169
+ export type SeriesProps = {
168
170
  /**
169
171
  * An optional string that will be added to the class attribute of the series'
170
172
  * SVG group element.
@@ -174,9 +176,10 @@ export type ChartSeriesProps = {
174
176
  readonly className?: string;
175
177
  /**
176
178
  * The Id of the Cell that provides each data point's x value. Finite numbers
177
- * can be used as continuous x values in line series, while strings and
178
- * booleans are used as category values. Boolean category labels are rendered
179
- * as `true` and `false`.
179
+ * can be used as continuous linear x values in line series, ISO date strings
180
+ * can be used as time x values, and other strings and booleans are used as
181
+ * category values. Boolean category labels are rendered as `true` and
182
+ * `false`.
180
183
  * @category Prop
181
184
  * @since v8.5.0
182
185
  */
@@ -222,16 +225,275 @@ export type ChartSeriesProps = {
222
225
  readonly limit?: number;
223
226
  };
224
227
 
228
+ /**
229
+ * The XAxisScale type describes how x-axis values should be interpreted:
230
+ * `auto`, `category`, `linear`, or `time`.
231
+ * @category Configuration
232
+ * @since v8.5.0
233
+ */
234
+ export type XAxisScale = 'auto' | 'category' | 'linear' | 'time';
235
+
236
+ /**
237
+ * The TimestampUnit type describes the unit used by numeric timestamp values on
238
+ * a time x axis: `millisecond` or `second`.
239
+ * @category Configuration
240
+ * @since v8.5.0
241
+ */
242
+ export type TimestampUnit = 'millisecond' | 'second';
243
+
244
+ /**
245
+ * The TimeValue type describes values that can be used for explicit bounds and
246
+ * ticks on a time x axis: numbers, ISO date strings, or Date objects.
247
+ * @category Configuration
248
+ * @since v8.5.0
249
+ */
250
+ export type TimeValue = number | string | Date;
251
+
252
+ /**
253
+ * The BaseXAxisProps type describes props shared by all x-axis configurations.
254
+ * @category Configuration
255
+ * @since v8.5.0
256
+ */
257
+ export type BaseXAxisProps = {
258
+ /**
259
+ * An optional string that will be added to the class attribute of the x-axis
260
+ * SVG group element.
261
+ * @category Prop
262
+ * @since v8.5.0
263
+ */
264
+ readonly className?: string;
265
+ /**
266
+ * An optional title to use for the x axis, defaulting to the x Cell Id, or to
267
+ * a combined title when multiple series use different x Cell Ids.
268
+ * @category Prop
269
+ * @since v8.5.0
270
+ */
271
+ readonly title?: string;
272
+ /**
273
+ * An optional preferred number of ticks to render on a continuous x axis.
274
+ *
275
+ * The actual number of ticks may vary so that labels remain readable.
276
+ * @category Prop
277
+ * @since v8.5.0
278
+ */
279
+ readonly tickCount?: number;
280
+ };
281
+
282
+ /**
283
+ * The LinearXAxisProps type describes x-axis configuration for automatically
284
+ * inferred, categorical, and linear axes.
285
+ * @category Configuration
286
+ * @since v8.5.0
287
+ */
288
+ export type LinearXAxisProps = BaseXAxisProps & {
289
+ /**
290
+ * An optional scale to use for the x axis.
291
+ *
292
+ * The default `auto` scale infers linear axes from numeric line-series x
293
+ * values, time axes from ISO date strings, and category axes otherwise. Use
294
+ * `time` explicitly for numeric Unix timestamp values.
295
+ * @category Prop
296
+ * @since v8.5.0
297
+ */
298
+ readonly scale?: 'auto' | 'category' | 'linear';
299
+ /**
300
+ * The unit for numeric timestamp values on a time x axis.
301
+ *
302
+ * This prop is ignored unless the scale prop is `time`, and defaults to
303
+ * `millisecond`.
304
+ * @category Prop
305
+ * @since v8.5.0
306
+ */
307
+ readonly timestampUnit?: never;
308
+ /**
309
+ * An optional minimum x-axis bound for continuous numeric or time x values.
310
+ *
311
+ * This prop is ignored when the x axis is categorical.
312
+ * @category Prop
313
+ * @since v8.5.0
314
+ */
315
+ readonly min?: number;
316
+ /**
317
+ * An optional maximum x-axis bound for continuous numeric or time x values.
318
+ *
319
+ * This prop is ignored when the x axis is categorical.
320
+ * @category Prop
321
+ * @since v8.5.0
322
+ */
323
+ readonly max?: number;
324
+ /**
325
+ * Optional tick values to use for a continuous numeric or time x axis.
326
+ *
327
+ * This prop is ignored when the x axis is categorical.
328
+ * @category Prop
329
+ * @since v8.5.0
330
+ */
331
+ readonly ticks?: readonly number[];
332
+ /**
333
+ * An optional function for formatting x-axis tick labels.
334
+ *
335
+ * It receives the original tick value for category axes, the numeric tick
336
+ * value for linear axes, or a Date object for time axes. For time axes, the
337
+ * normalized epoch millisecond timestamp is provided as a second argument.
338
+ * @category Prop
339
+ * @since v8.5.0
340
+ */
341
+ readonly tickFormatter?: (tick: boolean | number | string) => string;
342
+ };
343
+
344
+ /**
345
+ * The TimeXAxisProps type describes x-axis configuration for time axes.
346
+ * @category Configuration
347
+ * @since v8.5.0
348
+ */
349
+ export type TimeXAxisProps = BaseXAxisProps & {
350
+ /**
351
+ * An optional scale to use for the x axis.
352
+ *
353
+ * The default `auto` scale infers linear axes from numeric line-series x
354
+ * values, time axes from ISO date strings, and category axes otherwise. Use
355
+ * `time` explicitly for numeric Unix timestamp values.
356
+ * @category Prop
357
+ * @since v8.5.0
358
+ */
359
+ readonly scale: 'time';
360
+ /**
361
+ * The unit for numeric timestamp values on a time x axis.
362
+ *
363
+ * This prop is ignored unless the scale prop is `time`, and defaults to
364
+ * `millisecond`.
365
+ * @category Prop
366
+ * @since v8.5.0
367
+ */
368
+ readonly timestampUnit?: TimestampUnit;
369
+ /**
370
+ * An optional minimum x-axis bound for continuous numeric or time x values.
371
+ *
372
+ * This prop is ignored when the x axis is categorical.
373
+ * @category Prop
374
+ * @since v8.5.0
375
+ */
376
+ readonly min?: TimeValue;
377
+ /**
378
+ * An optional maximum x-axis bound for continuous numeric or time x values.
379
+ *
380
+ * This prop is ignored when the x axis is categorical.
381
+ * @category Prop
382
+ * @since v8.5.0
383
+ */
384
+ readonly max?: TimeValue;
385
+ /**
386
+ * Optional tick values to use for a continuous numeric or time x axis.
387
+ *
388
+ * This prop is ignored when the x axis is categorical.
389
+ * @category Prop
390
+ * @since v8.5.0
391
+ */
392
+ readonly ticks?: readonly TimeValue[];
393
+ /**
394
+ * An optional function for formatting x-axis tick labels.
395
+ *
396
+ * It receives the original tick value for category axes, the numeric tick
397
+ * value for linear axes, or a Date object for time axes. For time axes, the
398
+ * normalized epoch millisecond timestamp is provided as a second argument.
399
+ * @category Prop
400
+ * @since v8.5.0
401
+ */
402
+ readonly tickFormatter?: (tick: Date, timestamp: number) => string;
403
+ };
404
+
405
+ /**
406
+ * The XAxisProps type describes the props that configure the x axis of a
407
+ * CartesianChart component, LineChart component, or BarChart component.
408
+ *
409
+ * The x axis is inferred by default. Use an XAxis component child when you
410
+ * want to override its title, scale, continuous bounds, tick values, tick
411
+ * count, tick labels, or SVG class name.
412
+ * @category Configuration
413
+ * @since v8.5.0
414
+ */
415
+ export type XAxisProps = LinearXAxisProps | TimeXAxisProps;
416
+
417
+ /**
418
+ * The YAxisProps type describes the props that configure the y axis of a
419
+ * CartesianChart component.
420
+ *
421
+ * The y axis is inferred by default. Use a YAxis component child when you want
422
+ * to override its title, numeric bounds, tick values, tick count, tick labels,
423
+ * or SVG class name.
424
+ * @category Configuration
425
+ * @since v8.5.0
426
+ */
427
+ export type YAxisProps = {
428
+ /**
429
+ * An optional string that will be added to the class attribute of the y-axis
430
+ * SVG group element.
431
+ * @category Prop
432
+ * @since v8.5.0
433
+ */
434
+ readonly className?: string;
435
+ /**
436
+ * An optional title to use for the y axis, defaulting to the y Cell Id, y
437
+ * series label, or a combined title when multiple series use different y Cell
438
+ * Ids or labels.
439
+ * @category Prop
440
+ * @since v8.5.0
441
+ */
442
+ readonly title?: string;
443
+ /**
444
+ * An optional minimum y-axis bound.
445
+ * @category Prop
446
+ * @since v8.5.0
447
+ */
448
+ readonly min?: number;
449
+ /**
450
+ * An optional maximum y-axis bound.
451
+ * @category Prop
452
+ * @since v8.5.0
453
+ */
454
+ readonly max?: number;
455
+ /**
456
+ * Optional numeric tick values to use for the y axis.
457
+ * @category Prop
458
+ * @since v8.5.0
459
+ */
460
+ readonly ticks?: readonly number[];
461
+ /**
462
+ * An optional preferred number of ticks to render on the y axis.
463
+ *
464
+ * The actual number of ticks may vary so that labels remain readable.
465
+ * @category Prop
466
+ * @since v8.5.0
467
+ */
468
+ readonly tickCount?: number;
469
+ /**
470
+ * An optional function for formatting y-axis tick labels.
471
+ *
472
+ * It receives the numeric tick value.
473
+ * @category Prop
474
+ * @since v8.5.0
475
+ */
476
+ readonly tickFormatter?: (tick: number) => string;
477
+ };
478
+
225
479
  /**
226
480
  * The CartesianChart component renders a chart frame and provides TinyBase
227
- * source and layout context to child LineSeries and BarSeries components.
481
+ * source and layout context to LineSeries component and BarSeries component
482
+ * children.
483
+ *
484
+ * See the Composing Charts (React) demo for this component in action:
228
485
  *
229
- * The series children declare their own xCellId and yCellId bindings.
486
+ * ![CartesianChart component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
487
+ * "CartesianChart component example")
488
+ *
489
+ * The series children declare their own xCellId and yCellId bindings. The
490
+ * optional XAxis component and YAxis component children can be used to
491
+ * configure axis titles, bounds, ticks, and tick formatting.
230
492
  * @category Store components
231
493
  * @since v8.5.0
232
494
  * @example
233
- * This example creates a Store and renders two LineSeries components in a
234
- * CartesianChart.
495
+ * This example creates a Store and renders two LineSeries component children
496
+ * in a CartesianChart component.
235
497
  *
236
498
  * ```jsx
237
499
  * import React from 'react';
@@ -266,35 +528,87 @@ export type ChartSeriesProps = {
266
528
  * ```
267
529
  */
268
530
  export function CartesianChart(
269
- props: (ChartTableSourceProps | ChartQuerySourceProps) &
531
+ props: (TableSourceProps | QuerySourceProps) &
270
532
  ChartProps & {readonly children?: ReactNode},
271
533
  ): ComponentReturnType;
272
534
 
273
535
  /**
274
- * The LineSeries component renders a line series in a CartesianChart
275
- * component. If every x value in every series is a finite number, the x axis is
276
- * rendered as a continuous numeric scale. If any x value is a string or
277
- * boolean, the x axis is rendered categorically. When sortCellId is omitted,
278
- * rows are sorted by xCellId.
536
+ * The XAxis component configures the x axis of a CartesianChart component,
537
+ * LineChart component, or BarChart component.
538
+ *
539
+ * It is a configuration child rather than a separately rendered SVG element:
540
+ * include zero or one XAxis component in a chart's children. If omitted, the x
541
+ * axis is inferred from the chart's series.
542
+ *
543
+ * See the Axis Overrides (React) demo for this component in action:
544
+ *
545
+ * ![XAxis component example](https://beta.tinybase.org/shots/axis-overrides-react-demo.png
546
+ * "XAxis component example")
279
547
  * @category Store components
280
548
  * @since v8.5.0
281
549
  */
282
- export function LineSeries(props: ChartSeriesProps): ComponentReturnType;
550
+ export function XAxis(props: XAxisProps): ComponentReturnType;
551
+
552
+ /**
553
+ * The YAxis component configures the y axis of a CartesianChart component.
554
+ *
555
+ * It is a configuration child rather than a separately rendered SVG element:
556
+ * include zero or one YAxis component in a CartesianChart component's children.
557
+ * If omitted, the y axis is inferred from the chart's series.
558
+ *
559
+ * See the Axis Overrides (React) demo for this component in action:
560
+ *
561
+ * ![YAxis component example](https://beta.tinybase.org/shots/axis-overrides-react-demo.png
562
+ * "YAxis component example")
563
+ * @category Store components
564
+ * @since v8.5.0
565
+ */
566
+ export function YAxis(props: YAxisProps): ComponentReturnType;
567
+
568
+ /**
569
+ * The LineSeries component renders a line series in a CartesianChart component.
570
+ * If every x value in every series is a finite number, the x axis is rendered
571
+ * as a continuous linear scale. ISO date strings are inferred as a time scale.
572
+ * Other strings and booleans are rendered categorically. When sortCellId is
573
+ * omitted, rows are sorted by xCellId.
574
+ *
575
+ * See the Composing Charts (React) demo for this component in action:
576
+ *
577
+ * ![LineSeries component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
578
+ * "LineSeries component example")
579
+ * @category Store components
580
+ * @since v8.5.0
581
+ */
582
+ export function LineSeries(props: SeriesProps): ComponentReturnType;
283
583
 
284
584
  /**
285
585
  * The BarSeries component renders a bar series in a CartesianChart component.
286
- * Its x values are always rendered categorically, even when they are finite
287
- * numbers. Boolean category labels are rendered as `true` and `false`.
586
+ * Its x values are rendered categorically by default, even when they are finite
587
+ * numbers. Add an XAxis component with a `linear` or `time` scale to position
588
+ * bars continuously. Boolean category labels are rendered as `true` and
589
+ * `false`.
590
+ *
591
+ * See the Composing Charts (React) demo for this component in action:
592
+ *
593
+ * ![BarSeries component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
594
+ * "BarSeries component example")
288
595
  * @category Store components
289
596
  * @since v8.5.0
290
597
  */
291
- export function BarSeries(props: ChartSeriesProps): ComponentReturnType;
598
+ export function BarSeries(props: SeriesProps): ComponentReturnType;
292
599
 
293
600
  /**
294
601
  * The LineChart component renders a line chart from TinyBase data. If every x
295
- * value is a finite number, the x axis is rendered as a continuous numeric
296
- * scale. If any x value is a string or boolean, the x axis is rendered
297
- * categorically. When sortCellId is omitted, rows are sorted by xCellId.
602
+ * value is a finite number, the x axis is rendered as a continuous linear
603
+ * scale. ISO date strings are inferred as a time scale. Other strings and
604
+ * booleans are rendered categorically. Add XAxis component and YAxis component
605
+ * children to override axis configuration. When sortCellId is omitted, rows are
606
+ * sorted by xCellId.
607
+ *
608
+ * See the <LineChart /> (React) demo for this component in action:
609
+ *
610
+ * ![LineChart component example](https://beta.tinybase.org/shots/basic-chart-react-demo.png "LineChart
611
+ * component example")
298
612
  * @category Store components
299
613
  * @since v8.5.0
300
614
  * @example
@@ -333,15 +647,21 @@ export function BarSeries(props: ChartSeriesProps): ComponentReturnType;
333
647
  * ```
334
648
  */
335
649
  export function LineChart(
336
- props: (ChartTableSourceProps | ChartQuerySourceProps) &
337
- ChartBindingProps &
338
- ChartProps,
650
+ props: (TableSourceProps | QuerySourceProps) &
651
+ BindingProps &
652
+ ChartProps & {readonly children?: ReactNode},
339
653
  ): ComponentReturnType;
340
654
 
341
655
  /**
342
656
  * The BarChart component renders a bar chart from TinyBase data. Its x values
343
- * are always rendered categorically, even when they are finite numbers. Boolean
344
- * category labels are rendered as `true` and `false`.
657
+ * are rendered categorically by default, even when they are finite numbers. Add
658
+ * an XAxis component with a `linear` or `time` scale to position bars
659
+ * continuously. Boolean category labels are rendered as `true` and `false`.
660
+ *
661
+ * See the Sorting And Types (React) demo for this component in action:
662
+ *
663
+ * ![BarChart component example](https://beta.tinybase.org/shots/sorting-and-types-react-demo.png
664
+ * "BarChart component example")
345
665
  * @category Store components
346
666
  * @since v8.5.0
347
667
  * @example
@@ -381,7 +701,7 @@ export function LineChart(
381
701
  * ```
382
702
  */
383
703
  export function BarChart(
384
- props: (ChartTableSourceProps | ChartQuerySourceProps) &
385
- ChartBindingProps &
386
- ChartProps,
704
+ props: (TableSourceProps | QuerySourceProps) &
705
+ BindingProps &
706
+ ChartProps & {readonly children?: ReactNode},
387
707
  ): ComponentReturnType;