tinybase 8.0.0-beta.3 → 8.0.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.
Files changed (49) hide show
  1. package/@types/middleware/index.d.ts +44 -124
  2. package/@types/middleware/with-schemas/index.d.ts +44 -147
  3. package/@types/ui-react-dom/index.d.ts +6 -4
  4. package/@types/ui-react-dom/with-schemas/index.d.ts +6 -4
  5. package/index.js +100 -69
  6. package/mergeable-store/index.js +99 -48
  7. package/mergeable-store/with-schemas/index.js +99 -48
  8. package/middleware/index.js +1 -39
  9. package/middleware/with-schemas/index.js +1 -39
  10. package/min/index.js +1 -1
  11. package/min/index.js.gz +0 -0
  12. package/min/mergeable-store/index.js +1 -1
  13. package/min/mergeable-store/index.js.gz +0 -0
  14. package/min/mergeable-store/with-schemas/index.js +1 -1
  15. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  16. package/min/middleware/index.js +1 -1
  17. package/min/middleware/index.js.gz +0 -0
  18. package/min/middleware/with-schemas/index.js +1 -1
  19. package/min/middleware/with-schemas/index.js.gz +0 -0
  20. package/min/omni/index.js +1 -1
  21. package/min/omni/index.js.gz +0 -0
  22. package/min/omni/with-schemas/index.js +1 -1
  23. package/min/omni/with-schemas/index.js.gz +0 -0
  24. package/min/store/index.js +1 -1
  25. package/min/store/index.js.gz +0 -0
  26. package/min/store/with-schemas/index.js +1 -1
  27. package/min/store/with-schemas/index.js.gz +0 -0
  28. package/min/ui-react-dom/index.js +1 -1
  29. package/min/ui-react-dom/index.js.gz +0 -0
  30. package/min/ui-react-dom/with-schemas/index.js +1 -1
  31. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  32. package/min/ui-react-inspector/index.js +1 -1
  33. package/min/ui-react-inspector/index.js.gz +0 -0
  34. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  35. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  36. package/min/with-schemas/index.js +1 -1
  37. package/min/with-schemas/index.js.gz +0 -0
  38. package/omni/index.js +156 -102
  39. package/omni/with-schemas/index.js +156 -102
  40. package/package.json +6 -6
  41. package/readme.md +3 -3
  42. package/releases.md +39 -4
  43. package/store/index.js +99 -48
  44. package/store/with-schemas/index.js +99 -48
  45. package/ui-react-dom/index.js +56 -34
  46. package/ui-react-dom/with-schemas/index.js +56 -34
  47. package/ui-react-inspector/index.js +155 -82
  48. package/ui-react-inspector/with-schemas/index.js +155 -82
  49. package/with-schemas/index.js +100 -69
@@ -97,6 +97,15 @@ export type WillSetTableCallback = (
97
97
  * Multiple WillSetRowCallback functions can be registered and they will be
98
98
  * called sequentially, the Row being updated successively. If any callback
99
99
  * returns `undefined`, the chain short-circuits and the Row will not be set.
100
+ *
101
+ * This callback fires both when setRow is called with a whole Row, and when
102
+ * setCell is called for a single Cell. When fired from setCell, the Row passed
103
+ * to the callback is a prospective row containing the existing Cell values
104
+ * merged with the new Cell value. The entire returned Row is then applied as
105
+ * though setRow had been called with it: cells present in the returned Row are
106
+ * written (each also passing through willSetCell), and cells absent from the
107
+ * returned Row that were present in the existing Row will be deleted. Return
108
+ * `undefined` to cancel the operation entirely.
100
109
  * @param tableId The Id of the Table being written to.
101
110
  * @param rowId The Id of the Row being set.
102
111
  * @param row The Row object about to be set.
@@ -311,49 +320,6 @@ export type WillApplyChangesCallback = (
311
320
  changes: Changes,
312
321
  ) => Changes | undefined;
313
322
 
314
- /**
315
- * The DidSetRowCallback type describes a function called after a Row is changed
316
- * during a transaction, and after mutator listeners have fired.
317
- *
318
- * Unlike the `willSet*` callbacks, which intercept writes as they happen,
319
- * `didSetRow` fires once per touched Row after all cell writes in the
320
- * transaction have completed. This means multiple cell changes to the same Row
321
- * within a single transaction result in just one `didSetRow` call, with the
322
- * full before-transaction and after-transaction Row states.
323
- *
324
- * The callback receives the Table Id, Row Id, the Row as it was at the start of
325
- * the transaction (`oldRow`), and the Row as it is now (`newRow`). It must
326
- * return a Row:
327
- *
328
- * - `newRow` to accept the changes.
329
- * - a different `Row` to replace the final state.
330
- * - `oldRow` to revert all changes to the Row.
331
- * - an empty object to delete the Row.
332
- *
333
- * Multiple DidSetRowCallback functions can be registered for the same table and
334
- * they will be called sequentially, each receiving the Row returned by the
335
- * previous callback. The chain never short-circuits: all registered callbacks
336
- * always run.
337
- *
338
- * Note that `addDidSetRowCallback` is table-scoped: you must specify the table
339
- * Id when registering. Callbacks are only invoked for rows in the specified
340
- * table, keeping overhead to zero for other tables.
341
- * @param tableId The Id of the Table containing the changed Row.
342
- * @param rowId The Id of the Row that was changed.
343
- * @param oldRow The Row as it was at the start of the transaction.
344
- * @param newRow The Row as it is now, after all cell writes including those
345
- * made by mutating listeners.
346
- * @returns The Row to use as the final state.
347
- * @category Callback
348
- * @since v8.0.0
349
- */
350
- export type DidSetRowCallback = (
351
- tableId: Id,
352
- rowId: Id,
353
- oldRow: Row,
354
- newRow: Row,
355
- ) => Row;
356
-
357
323
  /**
358
324
  * A Middleware object lets you intercept and validate writes to a Store.
359
325
  *
@@ -585,6 +551,15 @@ export interface Middleware {
585
551
  * write. Multiple callbacks can be registered and they are called
586
552
  * sequentially, each receiving the (possibly transformed) row from the
587
553
  * previous callback.
554
+ *
555
+ * This callback fires both when a whole Row is set with the setRow method,
556
+ * _and_ when a single Cell is set with the setCell method. When called from
557
+ * setCell, the callback receives a prospective row consisting of the existing
558
+ * Cell values merged with the new Cell value. The entire returned Row is then
559
+ * applied as though setRow had been called: all cells in the returned Row are
560
+ * written (each also passing through willSetCell), and any cells absent from
561
+ * the returned Row that existed before will be deleted. Return `undefined` to
562
+ * cancel the operation entirely.
588
563
  * @param callback The WillSetRowCallback to register.
589
564
  * @returns A reference to the Middleware object, for chaining.
590
565
  * @example
@@ -634,6 +609,32 @@ export interface Middleware {
634
609
  *
635
610
  * middleware.destroy();
636
611
  * ```
612
+ * @example
613
+ * This example shows the callback firing when setCell is called,
614
+ * automatically stamping an 'updated' timestamp onto the row each time any
615
+ * cell in it is written.
616
+ *
617
+ * ```js
618
+ * import {createMiddleware, createStore} from 'tinybase';
619
+ *
620
+ * const store = createStore();
621
+ * const middleware = createMiddleware(store);
622
+ *
623
+ * store.setRow('pets', 'fido', {species: 'dog'});
624
+ *
625
+ * middleware.addWillSetRowCallback((_tableId, _rowId, row) => ({
626
+ * ...row,
627
+ * updated: Date.now(),
628
+ * }));
629
+ *
630
+ * store.setCell('pets', 'fido', 'legs', 4);
631
+ * console.log(store.getCell('pets', 'fido', 'legs'));
632
+ * // -> 4
633
+ * console.log(typeof store.getCell('pets', 'fido', 'updated'));
634
+ * // -> 'number'
635
+ *
636
+ * middleware.destroy();
637
+ * ```
637
638
  * @category Configuration
638
639
  * @since v8.0.0
639
640
  */
@@ -1044,87 +1045,6 @@ export interface Middleware {
1044
1045
  */
1045
1046
  addWillApplyChangesCallback(callback: WillApplyChangesCallback): Middleware;
1046
1047
 
1047
- /**
1048
- * The addDidSetRowCallback method registers a DidSetRowCallback for a
1049
- * specific table that will be called after any Row in that table is changed
1050
- * during a transaction, after mutator listeners have fired.
1051
- *
1052
- * Unlike `willSetRow`, which fires synchronously during each write, this
1053
- * callback fires once per changed Row after all cell writes in the
1054
- * transaction have landed. Multiple cell changes to the same Row within a
1055
- * transaction produce a single callback with the full before/after Row
1056
- * states.
1057
- *
1058
- * The callback receives `oldRow` (the Row at the start of the transaction)
1059
- * and `newRow` (the Row after all writes). Return `newRow` to accept, a
1060
- * different `Row` to replace, `oldRow` to revert, or an empty object to
1061
- * delete.
1062
- * @param tableId The Id of the Table to watch.
1063
- * @param callback The DidSetRowCallback to register.
1064
- * @returns A reference to the Middleware object, for chaining.
1065
- * @example
1066
- * This example registers a callback that validates the 'pets' table,
1067
- * reverting any row that ends up without a required 'species' cell.
1068
- *
1069
- * ```js
1070
- * import {createMiddleware, createStore} from 'tinybase';
1071
- *
1072
- * const store = createStore();
1073
- * const middleware = createMiddleware(store);
1074
- *
1075
- * middleware.addDidSetRowCallback(
1076
- * 'pets',
1077
- * (_tableId, _rowId, oldRow, newRow) =>
1078
- * 'species' in newRow ? newRow : oldRow,
1079
- * );
1080
- *
1081
- * store.setRow('pets', 'fido', {species: 'dog', name: 'Fido'});
1082
- * console.log(store.getRow('pets', 'fido'));
1083
- * // -> {species: 'dog', name: 'Fido'}
1084
- *
1085
- * store.setRow('pets', 'nemo', {name: 'Nemo'});
1086
- * console.log(store.getRow('pets', 'nemo'));
1087
- * // -> {}
1088
- *
1089
- * middleware.destroy();
1090
- * ```
1091
- * @example
1092
- * This example shows that multiple cell changes in one transaction result in
1093
- * a single didSetRow callback with the full before/after row states.
1094
- *
1095
- * ```js
1096
- * import {createMiddleware, createStore} from 'tinybase';
1097
- *
1098
- * const store = createStore();
1099
- * const middleware = createMiddleware(store);
1100
- *
1101
- * const seen = [];
1102
- * middleware.addDidSetRowCallback(
1103
- * 'pets',
1104
- * (_tableId, rowId, oldRow, newRow) => {
1105
- * seen.push({rowId, oldRow: {...oldRow}, newRow: {...newRow}});
1106
- * return newRow;
1107
- * },
1108
- * );
1109
- *
1110
- * store.transaction(() => {
1111
- * store.setCell('pets', 'fido', 'name', 'Fido');
1112
- * store.setCell('pets', 'fido', 'species', 'dog');
1113
- * });
1114
- * console.log(seen.length);
1115
- * // -> 1
1116
- * console.log(seen[0].rowId);
1117
- * // -> 'fido'
1118
- * console.log(seen[0].newRow);
1119
- * // -> {name: 'Fido', species: 'dog'}
1120
- *
1121
- * middleware.destroy();
1122
- * ```
1123
- * @category Configuration
1124
- * @since v8.0.0
1125
- */
1126
- addDidSetRowCallback(tableId: Id, callback: DidSetRowCallback): Middleware;
1127
-
1128
1048
  /**
1129
1049
  * The destroy method should be called when this Middleware object is no
1130
1050
  * longer used. It removes all hooks and listeners from the Store, and
@@ -144,6 +144,15 @@ export type WillSetTableCallback<
144
144
  * Multiple WillSetRowCallback functions can be registered and they will be
145
145
  * called sequentially, the Row being updated successively. If any callback
146
146
  * returns `undefined`, the chain short-circuits and the Row will not be set.
147
+ *
148
+ * This callback fires both when setRow is called with a whole Row, and when
149
+ * setCell is called for a single Cell. When fired from setCell, the Row passed
150
+ * to the callback is a prospective row containing the existing Cell values
151
+ * merged with the new Cell value. The entire returned Row is then applied as
152
+ * though setRow had been called with it: cells present in the returned Row are
153
+ * written (each also passing through willSetCell), and cells absent from the
154
+ * returned Row that were present in the existing Row will be deleted. Return
155
+ * `undefined` to cancel the operation entirely.
147
156
  * @param tableId The Id of the Table being written to.
148
157
  * @param rowId The Id of the Row being set.
149
158
  * @param row The Row object about to be set.
@@ -476,63 +485,6 @@ export type WillApplyChangesCallback<Schemas extends OptionalSchemas> = (
476
485
  changes: Changes<Schemas>,
477
486
  ) => Changes<Schemas> | undefined;
478
487
 
479
- /**
480
- * The DidSetRowCallback type describes a function called after a Row is changed
481
- * during a transaction, and after mutator listeners have fired.
482
- *
483
- * This has schema-based typing. The following is a simplified representation:
484
- *
485
- * ```ts override
486
- * (
487
- * tableId: Id,
488
- * rowId: Id,
489
- * oldRow: Row,
490
- * newRow: Row,
491
- * ) => Row;
492
- * ```
493
- *
494
- * Unlike the `willSet*` callbacks, which intercept writes as they happen,
495
- * `didSetRow` fires once per touched Row after all cell writes in the
496
- * transaction have completed. This means multiple cell changes to the same Row
497
- * within a single transaction result in just one `didSetRow` call, with the
498
- * full before-transaction and after-transaction Row states.
499
- *
500
- * The callback receives the Table Id, Row Id, the Row as it was at the start of
501
- * the transaction (`oldRow`), and the Row as it is now (`newRow`). It must
502
- * return a Row:
503
- *
504
- * - `newRow` to accept the changes.
505
- * - a different `Row` to replace the final state.
506
- * - `oldRow` to revert all changes to the Row.
507
- * - an empty object to delete the Row.
508
- *
509
- * Multiple DidSetRowCallback functions can be registered for the same table and
510
- * they will be called sequentially, each receiving the Row returned by the
511
- * previous callback. The chain never short-circuits: all registered callbacks
512
- * always run.
513
- *
514
- * Note that `addDidSetRowCallback` is table-scoped: you must specify the table
515
- * Id when registering. Callbacks are only invoked for rows in the specified
516
- * table, keeping overhead to zero for other tables.
517
- * @param tableId The Id of the Table containing the changed Row.
518
- * @param rowId The Id of the Row that was changed.
519
- * @param oldRow The Row as it was at the start of the transaction.
520
- * @param newRow The Row as it is now, after all cell writes including those
521
- * made by mutating listeners.
522
- * @returns The Row to use as the final state.
523
- * @category Callback
524
- * @since v8.0.0
525
- */
526
- export type DidSetRowCallback<
527
- Schema extends OptionalTablesSchema,
528
- TableId extends TableIdFromSchema<Schema>,
529
- > = (
530
- tableId: TableId,
531
- rowId: Id,
532
- oldRow: Row<Schema, TableId>,
533
- newRow: Row<Schema, TableId>,
534
- ) => Row<Schema, TableId>;
535
-
536
488
  /**
537
489
  * A Middleware object lets you intercept and validate writes to a Store.
538
490
  *
@@ -800,6 +752,15 @@ export interface Middleware<in out Schemas extends OptionalSchemas> {
800
752
  * write. Multiple callbacks can be registered and they are called
801
753
  * sequentially, each receiving the (possibly transformed) row from the
802
754
  * previous callback.
755
+ *
756
+ * This callback fires both when a whole Row is set with the setRow method,
757
+ * _and_ when a single Cell is set with the setCell method. When called from
758
+ * setCell, the callback receives a prospective row consisting of the existing
759
+ * Cell values merged with the new Cell value. The entire returned Row is then
760
+ * applied as though setRow had been called: all cells in the returned Row are
761
+ * written (each also passing through willSetCell), and any cells absent from
762
+ * the returned Row that existed before will be deleted. Return `undefined` to
763
+ * cancel the operation entirely.
803
764
  * @param callback The WillSetRowCallback to register.
804
765
  * @returns A reference to the Middleware object, for chaining.
805
766
  * @example
@@ -849,6 +810,32 @@ export interface Middleware<in out Schemas extends OptionalSchemas> {
849
810
  *
850
811
  * middleware.destroy();
851
812
  * ```
813
+ * @example
814
+ * This example shows the callback firing when setCell is called,
815
+ * automatically stamping an 'updated' timestamp onto the row each time any
816
+ * cell in it is written.
817
+ *
818
+ * ```js
819
+ * import {createMiddleware, createStore} from 'tinybase';
820
+ *
821
+ * const store = createStore();
822
+ * const middleware = createMiddleware(store);
823
+ *
824
+ * store.setRow('pets', 'fido', {species: 'dog'});
825
+ *
826
+ * middleware.addWillSetRowCallback((_tableId, _rowId, row) => ({
827
+ * ...row,
828
+ * updated: Date.now(),
829
+ * }));
830
+ *
831
+ * store.setCell('pets', 'fido', 'legs', 4);
832
+ * console.log(store.getCell('pets', 'fido', 'legs'));
833
+ * // -> 4
834
+ * console.log(typeof store.getCell('pets', 'fido', 'updated'));
835
+ * // -> 'number'
836
+ *
837
+ * middleware.destroy();
838
+ * ```
852
839
  * @category Configuration
853
840
  * @since v8.0.0
854
841
  */
@@ -1341,96 +1328,6 @@ export interface Middleware<in out Schemas extends OptionalSchemas> {
1341
1328
  callback: WillApplyChangesCallback<Schemas>,
1342
1329
  ): Middleware<Schemas>;
1343
1330
 
1344
- /**
1345
- * The addDidSetRowCallback method registers a DidSetRowCallback for a
1346
- * specific table that will be called after any Row in that table is changed
1347
- * during a transaction, after mutator listeners have fired.
1348
- *
1349
- * This has schema-based typing. The following is a simplified representation:
1350
- *
1351
- * ```ts override
1352
- * addDidSetRowCallback(tableId: Id, callback: DidSetRowCallback): Middleware;
1353
- * ```
1354
- *
1355
- * Unlike `willSetRow`, which fires synchronously during each write, this
1356
- * callback fires once per changed Row after all cell writes in the
1357
- * transaction have landed. Multiple cell changes to the same Row within a
1358
- * transaction produce a single callback with the full before/after Row
1359
- * states.
1360
- *
1361
- * The callback receives `oldRow` (the Row at the start of the transaction)
1362
- * and `newRow` (the Row after all writes). Return `newRow` to accept, a
1363
- * different `Row` to replace, `oldRow` to revert, or an empty object to
1364
- * delete.
1365
- * @param tableId The Id of the Table to watch.
1366
- * @param callback The DidSetRowCallback to register.
1367
- * @returns A reference to the Middleware object, for chaining.
1368
- * @example
1369
- * This example registers a callback that validates the 'pets' table,
1370
- * reverting any row that ends up without a required 'species' cell.
1371
- *
1372
- * ```js
1373
- * import {createMiddleware, createStore} from 'tinybase';
1374
- *
1375
- * const store = createStore();
1376
- * const middleware = createMiddleware(store);
1377
- *
1378
- * middleware.addDidSetRowCallback(
1379
- * 'pets',
1380
- * (_tableId, _rowId, oldRow, newRow) =>
1381
- * 'species' in newRow ? newRow : oldRow,
1382
- * );
1383
- *
1384
- * store.setRow('pets', 'fido', {species: 'dog', name: 'Fido'});
1385
- * console.log(store.getRow('pets', 'fido'));
1386
- * // -> {species: 'dog', name: 'Fido'}
1387
- *
1388
- * store.setRow('pets', 'nemo', {name: 'Nemo'});
1389
- * console.log(store.getRow('pets', 'nemo'));
1390
- * // -> {}
1391
- *
1392
- * middleware.destroy();
1393
- * ```
1394
- * @example
1395
- * This example shows that multiple cell changes in one transaction result in
1396
- * a single didSetRow callback with the full before/after row states.
1397
- *
1398
- * ```js
1399
- * import {createMiddleware, createStore} from 'tinybase';
1400
- *
1401
- * const store = createStore();
1402
- * const middleware = createMiddleware(store);
1403
- *
1404
- * const seen = [];
1405
- * middleware.addDidSetRowCallback(
1406
- * 'pets',
1407
- * (_tableId, rowId, oldRow, newRow) => {
1408
- * seen.push({rowId, oldRow: {...oldRow}, newRow: {...newRow}});
1409
- * return newRow;
1410
- * },
1411
- * );
1412
- *
1413
- * store.transaction(() => {
1414
- * store.setCell('pets', 'fido', 'name', 'Fido');
1415
- * store.setCell('pets', 'fido', 'species', 'dog');
1416
- * });
1417
- * console.log(seen.length);
1418
- * // -> 1
1419
- * console.log(seen[0].rowId);
1420
- * // -> 'fido'
1421
- * console.log(seen[0].newRow);
1422
- * // -> {name: 'Fido', species: 'dog'}
1423
- *
1424
- * middleware.destroy();
1425
- * ```
1426
- * @category Configuration
1427
- * @since v8.0.0
1428
- */
1429
- addDidSetRowCallback<TableId extends TableIdFromSchema<Schemas[0]>>(
1430
- tableId: TableId,
1431
- callback: DidSetRowCallback<Schemas[0], TableId>,
1432
- ): Middleware<Schemas>;
1433
-
1434
1331
  /**
1435
1332
  * The destroy method should be called when this Middleware object is no
1436
1333
  * longer used. It removes all hooks and listeners from the Store, and
@@ -1784,8 +1784,9 @@ export function ResultSortedTableInHtmlTable(
1784
1784
  * Id, Cell Id, and Store (which is either the default context Store, a named
1785
1785
  * context Store, or an explicit reference).
1786
1786
  *
1787
- * A Cell contains a string, number, or boolean, so the value is rendered in an
1788
- * appropriate <input> tag and a button lets the user change type, if possible.
1787
+ * A Cell contains a string, number, boolean, object or array (since v8.0) so
1788
+ * the value is rendered in an appropriate <input> tag, possibly as JSON and a
1789
+ * button lets the user cycle through the types.
1789
1790
  *
1790
1791
  * Set the `showType` prop to false to remove the ability for the user to see or
1791
1792
  * change the Cell type. They will also not be able to change the type if there
@@ -1851,8 +1852,9 @@ export function EditableCellView(
1851
1852
  * Id, Value Id, and Store (which is either the default context Store, a named
1852
1853
  * context Store, or an explicit reference).
1853
1854
  *
1854
- * A Value contains a string, number, or boolean, so the value is rendered in an
1855
- * appropriate <input> tag and a button lets the user change type, if possible.
1855
+ * A Value contains a string, number, boolean, object or array (since v8.0) so
1856
+ * the value is rendered in an appropriate <input> tag, possibly as JSON and a
1857
+ * button lets the user cycle through the types.
1856
1858
  *
1857
1859
  * Set the `showType` prop to false to remove the ability for the user to see or
1858
1860
  * change the Value type. They will also not be able to change the type if there
@@ -1820,8 +1820,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1820
1820
  * Id, Cell Id, and Store (which is either the default context Store, a named
1821
1821
  * context Store, or an explicit reference).
1822
1822
  *
1823
- * A Cell contains a string, number, or boolean, so the value is rendered in an
1824
- * appropriate <input> tag and a button lets the user change type, if possible.
1823
+ * A Cell contains a string, number, boolean, object or array (since v8.0) so
1824
+ * the value is rendered in an appropriate <input> tag, possibly as JSON and a
1825
+ * button lets the user cycle through the types.
1825
1826
  *
1826
1827
  * Set the `showType` prop to false to remove the ability for the user to see or
1827
1828
  * change the Cell type. They will also not be able to change the type if there
@@ -1901,8 +1902,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
1901
1902
  * Id, Value Id, and Store (which is either the default context Store, a named
1902
1903
  * context Store, or an explicit reference).
1903
1904
  *
1904
- * A Value contains a string, number, or boolean, so the value is rendered in an
1905
- * appropriate <input> tag and a button lets the user change type, if possible.
1905
+ * A Value contains a string, number, boolean, object or array (since v8.0) so
1906
+ * the value is rendered in an appropriate <input> tag, possibly as JSON and a
1907
+ * button lets the user cycle through the types.
1906
1908
  *
1907
1909
  * Set the `showType` prop to false to remove the ability for the user to see or
1908
1910
  * change the Value type. They will also not be able to change the type if there