tinybase 3.1.0-beta.0 → 3.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/lib/cjs/checkpoints.cjs +1 -0
  2. package/lib/cjs/checkpoints.cjs.gz +0 -0
  3. package/lib/cjs/checkpoints.d.ts +959 -0
  4. package/lib/cjs/common.cjs +1 -0
  5. package/lib/cjs/common.cjs.gz +0 -0
  6. package/lib/cjs/common.d.ts +115 -0
  7. package/lib/cjs/indexes.cjs +1 -0
  8. package/lib/cjs/indexes.cjs.gz +0 -0
  9. package/lib/cjs/indexes.d.ts +966 -0
  10. package/lib/cjs/metrics.cjs +1 -0
  11. package/lib/cjs/metrics.cjs.gz +0 -0
  12. package/lib/cjs/metrics.d.ts +827 -0
  13. package/lib/cjs/persisters.cjs +1 -0
  14. package/lib/cjs/persisters.cjs.gz +0 -0
  15. package/lib/cjs/persisters.d.ts +727 -0
  16. package/lib/cjs/queries.cjs +1 -0
  17. package/lib/cjs/queries.cjs.gz +0 -0
  18. package/lib/cjs/queries.d.ts +3024 -0
  19. package/lib/cjs/relationships.cjs +1 -0
  20. package/lib/cjs/relationships.cjs.gz +0 -0
  21. package/lib/cjs/relationships.d.ts +1201 -0
  22. package/lib/cjs/store.cjs +1 -0
  23. package/lib/cjs/store.cjs.gz +0 -0
  24. package/lib/cjs/store.d.ts +5244 -0
  25. package/lib/cjs/tinybase.cjs +1 -0
  26. package/lib/cjs/tinybase.cjs.gz +0 -0
  27. package/lib/cjs/tinybase.d.ts +14 -0
  28. package/lib/cjs/tools.cjs +1 -0
  29. package/lib/cjs/tools.cjs.gz +0 -0
  30. package/lib/cjs/tools.d.ts +536 -0
  31. package/lib/cjs/ui-react.cjs +1 -0
  32. package/lib/cjs/ui-react.cjs.gz +0 -0
  33. package/lib/cjs/ui-react.d.ts +10921 -0
  34. package/lib/cjs-es6/checkpoints.cjs +1 -0
  35. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  36. package/lib/cjs-es6/checkpoints.d.ts +959 -0
  37. package/lib/cjs-es6/common.cjs +1 -0
  38. package/lib/cjs-es6/common.cjs.gz +0 -0
  39. package/lib/cjs-es6/common.d.ts +115 -0
  40. package/lib/cjs-es6/indexes.cjs +1 -0
  41. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  42. package/lib/cjs-es6/indexes.d.ts +966 -0
  43. package/lib/cjs-es6/metrics.cjs +1 -0
  44. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  45. package/lib/cjs-es6/metrics.d.ts +827 -0
  46. package/lib/cjs-es6/persisters.cjs +1 -0
  47. package/lib/cjs-es6/persisters.cjs.gz +0 -0
  48. package/lib/cjs-es6/persisters.d.ts +727 -0
  49. package/lib/cjs-es6/queries.cjs +1 -0
  50. package/lib/cjs-es6/queries.cjs.gz +0 -0
  51. package/lib/cjs-es6/queries.d.ts +3024 -0
  52. package/lib/cjs-es6/relationships.cjs +1 -0
  53. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  54. package/lib/cjs-es6/relationships.d.ts +1201 -0
  55. package/lib/cjs-es6/store.cjs +1 -0
  56. package/lib/cjs-es6/store.cjs.gz +0 -0
  57. package/lib/cjs-es6/store.d.ts +5244 -0
  58. package/lib/cjs-es6/tinybase.cjs +1 -0
  59. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  60. package/lib/cjs-es6/tinybase.d.ts +14 -0
  61. package/lib/cjs-es6/tools.cjs +1 -0
  62. package/lib/cjs-es6/tools.cjs.gz +0 -0
  63. package/lib/cjs-es6/tools.d.ts +536 -0
  64. package/lib/cjs-es6/ui-react.cjs +1 -0
  65. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  66. package/lib/cjs-es6/ui-react.d.ts +10921 -0
  67. package/lib/debug/queries.js +4 -3
  68. package/lib/debug/store.js +7 -6
  69. package/lib/debug/tinybase.js +8 -7
  70. package/lib/debug/tools.d.ts +59 -35
  71. package/lib/debug/tools.js +1639 -728
  72. package/lib/debug/ui-react.js +30 -28
  73. package/lib/es6/tools.d.ts +59 -35
  74. package/lib/es6/tools.js +1 -1
  75. package/lib/es6/tools.js.gz +0 -0
  76. package/lib/es6/ui-react.js +1 -1
  77. package/lib/es6/ui-react.js.gz +0 -0
  78. package/lib/tools.d.ts +59 -35
  79. package/lib/tools.js +1 -1
  80. package/lib/tools.js.gz +0 -0
  81. package/lib/ui-react.js +1 -1
  82. package/lib/ui-react.js.gz +0 -0
  83. package/lib/umd/tinybase.js +1 -1
  84. package/lib/umd/tinybase.js.gz +0 -0
  85. package/lib/umd/tools.d.ts +59 -35
  86. package/lib/umd/tools.js +1 -1
  87. package/lib/umd/tools.js.gz +0 -0
  88. package/lib/umd/ui-react.js +1 -1
  89. package/lib/umd/ui-react.js.gz +0 -0
  90. package/lib/umd-es6/tinybase.js +1 -1
  91. package/lib/umd-es6/tinybase.js.gz +0 -0
  92. package/lib/umd-es6/tools.d.ts +59 -35
  93. package/lib/umd-es6/tools.js +1 -1
  94. package/lib/umd-es6/tools.js.gz +0 -0
  95. package/lib/umd-es6/ui-react.js +1 -1
  96. package/lib/umd-es6/ui-react.js.gz +0 -0
  97. package/package.json +31 -23
  98. package/readme.md +1 -1
@@ -272,26 +272,35 @@ export interface Tools {
272
272
  getStoreValuesSchema(): ValuesSchema;
273
273
 
274
274
  /**
275
- * The getStoreApi method returns a code-generated .d.ts file and a .ts file
276
- * that describe the schema of a Store in an ORM style.
275
+ * The getStoreApi method returns code-generated .d.ts and .ts(x) files that
276
+ * describe the schema of a Store and React bindings (since v3.1.0) in an ORM
277
+ * style.
277
278
  *
278
- * If the Store does not already have an explicit TablesSchema associated with
279
- * it, the data in the Store will be scanned to attempt to infer a new
280
- * TablesSchema. The method returns two strings (which should be saved as
281
- * files) though if no schema can be inferred, the strings will be empty.
279
+ * If the Store does not already have an explicit TablesSchema or ValuesSchema
280
+ * associated with it, the data in the Store will be scanned to attempt to
281
+ * infer new schemas. The method returns four strings (which should be saved
282
+ * as files) though if no schema can be inferred, the strings will be empty.
282
283
  *
283
284
  * The method takes a single argument which represents the name you want the
284
- * generated store object to have in code. You are expected to save the files
285
- * as `[storeName].d.ts` and `[storeName].ts`, and alongside each other so
286
- * that the latter can import types from the former.
285
+ * generated store object to have in code. You are expected to save the four
286
+ * files yourself, as, respectively:
287
+ *
288
+ * - `[storeName].d.ts`
289
+ * - `[storeName].ts`
290
+ * - `[storeName]-ui-react.d.ts`
291
+ * - `[storeName]-ui-react.tsx`
292
+ *
293
+ * Also you should save these alongside each other so that the .ts(x) files
294
+ * can import types from the .d.ts files.
287
295
  *
288
- * The .d.ts and .ts files that are generated are designed to resemble the
289
- * main TinyBase `store.d.ts` and `store.ts` files, but provide named types
290
- * and methods that describe the domain of the schema in the store.
296
+ * The .d.ts and .ts(x) files that are generated are designed to resemble the
297
+ * main TinyBase Store and React binding files, but provide named types and
298
+ * methods that describe the domain of the schema in the store.
291
299
  *
292
300
  * For example, from a Store that has a `pets` Table, you will get methods
293
- * like `getPetsTable`, and types like `PetsRow`, that are more specific
294
- * versions of the underlying getTable method or the Row type. For example:
301
+ * like `getPetsTable`, types like `PetsRow`, and hooks and components that
302
+ * are more specific versions of the underlying getTable method or the Row
303
+ * type, and so on. For example:
295
304
  *
296
305
  * |Store type|Equivalent generated type|
297
306
  * |-|-|
@@ -321,9 +330,9 @@ export interface Tools {
321
330
  * directly.
322
331
  *
323
332
  * @param storeName The name you want to provide to the generated Store, which
324
- * should also be used to save the `.d.ts` and `.ts` files.
325
- * @returns A pair of strings representing the contents of the `.d.ts` and
326
- * `.ts` files.
333
+ * should also be used to save the `.d.ts`, `.ts`, and `.tsx` files.
334
+ * @returns A set of four strings representing the contents of the `.d.ts`,
335
+ * `.ts`, and `.tsx` files for the generated Store and React modules.
327
336
  * @example
328
337
  * This example creates a Tools object and generates code for a Store that
329
338
  * already has a TablesSchema.
@@ -333,7 +342,8 @@ export interface Tools {
333
342
  * price: {type: 'number'},
334
343
  * },
335
344
  * });
336
- * const [dTs, ts] = createTools(store).getStoreApi('shop');
345
+ * const [dTs, ts, dTsUiReact, tsUiReact] =
346
+ * createTools(store).getStoreApi('shop');
337
347
  *
338
348
  * const dTsLines = dTs.split('\n');
339
349
  * console.log(dTsLines[3]);
@@ -342,7 +352,7 @@ export interface Tools {
342
352
  * // -> 'export type PetsRow = {\'price\'?: number;};'
343
353
  *
344
354
  * const tsLines = ts.split('\n');
345
- * console.log(tsLines[41]);
355
+ * console.log(tsLines[39]);
346
356
  * // -> 'getPetsTable: (): PetsTable => store.getTable(PETS) as PetsTable,'
347
357
  * ```
348
358
  * @example
@@ -353,7 +363,8 @@ export interface Tools {
353
363
  * fido: {price: 5},
354
364
  * felix: {price: 4},
355
365
  * });
356
- * const [dTs, ts] = createTools(store).getStoreApi('shop');
366
+ * const [dTs, ts, dTsUiReact, tsUiReact] =
367
+ * createTools(store).getStoreApi('shop');
357
368
  *
358
369
  * const dTsLines = dTs.split('\n');
359
370
  * console.log(dTsLines[3]);
@@ -362,18 +373,18 @@ export interface Tools {
362
373
  * // -> 'export type PetsRow = {\'price\': number;};'
363
374
  *
364
375
  * const tsLines = ts.split('\n');
365
- * console.log(tsLines[43]);
376
+ * console.log(tsLines[41]);
366
377
  * // -> 'getPetsTable: (): PetsTable => store.getTable(PETS) as PetsTable,'
367
378
  * ```
368
379
  * @category Modelling
369
380
  * @since v2.2.0
370
381
  */
371
- getStoreApi(storeName: string): [string, string];
382
+ getStoreApi(storeName: string): [string, string, string, string];
372
383
 
373
384
  /**
374
385
  * The getPrettyStoreApi method attempts to returns a prettified
375
- * code-generated .d.ts file and a .ts file that describe the schema of a
376
- * Store in an ORM style.
386
+ * code-generated .d.ts and .ts(x) files that describe the schema of a Store
387
+ * and React bindings (since v3.1.0) in an ORM style.
377
388
  *
378
389
  * This is simply a wrapper around the getStoreApi method that attempts to
379
390
  * invoke the `prettier` module (which it hopes you have installed) to format
@@ -384,17 +395,24 @@ export interface Tools {
384
395
  * the results as a promise.
385
396
  *
386
397
  * The method takes a single argument which represents the name you want the
387
- * generated store object to have in code. You are expected to save the files
388
- * as `[storeName].d.ts` and `[storeName].ts`, and alongside each other so
389
- * that the latter can import types from the former.
398
+ * generated store object to have in code. You are expected to save the four
399
+ * files yourself, as, respectively:
400
+ *
401
+ * - `[storeName].d.ts`
402
+ * - `[storeName].ts`
403
+ * - `[storeName]-ui-react.d.ts`
404
+ * - `[storeName]-ui-react.tsx`
405
+ *
406
+ * Also you should save these alongside each other so that the .ts(x) files
407
+ * can import types from the .d.ts files.
390
408
  *
391
409
  * See the documentation for the getStoreApi method for details of the content
392
410
  * of the generated files.
393
411
  *
394
412
  * @param storeName The name you want to provide to the generated Store, which
395
- * should also be used to save the `.d.ts` and `.ts` files.
396
- * @returns A pair of strings representing the contents of the `.d.ts` and
397
- * `.ts` files.
413
+ * should also be used to save the `.d.ts`, `.ts`, and `.tsx` files.
414
+ * @returns A set of four strings representing the contents of the `.d.ts`,
415
+ * `.ts`, and `.tsx` files for the generated Store and React modules.
398
416
  * @example
399
417
  * This example creates a Tools object and generates code for a Store that
400
418
  * already has a TablesSchema.
@@ -405,7 +423,9 @@ export interface Tools {
405
423
  * },
406
424
  * });
407
425
  * const tools = createTools(store);
408
- * const [dTs, ts] = await tools.getPrettyStoreApi('shop');
426
+ * const [dTs, ts, dTsUiReact, tsUiReact] = await createTools(
427
+ * store,
428
+ * ).getPrettyStoreApi('shop');
409
429
  *
410
430
  * const dTsLines = dTs.split('\n');
411
431
  * console.log(dTsLines[5]);
@@ -414,7 +434,7 @@ export interface Tools {
414
434
  * // -> 'export type PetsRow = {price?: number};'
415
435
  *
416
436
  * const tsLines = ts.split('\n');
417
- * console.log(tsLines[72]);
437
+ * console.log(tsLines[75]);
418
438
  * // -> ' hasPetsTable: (): boolean => store.hasTable(PETS),'
419
439
  * ```
420
440
  * @example
@@ -426,7 +446,9 @@ export interface Tools {
426
446
  * felix: {price: 4},
427
447
  * });
428
448
  * const tools = createTools(store);
429
- * const [dTs, ts] = await tools.getPrettyStoreApi('shop');
449
+ * const [dTs, ts, dTsUiReact, tsUiReact] = await createTools(
450
+ * store,
451
+ * ).getPrettyStoreApi('shop');
430
452
  *
431
453
  * const dTsLines = dTs.split('\n');
432
454
  * console.log(dTsLines[5]);
@@ -435,13 +457,15 @@ export interface Tools {
435
457
  * // -> 'export type PetsRow = {price: number};'
436
458
  *
437
459
  * const tsLines = ts.split('\n');
438
- * console.log(tsLines[74]);
460
+ * console.log(tsLines[77]);
439
461
  * // -> ' hasPetsTable: (): boolean => store.hasTable(PETS),'
440
462
  * ```
441
463
  * @category Modelling
442
464
  * @since v2.2.0
443
465
  */
444
- getPrettyStoreApi(storeName: string): Promise<[string, string]>;
466
+ getPrettyStoreApi(
467
+ storeName: string,
468
+ ): Promise<[string, string, string, string]>;
445
469
 
446
470
  /**
447
471
  * The getStore method returns a reference to the underlying Store that is
@@ -1 +1 @@
1
- var e,a;e=this,a=function(e){"use strict";const a=e=>typeof e,l="",t=a(l),o=a(!0),n=a(0),s="type",r="default",d=(e,a)=>e.every(a),$=(e,a)=>e.sort(a),i=(e,a)=>e.forEach(a),u=(e,a)=>e.map(a),I=e=>e.length,c=e=>0==I(e),b=(e,...a)=>e.push(...a),w=e=>e.pop(),h=(e,...a)=>e.unshift(...a),g=e=>e.shift(),C=JSON.parse,f=isFinite,T=(e,a)=>e instanceof a,V=e=>null==e,v=e=>e==t||e==o,p=e=>a(e)==t,R=e=>Array.isArray(e),m=e=>{const l=a(e);return v(l)||l==n&&f(e)?l:void 0},y=(e,a)=>{var l;return null!=(l=null==e?void 0:e.has(a))&&l},L=e=>{var a;return[...null!=(a=null==e?void 0:e.values())?a:[]]},S=(e,a)=>null==e?void 0:e.forEach(a),k=(e,a)=>null==e?void 0:e.delete(a),J=e=>new Map(e),E=(e,a)=>null==e?void 0:e.get(a),O=(e,a)=>S(e,((e,l)=>a(l,e))),j=(e,a)=>{var l;return u([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>a(l,e)))},x=(e,a,l)=>V(l)?(k(e,a),e):null==e?void 0:e.set(a,l),A=(e,a,l)=>(y(e,a)||x(e,a,l()),E(e,a)),P=e=>new Set(R(e)||V(e)?e:[e]),D=(e,a)=>null==e?void 0:e.add(a),N=e=>[e,e],G=()=>[J(),J()],z=/[^A-Za-z]+/,F=/[^A-Za-z0-9]+/,W=/^( *)\/\*\* *(.*?) *\*\/$/gm,M=(e,a,l)=>e.substring(a,l),Z=e=>e.toUpperCase(),_=e=>e.toLowerCase(),B=(e,a,l,t=1)=>{const o=`${a}${1==t?"":t}`;return y(e,o)?B(e,a,l,t+1):(x(e,o,l),o)},Q=e=>e.replace(W,((e,a,l)=>{const t=77-U(a);return`${a}/**\n${l.replace(RegExp(`([^\\n]{1,${t}})(\\s|$)`,"g"),a+" * $1\n")}${a} */`})),U=e=>e.length,q=(e,a=l)=>e.join(a),H=e=>e.flat(1e3),K=(e,a=0)=>q(u(e.split(F),((e,l)=>(l>0||a?Z:_)(M(e,0,1))+M(e,1)))),X=e=>Z(q((e&&!z.test(e[0])?e:" "+e).split(F),"_")),Y=e=>`/** ${e}. */`,ee=()=>{const e=G(),a=J(),t=J(),o=J();return[(...e)=>q(H(e),"\n"),(a,l,...t)=>i(t,(t=>D(A(e[a],l,P),t))),(e,l,t)=>B(a,e,[l,t]),(e,a,l,o,n,s="")=>B(t,e,[a,l,o,n,s]),(e,a,l)=>B(o,e,R(l)?[`(${a}) => {`,l,"}"]:[`(${a}) => ${l}`]),(e,a)=>E(o,e)===a?e:B(o,e,a),a=>[...$(j(e[a],((e,a)=>`import {${q($(L(e)),", ")}} from '${a}';`))),l],()=>j(a,(([e,a],t)=>[Y(a),`export type ${t} = ${e};`,l])),e=>j(t,(([a,t,o,n,s],r)=>{const d=e?[`${r}: ${s}(${a}): ${t} => ${o},`]:[`${r}${s}(${a}): ${t};`];return e||h(d,Y(n)),b(d,l),d})),()=>j(o,((e,a)=>(e=R(e)?e:[e],b(e,w(e)+";"),[`const ${a} = ${g(e)}`,e,l])))]},ae=Object,le=ae.keys,te=ae.freeze,oe=e=>T(e,ae)&&e.constructor==ae,ne=(e,a)=>u(ae.entries(e),(([e,l])=>a(l,e))),se=e=>oe(e)&&c(le(e)),re=e=>{const a=new WeakMap;return l=>(a.has(l)||a.set(l,e(l)),a.get(l))},de="the Store",$e="A function for",ie="export",ue="listener",Ie=" | undefined",ce=`Registers a ${ue} that will be called`,be="Represents",we=" => void",he="the end of the transaction",ge="the specified Row",Ce="a string serialization of",fe=(e=0,a=0)=>`the ${Ne[e]}content of${a?" "+de:""}`,Te=(e,a=0,l=0)=>`${Pe[e]} ${fe(a,1)}${l?" when set":""}`,Ve=(e,a=0)=>`${be} a Row when ${a?"s":"g"}etting ${fe()} the '${e}' Table`,ve=(e,a,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in ${a}`,pe=(e,a)=>`Calls a function for each ${e} in ${a}`,Re=(e,a=de)=>`Gets whether ${e} exists in ${a}`,me=e=>"A function that takes "+e,ye=(e,a=0)=>`${$e} listening to changes to ${De[e]} in ${De[a]}`,Le=(e,a,t=0)=>`${ce} whenever ${e} in ${a} change`+(t?l:"s"),Se=e=>`the '${e}' Table`,ke=e=>`${ge} in ${Se(e)}`,Je=e=>`the '${e}' Cell`,Ee=e=>`the '${e}' Value`,Oe=(e,a=0)=>`${Pe[a]} ${fe()} ${Se(e)}`,je=(e,a=0)=>`${Pe[a]} ${fe()} ${ke(e)}`,xe=(e,a,l=0)=>`${Pe[l]} ${Je(a)} for ${ke(e)}`,Ae=(e,a=0)=>`${Pe[a]} ${Ee(e)}`,Pe=["Gets","Sets","Sets part of","Deletes",be,"Gets "+Ce,"Sets "+Ce,ce+" whenever"],De=[de,"Tables","Table Ids","a Table","Row Ids","a Row","Cell Ids","a Cell","invalid Cell changes","Values","Value Ids","a Value","invalid Value changes"],Ne=["","tabular ","keyed value "],Ge=["DoRollback","Id","IdOrNull","Ids","Json","Store"],ze=(e,a=l,t=l)=>`store.${e}(${a})${t?" as "+t:l}`,Fe=(e,a=l)=>`fluent(() => ${ze(e,a)})`,We=(e,a=l,t=l)=>`store.${e}(${a?a+", ":l}proxy(${ue})${t?", "+t:l})`,Me=(e,a,t)=>{if(se(e)&&se(a))return N(l);const[n,d,$,i,u,I,c,w,h,g]=ee(),C=`./${K(t)}.d`,f=K(t,1),T=K(f),v=[],R=J(),m=a=>ne(e,((e,t)=>a(t,A(R,t,(()=>{const e=K(t,1);return[$(e+"Table",`{[rowId: Id]: ${e}Row}`,`${be} the '${t}' Table`),$(e+"Row",`{${q(y(t,((e,a,t)=>`'${e}'${V(t)?"?":l}: ${a};`))," ")}}`,Ve(t)),$(e+"RowWhenSet",`{${q(y(t,((e,a)=>`'${e}'?: ${a};`))," ")}}`,Ve(t,1)),$(e+"CellId",q(y(t,(e=>`'${e}'`))," | "),`A Cell Id for the '${t}' Table`),$(e+"CellCallback",`(...[cellId, cell]: ${q(y(t,((e,a)=>`[cellId: '${e}', cell: ${a}]`))," | ")})${we}`,me(`a Cell Id and value from a Row in the '${t}' Table`)),$(e+"RowCallback",`(rowId: Id, forEachCell: (cellCallback: ${e}CellCallback)${we})${we}`,me(`a Row Id from the '${t}' Table, and a Cell iterator`))]})),K(t,1),I(X(t),`'${t}'`)))),y=(a,l)=>ne(e[a],((e,a)=>l(a,e[s],e[r],I(X(a),`'${a}'`),K(a,1)))),S=e=>ne(a,((a,l)=>e(l,a[s],a[r],I(X(l),`'${l}'`),K(l,1))));if(d(1,C,f,`create${f} as create${f}Decl`),!se(e)){const e=$("Tables",`{${q(m(((e,a)=>`'${e}'?: ${a[0]};`))," ")}}`,Te(4,1)),a=$("TableId",q(m((e=>`'${e}'`))," | "),"A Table Id in "+de),t=$("TableCallback",`(...[tableId, rowCallback]: ${q(m(((e,a)=>`[tableId: '${e}', forEachRow: (rowCallback: ${a[5]})${we}]`))," | ")})${we}`,me("a Table Id, and a Row iterator")),n=$("GetCellChange",`(...[tableId, rowId, cellId]: ${q(m(((e,a)=>`[tableId: '${e}', rowId: Id, cellId: ${a[3]}]`))," | ")}) => CellChange`,$e+" returning information about any Cell's changes during a transaction"),u=$("TablesListener",`(${T}: ${f}, getCellChange: ${n}${Ie})${we}`,ye(1)),c=$("TableIdsListener",`(${T}: ${f})${we}`,ye(2)),w=$("TableListener",`(${T}: ${f}, tableId: ${a}, getCellChange: ${n}${Ie})${we}`,ye(3)),h=$("RowIdsListener",`(${T}: ${f}, tableId: ${a})`+we,ye(4,3)),g=$("RowListener",`(${T}: ${f}, tableId: ${a}, rowId: Id, getCellChange: ${n}${Ie})${we}`,ye(5,3)),R=$("CellIdsListener",`(${T}: ${f}, tableId: ${a}, rowId: Id)`+we,ye(6,5)),S=$("CellListener",`(...[${T}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${q(H(m((e=>y(e,((a,l)=>`[${T}: ${f}, tableId: '${e}', rowId: Id, cellId: '${a}', newCell: ${l}${Ie}, oldCell: ${l}${Ie}, getCellChange: ${n} | undefined]`)))))," | ")})${we}`,ye(7,5)),k=$("InvalidCellListener",`(${T}: ${f}, tableId: Id, rowId: Id, cellId: Id, invalidCells: any[])${we}`,ye(8));i("hasTables",l,o,ze("hasTables"),Re("any Table")),i("getTables",l,e,ze("getTables"),Te(0,1)),i("setTables","tables: "+e,f,Fe("setTables","tables"),Te(1,1)),i("delTables",l,f,Fe("delTables"),Te(3,1)),i("getTableIds",l,a+"[]",ze("getTableIds",l,a+"[]"),ve("Table",de)),i("forEachTable","tableCallback: "+t,"void",ze("forEachTable","tableCallback as any"),pe("Table",de));const E=J();m(((e,[a,t,n,s,r,$],u,I)=>{d(1,C,a,t,n,s,r,$),i(`has${u}Table`,l,o,ze("hasTable",I),Re(Se(e))),i(`get${u}Table`,l,a,ze("getTable",I,a),Oe(e)),i(`set${u}Table`,"table: "+a,f,Fe("setTable",I+", table"),Oe(e,1)),i(`del${u}Table`,l,f,Fe("delTable",I),Oe(e,3)),i(`get${u}RowIds`,l,"Ids",ze("getRowIds",I),ve("Row",Se(e))),i(`get${u}SortedRowIds`,`cellId?: ${s}, descending?: boolean, offset?: number, limit?: number`,"Ids",ze("getSortedRowIds",I+", cellId, descending, offset, limit"),ve("Row",Se(e),1)),i(`forEach${u}Row`,"rowCallback: "+$,"void",ze("forEachRow",I+", rowCallback as any"),pe("Row",Se(e))),i(`has${u}Row`,"rowId: Id",o,ze("hasRow",I+", rowId"),Re(ge,Se(e))),i(`get${u}Row`,"rowId: Id",t,ze("getRow",I+", rowId",t),je(e)),i(`set${u}Row`,"rowId: Id, row: "+n,f,Fe("setRow",I+", rowId, row"),je(e,1)),i(`add${u}Row`,"row: "+n,"Id"+Ie,ze("addRow",I+", row"),"Adds a new Row to "+Se(e)),i(`set${u}PartialRow`,"rowId: Id, partialRow: "+n,f,Fe("setPartialRow",I+", rowId, partialRow"),je(e,2)),i(`del${u}Row`,"rowId: Id",f,Fe("delRow",I+", rowId"),je(e,3)),i(`get${u}CellIds`,"rowId: Id",s+"[]",ze("getCellIds",I+", rowId",s+"[]"),ve("Cell",ke(e))),i(`forEach${u}Cell`,"rowId: Id, cellCallback: "+r,"void",ze("forEachCell",I+", rowId, cellCallback as any"),pe("Cell",ke(e))),y(e,((a,t,n,s,r)=>{const d="Map"+K(t,1);x(E,t,d),i(`has${u}${r}Cell`,"rowId: Id",o,ze("hasCell",`${I}, rowId, ${s}`),Re(Je(a),ke(e)));const $=`${t}${V(n)?Ie:l}`;i(`get${u}${r}Cell`,"rowId: Id",$,ze("getCell",`${I}, rowId, ${s}`,$),xe(e,a)),i(`set${u}${r}Cell`,`rowId: Id, cell: ${t} | ${d}`,f,Fe("setCell",`${I}, rowId, ${s}, cell as any`),xe(e,a,1)),i(`del${u}${r}Cell`,"rowId: Id",f,Fe("delCell",`${I}, rowId, ${s}`),xe(e,a,3))}))})),i("getTablesJson",l,"Json",ze("getTablesJson"),Te(5,1)),i("setTablesJson","tablesJson: Json",f,Fe("setTablesJson","tablesJson"),Te(6,1)),i("addTablesListener",`${ue}: ${u}, mutator?: boolean`,"Id",We("addTablesListener",l,"mutator"),Te(7,1)+" changes"),i("addTableIdsListener",`${ue}: ${c}, mutator?: boolean`,"Id",We("addTableIdsListener",l,"mutator"),Le("the Table Ids",de,1)),i("addTableListener",`tableId: ${a} | null, ${ue}: ${w}, mutator?: boolean`,"Id",We("addTableListener","tableId","mutator"),Le("a Table",de)),i("addRowIdsListener",`tableId: ${a} | null, ${ue}: ${h}, mutator?: boolean`,"Id",We("addRowIdsListener","tableId","mutator"),Le("the Row Ids","a Table",1)),i("addRowListener",`tableId: ${a} | null, rowId: IdOrNull, ${ue}: ${g}, mutator?: boolean`,"Id",We("addRowListener","tableId, rowId","mutator"),Le("a Row","a Table")),i("addCellIdsListener",`tableId: ${a} | null, rowId: IdOrNull, ${ue}: ${R}, mutator?: boolean`,"Id",We("addCellIdsListener","tableId, rowId","mutator"),Le("the Cell Ids","a Row",1)),i("addCellListener",`tableId: ${a} | null, rowId: IdOrNull, cellId: ${q(m(((e,a)=>a[3]))," | ")} | null, ${ue}: ${S}, mutator?: boolean`,"Id",We("addCellListener","tableId, rowId, cellId","mutator"),Le("a Cell","a Row")),i("addInvalidCellListener",`tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull, ${ue}: ${k}, mutator?: boolean`,"Id",We("addInvalidCellListener","tableId, rowId, cellId","mutator"),ce+" whenever an invalid Cell change was attempted"),O(E,((e,a)=>$(a,`(cell: ${e}${Ie}) => ${e}`,`Takes a ${e} Cell value and returns another`))),d(1,C,e,a,t,u,c,w,h,g,R,S,k,...L(E)),d(0,"tinybase","CellChange"),b(v,".setTablesSchema({",H(m(((e,a,t,o)=>[`[${o}]: {`,...y(e,((e,a,t,o)=>`[${o}]: {[${I(X(s),`'${s}'`)}]: ${I(X(a),`'${a}'`)}${V(t)?l:`, [${I(X(r),`'${r}'`)}]: ${p(t)?I(X(t),`'${t}'`):t}`}},`)),"},"]))),"})")}if(!se(a)){const e=$("Values",`{${q(S(((e,a,t)=>`'${e}'${V(t)?"?":l}: ${a};`))," ")}}`,Te(4,2)),a=$("ValuesWhenSet",`{${q(S(((e,a)=>`'${e}'?: ${a};`))," ")}}`,Te(4,2,1)),t=$("ValueId",q(S((e=>`'${e}'`))," | "),"A Value Id in "+de),n=$("ValueCallback",`(...[valueId, rowCallback]: ${q(S(((e,a)=>`[valueId: '${e}', value: ${a}]`))," | ")})${we}`,me("a Value Id, and value")),u=$("GetValueChange",`(valueId: ${t}) => ValueChange`,$e+" returning information about any Value's changes during a transaction"),c=$("ValuesListener",`(${T}: ${f}, getValueChange: ${u}${Ie})`+we,ye(9)),w=$("ValueIdsListener",`(${T}: ${f})${we}`,ye(10)),h=$("ValueListener",`(...[${T}, valueId, newValue, oldValue, getValueChange]: ${q(S(((e,a)=>`[${T}: ${f}, valueId: '${e}', newValue: ${a}${Ie}, oldValue: ${a}${Ie}, getValueChange: ${u} | undefined]`))," | ")})${we}`,ye(11)),g=$("InvalidValueListener",`(${T}: ${f}, valueId: Id, invalidValues: any[])${we}`,ye(12));i("hasValues",l,o,ze("hasValues"),Re("any Value")),i("getValues",l,e,ze("getValues"),Te(0,2)),i("setValues","values: "+a,f,Fe("setValues","values"),Te(1,2)),i("setPartialValues","partialValues: "+a,f,Fe("setPartialValues","partialValues"),Te(2,2)),i("delValues",l,f,Fe("delValues"),Te(3,2)),i("getValueIds",l,t+"[]",ze("getValueIds",l,t+"[]"),ve("Value",de)),i("forEachValue","valueCallback: "+n,"void",ze("forEachValue","valueCallback as any"),pe("Value",de)),S(((e,a,t,n,s)=>{i(`has${s}Value`,l,o,ze("hasValue",n),Re(Ee(e))),i(`get${s}Value`,l,a,ze("getValue",n,a),Ae(e)),i(`set${s}Value`,"value: "+a,f,Fe("setValue",n+", value"),Ae(e,1)),i(`del${s}Value`,l,f,Fe("delValue",n),Ae(e,3))})),i("getValuesJson",l,"Json",ze("getValuesJson"),Te(5,2)),i("setValuesJson","valuesJson: Json",f,Fe("setValuesJson","valuesJson"),Te(6,2)),i("addValuesListener",`${ue}: ${c}, mutator?: boolean`,"Id",We("addValuesListener",l,"mutator"),Te(7,2)+" changes"),i("addValueIdsListener",`${ue}: ${w}, mutator?: boolean`,"Id",We("addValueIdsListener",l,"mutator"),Le("the Value Ids",de,1)),i("addValueListener",`valueId: ${t} | null, ${ue}: ${h}, mutator?: boolean`,"Id",We("addValueListener","valueId","mutator"),Le("a Value",de)),i("addInvalidValueListener",`valueId: IdOrNull, ${ue}: ${g}, mutator?: boolean`,"Id",We("addInvalidValueListener","valueId","mutator"),ce+" whenever an invalid Cell change was attempted"),d(1,C,e,t,n,c,w,h,g),d(0,"tinybase","ValueChange"),b(v,".setValuesSchema({",S(((e,a,t,o)=>[`[${o}]: {[${I(X(s),`'${s}'`)}]: ${I(X(a),`'${a}'`)}${V(t)?l:`, [${I(X(r),`'${r}'`)}]: ${p(t)?I(X(t),`'${t}'`):t}`}},`])),"})")}d(0,"tinybase",...Ge);const k=$("TransactionListener",`(${T}: ${f}, cellsTouched: boolean, valuesTouched: boolean)${we}`,$e+" listening to the completion of a transaction");return i("getJson",l,"Json",ze("getJson"),Te(5)),i("setJson","json: Json",f,Fe("setJson","json"),Te(6)),i("transaction","actions: () => Return, doRollback?: DoRollback","Return",ze("transaction","actions, doRollback"),"Execute a transaction to make multiple mutations","<Return>"),i("startTransaction",l,f,Fe("startTransaction"),"Explicitly starts a transaction"),i("finishTransaction","doRollback?: DoRollback,",f,Fe("finishTransaction","doRollback"),"Explicitly finishes a transaction"),i("addWillFinishTransactionListener",`${ue}: ${k}`,"Id",We("addWillFinishTransactionListener"),`${ce} just before ${he}`),i("addDidFinishTransactionListener",`${ue}: ${k}`,"Id",We("addDidFinishTransactionListener"),`${ce} just after ${he}`),i("callListener",ue+"Id: Id",f,Fe("callListener",ue+"Id"),`Manually provoke a ${ue} to be called`),i("delListener",ue+"Id: Id",f,Fe("delListener",ue+"Id"),`Remove a ${ue} that was previously added to ${de}`),i("getStore",l,"Store","store",Pe[0]+" the underlying Store object"),d(1,"tinybase","createStore",...Ge),d(1,C,f,`create${f} as create${f}Decl`,k),I("store",["createStore()",...v]),u("fluent","actions: () => Store",["actions();",`return ${T};`]),u("proxy",ue+": any",`(_: Store, ...args: any[]) => ${ue}(${T}, ...args)`),I(T,["{",...h(1),"}"]),[n(...c(0),...w(),`${ie} interface ${f} {`,...h(0),"}",l,Y(`Creates a ${f} object`),`${ie} function create${f}(): ${f};`),n(...c(1),`${ie} const create${f}: typeof create${f}Decl = () => {`,...g(),`return Object.freeze(${T});`,"};")]};var Ze=Object.defineProperty,_e=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,Ue=(e,a,l)=>a in e?Ze(e,a,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[a]=l,qe=(e,a)=>{for(var l in a||(a={}))Be.call(a,l)&&Ue(e,l,a[l]);if(_e)for(var l of _e(a))Qe.call(a,l)&&Ue(e,l,a[l]);return e},He=(e,a,l)=>new Promise(((t,o)=>{var n=e=>{try{r(l.next(e))}catch(e){o(e)}},s=e=>{try{r(l.throw(e))}catch(e){o(e)}},r=e=>e.done?t(e.value):Promise.resolve(e.value).then(n,s);r((l=l.apply(e,a)).next())}));const Ke={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Xe=re((e=>{const a=()=>{const a=C(e.getTablesSchemaJson());return!se(a)||d(e.getTableIds(),(l=>{const t=e.getRowIds(l),o=J();if(d(t,(a=>d(e.getCellIds(l,a),(t=>{const n=e.getCell(l,a,t),s=A(o,t,(()=>[m(n),J(),[0],0])),[r,d,[$]]=s,i=A(d,n,(()=>0))+1;return i>$&&(s[2]=[i,n]),x(d,n,i),s[3]++,r==m(n)})))))return a[l]={},S(o,(([e,,[,o],n],d)=>{a[l][d]=qe({[s]:e},n==I(t)?{[r]:o}:{})})),1}))?a:{}},l=()=>{const a=C(e.getValuesSchemaJson());return se(a)&&e.forEachValue(((e,l)=>{a[e]={[s]:m(l)}})),a},t=e=>Me(a(),l(),e),o=e=>He(void 0,null,(function*(){let a;try{a=(yield import("prettier")).format}catch(e){a=e=>e}return u(t(e),(e=>Q(a(e,Ke))))}));return te({getStoreStats:a=>{let l=0,t=0,o=0;const n={};return e.forEachTable(((e,s)=>{l++;let r=0,d=0;const $={};s(((e,l)=>{r++;let t=0;l((()=>t++)),d+=t,a&&($[e]={rowCells:t})})),t+=r,o+=d,a&&(n[e]={tableRows:r,tableCells:d,rows:$})})),qe({totalTables:l,totalRows:t,totalCells:o,totalValues:I(e.getValueIds()),jsonLength:U(e.getJson())},a?{detail:{tables:n}}:{})},getStoreTablesSchema:a,getStoreValuesSchema:l,getStoreApi:t,getPrettyStoreApi:o,getStore:()=>e})}));e.createTools=Xe},"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
1
+ var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="",a=t(l),n=t(!0),o=t(0),r="type",s="default",d="Listener",c="get",i="add",$="Ids",u="Table",I=u+"s",b=u+$,h="Row",p=h+$,f="Sorted"+h+$,g="Cell",v=g+$,w="Value",m=w+"s",C=w+$,y=(e,t)=>e.every(t),R=(e,t)=>e.sort(t),S=(e,t)=>e.forEach(t),k=(e,t)=>e.map(t),x=e=>e.length,V=e=>0==x(e),O=(e,t)=>e.filter(t),P=(e,...t)=>e.push(...t),j=e=>e.pop(),T=(e,...t)=>e.unshift(...t),D=e=>e.shift(),A=JSON.parse,N=isFinite,E=(e,t)=>e instanceof t,M=e=>null==e,z=e=>e==a||e==n,G=e=>t(e)==a,J=e=>Array.isArray(e),B=e=>{const l=t(e);return z(l)||l==o&&N(e)?l:void 0},L=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},W=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},F=(e,t)=>null==e?void 0:e.forEach(t),U=(e,t)=>null==e?void 0:e.delete(t),_=e=>new Map(e),Z=(e,t)=>null==e?void 0:e.get(t),H=(e,t)=>F(e,((e,l)=>t(l,e))),Q=(e,t)=>{var l;return k([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},q=(e,t,l)=>M(l)?(U(e,t),e):null==e?void 0:e.set(t,l),K=(e,t,l)=>(L(e,t)||q(e,t,l()),Z(e,t)),X=e=>e.toUpperCase(),Y=e=>e.toLowerCase(),ee="a ",te="A function for",le="Callback",ae="Del",ne="export",oe="Id",re="Invalid",se="Json",de=Y(d),ce=" | undefined",ie="Partial",$e=`Registers a ${de} that will be called`,ue="Represents",Ie="Set",be="[]",he="the Store",pe="Transaction",fe=Y(pe),ge="the end of the "+fe,ve="void",we=" => "+ve,me=ee+"string serialization of",Ce=" ",ye="Gets a callback that can ",Re="the ",Se=(e=0,t=0)=>`the ${Be[e]}content of`+(t?Ce+he:l),ke=(e=0,t,a=0)=>Ge[t]+Ce+Se(e,1)+(a?" when set":l),xe=(e,t=0)=>ue+` a Row when ${t?"s":"g"}etting ${Se()} the '${e}' `+u,Ve=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,Oe=(e,t)=>`Calls a function for each ${e} in `+t,Pe=e=>"A function that takes "+e,je=(e,t=0)=>te+" listening to changes to "+Je[e]+" in "+Je[t],Te=(e,t,a=0)=>$e+" whenever "+Je[e]+" in "+Je[t]+" change"+(a?l:"s"),De=e=>`the '${e}' `+u,Ae=e=>"the specified Row in "+De(e),Ne=(e,t=0)=>Ge[t]+` ${Se()} `+De(e),Ee=(e,t=0)=>Ge[t]+` ${Se()} `+Ae(e),Me=(e,t,l=0)=>Ge[l]+` the '${t}' Cell for `+Ae(e),ze=(e,t=0)=>Ge[t]+` the '${e}' Value`,Ge=["Gets","Checks existence of","Sets","Deletes","Sets part of",ue,"Gets "+me,"Sets "+me,$e+" whenever",ye+"set",ye+"add",ye+"set part of",ye+"delete"],Je=[he,I,Re+u+Ce+$,ee+u,Re+h+Ce+$,ee+h,Re+g+Ce+$,ee+g,"invalid Cell changes",m,Re+w+Ce+$,ee+w,"invalid Value changes",Re+"sorted "+h+Ce+$],Be=[l,"tabular ","keyed value "],Le=e=>new Set(J(e)||M(e)?e:[e]),We=(e,t)=>null==e?void 0:e.add(t),Fe=/[^A-Za-z]+/,Ue=/[^A-Za-z0-9]+/,_e=/^( *)\/\*\* *(.*?) *\*\/$/gm,Ze=(e,t,l)=>e.substring(t,l),He=e=>e.includes(","),Qe=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return L(e,n)?Qe(e,t,l,a+1):(q(e,n,l),n)},qe=e=>e.replace(_e,((e,t,l)=>{const a=77-Ke(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Ke=e=>e.length,Xe=(e,t=l)=>e.join(t),Ye=e=>e.flat(1e3),et=(e,t=0)=>Xe(k(e.split(Ue),((e,l)=>(l>0||t?X:Y)(Ze(e,0,1))+Ze(e,1)))),tt=e=>X(Xe((e&&!Fe.test(e[0])?e:" "+e).split(Ue),"_")),lt=e=>`/** ${e}. */`,at=(...e)=>Xe(O(e,(e=>e)),", "),nt=()=>{const e=[_(),_(),_(),_()],t=_(),a=_();return[(...e)=>Xe(Ye(e),"\n"),(t,l,...a)=>S(a,(a=>S([0,1],(n=>(null!=t?t:n)==n?We(K(e[n],l,Le),a):0)))),(e,l,a)=>Qe(t,e,[l,a]),(e,t,l)=>Qe(a,e,J(l)?[`(${t}) => {`,l,"}"]:[`(${t}) => ${l}`]),(e,t)=>Z(a,e)===t?e:Qe(a,e,t),(t=0)=>k([...R(Q(e[t],((e,t)=>`import {${Xe(R(W(e)),", ")}} from '${t}';`)),((e,t)=>He(e)!=He(t)?He(e)?-1:1:e>t?1:-1)),l],(e=>e.replace("{React}","React"))),()=>Q(t,(([e,t],a)=>[lt(t),`${ne} type ${a} = ${e};`,l])),()=>Q(a,((e,t)=>(e=J(e)?e:[e],P(e,j(e)+";"),[`const ${t} = ${D(e)}`,e,l])))]},ot=Object,rt=ot.keys,st=ot.freeze,dt=e=>E(e,ot)&&e.constructor==ot,ct=(e,t)=>k(ot.entries(e),(([e,l])=>t(l,e))),it=e=>dt(e)&&V(rt(e)),$t=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},ut=(e,t,l)=>[t=>ct(e,((e,a)=>t(a,et(a,1),l(tt(a),`'${a}'`)))),(t,a)=>ct(e[t],((e,t)=>a(t,e[r],e[s],l(tt(t),`'${t}'`),et(t,1)))),e=>ct(t,((t,a)=>e(a,t[r],t[s],l(tt(a),`'${a}'`),et(a,1))))],It=[c,"has","set","del","set","forEach",i,l],bt=(e,t=l,a=l)=>`store.${e}(${t})`+(a?" as "+a:l),ht=(e,t=l)=>`fluent(() => ${bt(e,t)})`,pt=(e,t=l,a=l)=>`store.${e}(${t?t+", ":l}proxy(listener)${a?", "+a:l})`,ft=(e,t,a)=>{const[o,c,y,R,k,x,V,O]=nt(),[j,D,A]=ut(e,t,k),N=_(),E=(e=0)=>Q(N,(([t,a,n,o,r],s)=>{const d=e?[s+`: ${r}(${t}): ${a} => ${n},`]:[s+r+`(${t}): ${a};`];return e||T(d,lt(o)),P(d,l),d})),z=(e,t,a,n,o,r=l)=>Qe(N,e,[t,a,n,o,r]),J=(e,t,a,n,o,r=l,s=l,d=l)=>z(It[e]+t+(4==e?ie:l)+a,r,n,(n==F?ht:bt)(It[e]+(4==e?ie:l)+a,s,e?void 0:n),o,d),B=(e,t,a,n=l,o=l,r=1)=>z(i+e+d,(n?n+", ":l)+de+": "+t+(r?", mutator?: boolean":l),oe,pt(i+e+d,o,r?"mutator":l),a),L=`./${et(a)}.d`,F=et(a,1),U=et(F),K=[],X=_();let Y=[],ae=[];if(c(1,L,F,`create${F} as create${F}Decl`),!it(e)){const e=_();j(((t,a)=>{const n=[y(a+u,`{[rowId: Id]: ${a}Row}`,ue+` the '${t}' `+u),y(a+h,`{${Xe(D(t,((e,t,a)=>`'${e}'${M(a)?"?":l}: ${t};`))," ")}}`,xe(t)),y(a+h+"WhenSet",`{${Xe(D(t,((e,t)=>`'${e}'?: ${t};`))," ")}}`,xe(t,1)),y(a+g+oe,Xe(D(t,(e=>`'${e}'`))," | "),`A Cell Id for the '${t}' `+u),y(a+g+le,`(...[cellId, cell]: ${Xe(D(t,((e,t)=>`[cellId: '${e}', cell: ${t}]`))," | ")})`+we,Pe(`a Cell Id and value from a Row in the '${t}' `+u)),y(a+h+le,`(rowId: Id, forEachCell: (cellCallback: ${a}CellCallback)`+we+")"+we,Pe(`a Row Id from the '${t}' Table, and a Cell iterator`))];q(e,t,n),c(1,L,...n)}));const t=y(I,`{${Xe(j((t=>{var l;return`'${t}'?: ${null==(l=Z(e,t))?void 0:l[0]};`}))," ")}}`,ke(1,5)),a=y(u+oe,Xe(j((e=>`'${e}'`))," | "),"A "+u+" Id in "+he),o=y(u+le,`(...[tableId, rowCallback]: ${Xe(j((t=>{var l;return`[tableId: '${t}', forEachRow: (rowCallback: ${null==(l=Z(e,t))?void 0:l[5]})${we}]`}))," | ")})`+we,Pe(ee+u+" Id, and a Row iterator")),i=y("GetCellChange",`(...[tableId, rowId, cellId]: ${Xe(j((t=>{var l;return`[tableId: '${t}', rowId: Id, cellId: ${null==(l=Z(e,t))?void 0:l[3]}]`}))," | ")}) => CellChange`,te+" returning information about any Cell's changes during a "+fe),w=y(I+d,`(${U}: ${F}, getCellChange: ${i}${ce})`+we,je(1)),m=y(b+d,`(${U}: ${F})`+we,je(2)),C=y(u+d,`(${U}: ${F}, tableId: ${a}, getCellChange: ${i}${ce})`+we,je(3)),R=y(p+d,`(${U}: ${F}, tableId: ${a})`+we,je(4,3)),x=y(f+d,"("+at(U+": "+F,"tableId: "+a,"cellId: Id"+ce,"descending: boolean","offset: number","limit: number"+ce,"sortedRowIds: Ids")+")"+we,je(13,3)),V=y(h+d,`(${U}: ${F}, tableId: ${a}, rowId: Id, getCellChange: ${i}${ce})`+we,je(5,3)),O=y(v+d,`(${U}: ${F}, tableId: ${a}, rowId: Id)`+we,je(6,5)),T=y(g+d,`(...[${U}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${Xe(Ye(j((e=>D(e,((t,l)=>`[${U}: ${F}, tableId: '${e}', rowId: Id, cellId: '${t}', newCell: ${l}${ce}, oldCell: ${l}${ce}, getCellChange: ${i} | undefined]`)))))," | ")})`+we,je(7,5)),A=y(re+g+d,`(${U}: ${F}, tableId: Id, rowId: Id, cellId: Id, invalidCells: any[])`+we,je(8));Y=[t,a,w,m,C,R,x,V,O,T,e],S([[t],[n],[F,"tables: "+t,"tables"],[F]],(([e,t,a],n)=>J(n,l,I,e,ke(1,n),t,a))),J(0,l,b,a+be,Ve(u,he)),J(5,l,u,ve,Oe(u,he),"tableCallback: "+o,"tableCallback as any"),j(((t,a,o)=>{const[r,s,d,c,i,I]=Z(e,t);S([[r],[n],[F,"table: "+r,", table"],[F]],(([e,n,r=l],s)=>J(s,a,u,e,Ne(t,s),n,o+r))),J(0,a,p,$,Ve(h,De(t)),l,o),J(0,a,f,$,Ve(h,De(t),1),"cellId?: "+c+", descending?: boolean, offset?: number, limit?: number",o+", cellId, descending, offset, limit"),J(5,a,h,ve,Oe(h,De(t)),"rowCallback: "+I,o+", rowCallback as any"),S([[s],[n],[F,", row: "+d,", row"],[F],[F,", partialRow: "+d,", partialRow"]],(([e,n=l,r=l],s)=>J(s,a,h,e,Ee(t,s),"rowId: Id"+n,o+", rowId"+r))),J(6,a,h,oe+ce,"Adds a new Row to "+De(t),"row: "+d,o+", row"),J(0,a,v,c+be,Ve(g,Ae(t)),"rowId: "+oe,o+", rowId"),J(5,a,g,ve,Oe(g,Ae(t)),"rowId: Id, cellCallback: "+i,o+", rowId, cellCallback as any"),D(t,((e,r,s,d,c)=>{const i="Map"+et(r,1);q(X,r,i);const $=r+(M(s)?ce:l);S([[$],[n],[F,`, cell: ${r} | `+i,", cell as any"],[F]],(([n,r=l,s=l],i)=>J(i,a+c,g,n,Me(t,e,i),"rowId: Id"+r,o+", rowId, "+d+s)))}))})),J(0,l,I+se,se,ke(1,6)),J(2,l,I+se,F,ke(1,7),"tablesJson: "+se,"tables"+se),B(I,w,ke(1,8)+" changes"),B(b,m,Te(2,0,1)),B(u,C,Te(3,0),`tableId: ${a} | null`,"tableId"),B(p,R,Te(4,3,1),`tableId: ${a} | null`,"tableId"),B(f,x,Te(13,3,1),at("tableId: "+a,"cellId: Id"+ce,"descending: boolean","offset: number","limit: number"+ce),at("tableId","cellId","descending","offset","limit")),B(h,V,Te(5,3),`tableId: ${a} | null, rowId: IdOrNull`,"tableId, rowId"),B(v,O,Te(6,5,1),`tableId: ${a} | null, rowId: IdOrNull`,"tableId, rowId"),B(g,T,Te(7,5),`tableId: ${a} | null, rowId: IdOrNull, cellId: ${Xe(j((t=>{var a,n;return null!=(n=null==(a=Z(e,t))?void 0:a[3])?n:l}))," | ")} | null`,"tableId, rowId, cellId"),B(re+g,A,$e+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),c(1,L,t,a,o,w,m,C,R,x,V,O,T,A,...W(X)),c(0,"tinybase","CellChange"),P(K,".setTablesSchema({",Ye(j(((e,t,a)=>[`[${a}]: {`,...D(e,((e,t,a,n)=>`[${n}]: {[${k(tt(r),`'${r}'`)}]: ${k(tt(t),`'${t}'`)}${M(a)?l:`, [${k(tt(s),`'${s}'`)}]: `+(G(a)?k(tt(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(!it(t)){const e=y(m,"{"+Xe(A(((e,t,a)=>`'${e}'${M(a)?"?":l}: ${t};`))," ")+"}",ke(2,5)),t=y(m+"WhenSet","{"+Xe(A(((e,t)=>`'${e}'?: ${t};`))," ")+"}",ke(2,5,1)),a=y(w+oe,Xe(A((e=>`'${e}'`))," | "),"A Value Id in "+he),o=y(w+le,`(...[valueId, rowCallback]: ${Xe(A(((e,t)=>`[valueId: '${e}', value: ${t}]`))," | ")})`+we,Pe("a Value Id, and value")),i=y("GetValueChange",`(valueId: ${a}) => ValueChange`,te+" returning information about any Value's changes during a "+fe),$=y(m+d,`(${U}: ${F}, getValueChange: ${i}${ce})`+we,je(9)),u=y(C+d,`(${U}: ${F})`+we,je(10)),I=y(w+d,`(...[${U}, valueId, newValue, oldValue, getValueChange]: ${Xe(A(((e,t)=>`[${U}: ${F}, valueId: '${e}', newValue: ${t}${ce}, oldValue: ${t}${ce}, getValueChange: ${i} | undefined]`))," | ")})`+we,je(11)),b=y(re+w+d,`(${U}: ${F}, valueId: Id, invalidValues: any[])`+we,je(12));ae=[e,t,a,$,u,I],S([[e],[n],[F,"values: "+t,"values"],[F],[F,"partialValues: "+t,"partialValues"]],(([e,t,a],n)=>J(n,l,m,e,ke(2,n),t,a))),J(0,l,C,a+be,Ve(w,he)),J(5,l,w,"void",Oe(w,he),"valueCallback: "+o,"valueCallback as any"),A(((e,t,a,o,r)=>{const s="Map"+et(t,1);q(X,t,s),S([[t],[n],[F,`value: ${t} | `+s,", value as any"],[F]],(([t,a,n=l],s)=>J(s,r,w,t,ze(e,s),a,o+n)))})),J(0,l,m+se,se,ke(2,6)),J(2,l,m+se,F,ke(2,7),"valuesJson: "+se,"values"+se),B(m,$,ke(2,8)+" changes"),B(C,u,Te(10,0,1)),B(w,I,Te(11,0),`valueId: ${a} | null`,"valueId"),B(re+w,b,$e+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),c(1,L,e,t,a,o,$,u,I,b),c(0,"tinybase","ValueChange"),P(K,".setValuesSchema({",A(((e,t,a,n)=>[`[${n}]: {[${k(tt(r),`'${r}'`)}]: ${k(tt(t),`'${t}'`)}${M(a)?l:`, [${k(tt(s),`'${s}'`)}]: `+(G(a)?k(tt(a),`'${a}'`):a)}},`])),"})")}H(X,((e,t)=>y(t,`(cell: ${e}${ce}) => `+e,`Takes a ${e} Cell value and returns another`))),c(null,"tinybase","DoRollback",oe,"IdOrNull",$,se,"Store");const Ie=y(pe+d,`(${U}: ${F}, cellsTouched: boolean, valuesTouched: boolean)`+we,te+" listening to the completion of a "+fe);return J(0,l,se,se,ke(0,6)),J(2,l,se,F,ke(0,7),"json: "+se,"json"),J(7,l,fe,"Return","Execute a "+fe+" to make multiple mutations","actions: () => Return, doRollback?: DoRollback","actions, doRollback","<Return>"),J(7,l,"start"+pe,F,"Explicitly starts a "+fe),J(7,l,"finish"+pe,F,"Explicitly finishes a "+fe,"doRollback?: DoRollback,","doRollback"),B("WillFinish"+pe,Ie,$e+" just before "+ge,l,l,0),B("DidFinish"+pe,Ie,$e+" just after "+ge,l,l,0),J(7,l,"call"+d,F,"Manually provoke a listener to be called","listenerId: Id","listenerId"),J(3,l,d,F,"Remove a listener that was previously added to "+he,"listenerId: Id","listenerId"),z("getStore",l,"Store","store",Ge[0]+" the underlying Store object"),c(1,"tinybase","createStore"),c(1,L,F,`create${F} as create${F}Decl`,Ie),k("store",["createStore()",...K]),R("fluent","actions: () => Store",["actions();",`return ${U};`]),R("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${U}, ...params)`),k(U,["{",...E(1),"}"]),[o(...x(0),...V(),ne+" interface "+F+" {",...E(0),"}",l,lt(`Creates a ${F} object`),ne+" function create"+F+"(): "+F+";"),o(...x(1),ne+" const create"+F+": typeof create"+F+"Decl = () => {",...O(),`return Object.freeze(${U});`,"};"),Y,ae]},gt="Deps",vt=e=>c+e,wt=e=>at(vt(e),vt(e)+gt),mt="Parameter",Ct=": (parameter: "+mt+", store: Store) => ",yt="const contextValue = useContext(Context);",Rt=", and registers a listener so that any changes to that result will cause a re-render",St=", based on a parameter",kt=": ",xt=mt+"ized"+le+"<"+mt+">",Vt="<"+mt+",>",Ot=gt+"?: React.DependencyList",Pt="then"+Ot,jt="then?: (store: Store",Tt=at(jt+")"+we,Pt),Dt="then, then"+gt,At="rowId",Nt=At+kt+oe,Et=(e,...t)=>at(...t,de+": "+e,de+Ot,"mutator?: boolean"),Mt=(...e)=>at(...e,de,de+gt,"mutator"),zt=(e,t,a,n,o)=>{const[r,s,c,i,y,R,S,k]=nt(),[x,V,O]=ut(e,t,y),j=`./${et(a)}.d`,D=`./${et(a)}-ui-react.d`,A="tinybase/ui-react",N=et(a,1),E=et(N),z=N+"Or"+N+oe,G=E+"Or"+N+oe,B=_(),L=(e,t,a,n,o,r=l)=>(s(1,D,e+" as "+e+"Decl"),Qe(B,e,[t,a,J(n)?["{",n,"}"]:n,o,r])),W=(e,t,a,n,o,r=l)=>L("use"+e,t,a,n,o,r),F=(e,t,a,n,o=l,r=l,d=l,c=l,i=l)=>{s(1,A,`use${t} as use${t}Core`),W(e,at(o,X,c),a,ee+`(${G}, use${t}Core, [`+(r||l)+(i?"], ["+i:l)+"])",n,d)},U=(e,t,l,a)=>L(e,t,1,l,a),H=(e=0)=>Q(B,(([t,a,n,o,r],s)=>{const d=e?[ne+` const ${s}: typeof ${s}Decl = ${r}(${t}): ${1==a?"any":a} =>`,n]:[ne+` function ${s}${r}(${t}): ${1==a?"ComponentReturnType":a};`];return e||T(d,lt(o)),P(d,l),d}));s(null,"tinybase",oe,$,"IdOrNull","Store",le,mt+"ized"+le),s(0,A,"ComponentReturnType"),s(0,j,N);const q=c(z,N+" | "+oe,`Used when you need to refer to a ${N} in a React hook or component`),K=c("ProviderProps",`{readonly ${E}?: ${N}; readonly ${E}ById?: {[${E}Id: Id]: ${N}}}`,`Used with the Provider component, so that a ${N} can be passed into the context of an application`);s(1,"react","React"),s(1,D,q,K);const X=G+"?: "+q;y("{createContext, useContext, useMemo}","React"),y("Context",`createContext<[${N}?, {[${E}Id: Id]: ${N}}?]>([])`),W("Create"+N,`create: () => ${N}, create`+Ot,N,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${N} within a React application with convenient memoization`);const Y=W(N,"id?: Id",N+ce,[yt,"return id == null ? contextValue[0] : contextValue[1]?.[id];"],`Get a reference to a ${N} from within a Provider component context`),ee=i("useHook",G+`: ${q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${E} = ${Y}(${G} as Id);`,`return hook(...preParams, ((${G} == null || typeof ${G} == 'string')`,`? ${E} : ${G})?.getStore(), ...postParams)`]);if(!it(e)){const[e,t,a,o,r,c,i,w,m,C,y]=n;s(null,j,e,t,a,o,r,c,i,w,m,C),s(1,A),s(1,j,N),F(I,I,e,ke(1,0)+Rt),F(b,b,t+be,Ve(u,he)+Rt),F(Ie+I+le,Ie+I+le,xt,ke(1,9)+St,at(vt(I)+Ct+e,vt(I)+Ot),wt(I),Vt,at(jt,`tables: ${e})`+we,Pt),Dt),F(ae+I+le,ae+I+le,le,ke(1,12),l,l,l,Tt,Dt),x(((e,t,a)=>{const[n,o,r,d]=Z(y,e);s(0,j,n,o,r,d),s(1,j,n,o,r,d),F(t+u,u,n,Ne(e)+Rt,l,a),F(t+p,p,$,Ve(h,De(e))+Rt,l,a),F(t+f,f,$,Ve(h,De(e),1)+Rt,"cellId?: "+d+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit"),F(t+h,h,o,Ee(e)+Rt,Nt,at(a,At)),F(t+v,v,d+be,Ve(g,Ae(e))+Rt,Nt,at(a,At)),F(Ie+t+u+le,Ie+u+le,xt,Ne(e,9)+St,at(vt(u)+Ct+n,vt(u)+Ot),at(a,wt(u)),Vt,at(jt,`table: ${n})`+we,Pt),Dt),F(ae+t+u+le,ae+u+le,le,Ne(e,12),l,a,l,Tt,Dt),F(Ie+t+h+le,Ie+h+le,xt,Ee(e,9)+St,at(Nt,vt(h)+Ct+r,vt(h)+Ot),at(a,At,wt(h)),Vt,at(jt,`row: ${r})`+we,Pt),Dt),F("Add"+t+h+le,"Add"+h+le,xt,Ee(e,10)+St,at(vt(h)+Ct+r,vt(h)+Ot),at(a,wt(h)),Vt,"then?: ("+at(Nt+ce,"store: Store","row: "+r+")"+we,"then"+Ot),Dt),F(Ie+t+ie+h+le,Ie+ie+h+le,xt,Ee(e,11)+St,at(Nt,vt(ie+h)+Ct+r,vt(ie+h)+Ot),at(a,At,wt(ie+h)),Vt,at(jt,`partialRow: ${r})`+we,Pt),Dt),F(ae+t+h+le,ae+h+le,le,Ee(e,12),Nt,at(a,At),l,Tt,Dt),V(e,((n,o,r,d,c)=>{const i="Map"+et(o,1);s(0,j,i),s(1,j,i),F(t+c+g,g,o+(M(r)?ce:l),Me(e,n)+Rt,Nt,at(a,At,d)),F(Ie+t+c+g+le,Ie+g+le,xt,Me(e,n,9)+St,at(Nt,vt(g)+Ct+o+" | "+i,vt(g)+Ot),at(a,At,d,wt(g)),Vt,at(jt,`cell: ${o} | ${i})`+we,Pt),Dt),F(ae+t+c+g+le,ae+g+le,le,Me(e,n,12),at(Nt,"forceDel?: boolean"),at(a,At,d,"forceDel"),l,Tt,Dt)}))}));const R=Xe(x((e=>{var t,a;return null!=(a=null==(t=Z(y,e))?void 0:t[3])?a:l}))," | ");F(I+d,I+d,ve,ke(1,8)+" changes",Et(a),Mt()),F(b+d,b+d,ve,Te(2,0,1),Et(o),Mt()),F(u+d,u+d,ve,Te(3,0),Et(r,`tableId: ${t} | null`),Mt("tableId")),F(p+d,p+d,ve,Te(4,3,1),Et(c,`tableId: ${t} | null`),Mt("tableId")),F(f+d,f+d,ve,Te(13,3,1),Et(i,`tableId: ${t} | null`,"cellId: "+R+ce,"descending: boolean","offset: number","limit: number"+ce),Mt("tableId","cellId","descending","offset","limit")),F(h+d,h+d,ve,Te(5,3),Et(w,`tableId: ${t} | null`,At+": IdOrNull"),Mt("tableId",At)),F(v+d,v+d,ve,Te(6,5,1),Et(m,`tableId: ${t} | null`,At+": IdOrNull"),Mt("tableId",At)),F(g+d,g+d,ve,Te(7,5),Et(C,`tableId: ${t} | null`,At+": IdOrNull",`cellId: ${R} | null`),Mt("tableId",At,"cellId"))}if(!it(t)){const[e,t,a,n,r,c]=o;s(null,j,...o),F(m,m,e,ke(2,0)+Rt),F(C,C,a+be,Ve(w,he)+Rt),F(Ie+m+le,Ie+m+le,xt,ke(2,9)+St,at(vt(m)+Ct+t,vt(m)+Ot),wt(m),Vt,at(jt,`values: ${t})`+we,Pt),Dt),F(Ie+ie+m+le,Ie+ie+m+le,xt,ke(2,11)+St,at(vt(ie+m)+Ct+t,vt(ie+m)+Ot),wt(ie+m),Vt,at(jt,`partialValues: ${t})`+we,Pt),Dt),F(ae+m+le,ae+m+le,le,ke(2,12),l,l,l,Tt,Dt),O(((e,t,a,n,o)=>{const r="Map"+et(t,1);s(0,j,r),s(1,j,r),F(o+w,w,t,ze(e)+Rt,l,n),F(Ie+o+w+le,Ie+w+le,xt,ze(e,9)+St,at(vt(w)+Ct+t+" | "+r,vt(w)+Ot),at(n,wt(w)),Vt,at(jt,`value: ${t} | ${r})`+we,Pt),Dt),F(ae+o+w+le,ae+w+le,le,ze(e,12),l,n,l,Tt,Dt)})),F(m+d,m+d,ve,ke(2,8)+" changes",Et(n),Mt()),F(C+d,C+d,ve,Te(10,0,1),Et(r),Mt()),F(w+d,w+d,ve,Te(11,0),Et(c,`valueId: ${a} | null`),Mt("valueId"))}return U("Provider",`{${E}, ${E}ById, children}: `+K+" & {children: React.ReactNode}",[yt,"return (","<Context.Provider","value={useMemo(",`() => [${E} ?? contextValue[0], {...contextValue[1], ...${E}ById}],`,`[${E}, ${E}ById, contextValue],`,")}>","{children}","</Context.Provider>",");"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...R(0),...S(),...H(0)),r(...R(1),...k(),...H(1))]},Gt=(e,t,a)=>{if(it(e)&&it(t))return[l,l,l,l];const[n,o,r,s]=ft(e,t,a);return[n,o,...zt(e,t,a,r,s)]};var Jt=Object.defineProperty,Bt=Object.defineProperties,Lt=Object.getOwnPropertyDescriptors,Wt=Object.getOwnPropertySymbols,Ft=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,_t=(e,t,l)=>t in e?Jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Zt=(e,t)=>{for(var l in t||(t={}))Ft.call(t,l)&&_t(e,l,t[l]);if(Wt)for(var l of Wt(t))Ut.call(t,l)&&_t(e,l,t[l]);return e},Ht=(e,t)=>Bt(e,Lt(t)),Qt=(e,t,l)=>new Promise(((a,n)=>{var o=e=>{try{s(l.next(e))}catch(e){n(e)}},r=e=>{try{s(l.throw(e))}catch(e){n(e)}},s=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,r);s((l=l.apply(e,t)).next())}));const qt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Kt=$t((e=>{const t=()=>{const t=A(e.getTablesSchemaJson());return!it(t)||y(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=_();if(y(a,(t=>y(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),r=K(n,a,(()=>[B(o),_(),[0],0])),[s,d,[c]]=r,i=K(d,o,(()=>0))+1;return i>c&&(r[2]=[i,o]),q(d,o,i),r[3]++,s==B(o)})))))return t[l]={},F(n,(([e,,[,n],o],d)=>{t[l][d]=Zt({[r]:e},o==x(a)?{[s]:n}:{})})),1}))?t:{}},l=()=>{const t=A(e.getValuesSchemaJson());return it(t)&&e.forEachValue(((e,l)=>{t[e]={[r]:B(l)}})),t},a=e=>Gt(t(),l(),e),n=e=>Qt(void 0,null,(function*(){const t=["d.ts","ts","d.ts","tsx"];let l;try{l=(yield import("prettier")).format}catch(e){l=e=>e}return k(a(e),((e,a)=>qe(l(e,Ht(Zt({},qt),{filepath:"_."+t[a]})))))}));return st({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,r)=>{l++;let s=0,d=0;const c={};r(((e,l)=>{s++;let a=0;l((()=>a++)),d+=a,t&&(c[e]={rowCells:a})})),a+=s,n+=d,t&&(o[e]={tableRows:s,tableCells:d,rows:c})})),Zt({totalTables:l,totalRows:a,totalCells:n,totalValues:x(e.getValueIds()),jsonLength:Ke(e.getJson())},t?{detail:{tables:o}}:{})},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=Kt},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
Binary file
@@ -1 +1 @@
1
- var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Tables",u="TableIds",d="Table",n="RowIds",i="SortedRowIds",a="Row",c="CellIds",I="Cell",w="Values",p="ValueIds",b="Value",R=(e,s)=>e.map(s),C=e=>null==e,k=(e,s,t)=>C(e)?null==t?void 0:t():s(e),v=()=>{},{createContext:g,useContext:m}=s,y=g([]),h=(e,s)=>{const t=m(y);return C(e)?t[s]:((e,s)=>k(e,(e=>e[s])))(t[s+1],e)},f=(e,s)=>{const o=h(e,s);return C(e)||(e=>t(e)==l)(e)?o:e},V=e=>f(e,0),L=e=>f(e,2),S=e=>f(e,4),T=e=>f(e,6),P=e=>f(e,8),x=e=>f(e,10),{useCallback:q,useEffect:O,useMemo:B,useRef:M,useState:j}=s,D=(e,s,t=[])=>{const o=B((()=>s(e)),[e,...t]);return O((()=>()=>o.destroy()),[o]),o},A=(e,s,t,o=[],l)=>{const[,r]=j(),u=q((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[d]=j(u),n=M(d);return B((()=>n.current=u()),[u]),E(e,s,((...e)=>{n.current=C(l)?u():e[l],r([])}),[],o),n.current},E=(e,s,t,o=[],l=[],...r)=>O((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),F=(e,s,t,o=[],l=v,r=[],...u)=>{const d=V(e);return q((e=>k(d,(o=>k(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[d,s,...o,...r,...u])},G=(e,s,t=v,o=[],...l)=>{const r=V(e);return q((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Q=(e,s,t)=>{const o=x(e);return q((()=>null==o?void 0:o[s](t)),[o,s,t])},U=e=>A(u,V(e),[],[]),z=(e,s)=>A(n,V(s),[],[e]),H=(e,s,t,o=0,l,r)=>A(i,V(r),[],[e,s,t,o,l],6),J=(e,s,t)=>A(c,V(t),[],[e,s]),K=(e,s,t,o)=>A(I,V(o),void 0,[e,s,t],4),N=e=>A(p,V(e),[],[]),W=(e,s)=>A(b,V(s),void 0,[e]),X=(e,s)=>A("Metric",L(s),void 0,[e]),Y=(e,s)=>A("SliceIds",S(s),[],[e]),Z=(e,s,t)=>A("SliceRowIds",S(t),[],[e,s]),$=(e,s,t)=>A("RemoteRowId",T(t),void 0,[e,s]),_=(e,s,t)=>A("LocalRowIds",T(t),[],[e,s]),ee=(e,s,t)=>A("LinkedRowIds",T(t),[],[e,s]),se=(e,s)=>A("ResultRowIds",P(s),[],[e]),te=(e,s,t,o=0,l,r)=>A("ResultSortedRowIds",P(r),[],[e,s,t,o,l],6),oe=(e,s,t)=>A("ResultCellIds",P(t),[],[e,s]),le=(e,s,t,o)=>A("ResultCell",P(o),void 0,[e,s,t]),re=e=>A("CheckpointIds",x(e),[[],void 0,[]]),ue=(e,s)=>A("Checkpoint",x(s),void 0,[e]),de=e=>Q(e,"goBackward"),ne=e=>Q(e,"goForward");var ie=Object.defineProperty,ae=Object.defineProperties,ce=Object.getOwnPropertyDescriptors,Ie=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,be=(e,s,t)=>s in e?ie(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Re=(e,s)=>{for(var t in s||(s={}))we.call(s,t)&&be(e,t,s[t]);if(Ie)for(var t of Ie(s))pe.call(s,t)&&be(e,t,s[t]);return e},Ce=(e,s)=>ae(e,ce(s)),ke=(e,s)=>{var t={};for(var o in e)we.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Ie)for(var o of Ie(e))s.indexOf(o)<0&&pe.call(e,o)&&(t[o]=e[o]);return t};const{createElement:ve,useMemo:ge}=s,me=({tableId:e,store:s,rowComponent:t=Pe,getRowComponentProps:o,separator:l,debugIds:r},u)=>Se(R(u,(l=>ve(t,Ce(Re({},Le(o,l)),{key:l,tableId:e,rowId:l,store:s,debugIds:r})))),l,r,e),ye=({queryId:e,queries:s,resultRowComponent:t=Me,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Se(R(u,(l=>ve(t,Ce(Re({},Le(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),he=e=>{const s=T(e);return[s,null==s?void 0:s.getStore()]},fe=({relationshipId:e,relationships:s,rowComponent:t=Pe,getRowComponentProps:o,separator:l,debugIds:r},u,d)=>{const[n,i]=he(s),a=null==n?void 0:n.getLocalTableId(e),c=u(e,d,n);return Se(R(c,(e=>ve(t,Ce(Re({},Le(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,d)},Ve=e=>({checkpoints:s,checkpointComponent:t=je,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=x(s);return Se(R(e(re(u)),(e=>ve(t,Ce(Re({},Le(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Le=(e,s)=>C(e)?{}:e(s),Se=(e,s,t,o)=>{const l=C(s)||!Array.isArray(e)?e:R(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},Te=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Se(o+(null!=(u=K(e,s,t,l))?u:o),void 0,r,t)},Pe=({tableId:e,rowId:s,store:t,cellComponent:o=Te,getCellComponentProps:l,separator:r,debugIds:u})=>Se(R(J(e,s,t),(r=>ve(o,Ce(Re({},Le(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:u})))),r,u,s),xe=e=>me(e,z(e.tableId,e.store)),qe=({valueId:e,store:s,debugIds:t})=>{var l;return Se(o+(null!=(l=W(e,s))?l:o),void 0,t,e)},Oe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=Pe,getRowComponentProps:l,separator:r,debugIds:u})=>{const d=S(t),n=null==d?void 0:d.getStore(),i=null==d?void 0:d.getTableId(e),a=Z(e,s,d);return Se(R(a,(e=>ve(o,Ce(Re({},Le(l,e)),{key:e,tableId:i,rowId:e,store:n,debugIds:u})))),r,u,s)},Be=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Se(o+(null!=(u=le(e,s,t,l))?u:o),void 0,r,t)},Me=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Be,getResultCellComponentProps:l,separator:r,debugIds:u})=>Se(R(oe(e,s,t),(r=>ve(o,Ce(Re({},Le(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),je=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Se(null!=(l=ue(s,e))?l:o,void 0,t,s)},De=Ve((e=>e[0])),Ae=Ve((e=>C(e[1])?[]:[e[1]])),Ee=Ve((e=>e[2]));e.BackwardCheckpointsView=De,e.CellView=Te,e.CheckpointView=je,e.CurrentCheckpointView=Ae,e.ForwardCheckpointsView=Ee,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Oe,getSliceComponentProps:o,separator:l,debugIds:r})=>Se(R(Y(e,s),(l=>ve(t,Ce(Re({},Le(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>fe(e,ee,e.firstRowId),e.LocalRowsView=e=>fe(e,_,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Se(null!=(l=X(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:d,relationshipsById:n,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:w})=>{const p=s.useContext(y);return ve(y.Provider,{value:ge((()=>[null!=e?e:p[0],Re(Re({},p[1]),t),null!=o?o:p[2],Re(Re({},p[3]),l),null!=r?r:p[4],Re(Re({},p[5]),u),null!=d?d:p[6],Re(Re({},p[7]),n),null!=i?i:p[8],Re(Re({},p[9]),a),null!=c?c:p[10],Re(Re({},p[11]),I)]),[e,t,o,l,r,u,d,n,i,a,c,I,p])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=Pe,getRowComponentProps:l,debugIds:r})=>{const[u,d]=he(t),n=null==u?void 0:u.getRemoteTableId(e),i=$(e,s,u);return Se(C(n)||C(i)?null:ve(o,Ce(Re({},Le(l,i)),{key:i,tableId:n,rowId:i,store:d,debugIds:r})),void 0,r,s)},e.ResultCellView=Be,e.ResultRowView=Me,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ke(s,["cellId","descending","offset","limit"]);return ye(u,te(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>ye(e,se(e.queryId,e.queries)),e.RowView=Pe,e.SliceView=Oe,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ke(s,["cellId","descending","offset","limit"]);return me(u,H(u.tableId,t,o,l,r,u.store))},e.TableView=xe,e.TablesView=({store:e,tableComponent:s=xe,getTableComponentProps:t,separator:o,debugIds:l})=>Se(R(U(e),(o=>ve(s,Ce(Re({},Le(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=qe,e.ValuesView=({store:e,valueComponent:s=qe,getValueComponentProps:t,separator:o,debugIds:l})=>Se(R(N(e),(o=>ve(s,Ce(Re({},Le(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.tableView=me,e.useAddRowCallback=(e,s,t=[],o,l=v,r=[])=>{const u=V(o);return q((t=>k(u,(o=>k(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[u,e,...t,...r])},e.useCell=K,e.useCellIds=J,e.useCellIdsListener=(e,s,t,o,l,r)=>E(c,V(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>E(I,V(u),o,l,[e,s,t],r),e.useCheckpoint=ue,e.useCheckpointIds=re,e.useCheckpointIdsListener=(e,s,t)=>E("CheckpointIds",x(t),e,s),e.useCheckpointListener=(e,s,t,o)=>E("Checkpoint",x(o),s,t,[e]),e.useCheckpoints=e=>h(e,10),e.useCreateCheckpoints=(e,s,t)=>D(e,s,t),e.useCreateIndexes=(e,s,t)=>D(e,s,t),e.useCreateMetrics=(e,s,t)=>D(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=j(),u=B((()=>s(e)),[e,...t]);return O((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>D(e,s,t),e.useCreateRelationships=(e,s,t)=>D(e,s,t),e.useCreateStore=(e,s=[])=>B(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>G(l,I,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>G(t,a,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>G(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>G(e,r,s,t),e.useDelValueCallback=(e,s,t,o)=>G(s,b,t,o,e),e.useDelValuesCallback=(e,s,t)=>G(e,w,s,t),e.useGoBackwardCallback=de,e.useGoForwardCallback=ne,e.useGoToCallback=(e,s=[],t,o=v,l=[])=>{const r=x(t);return q((s=>k(r,(t=>k(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>h(e,4),e.useLinkedRowIds=ee,e.useLinkedRowIdsListener=(e,s,t,o,l)=>E("LinkedRowIds",T(l),t,o,[e,s]),e.useLocalRowIds=_,e.useLocalRowIdsListener=(e,s,t,o,l)=>E("LocalRowIds",T(l),t,o,[e,s]),e.useMetric=X,e.useMetricListener=(e,s,t,o)=>E("Metric",L(o),s,t,[e]),e.useMetrics=e=>h(e,2),e.useQueries=e=>h(e,8),e.useRedoInformation=e=>{var s;const t=x(e),[,,[l]]=re(t);return[!C(l),ne(t),l,null!=(s=k(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationships=e=>h(e,6),e.useRemoteRowId=$,e.useRemoteRowIdListener=(e,s,t,o,l)=>E("RemoteRowId",T(l),t,o,[e,s]),e.useResultCell=le,e.useResultCellIds=oe,e.useResultCellIdsListener=(e,s,t,o,l)=>E("ResultCellIds",P(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>E("ResultCell",P(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>A("ResultRow",P(t),{},[e,s]),e.useResultRowIds=se,e.useResultRowIdsListener=(e,s,t,o)=>E("ResultRowIds",P(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>E("ResultRow",P(l),t,o,[e,s]),e.useResultSortedRowIds=te,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,u,d)=>E("ResultSortedRowIds",P(d),r,u,[e,s,t,o,l]),e.useResultTable=(e,s)=>A("ResultTable",P(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>E("ResultTable",P(o),s,t,[e]),e.useRow=(e,s,t)=>A(a,V(t),{},[e,s]),e.useRowIds=z,e.useRowIdsListener=(e,s,t,o,l)=>E(n,V(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>E(a,V(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,d)=>F(r,I,o,l,u,d,e,s,t),e.useSetCheckpointCallback=(e=v,s=[],t,o=v,l=[])=>{const r=x(t);return q((s=>k(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>F(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>F(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>F(l,a,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>F(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>F(t,r,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>F(o,b,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>F(t,w,e,s,o,l),e.useSliceIds=Y,e.useSliceIdsListener=(e,s,t,o)=>E("SliceIds",S(o),s,t,[e]),e.useSliceRowIds=Z,e.useSliceRowIdsListener=(e,s,t,o,l)=>E("SliceRowIds",S(l),t,o,[e,s]),e.useSortedRowIds=H,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,d,n)=>E(i,V(n),r,u,[e,s,t,o,l],d),e.useStore=e=>h(e,0),e.useTable=(e,s)=>A(d,V(s),{},[e]),e.useTableIds=U,e.useTableIdsListener=(e,s,t,o)=>E(u,V(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>E(d,V(l),s,t,[e],o),e.useTables=e=>A(r,V(e),{}),e.useTablesListener=(e,s,t,o)=>E(r,V(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=x(e),[l,r]=re(t);return[(u=l,!(0==(e=>e.length)(u))),de(t),r,null!=(s=k(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=W,e.useValueIds=N,e.useValueIdsListener=(e,s,t,o)=>E(p,V(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>E(b,V(l),s,t,[e],o),e.useValues=e=>A(w,V(e),{}),e.useValuesListener=(e,s,t,o)=>E(w,V(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
1
+ var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Ids",u="Table",n="Tables",d=u+r,i="Row",a=i+r,c="SortedRowIds",I="Cell",w=I+r,p="Value",b="Values",R=p+r,C=(e,s)=>e.map(s),k=e=>null==e,v=(e,s,t)=>k(e)?null==t?void 0:t():s(e),g=e=>t(e)==l,m=()=>{},{createContext:y,useContext:h}=s,f=y([]),V=(e,s)=>{const t=h(f);return k(e)?t[s]:g(e)?((e,s)=>v(e,(e=>e[s])))(t[s+1],e):e},L=(e,s)=>{const t=V(e,s);return k(e)||g(e)?t:e},S=e=>L(e,0),T=e=>L(e,2),P=e=>L(e,4),x=e=>L(e,6),q=e=>L(e,8),O=e=>L(e,10),{useCallback:B,useEffect:M,useMemo:j,useRef:D,useState:A}=s,E=(e,s,t=[])=>{const o=j((()=>s(e)),[e,...t]);return M((()=>()=>o.destroy()),[o]),o},F=(e,s,t,o=[],l)=>{const[,r]=A(),u=B((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=A(u),d=D(n);return j((()=>d.current=u()),[u]),G(e,s,((...e)=>{d.current=k(l)?u():e[l],r([])}),[],o),d.current},G=(e,s,t,o=[],l=[],...r)=>M((()=>{var o;const u=null==(o=null==s?void 0:s["add"+e+"Listener"])?void 0:o.call(s,...l,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...l,...o,...r]),Q=(e,s,t,o=[],l=m,r=[],...u)=>{const n=S(e);return B((e=>v(n,(o=>v(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},U=(e,s,t=m,o=[],...l)=>{const r=S(e);return B((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},z=(e,s,t)=>{const o=O(e);return B((()=>null==o?void 0:o[s](t)),[o,s,t])},H=e=>F(d,S(e),[],[]),J=(e,s)=>F(a,S(s),[],[e]),K=(e,s,t,o=0,l,r)=>F(c,S(r),[],[e,s,t,o,l],6),N=(e,s,t)=>F(w,S(t),[],[e,s]),W=(e,s,t,o)=>F(I,S(o),void 0,[e,s,t],4),X=e=>F(R,S(e),[],[]),Y=(e,s)=>F(p,S(s),void 0,[e]),Z=(e,s)=>F("Metric",T(s),void 0,[e]),$=(e,s)=>F("SliceIds",P(s),[],[e]),_=(e,s,t)=>F("SliceRowIds",P(t),[],[e,s]),ee=(e,s,t)=>F("RemoteRowId",x(t),void 0,[e,s]),se=(e,s,t)=>F("LocalRowIds",x(t),[],[e,s]),te=(e,s,t)=>F("LinkedRowIds",x(t),[],[e,s]),oe=(e,s)=>F("ResultRowIds",q(s),[],[e]),le=(e,s,t,o=0,l,r)=>F("ResultSortedRowIds",q(r),[],[e,s,t,o,l],6),re=(e,s,t)=>F("ResultCellIds",q(t),[],[e,s]),ue=(e,s,t,o)=>F("ResultCell",q(o),void 0,[e,s,t]),ne=e=>F("CheckpointIds",O(e),[[],void 0,[]]),de=(e,s)=>F("Checkpoint",O(s),void 0,[e]),ie=e=>z(e,"goBackward"),ae=e=>z(e,"goForward");var ce=Object.defineProperty,Ie=Object.defineProperties,we=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,Ce=(e,s,t)=>s in e?ce(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ke=(e,s)=>{for(var t in s||(s={}))be.call(s,t)&&Ce(e,t,s[t]);if(pe)for(var t of pe(s))Re.call(s,t)&&Ce(e,t,s[t]);return e},ve=(e,s)=>Ie(e,we(s)),ge=(e,s)=>{var t={};for(var o in e)be.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&pe)for(var o of pe(e))s.indexOf(o)<0&&Re.call(e,o)&&(t[o]=e[o]);return t};const{createElement:me,useMemo:ye}=s,he=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:o,separator:l,debugIds:r},u)=>Pe(C(u,(l=>me(t,ve(ke({},Te(o,l)),{key:l,tableId:e,rowId:l,store:s,debugIds:r})))),l,r,e),fe=({queryId:e,queries:s,resultRowComponent:t=De,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Pe(C(u,(l=>me(t,ve(ke({},Te(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ve=e=>{const s=x(e);return[s,null==s?void 0:s.getStore()]},Le=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i]=Ve(s),a=null==d?void 0:d.getLocalTableId(e),c=u(e,n,d);return Pe(C(c,(e=>me(t,ve(ke({},Te(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Se=e=>({checkpoints:s,checkpointComponent:t=Ae,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=O(s);return Pe(C(e(ne(u)),(e=>me(t,ve(ke({},Te(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Te=(e,s)=>k(e)?{}:e(s),Pe=(e,s,t,o)=>{const l=k(s)||!Array.isArray(e)?e:C(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},xe=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Pe(o+(null!=(u=W(e,s,t,l))?u:o),void 0,r,t)},qe=({tableId:e,rowId:s,store:t,cellComponent:o=xe,getCellComponentProps:l,separator:r,debugIds:u})=>Pe(C(N(e,s,t),(r=>me(o,ve(ke({},Te(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:u})))),r,u,s),Oe=e=>he(e,J(e.tableId,e.store)),Be=({valueId:e,store:s,debugIds:t})=>{var l;return Pe(o+(null!=(l=Y(e,s))?l:o),void 0,t,e)},Me=({indexId:e,sliceId:s,indexes:t,rowComponent:o=qe,getRowComponentProps:l,separator:r,debugIds:u})=>{const n=P(t),d=null==n?void 0:n.getStore(),i=null==n?void 0:n.getTableId(e),a=_(e,s,n);return Pe(C(a,(e=>me(o,ve(ke({},Te(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},je=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Pe(o+(null!=(u=ue(e,s,t,l))?u:o),void 0,r,t)},De=({queryId:e,rowId:s,queries:t,resultCellComponent:o=je,getResultCellComponentProps:l,separator:r,debugIds:u})=>Pe(C(re(e,s,t),(r=>me(o,ve(ke({},Te(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ae=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Pe(null!=(l=de(s,e))?l:o,void 0,t,s)},Ee=Se((e=>e[0])),Fe=Se((e=>k(e[1])?[]:[e[1]])),Ge=Se((e=>e[2]));e.BackwardCheckpointsView=Ee,e.CellView=xe,e.CheckpointView=Ae,e.CurrentCheckpointView=Fe,e.ForwardCheckpointsView=Ge,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Me,getSliceComponentProps:o,separator:l,debugIds:r})=>Pe(C($(e,s),(l=>me(t,ve(ke({},Te(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Le(e,te,e.firstRowId),e.LocalRowsView=e=>Le(e,se,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Pe(null!=(l=Z(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:w})=>{const p=s.useContext(f);return me(f.Provider,{value:ye((()=>[null!=e?e:p[0],ke(ke({},p[1]),t),null!=o?o:p[2],ke(ke({},p[3]),l),null!=r?r:p[4],ke(ke({},p[5]),u),null!=n?n:p[6],ke(ke({},p[7]),d),null!=i?i:p[8],ke(ke({},p[9]),a),null!=c?c:p[10],ke(ke({},p[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,p])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=qe,getRowComponentProps:l,debugIds:r})=>{const[u,n]=Ve(t),d=null==u?void 0:u.getRemoteTableId(e),i=ee(e,s,u);return Pe(k(d)||k(i)?null:me(o,ve(ke({},Te(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=je,e.ResultRowView=De,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ge(s,["cellId","descending","offset","limit"]);return fe(u,le(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>fe(e,oe(e.queryId,e.queries)),e.RowView=qe,e.SliceView=Me,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=ge(s,["cellId","descending","offset","limit"]);return he(u,K(u.tableId,t,o,l,r,u.store))},e.TableView=Oe,e.TablesView=({store:e,tableComponent:s=Oe,getTableComponentProps:t,separator:o,debugIds:l})=>Pe(C(H(e),(o=>me(s,ve(ke({},Te(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Be,e.ValuesView=({store:e,valueComponent:s=Be,getValueComponentProps:t,separator:o,debugIds:l})=>Pe(C(X(e),(o=>me(s,ve(ke({},Te(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.tableView=he,e.useAddRowCallback=(e,s,t=[],o,l=m,r=[])=>{const u=S(o);return B((t=>v(u,(o=>v(s(t,o),(s=>l(o.addRow(e,s),o,s)))))),[u,e,...t,...r])},e.useCell=W,e.useCellIds=N,e.useCellIdsListener=(e,s,t,o,l,r)=>G(w,S(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>G(I,S(u),o,l,[e,s,t],r),e.useCheckpoint=de,e.useCheckpointIds=ne,e.useCheckpointIdsListener=(e,s,t)=>G("CheckpointIds",O(t),e,s),e.useCheckpointListener=(e,s,t,o)=>G("Checkpoint",O(o),s,t,[e]),e.useCheckpoints=e=>V(e,10),e.useCreateCheckpoints=(e,s,t)=>E(e,s,t),e.useCreateIndexes=(e,s,t)=>E(e,s,t),e.useCreateMetrics=(e,s,t)=>E(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=A(),u=j((()=>s(e)),[e,...t]);return M((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>E(e,s,t),e.useCreateRelationships=(e,s,t)=>E(e,s,t),e.useCreateStore=(e,s=[])=>j(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>U(l,I,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>U(t,i,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>U(s,u,t,o,e),e.useDelTablesCallback=(e,s,t)=>U(e,n,s,t),e.useDelValueCallback=(e,s,t,o)=>U(s,p,t,o,e),e.useDelValuesCallback=(e,s,t)=>U(e,b,s,t),e.useGoBackwardCallback=ie,e.useGoForwardCallback=ae,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=O(t);return B((s=>v(r,(t=>v(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>V(e,4),e.useLinkedRowIds=te,e.useLinkedRowIdsListener=(e,s,t,o,l)=>G("LinkedRowIds",x(l),t,o,[e,s]),e.useLocalRowIds=se,e.useLocalRowIdsListener=(e,s,t,o,l)=>G("LocalRowIds",x(l),t,o,[e,s]),e.useMetric=Z,e.useMetricListener=(e,s,t,o)=>G("Metric",T(o),s,t,[e]),e.useMetrics=e=>V(e,2),e.useQueries=e=>V(e,8),e.useRedoInformation=e=>{var s;const t=O(e),[,,[l]]=ne(t);return[!k(l),ae(t),l,null!=(s=v(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationships=e=>V(e,6),e.useRemoteRowId=ee,e.useRemoteRowIdListener=(e,s,t,o,l)=>G("RemoteRowId",x(l),t,o,[e,s]),e.useResultCell=ue,e.useResultCellIds=re,e.useResultCellIdsListener=(e,s,t,o,l)=>G("ResultCellIds",q(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>G("ResultCell",q(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>F("ResultRow",q(t),{},[e,s]),e.useResultRowIds=oe,e.useResultRowIdsListener=(e,s,t,o)=>G("ResultRowIds",q(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>G("ResultRow",q(l),t,o,[e,s]),e.useResultSortedRowIds=le,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,u,n)=>G("ResultSortedRowIds",q(n),r,u,[e,s,t,o,l]),e.useResultTable=(e,s)=>F("ResultTable",q(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>G("ResultTable",q(o),s,t,[e]),e.useRow=(e,s,t)=>F(i,S(t),{},[e,s]),e.useRowIds=J,e.useRowIdsListener=(e,s,t,o,l)=>G(a,S(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>G(i,S(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>Q(r,I,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=O(t);return B((s=>v(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>Q(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>Q(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>Q(l,i,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>Q(o,u,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>Q(t,n,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>Q(o,p,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>Q(t,b,e,s,o,l),e.useSliceIds=$,e.useSliceIdsListener=(e,s,t,o)=>G("SliceIds",P(o),s,t,[e]),e.useSliceRowIds=_,e.useSliceRowIdsListener=(e,s,t,o,l)=>G("SliceRowIds",P(l),t,o,[e,s]),e.useSortedRowIds=K,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>G(c,S(d),r,u,[e,s,t,o,l],n),e.useStore=e=>V(e,0),e.useTable=(e,s)=>F(u,S(s),{},[e]),e.useTableIds=H,e.useTableIdsListener=(e,s,t,o)=>G(d,S(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>G(u,S(l),s,t,[e],o),e.useTables=e=>F(n,S(e),{}),e.useTablesListener=(e,s,t,o)=>G(n,S(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=O(e),[l,r]=ne(t);return[(u=l,!(0==(e=>e.length)(u))),ie(t),r,null!=(s=v(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=Y,e.useValueIds=X,e.useValueIdsListener=(e,s,t,o)=>G(R,S(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>G(p,S(l),s,t,[e],o),e.useValues=e=>F(b,S(e),{}),e.useValuesListener=(e,s,t,o)=>G(b,S(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "3.1.0-beta.0",
3
+ "version": "3.1.0-beta.1",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -21,6 +21,14 @@
21
21
  "exports": {
22
22
  ".": "./lib/tinybase.js",
23
23
  "./package.json": "./package.json",
24
+ "./es6": "./lib/es6/tinybase.js",
25
+ "./debug": "./lib/debug/tinybase.js",
26
+ "./cjs": "./lib/cjs/tinybase.cjs",
27
+ "./cjs-es6": "./lib/cjs-es6/tinybase.cjs",
28
+ "./umd": "./lib/umd/tinybase.js",
29
+ "./umd-es6": "./lib/umd-es6/tinybase.js",
30
+ "./cjs/*": "./lib/cjs/*.cjs",
31
+ "./cjs-es6/*": "./lib/cjs-es6/*.cjs",
24
32
  "./*": "./lib/*.js"
25
33
  },
26
34
  "bin": {
@@ -63,63 +71,63 @@
63
71
  "publishPackage": "gulp publishPackage"
64
72
  },
65
73
  "devDependencies": {
66
- "@babel/cli": "^7.20.7",
67
- "@babel/core": "^7.20.12",
74
+ "@babel/cli": "^7.21.0",
75
+ "@babel/core": "^7.21.0",
68
76
  "@babel/preset-env": "^7.20.2",
69
77
  "@babel/preset-react": "^7.18.6",
70
- "@babel/preset-typescript": "^7.18.6",
78
+ "@babel/preset-typescript": "^7.21.0",
71
79
  "@rollup/plugin-replace": "^5.0.2",
72
80
  "@rollup/plugin-terser": "^0.4.0",
73
81
  "@types/asciichart": "^1.5.6",
74
- "@types/expect-puppeteer": "^5.0.2",
82
+ "@types/expect-puppeteer": "^5.0.3",
75
83
  "@types/http-server": "^0.12.1",
76
84
  "@types/jest": "^29.4.0",
77
85
  "@types/jest-environment-puppeteer": "^5.0.3",
78
86
  "@types/less": "^3.0.3",
79
- "@types/node": "^18.11.18",
87
+ "@types/node": "^18.14.0",
80
88
  "@types/puppeteer": "^5.4.7",
81
- "@types/react": "^18.0.27",
82
- "@types/react-dom": "^18.0.10",
89
+ "@types/react": "^18.0.28",
90
+ "@types/react-dom": "^18.0.11",
83
91
  "@types/react-test-renderer": "^18.0.0",
84
92
  "@types/tmp": "^0.2.3",
85
- "@typescript-eslint/eslint-plugin": "^5.49.0",
86
- "@typescript-eslint/parser": "^5.49.0",
93
+ "@typescript-eslint/eslint-plugin": "^5.53.0",
94
+ "@typescript-eslint/parser": "^5.53.0",
87
95
  "asciichart": "^1.5.25",
88
96
  "babel-eslint": "^10.1.0",
89
- "babel-jest": "^29.4.1",
97
+ "babel-jest": "^29.4.3",
90
98
  "babel-preset-minify": "^0.5.2",
91
99
  "buffer-replace": "^1.0.0",
92
100
  "country-flag-emoji-json": "^2.0.0",
93
- "cspell": "^6.19.2",
94
- "esbuild": "^0.17.5",
95
- "eslint": "^8.33.0",
101
+ "cspell": "^6.26.3",
102
+ "esbuild": "^0.17.10",
103
+ "eslint": "^8.34.0",
96
104
  "eslint-config-prettier": "^8.6.0",
97
105
  "eslint-plugin-jest": "^27.2.1",
98
- "eslint-plugin-jsdoc": "^39.7.4",
106
+ "eslint-plugin-jsdoc": "^40.0.0",
99
107
  "eslint-plugin-react": "^7.32.2",
100
108
  "eslint-plugin-react-hooks": "^4.6.0",
101
109
  "gulp": "^4.0.2",
102
110
  "gulp-gzip": "^1.4.2",
103
111
  "http-server": "^14.1.1",
104
- "jest": "^29.4.1",
105
- "jest-environment-jsdom": "^29.4.1",
112
+ "jest": "^29.4.3",
113
+ "jest-environment-jsdom": "^29.4.3",
106
114
  "jest-fetch-mock": "^3.0.3",
107
- "jest-puppeteer": "^6.2.0",
115
+ "jest-puppeteer": "^7.0.1",
108
116
  "less": "^4.1.3",
109
- "prettier": "^2.8.3",
110
- "puppeteer": "^17.1.3",
117
+ "prettier": "^2.8.4",
118
+ "puppeteer": "^19.7.2",
111
119
  "react": "^18.2.0",
112
120
  "react-dom": "^18.2.0",
113
121
  "react-test-renderer": "^18.2.0",
114
- "rollup": "^3.12.0",
122
+ "rollup": "^3.17.2",
115
123
  "rollup-plugin-esbuild": "^5.0.0",
116
124
  "rollup-plugin-gzip": "^3.1.0",
117
125
  "rollup-plugin-preserve-shebang": "^1.0.1",
118
126
  "rollup-plugin-prettier": "^3.0.0",
119
127
  "tinydocs": "^0.1.23",
120
128
  "tmp": "^0.2.1",
121
- "ts-unused-exports": "^9.0.2",
122
- "typescript": "4.9.4"
129
+ "ts-unused-exports": "^9.0.4",
130
+ "typescript": "4.9.5"
123
131
  },
124
132
  "peerDependencies": {
125
133
  "prettier": "^2.0.0",
package/readme.md CHANGED
@@ -266,4 +266,4 @@ export const createShop: typeof createShopDecl = () => {
266
266
  };
267
267
  ```
268
268
 
269
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.2kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>8.7kB</em>.</p><p>The <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module is <em>5.4kB</em>, and everything is fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">store</a></th><td>4.2kB</td><td>10.0kB</td><td>43.9kB</td><td>184.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.8kB</td><td>29.1kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.6kB</td><td>33.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.6kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/queries/">queries</a></th><td>2.6kB</td><td>5.5kB</td><td>24.9kB</td><td>106.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.0kB</td><td>12.5kB</td><td>33.4kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.7kB</td><td>5.2kB</td><td>27.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.7kB</td><td>21.1kB</td><td>92.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,794</td><td>1,794</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,932</td><td>1,932</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>768</td><td>768</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>628</td><td>628</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">2,581</td></tr><tr><th class="right">Assertions</th><td colspan="3">12,421</td></tr></tbody></table></div><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussion">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://beta.tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/3.1.0-beta.0">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it!</p></section>
269
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.2kB</em> to your app. You can incrementally add the other modules as you need more functionality, or get it all for <em>8.7kB</em>.</p><p>The <a href="https://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module is <em>7.8kB</em>, and everything is fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured in the <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">store</a></th><td>4.2kB</td><td>10.0kB</td><td>43.9kB</td><td>184.6kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.8kB</td><td>29.1kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.6kB</td><td>33.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.6kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/queries/">queries</a></th><td>2.6kB</td><td>5.5kB</td><td>25.0kB</td><td>106.8kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.0kB</td><td>12.5kB</td><td>33.4kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.7kB</td><td>5.2kB</td><td>27.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.7kB</td><td>21.1kB</td><td>92.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible to get up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,794</td><td>1,794</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,932</td><td>1,932</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>768</td><td>768</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>630</td><td>630</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">2,581</td></tr><tr><th class="right">Assertions</th><td colspan="3">12,421</td></tr></tbody></table></div><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussion">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://beta.tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/3.1.0-beta.1">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it!</p></section>