tinybase 4.0.0 → 4.0.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 (186) hide show
  1. package/bin/cli.js +1 -1
  2. package/lib/checkpoints.js +1 -1
  3. package/lib/checkpoints.js.gz +0 -0
  4. package/lib/cjs/checkpoints.cjs +1 -1
  5. package/lib/cjs/checkpoints.cjs.gz +0 -0
  6. package/lib/cjs/indexes.cjs +1 -1
  7. package/lib/cjs/indexes.cjs.gz +0 -0
  8. package/lib/cjs/metrics.cjs +1 -1
  9. package/lib/cjs/metrics.cjs.gz +0 -0
  10. package/lib/cjs/persisters/persister-browser.cjs +1 -1
  11. package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
  12. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  13. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  14. package/lib/cjs/persisters/persister-file.cjs +1 -1
  15. package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
  16. package/lib/cjs/persisters/persister-remote.cjs +1 -1
  17. package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
  18. package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
  19. package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  20. package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
  21. package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
  22. package/lib/cjs/relationships.cjs +1 -1
  23. package/lib/cjs/relationships.cjs.gz +0 -0
  24. package/lib/cjs/store.cjs +1 -1
  25. package/lib/cjs/store.cjs.gz +0 -0
  26. package/lib/cjs/tinybase.cjs +1 -1
  27. package/lib/cjs/tinybase.cjs.gz +0 -0
  28. package/lib/cjs/tools.cjs +1 -1
  29. package/lib/cjs/tools.cjs.gz +0 -0
  30. package/lib/cjs/ui-react.cjs +1 -1
  31. package/lib/cjs/ui-react.cjs.gz +0 -0
  32. package/lib/cjs-es6/checkpoints.cjs +1 -1
  33. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  34. package/lib/cjs-es6/indexes.cjs +1 -1
  35. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  36. package/lib/cjs-es6/metrics.cjs +1 -1
  37. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  38. package/lib/cjs-es6/persisters/persister-browser.cjs +1 -1
  39. package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
  40. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  41. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  42. package/lib/cjs-es6/persisters/persister-file.cjs +1 -1
  43. package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
  44. package/lib/cjs-es6/persisters/persister-remote.cjs +1 -1
  45. package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
  46. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
  47. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  48. package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
  49. package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
  50. package/lib/cjs-es6/relationships.cjs +1 -1
  51. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  52. package/lib/cjs-es6/store.cjs +1 -1
  53. package/lib/cjs-es6/store.cjs.gz +0 -0
  54. package/lib/cjs-es6/tinybase.cjs +1 -1
  55. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  56. package/lib/cjs-es6/tools.cjs +1 -1
  57. package/lib/cjs-es6/tools.cjs.gz +0 -0
  58. package/lib/cjs-es6/ui-react.cjs +1 -1
  59. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  60. package/lib/debug/checkpoints.js +6 -6
  61. package/lib/debug/indexes.js +7 -7
  62. package/lib/debug/metrics.js +12 -12
  63. package/lib/debug/persisters/persister-browser.js +10 -19
  64. package/lib/debug/persisters/persister-cr-sqlite-wasm.js +6 -15
  65. package/lib/debug/persisters/persister-file.js +10 -19
  66. package/lib/debug/persisters/persister-remote.js +10 -19
  67. package/lib/debug/persisters/persister-sqlite-wasm.js +6 -15
  68. package/lib/debug/persisters/persister-sqlite3.js +6 -15
  69. package/lib/debug/persisters.js +4 -4
  70. package/lib/debug/relationships.js +7 -7
  71. package/lib/debug/store.js +16 -24
  72. package/lib/debug/tinybase.js +20 -28
  73. package/lib/debug/tools.js +14 -13
  74. package/lib/debug/ui-react.js +4 -4
  75. package/lib/es6/checkpoints.js +1 -1
  76. package/lib/es6/checkpoints.js.gz +0 -0
  77. package/lib/es6/indexes.js +1 -1
  78. package/lib/es6/indexes.js.gz +0 -0
  79. package/lib/es6/metrics.js +1 -1
  80. package/lib/es6/metrics.js.gz +0 -0
  81. package/lib/es6/persisters/persister-browser.js +1 -1
  82. package/lib/es6/persisters/persister-browser.js.gz +0 -0
  83. package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  84. package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  85. package/lib/es6/persisters/persister-file.js +1 -1
  86. package/lib/es6/persisters/persister-file.js.gz +0 -0
  87. package/lib/es6/persisters/persister-remote.js +1 -1
  88. package/lib/es6/persisters/persister-remote.js.gz +0 -0
  89. package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
  90. package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  91. package/lib/es6/persisters/persister-sqlite3.js +1 -1
  92. package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
  93. package/lib/es6/relationships.js +1 -1
  94. package/lib/es6/relationships.js.gz +0 -0
  95. package/lib/es6/store.js +1 -1
  96. package/lib/es6/store.js.gz +0 -0
  97. package/lib/es6/tinybase.js +1 -1
  98. package/lib/es6/tinybase.js.gz +0 -0
  99. package/lib/es6/tools.js +1 -1
  100. package/lib/es6/tools.js.gz +0 -0
  101. package/lib/es6/ui-react.js +1 -1
  102. package/lib/es6/ui-react.js.gz +0 -0
  103. package/lib/indexes.js +1 -1
  104. package/lib/indexes.js.gz +0 -0
  105. package/lib/metrics.js +1 -1
  106. package/lib/metrics.js.gz +0 -0
  107. package/lib/persisters/persister-browser.js +1 -1
  108. package/lib/persisters/persister-browser.js.gz +0 -0
  109. package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
  110. package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  111. package/lib/persisters/persister-file.js +1 -1
  112. package/lib/persisters/persister-file.js.gz +0 -0
  113. package/lib/persisters/persister-remote.js +1 -1
  114. package/lib/persisters/persister-remote.js.gz +0 -0
  115. package/lib/persisters/persister-sqlite-wasm.js +1 -1
  116. package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
  117. package/lib/persisters/persister-sqlite3.js +1 -1
  118. package/lib/persisters/persister-sqlite3.js.gz +0 -0
  119. package/lib/relationships.js +1 -1
  120. package/lib/relationships.js.gz +0 -0
  121. package/lib/store.js +1 -1
  122. package/lib/store.js.gz +0 -0
  123. package/lib/tinybase.js +1 -1
  124. package/lib/tinybase.js.gz +0 -0
  125. package/lib/tools.js +1 -1
  126. package/lib/tools.js.gz +0 -0
  127. package/lib/ui-react.js +1 -1
  128. package/lib/ui-react.js.gz +0 -0
  129. package/lib/umd/checkpoints.js +1 -1
  130. package/lib/umd/checkpoints.js.gz +0 -0
  131. package/lib/umd/indexes.js +1 -1
  132. package/lib/umd/indexes.js.gz +0 -0
  133. package/lib/umd/metrics.js +1 -1
  134. package/lib/umd/metrics.js.gz +0 -0
  135. package/lib/umd/persisters/persister-browser.js +1 -1
  136. package/lib/umd/persisters/persister-browser.js.gz +0 -0
  137. package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
  138. package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  139. package/lib/umd/persisters/persister-file.js +1 -1
  140. package/lib/umd/persisters/persister-file.js.gz +0 -0
  141. package/lib/umd/persisters/persister-remote.js +1 -1
  142. package/lib/umd/persisters/persister-remote.js.gz +0 -0
  143. package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
  144. package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
  145. package/lib/umd/persisters/persister-sqlite3.js +1 -1
  146. package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
  147. package/lib/umd/relationships.js +1 -1
  148. package/lib/umd/relationships.js.gz +0 -0
  149. package/lib/umd/store.js +1 -1
  150. package/lib/umd/store.js.gz +0 -0
  151. package/lib/umd/tinybase.js +1 -1
  152. package/lib/umd/tinybase.js.gz +0 -0
  153. package/lib/umd/tools.js +1 -1
  154. package/lib/umd/tools.js.gz +0 -0
  155. package/lib/umd/ui-react.js +1 -1
  156. package/lib/umd/ui-react.js.gz +0 -0
  157. package/lib/umd-es6/checkpoints.js +1 -1
  158. package/lib/umd-es6/checkpoints.js.gz +0 -0
  159. package/lib/umd-es6/indexes.js +1 -1
  160. package/lib/umd-es6/indexes.js.gz +0 -0
  161. package/lib/umd-es6/metrics.js +1 -1
  162. package/lib/umd-es6/metrics.js.gz +0 -0
  163. package/lib/umd-es6/persisters/persister-browser.js +1 -1
  164. package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
  165. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  166. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  167. package/lib/umd-es6/persisters/persister-file.js +1 -1
  168. package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
  169. package/lib/umd-es6/persisters/persister-remote.js +1 -1
  170. package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
  171. package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
  172. package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  173. package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
  174. package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
  175. package/lib/umd-es6/relationships.js +1 -1
  176. package/lib/umd-es6/relationships.js.gz +0 -0
  177. package/lib/umd-es6/store.js +1 -1
  178. package/lib/umd-es6/store.js.gz +0 -0
  179. package/lib/umd-es6/tinybase.js +1 -1
  180. package/lib/umd-es6/tinybase.js.gz +0 -0
  181. package/lib/umd-es6/tools.js +1 -1
  182. package/lib/umd-es6/tools.js.gz +0 -0
  183. package/lib/umd-es6/ui-react.js +1 -1
  184. package/lib/umd-es6/ui-react.js.gz +0 -0
  185. package/package.json +30 -30
  186. package/readme.md +5 -5
@@ -1 +1 @@
1
- var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="tinybase",a="",n=",",o=t(a),d=t(!0),r=t(0),s="type",I="default",c="Listener",i="get",$="add",u="Ids",p="Table",b=p+"s",C=p+u,h="Row",g=h+u,f="Sorted"+h+u,m="Cell",w=m+u,y="Value",v=y+"s",T=y+u,V=(e,t)=>e.every(t),x=(e,t)=>e.sort(t),R=(e,t)=>e.forEach(t),k=(e,t=a)=>e.join(t),P=(e,t)=>e.map(t),S=e=>e.length,A=(e,t)=>e.filter(t),O=(e,...t)=>e.push(...t),E=e=>e.pop(),D=(e,...t)=>e.unshift(...t),j=e=>e.shift(),N=JSON.parse,L=isFinite,G=(e,t)=>e instanceof t,M=e=>null==e,J=e=>e==o||e==d,z=e=>t(e)==o,W=e=>Array.isArray(e),B=e=>{const l=t(e);return J(l)||l==r&&L(e)?l:void 0},F=Object,U=F.keys,_=F.freeze,Z=e=>G(e,F)&&e.constructor==F,H=(e,t)=>P(F.entries(e),(([e,l])=>t(l,e))),Q=e=>S(U(e)),q=e=>Z(e)&&0==Q(e),K=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},X=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},Y=(e,t)=>null==e?void 0:e.forEach(t),ee=(e,t)=>null==e?void 0:e.delete(t),te=e=>new Map(e),le=(e,t)=>null==e?void 0:e.get(t),ae=(e,t)=>Y(e,((e,l)=>t(l,e))),ne=(e,t)=>{var l;return P([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},oe=(e,t,l)=>M(l)?(ee(e,t),e):null==e?void 0:e.set(t,l),de=(e,t,l)=>(K(e,t)||oe(e,t,l()),le(e,t)),re=e=>e.toUpperCase(),se=e=>e.toLowerCase(),Ie="a ",ce="A function for",ie=", and registers a listener so that any changes to that result will cause a re-render",$e="Callback",ue="Del",pe="Deps",be=pe+"?: React.DependencyList",Ce="doRollback?: DoRollback",he="actions: () => Return, "+Ce,ge="export",fe="Id",me="Invalid",we="Json",ye=se(c),ve="?: ",Te=" | undefined",Ve="NonNullable",xe="Partial",Re="Props",ke="Provider",Pe=`Registers a ${ye} that will be called`,Se="Represents",Ae="rowId: "+fe,Oe="Schema",Ee="Set",De=", descending?: boolean, offset?: number, limit?: number",je="[]",Ne="the Store",Le="Transaction",Ge=Le+"Changes",Me=se(Le),Je="Execute a "+Me+" to make multiple mutations",ze="Explicitly starts a "+Me,We="Explicitly finishes a "+Me,Be="the end of the "+Me,Fe="void",Ue=" => "+Fe,_e="WhenSet",Ze=" when setting it",He=Ie+"string serialization of",Qe=" ",qe="Gets a callback that can ",Ke="the ",Xe=" the schema for",Ye=(e=0,t=0)=>`the ${ht[e]}content of`+(t?Qe+Ne:a),et=(e=0,t,l=0)=>pt[t]+Qe+Ye(e,1)+(l?" when setting it":a),tt=(e,t=0)=>Se+` a Row when ${t?"s":"g"}etting ${Ye()} the '${e}' `+p,lt=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,at=(e,t)=>`Calls a function for each ${e} in `+t,nt=e=>"The props passed to a component that renders "+e,ot=e=>"A function that takes "+e,dt=(e,t=0)=>ce+" listening to changes to "+Ct[e]+" in "+Ct[t],rt=(e,t,l=0)=>Pe+" whenever "+Ct[e]+" in "+Ct[t]+" change"+(l?a:"s"),st=e=>`the '${e}' `+p,It=e=>"the specified Row in "+st(e),ct=(e,t=0)=>pt[t]+` ${Ye()} `+st(e),it=(e,t=0)=>pt[t]+` ${Ye()} `+It(e),$t=(e,t,l=0)=>pt[l]+` the '${t}' Cell for `+It(e),ut=(e,t=0)=>pt[t]+` the '${e}' Value`,pt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Se,"Gets "+He,"Sets "+He,Pe+" whenever",qe+"set",qe+"add",qe+"set part of",qe+"delete","Renders","Gets "+He+Xe,"Sets"+Xe,"Deletes"+Xe],bt=[i,"has","set","del","set","forEach",$,a],Ct=[Ne,b,Ke+p+Qe+u,Ie+p,Ke+h+Qe+u,Ie+h,Ke+m+Qe+u,Ie+m,"invalid Cell changes",v,Ke+y+Qe+u,Ie+y,"invalid Value changes",Ke+"sorted "+h+Qe+u,Ke+m+Qe+u+" anywhere"],ht=[a,"tabular ","keyed value "],gt=e=>new Set(W(e)||M(e)?e:[e]),ft=(e,t)=>null==e?void 0:e.add(t),mt=/[^A-Za-z]+/,wt=/[^A-Za-z0-9]+/,yt=/^( *)\/\*\* *(.*?) *\*\/$/gm,vt=(e,t,l)=>e.substring(t,l),Tt=e=>e.includes(n),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return K(e,n)?Vt(e,t,l,a+1):(oe(e,n,l),n)},xt=e=>e.replace(yt,((e,t,l)=>{const a=77-Rt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.length,kt=e=>e.flat(1e3),Pt=(e,t=0)=>k(P(e.split(wt),((e,l)=>(l>0||t?re:se)(vt(e,0,1))+vt(e,1)))),St=e=>re(k((e&&!mt.test(e[0])?e:" "+e).split(wt),"_")),At=e=>`/** ${e}. */`,Ot=(...e)=>k(A(e,(e=>e)),", "),Et=(...e)=>"{"+k(e,"; ")+"}",Dt=(...e)=>Et(...P(e,(e=>"readonly "+e))),jt=()=>{const e=[te(),te(),te(),te()],t=te(),l=te(),n=e=>{const t=e.indexOf(" as ");return-1!=t?e.substring(t+4):e};return[(...e)=>k(kt(e),"\n"),(t,l,...a)=>R(a,(a=>R([0,1],(n=>(null!=t?t:n)==n?ft(de(e[n],l,gt),a):0)))),(e,l,n,o=a,d=1)=>Vt(t,e,[l,n,o,d]),(e,t,a)=>Vt(l,e,W(a)?[`(${t}) => {`,a,"}"]:[`(${t}) => ${a}`]),(e,t)=>le(l,e)===t?e:Vt(l,e,t),(t=0)=>P([...x(ne(e[t],((e,t)=>`import {${k(x(X(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>Tt(e)!=Tt(t)?Tt(e)?-1:1:e>t?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ne(t,(([e,t,l,n],o)=>[At(t),`${n?ge+" ":a}type ${o}${l} = ${e};`,a])),()=>ne(l,((e,t)=>(e=W(e)?e:[e],O(e,E(e)+";"),[`const ${t} = ${j(e)}`,e,a])))]},Nt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Lt=(e,t,l)=>[t=>H(e,((e,a)=>t(a,Pt(a,1),l(St(a),`'${a}'`)))),(t,a)=>H(e[t],((e,t)=>a(t,e[s],e[I],l(St(t),`'${t}'`),Pt(t,1)))),e=>H(t,((t,a)=>e(a,t[s],t[I],l(St(a),`'${a}'`),Pt(a,1))))],Gt=(e,t,l,n)=>[(n,o)=>{const d=n+": "+o,r=e(b,Et(...t((e=>`'${e}'?: {[rowId: Id]: `+Et(...l(e,((e,t,l)=>`'${e}'${M(l)?"?":a}: ${t}`)))+"}"))),et(1,5)),s=e(b+_e,Et(...t((e=>`'${e}'?: {[rowId: Id]: `+Et(...l(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),et(1,5,1)),I=e(p+fe,"keyof "+r,"A "+p+" Id in "+Ne),i=`<TId extends ${I}>`,$=e(p,Ve+`<${r}[TId]>`,"A "+p+" in "+Ne,i),u=e(p+_e,Ve+`<${s}[TId]>`,"A "+p+" in "+Ne+Ze,i),y=e(h,$+"<TId>[Id]","A "+h+" in a "+p,i),v=e(h+_e,u+"<TId>[Id]","A "+h+" in a "+p+Ze,i),T=e(m+fe,`Extract<keyof ${y}<TId>, Id>`,"A "+m+" Id in a "+h,i),V=e(m,Ve+`<${r}[TId]>[Id][CId]`,"A "+m+" in a "+h,`<TId extends ${I}, CId extends ${T}<TId>>`),x=e("CellIdCellArray",`CId extends ${T}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,m+" Ids and types in a "+h,`<TId extends ${I}, CId = ${T}<TId>>`,0),R=e(m+$e,`(...[cellId, cell]: ${x}<TId>)`+Ue,ot(Ie+m+" Id, and "+m),i),k=e(h+$e,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ue+") "+Ue,ot(Ie+h+" Id, and a "+m+" iterator"),i),P=e(p+m+$e,`(cellId: ${T}<TId>, count: number) `+Ue,ot(Ie+m+" Id, and count of how many times it appears"),i),S=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Ue}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),A=e(p+$e,`(...[tableId, forEachRow]: ${S})`+Ue,ot(Ie+p+" Id, and a "+h+" iterator"),a),O=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${T}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),E=e("GetCellChange",`(...[tableId, rowId, cellId]: ${O}) => CellChange`,ce+" returning information about any Cell's changes during a "+Me),D=e(b+c,`(${d}, getCellChange: ${E}${Te})`+Ue,dt(1)),j=e(C+c,`(${d})`+Ue,dt(2)),N=e(p+c,`(${d}, tableId: ${I}, getCellChange: ${E}${Te})`+Ue,dt(3)),L=e(p+w+c,`(${d}, tableId: ${I})`+Ue,dt(14,3)),G=e(g+c,`(${d}, tableId: ${I})`+Ue,dt(4,3)),J=e(f+c,"("+Ot(d,"tableId: "+I,"cellId: Id"+Te,"descending: boolean","offset: number","limit: number"+Te,"sortedRowIds: Ids")+")"+Ue,dt(13,3)),z=e(h+c,"("+Ot(""+d,"tableId: "+I,Ae,`getCellChange: ${E}${Te}`)+")"+Ue,dt(5,3)),W=e(w+c,"("+Ot(""+d,"tableId: "+I,Ae)+")"+Ue,dt(6,5)),B=e("CellListenerArgsArrayInner",`CId extends ${T}<TId> ? [${d}, tableId: TId, ${Ae}, cellId: CId, newCell: ${V}<TId, CId> ${Te}, oldCell: ${V}<TId, CId> ${Te}, getCellChange: ${E} ${Te}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${T}<TId>>`,0),F=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+B+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[r,s,I,$,u,y,v,T,V,R,k,P,A,D,j,N,L,G,J,z,W,e(m+c,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${F})`+Ue,dt(7,5)),e(me+m+c,`(${d}, tableId: Id, ${Ae}, cellId: Id, invalidCells: any[])`+Ue,dt(8))]},(t,l)=>{const o=t+": "+l,d=e(v,Et(...n(((e,t,l)=>`'${e}'${M(l)?"?":a}: ${t}`))),et(2,5)),r=e(v+_e,Et(...n(((e,t)=>`'${e}'?: ${t}`))),et(2,5,1)),s=e(y+fe,"keyof "+d,"A "+y+" Id in "+Ne),I=e(y,Ve+`<${d}[VId]>`,"A "+y+" Id in "+Ne,`<VId extends ${s}>`),i=e("ValueIdValueArray",`VId extends ${s} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+Ne,`<VId = ${s}>`,0),$=e(y+$e,`(...[valueId, value]: ${i})`+Ue,ot(Ie+y+" Id, and "+y)),u=e("GetValueChange",`(valueId: ${s}) => ValueChange`,ce+" returning information about any Value's changes during a "+Me),p=e(v+c,`(${o}, getValueChange: ${u}${Te})`+Ue,dt(9)),b=e(T+c,`(${o})`+Ue,dt(10)),C=e("ValueListenerArgsArray",`VId extends ${s} ? [${o}, valueId: VId, newValue: ${I}<VId> ${Te}, oldValue: ${I}<VId> ${Te}, getValueChange: ${u} ${Te}] : never`,"Value args for ValueListener",`<VId = ${s}>`,0);return[d,r,s,I,$,p,b,e(y+c,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+Ue,dt(11)),e(me+y+c,`(${o}, valueId: Id, invalidValues: any[])`+Ue,dt(12))]},(t,l)=>e(Le+c,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Ue,ce+" listening to the completion of a "+Me)],Mt=(e,t=a,l=a)=>`store.${e}(${t})`+(l?" as "+l:a),Jt=(e,t=a)=>`fluent(() => ${Mt(e,t)})`,zt=(e,t=a,l=a)=>`store.${e}(${t?t+", ":a}proxy(listener)${l?", "+l:a})`,Wt=(e,t,n)=>{const[o,r,i,V,x,P,S,A]=jt(),[E,j,N]=Lt(e,t,x),[L,G,J]=Gt(i,E,j,N),W=te(),B=(e=0)=>ne(W,(([t,l,n,o,d],r)=>{const s=e?[r+`: ${d}(${t}): ${l} => ${n},`]:[r+d+`(${t}): ${l};`];return e||D(s,At(o)),O(s,a),s})),F=(e,t,l,n,o,d=a)=>Vt(W,e,[t,l,n,o,d]),U=(e,t,l,n,o,d=a,r=a,s=a)=>F(bt[e]+t+(4==e?xe:a)+l,d,n,(n==H?Jt:Mt)(bt[e]+(4==e?xe:a)+l,r,e?void 0:n),o,s),_=(e,t,l,n=a,o=a,d=1,r=a)=>F($+e+c,(n?n+", ":a)+ye+": "+t+(d?", mutator?: boolean":a),fe,zt($+e+c,o,d?"mutator":a),l,r),Z=`./${Pt(n)}.d`,H=Pt(n,1),Q=Pt(H),K=[],Y=te();let ee=[],de=[];if(r(1,Z,H,`create${H} as create${H}Decl`),q(e))r(null,l,b);else{r(0,l,"CellChange"),r(null,l,u);const[e,t,n,o,c,$,y,v,T,V,P,S,A,D,N,G,J,W,B,F,q,ae,ne]=L(Q,H),de=te();E(((e,t)=>{const l=`<'${e}'>`,a=[i(t+p,o+l,Se+` the '${e}' `+p),i(t+p+_e,c+l,Se+` the '${e}' `+p+Ze),i(t+h,$+l,tt(e)),i(t+h+_e,y+l,tt(e,1)),i(t+m+fe,v+l,`A Cell Id for the '${e}' `+p),i(t+m+$e,V+l,ot(`a Cell Id and value from a Row in the '${e}' `+p)),i(t+h+$e,P+l,ot(`a Row Id from the '${e}' Table, and a Cell iterator`)),i(t+p+m+$e,S+l,ot(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];oe(de,e,a),r(1,Z,...a)})),r(1,Z,e,t,n,v,A,D,N,G,J,W,B,F,q,ae,ne),ee=[e,t,n,v,D,N,G,J,W,B,F,q,ae,de],R([[e],[d],[H,"tables: "+t,"tables"],[H]],(([e,t,l],n)=>U(n,a,b,e,et(1,n),t,l))),U(0,a,C,n+je,lt(p,Ne)),U(5,a,p,Fe,at(p,Ne),"tableCallback: "+A,"tableCallback as any"),E(((e,t,l)=>{const[n,o,r,s,I,c,i,$]=le(de,e);R([[n],[d],[H,"table: "+o,", table"],[H]],(([n,o,d=a],r)=>U(r,t,p,n,ct(e,r),o,l+d))),U(0,t,p+w,u,lt(m,"the whole of "+st(e)),a,l),U(5,t,p+m,Fe,at(p+m,"the whole of "+st(e)),"tableCellCallback: "+$,l+", tableCellCallback as any"),U(0,t,g,u,lt(h,st(e)),a,l),U(0,t,f,u,lt(h,st(e),1),"cellId?: "+I+De,l+", cellId, descending, offset, limit"),U(5,t,h,Fe,at(h,st(e)),"rowCallback: "+i,l+", rowCallback as any"),R([[r],[d],[H,", row: "+s,", row"],[H],[H,", partialRow: "+s,", partialRow"]],(([n,o=a,d=a],r)=>U(r,t,h,n,it(e,r),Ae+o,l+", rowId"+d))),U(6,t,h,fe+Te,"Add a new Row to "+st(e),"row: "+s+", reuseIds?: boolean",l+", row, reuseIds"),U(0,t,w,I+je,lt(m,It(e)),Ae,l+", rowId"),U(5,t,m,Fe,at(m,It(e)),Ae+", cellCallback: "+c,l+", rowId, cellCallback as any"),j(e,((n,o,r,s,I)=>{const c="Map"+Pt(o,1);oe(Y,o,c);const i=o+(M(r)?Te:a);R([[i],[d],[H,`, cell: ${o} | `+c,", cell as any"],[H]],(([o,d=a,r=a],c)=>U(c,t+I,m,o,$t(e,n,c),Ae+d,l+", rowId, "+s+r))),U(1,t+I,p+m,d,pt[1]+` the '${n}' Cell anywhere in `+st(e),a,l+", "+s)}))})),U(0,a,b+we,we,et(1,6)),U(2,a,b+we,H,et(1,7),"tablesJson: "+we,"tables"+we),_(b,D,et(1,8)+" changes"),_(C,N,rt(2,0,1)),_(p,G,rt(3,0),`tableId: ${n} | null`,"tableId"),_(p+w,J,rt(14,3,1),`tableId: ${n} | null`,"tableId"),_(g,W,rt(4,3,1),`tableId: ${n} | null`,"tableId"),_(f,B,rt(13,3,1),Ot("tableId: TId",`cellId: ${v}<TId>`+Te,"descending: boolean","offset: number","limit: number"+Te),Ot("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(h,F,rt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(w,q,rt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(m,ae,rt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${k(E((e=>{var t,l;return null!=(l=null==(t=le(de,e))?void 0:t[4])?l:a}))," | ")} | null`,"tableId, rowId, cellId"),_(me+m,ne,Pe+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),r(1,Z,...X(Y)),O(K,".set"+b+Oe+"({",kt(E(((e,t,l)=>[`[${l}]: {`,...j(e,((e,t,l,n)=>`[${n}]: {[${x(St(s),`'${s}'`)}]: ${x(St(t),`'${t}'`)}${M(l)?a:`, [${x(St(I),`'${I}'`)}]: `+(z(l)?x(St(l),`'${l}'`):l)}},`)),"},"]))),"})")}if(q(t))r(null,l,v);else{const[e,t,n,o,c,i,$,u,p]=G(Q,H);r(1,Z,e,t,n,c,i,$,u,p),de=[e,t,n,i,$,u],R([[e],[d],[H,"values: "+t,"values"],[H],[H,"partialValues: "+t,"partialValues"]],(([e,t,l],n)=>U(n,a,v,e,et(2,n),t,l))),U(0,a,T,n+je,lt(y,Ne)),U(5,a,y,"void",at(y,Ne),"valueCallback: "+c,"valueCallback as any"),N(((e,t,l,n,o)=>{const r="Map"+Pt(t,1);oe(Y,t,r),R([[t],[d],[H,`value: ${t} | `+r,", value as any"],[H]],(([t,l,d=a],r)=>U(r,o,y,t,ut(e,r),l,n+d)))})),U(0,a,v+we,we,et(2,6)),U(2,a,v+we,H,et(2,7),"valuesJson: "+we,"values"+we),_(v,i,et(2,8)+" changes"),_(T,$,rt(10,0,1)),_(y,u,rt(11,0),`valueId: ${n} | null`,"valueId"),_(me+y,p,Pe+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),r(1,Z,...X(Y)),r(0,l,"ValueChange"),O(K,".set"+v+Oe+"({",N(((e,t,l,n)=>[`[${n}]: {[${x(St(s),`'${s}'`)}]: ${x(St(t),`'${t}'`)}${M(l)?a:`, [${x(St(I),`'${I}'`)}]: `+(z(l)?x(St(l),`'${l}'`):l)}},`])),"})")}U(0,a,"Content",`[${b}, ${v}]`,et(0,0)),U(2,a,"Content",H,et(0,2),`[tables, values]: [${b}, ${v}]`,"[tables, values]"),U(2,a,Ge,H,`Applies a set of ${Ge} to the Store`,"transactionChanges: "+Ge,"transactionChanges"),ae(Y,((e,t)=>i(t,`(cell: ${e}${Te}) => `+e,`Takes a ${e} Cell value and returns another`))),r(null,l,"DoRollback",fe,"IdOrNull",we,"Store",Ge),r(0,l,"Get"+Ge,"GetTransactionLog"),U(0,a,we,we,et(0,6)),U(2,a,we,H,et(0,7),"tablesAndValuesJson: "+we,"tablesAndValuesJson"),U(7,a,Me,"Return",Je,he,"actions, doRollback","<Return>"),U(7,a,"start"+Le,H,ze),U(7,a,"finish"+Le,H,We,Ce,"doRollback");const re=J(Q,H);return _("Start"+Le,re,Pe+" just before the start of the "+Me,a,a,0),_("WillFinish"+Le,re,Pe+" just before "+Be,a,a,0),_("DidFinish"+Le,re,Pe+" just after "+Be,a,a,0),U(7,a,"call"+c,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,c,H,"Remove a listener that was previously added to "+Ne,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",pt[0]+" the underlying Store object"),r(1,l,"createStore"),r(1,Z,H,`create${H} as create${H}Decl`,re),x("store",["createStore()",...K]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...B(1),"}"]),[o(...P(0),...S(),ge+" interface "+H+" {",...B(0),"}",a,At(`Creates a ${H} object`),ge+" function create"+H+"(): "+H+";"),o(...P(1),ge+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${Q});`,"};"),ee,de]},Bt=e=>i+e,Ft=e=>Ot(Bt(e),Bt(e)+pe),Ut="debugIds?: boolean",_t="debugIds={debugIds}",Zt="then"+be,Ht="Parameter",Qt=": (parameter: "+Ht+", store: Store) => ",qt="const contextValue = useContext(Context);",Kt=", based on a parameter",Xt=": ",Yt="<"+Ht+",>",el=Ht+"ized"+$e+"<"+Ht+">",tl="rowId",ll="rowId={rowId}",al=", separator, debugIds",nl="separator?: ReactElement | string",ol="then?: (store: Store",dl=Ot(ol+")"+Ue,Zt),rl="then, then"+pe,sl=tl+Xt+fe,Il="View",cl=(e,...t)=>Ot(...t,ye+": "+e,ye+be,"mutator?: boolean"),il=(...e)=>Ot(...e,ye,ye+pe,"mutator"),$l=(e,t,n,o,d)=>{const[r,s,I,i,$,V,x,R]=jt(),[P,S,A]=Lt(e,t,$),E=`./${Pt(n)}.d`,j=`./${Pt(n)}-ui-react.d`,N="tinybase/ui-react",L=Pt(n,1),G=Pt(L),J=L+"Or"+L+fe,z=G+"Or"+L+fe,W=G+`={${G}}`,B=te(),F=(e,t,l,n,o,d=a)=>(s(1,j,e+" as "+e+"Decl"),Vt(B,e,[t,l,n,o,d])),U=(e,t,l,n,o,d=a)=>F("use"+e,t,l,n,o,d),_=(e,t,l,n,o=a,d=a,r=a,I=a,c=a)=>(s(1,N,`use${t} as use${t}Core`),U(e,Ot(o,X,I),l,ee+`(${z}, use${t}Core, [`+(d||a)+(c?"], ["+c:a)+"]);",n,r)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>ne(B,(([t,l,n,o,d],r)=>{const s=e?[ge+` const ${r}: typeof ${r}Decl = ${d}(${t}): ${1==l?"any":l} =>`,n]:[ge+` function ${r}${d}(${t}): ${1==l?"ComponentReturnType":l};`];return e||D(s,At(o)),O(s,a),s}));s(null,l,fe,"Store",$e,Ht+"ized"+$e),s(0,N,"ComponentReturnType"),s(null,N,"ExtraProps"),s(0,E,L);const Q=I(J,L+" | "+fe,`Used when you need to refer to a ${L} in a React hook or component`),K=I(ke+Re,Dt(G+ve+L,G+`ById?: {[${G}Id: Id]: ${L}}`),`Used with the ${ke} component, so that a `+L+" can be passed into the context of an application");s(0,"react","ReactElement","ComponentType"),s(1,"react","React"),s(1,j,Q,K);const X=z+ve+Q;$("{createContext, useContext, useMemo}","React"),$("Context",`createContext<[${L}?, {[${G}Id: Id]: ${L}}?]>([])`),U("Create"+L,`create: () => ${L}, create`+be,L,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${L} within a React application with convenient memoization`);const Y=U(L,"id?: Id",L+Te,["{",qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${L} from within a ${ke} component context`),ee=i("useHook",z+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${G} = ${Y}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${G} : ${z})?.getStore(), ...postParams)`]),ae=i("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=i("wrap",Ot("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("NullComponent","() => null");if(!q(e)){const[e,t,n,d,r,$,y,v,T,V,x,R,A,O]=o;s(null,E,e,t,n,r,$,y,v,T,V,x,R,A),s(0,E,d),s(1,E,L),s(null,l,u,"IdOrNull");const D=i("tableView",`{${G}, rowComponent, getRowComponentProps`+al+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+ae+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ll,W,_t,"/>","))",al,", tableId,",");"]),N=i("getDefaultTableComponent","tableId: Id",k(P(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+de),J=i("getDefaultCellComponent","tableId: Id, cellId: Id",k(P(((e,t,l)=>`tableId == ${l} ? ${k(S(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+de} : `)))+de);_(b,b,e,et(1,0)+ie);const z=_(C,C,n+je,lt(p,Ne)+ie);_(Ee+b+$e,Ee+b+$e,el,et(1,9)+Kt,Ot(Bt(b)+Qt+t,Bt(b)+be),Ft(b),Yt,Ot(ol,`tables: ${t})`+Ue,Zt),rl),_(ue+b+$e,ue+b+$e,$e,et(1,12),a,a,a,dl,rl);const B=I(m+Re,Dt("tableId?: TId","rowId: Id","cellId?: CId",G+ve+L,Ut),nt(Ie+m),`<TId extends ${n}, CId extends ${d}<TId>>`),F=I(h+Re,Dt("tableId?: TId","rowId: Id",G+ve+L,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${B}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,nl,Ut),nt(Ie+h),`<TId extends ${n}>`),U=I(p+Re,Dt("tableId?: TId",G+ve+L,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps",nl,Ut),nt(Ie+p),`<TId extends ${n}>`),H=I("Sorted"+p+Re,Dt("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",G+ve+L,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps",nl,Ut),nt(Ie+"sorted "+p),`<TId extends ${n}>`),Q=I(b+Re,Dt(G+ve+L,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${U}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,nl,Ut),nt(Ye(1,1)));s(1,j,Q,U,H,F,B),Z(b+Il,"{"+G+", tableComponents, getTableComponentProps"+al+"}: "+Q,[oe+`(${z}(${G}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+N+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ae}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",W,_t,"/>;","}), separator)"],et(1,13)+ie),P(((e,t,l)=>{const[n,o,d,r,I]=le(O,e);s(null,E,n,o,d,r,I),_(t+p,p,n,ct(e)+ie,a,l),_(t+p+w,p+w,u,lt(m,"the whole of "+st(e))+ie,a,l);const c=_(t+g,g,u,lt(h,st(e))+ie,a,l),i=_(t+f,f,u,lt(h,st(e),1)+ie,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",l+", cellId, descending, offset, limit");_(t+h,h,d,it(e)+ie,sl,Ot(l,tl));const $=_(t+w,w,I+je,lt(m,It(e))+ie,sl,Ot(l,tl));_(Ee+t+p+$e,Ee+p+$e,el,ct(e,9)+Kt,Ot(Bt(p)+Qt+o,Bt(p)+be),Ot(l,Ft(p)),Yt,Ot(ol,`table: ${o})`+Ue,Zt),rl),_(ue+t+p+$e,ue+p+$e,$e,ct(e,12),a,l,a,dl,rl),_(Ee+t+h+$e,Ee+h+$e,el,it(e,9)+Kt,Ot(sl,Bt(h)+Qt+r,Bt(h)+be),Ot(l,tl,Ft(h)),Yt,Ot(ol,`row: ${r})`+Ue,Zt),rl),_("Add"+t+h+$e,"Add"+h+$e,el,it(e,10)+Kt,Ot(Bt(h)+Qt+r,Bt(h)+be),Ot(l,Ft(h)),Yt,"then?: ("+Ot(sl+Te,"store: Store","row: "+r+")"+Ue,"then"+be)+", reuseRowIds?: boolean",rl+", reuseRowIds"),_(Ee+t+xe+h+$e,Ee+xe+h+$e,el,it(e,11)+Kt,Ot(sl,Bt(xe+h)+Qt+r,Bt(xe+h)+be),Ot(l,tl,Ft(xe+h)),Yt,Ot(ol,`partialRow: ${r})`+Ue,Zt),rl),_(ue+t+h+$e,ue+h+$e,$e,it(e,12),sl,Ot(l,tl),a,dl,rl);const b=Z(t+h+Il,"{rowId, "+G+", cellComponents, getCellComponentProps"+al+`}: ${F}<'${e}'>`,[oe+`(${$}(rowId, ${G}).map((cellId) => {`,"const Cell = (cellComponents?.[cellId] ?? "+J+`(${l}, cellId)) as React.ComponentType<CellProps<typeof `+l+", typeof cellId>>;","return <Cell",`{...${ae}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${l}}`,ll,"cellId={cellId}",W,_t,"/>;","})"+al+", rowId)"],it(e,13)+ie);Z(t+"Sorted"+p+Il,"{cellId, descending, offset, limit, ...props}: "+H+`<'${e}'>`,D+"(props, "+i+`(cellId, descending, offset, limit, props.${G}), ${l}, ${b});`,ct(e,13)+", sorted"+ie),Z(t+p+Il,`props: ${U}<'${e}'>`,D+"(props, "+c+`(props.${G}), ${l}, ${b});`,ct(e,13)+ie),S(e,((n,o,d,r,I)=>{const c="Map"+Pt(o,1);s(0,E,c),s(1,E,c);const i=_(t+I+m,m,o+(M(d)?Te:a),$t(e,n)+ie,sl,Ot(l,tl,r));_(Ee+t+I+m+$e,Ee+m+$e,el,$t(e,n,9)+Kt,Ot(sl,Bt(m)+Qt+o+" | "+c,Bt(m)+be),Ot(l,tl,r,Ft(m)),Yt,Ot(ol,`cell: ${o} | ${c})`+Ue,Zt),rl),_(ue+t+I+m+$e,ue+m+$e,$e,$t(e,n,12),Ot(sl,"forceDel?: boolean"),Ot(l,tl,r,"forceDel"),a,dl,rl),Z(t+I+m+Il,`{rowId, ${G}, debugIds}: `+B+`<'${e}', '${n}'>`,[oe+`('' + ${i}(rowId, `+G+`) ?? '', undefined, debugIds, ${r})`],$t(e,n,13)+ie)}))}));const q=k(P((e=>{var t,l;return null!=(l=null==(t=le(O,e))?void 0:t[4])?l:a}))," | ");_(b+c,b+c,Fe,et(1,8)+" changes",cl(r),il()),_(C+c,C+c,Fe,rt(2,0,1),cl($),il()),_(p+c,p+c,Fe,rt(3,0),cl(y,`tableId: ${n} | null`),il("tableId")),_(p+w+c,p+w+c,Fe,rt(14,3,1),cl(v,`tableId: ${n} | null`),il("tableId")),_(g+c,g+c,Fe,rt(4,3,1),cl(T,`tableId: ${n} | null`),il("tableId")),_(f+c,f+c,Fe,rt(13,3,1),cl(V,`tableId: ${n} | null`,"cellId: "+q+Te,"descending: boolean","offset: number","limit: number"+Te),il("tableId","cellId","descending","offset","limit")),_(h+c,h+c,Fe,rt(5,3),cl(x,`tableId: ${n} | null`,tl+": IdOrNull"),il("tableId",tl)),_(w+c,w+c,Fe,rt(6,5,1),cl(R,`tableId: ${n} | null`,tl+": IdOrNull"),il("tableId",tl)),_(m+c,m+c,Fe,rt(7,5),cl(A,`tableId: ${n} | null`,tl+": IdOrNull",`cellId: ${q} | null`),il("tableId",tl,"cellId"))}if(!q(t)){const[e,t,l,n,o,r]=d;s(null,E,...d),s(1,E,L);const $=i("getDefaultValueComponent","valueId: Id",k(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+de);_(v,v,e,et(2,0)+ie);const u=_(T,T,l+je,lt(y,Ne)+ie);_(Ee+v+$e,Ee+v+$e,el,et(2,9)+Kt,Ot(Bt(v)+Qt+t,Bt(v)+be),Ft(v),Yt,Ot(ol,`values: ${t})`+Ue,Zt),rl),_(Ee+xe+v+$e,Ee+xe+v+$e,el,et(2,11)+Kt,Ot(Bt(xe+v)+Qt+t,Bt(xe+v)+be),Ft(xe+v),Yt,Ot(ol,`partialValues: ${t})`+Ue,Zt),rl),_(ue+v+$e,ue+v+$e,$e,et(2,12),a,a,a,dl,rl);const p=I(y+Re,Dt("valueId?: VId",G+ve+L,Ut),nt("a Value"),`<VId extends ${l}>`),b=I(v+Re,Dt(G+ve+L,"valueComponents?: {readonly [VId in "+l+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${l}) => ExtraProps`,nl,Ut),nt(Ye(2,1)));s(1,j,b,p),Z(v+Il,"{"+G+", valueComponents, getValueComponentProps"+al+"}: "+b,[oe+`(${u}(${G}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+$+"(valueId);","return <Value",`{...${ae}(getValueComponentProps, valueId)}`,"key={valueId}",W,_t,"/>;","}), separator)"],et(2,13)+ie),A(((e,t,l,n,o)=>{const d="Map"+Pt(t,1);s(0,E,d),s(1,E,d);const r=_(o+y,y,t,ut(e)+ie,a,n);_(Ee+o+y+$e,Ee+y+$e,el,ut(e,9)+Kt,Ot(Bt(y)+Qt+t+" | "+d,Bt(y)+be),Ot(n,Ft(y)),Yt,Ot(ol,`value: ${t} | ${d})`+Ue,Zt),rl),_(ue+o+y+$e,ue+y+$e,$e,ut(e,12),a,n,a,dl,rl),Z(o+y+Il,`{${G}, debugIds}: ${p}<'${e}'>`,[oe+`('' + ${r}(`+G+`) ?? '', undefined, debugIds, ${n})`],ut(e,13)+ie)})),_(v+c,v+c,Fe,et(2,8)+" changes",cl(n),il()),_(T+c,T+c,Fe,rt(10,0,1),cl(o),il()),_(y+c,y+c,Fe,rt(11,0),cl(r,`valueId: ${l} | null`),il("valueId"))}return Z(ke,`{${G}, ${G}ById, children}: `+K+" & {children: React.ReactNode}",["{",qt,"return (","<Context."+ke,"value={useMemo(",`() => [${G} ?? contextValue[0], {...contextValue[1], ...${G}ById}],`,`[${G}, ${G}ById, contextValue],`,")}>","{children}",`</Context.${ke}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...V(0),...x(),...H(0)),r(...V(1),...R(),...H(1))]},ul=(e,t,l)=>{if(q(e)&&q(t))return[a,a,a,a];const[n,o,d,r]=Wt(e,t,l);return[n,o,...$l(e,t,l,d,r)]};var pl=Object.defineProperty,bl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptors,hl=Object.getOwnPropertySymbols,gl=Object.prototype.hasOwnProperty,fl=Object.prototype.propertyIsEnumerable,ml=(e,t,l)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,wl=(e,t)=>{for(var l in t||(t={}))gl.call(t,l)&&ml(e,l,t[l]);if(hl)for(var l of hl(t))fl.call(t,l)&&ml(e,l,t[l]);return e},yl=(e,t)=>bl(e,Cl(t)),vl=(e,t,l)=>new Promise(((a,n)=>{var o=e=>{try{r(l.next(e))}catch(e){n(e)}},d=e=>{try{r(l.throw(e))}catch(e){n(e)}},r=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,d);r((l=l.apply(e,t)).next())}));const Tl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Vl=Nt((e=>{const t=()=>{const t=N(e.getTablesSchemaJson());return!q(t)||V(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=te();if(V(a,(t=>V(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=de(n,a,(()=>[B(o),te(),[0],0])),[r,s,[I]]=d,c=de(s,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),oe(s,o,c),d[3]++,r==B(o)})))))return t[l]={},Y(n,(([e,,[,n],o],d)=>{t[l][d]=wl({[s]:e},o==S(a)?{[I]:n}:{})})),1}))?t:{}},l=()=>{const t=N(e.getValuesSchemaJson());return q(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:B(l)}})),t},a=e=>ul(t(),l(),e),n=e=>vl(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 P(a(e),((e,a)=>xt(l(e,yl(wl({},Tl),{filepath:"_."+t[a]})))))}));return _({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let r=0,s=0;const I={};d(((e,l)=>{r++;let a=0;l((()=>a++)),s+=a,t&&(I[e]={rowCells:a})})),a+=r,n+=s,t&&(o[e]={tableRows:r,tableCells:s,rows:I})})),wl({totalTables:l,totalRows:a,totalCells:n,totalValues:S(e.getValueIds()),jsonLength:Rt(e.getJson())},t?{detail:{tables:o}}:{})},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=Vl},"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={});
1
+ var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="tinybase",a="",n=",",o=t(a),d=t(!0),r=t(0),s="type",I="default",c="Listener",i="get",$="add",u="Ids",p="Table",b=p+"s",C=p+u,h="Row",g=h+u,f="Sorted"+h+u,m="Cell",w=m+u,y="Value",v=y+"s",T=y+u,V=isFinite,x=(e,t)=>e instanceof t,R=e=>null==e,k=e=>e==o||e==d,P=e=>t(e)==o,S=e=>Array.isArray(e),A=e=>{const l=t(e);return k(l)||l==r&&V(e)?l:void 0},O=(e,t)=>e.every(t),E=(e,t)=>e.sort(t),D=(e,t)=>e.forEach(t),j=(e,t=a)=>e.join(t),N=(e,t)=>e.map(t),L=e=>e.length,G=(e,t)=>e.filter(t),M=(e,...t)=>e.push(...t),J=e=>e.pop(),z=(e,...t)=>e.unshift(...t),W=e=>e.shift(),B=Object,F=B.keys,U=B.freeze,_=e=>x(e,B)&&e.constructor==B,Z=(e,t)=>N(B.entries(e),(([e,l])=>t(l,e))),H=e=>L(F(e)),Q=e=>_(e)&&0==H(e),q=(e,t)=>{var l;return null!=(l=null==e?void 0:e.has(t))&&l},K=e=>{var t;return[...null!=(t=null==e?void 0:e.values())?t:[]]},X=(e,t)=>null==e?void 0:e.forEach(t),Y=(e,t)=>null==e?void 0:e.delete(t),ee=e=>new Map(e),te=(e,t)=>null==e?void 0:e.get(t),le=(e,t)=>X(e,((e,l)=>t(l,e))),ae=(e,t)=>{var l;return N([...null!=(l=null==e?void 0:e.entries())?l:[]],(([e,l])=>t(l,e)))},ne=(e,t,l)=>R(l)?(Y(e,t),e):null==e?void 0:e.set(t,l),oe=(e,t,l)=>(q(e,t)||ne(e,t,l()),te(e,t)),de=e=>e.toUpperCase(),re=e=>e.toLowerCase(),se="a ",Ie="A function for",ce=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",$e="Del",ue="Deps",pe=ue+"?: React.DependencyList",be="doRollback?: DoRollback",Ce="actions: () => Return, "+be,he="export",ge="Id",fe="Invalid",me="Json",we=re(c),ye="?: ",ve=" | undefined",Te="NonNullable",Ve="Partial",xe="Props",Re="Provider",ke=`Registers a ${we} that will be called`,Pe="Represents",Se="rowId: "+ge,Ae="Schema",Oe="Set",Ee=", descending?: boolean, offset?: number, limit?: number",De="[]",je="the Store",Ne="Transaction",Le=Ne+"Changes",Ge=re(Ne),Me="Execute a "+Ge+" to make multiple mutations",Je="Explicitly starts a "+Ge,ze="Explicitly finishes a "+Ge,We="the end of the "+Ge,Be="void",Fe=" => "+Be,Ue="WhenSet",_e=" when setting it",Ze=se+"string serialization of",He=" ",Qe="Gets a callback that can ",qe="the ",Ke=" the schema for",Xe=(e=0,t=0)=>`the ${Ct[e]}content of`+(t?He+je:a),Ye=(e=0,t,l=0)=>ut[t]+He+Xe(e,1)+(l?" when setting it":a),et=(e,t=0)=>Pe+` a Row when ${t?"s":"g"}etting ${Xe()} the '${e}' `+p,tt=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,lt=(e,t)=>`Calls a function for each ${e} in `+t,at=e=>"The props passed to a component that renders "+e,nt=e=>"A function that takes "+e,ot=(e,t=0)=>Ie+" listening to changes to "+bt[e]+" in "+bt[t],dt=(e,t,l=0)=>ke+" whenever "+bt[e]+" in "+bt[t]+" change"+(l?a:"s"),rt=e=>`the '${e}' `+p,st=e=>"the specified Row in "+rt(e),It=(e,t=0)=>ut[t]+` ${Xe()} `+rt(e),ct=(e,t=0)=>ut[t]+` ${Xe()} `+st(e),it=(e,t,l=0)=>ut[l]+` the '${t}' Cell for `+st(e),$t=(e,t=0)=>ut[t]+` the '${e}' Value`,ut=["Gets","Checks existence of","Sets","Deletes","Sets part of",Pe,"Gets "+Ze,"Sets "+Ze,ke+" whenever",Qe+"set",Qe+"add",Qe+"set part of",Qe+"delete","Renders","Gets "+Ze+Ke,"Sets"+Ke,"Deletes"+Ke],pt=[i,"has","set","del","set","forEach",$,a],bt=[je,b,qe+p+He+u,se+p,qe+h+He+u,se+h,qe+m+He+u,se+m,"invalid Cell changes",v,qe+y+He+u,se+y,"invalid Value changes",qe+"sorted "+h+He+u,qe+m+He+u+" anywhere"],Ct=[a,"tabular ","keyed value "],ht=e=>new Set(S(e)||R(e)?e:[e]),gt=(e,t)=>null==e?void 0:e.add(t),ft=/[^A-Za-z]+/,mt=/[^A-Za-z0-9]+/,wt=/^( *)\/\*\* *(.*?) *\*\/$/gm,yt=(e,t,l)=>e.substring(t,l),vt=e=>e.includes(n),Tt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return q(e,n)?Tt(e,t,l,a+1):(ne(e,n,l),n)},Vt=e=>e.replace(wt,((e,t,l)=>{const a=77-xt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),xt=e=>e.length,Rt=e=>e.flat(1e3),kt=(e,t=0)=>j(N(e.split(mt),((e,l)=>(l>0||t?de:re)(yt(e,0,1))+yt(e,1)))),Pt=e=>de(j((e&&!ft.test(e[0])?e:" "+e).split(mt),"_")),St=e=>`/** ${e}. */`,At=(...e)=>j(G(e,(e=>e)),", "),Ot=(...e)=>"{"+j(e,"; ")+"}",Et=(...e)=>Ot(...N(e,(e=>"readonly "+e))),Dt=()=>{const e=[ee(),ee(),ee(),ee()],t=ee(),l=ee(),n=e=>{const t=e.indexOf(" as ");return-1!=t?e.substring(t+4):e};return[(...e)=>j(Rt(e),"\n"),(t,l,...a)=>D(a,(a=>D([0,1],(n=>(null!=t?t:n)==n?gt(oe(e[n],l,ht),a):0)))),(e,l,n,o=a,d=1)=>Tt(t,e,[l,n,o,d]),(e,t,a)=>Tt(l,e,S(a)?[`(${t}) => {`,a,"}"]:[`(${t}) => ${a}`]),(e,t)=>te(l,e)===t?e:Tt(l,e,t),(t=0)=>N([...E(ae(e[t],((e,t)=>`import {${j(E(K(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ae(t,(([e,t,l,n],o)=>[St(t),`${n?he+" ":a}type ${o}${l} = ${e};`,a])),()=>ae(l,((e,t)=>(e=S(e)?e:[e],M(e,J(e)+";"),[`const ${t} = ${W(e)}`,e,a])))]},jt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Nt=(e,t,l)=>[t=>Z(e,((e,a)=>t(a,kt(a,1),l(Pt(a),`'${a}'`)))),(t,a)=>Z(e[t],((e,t)=>a(t,e[s],e[I],l(Pt(t),`'${t}'`),kt(t,1)))),e=>Z(t,((t,a)=>e(a,t[s],t[I],l(Pt(a),`'${a}'`),kt(a,1))))],Lt=(e,t,l,n)=>[(n,o)=>{const d=n+": "+o,r=e(b,Ot(...t((e=>`'${e}'?: {[rowId: Id]: `+Ot(...l(e,((e,t,l)=>`'${e}'${R(l)?"?":a}: ${t}`)))+"}"))),Ye(1,5)),s=e(b+Ue,Ot(...t((e=>`'${e}'?: {[rowId: Id]: `+Ot(...l(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),Ye(1,5,1)),I=e(p+ge,"keyof "+r,"A "+p+" Id in "+je),i=`<TId extends ${I}>`,$=e(p,Te+`<${r}[TId]>`,"A "+p+" in "+je,i),u=e(p+Ue,Te+`<${s}[TId]>`,"A "+p+" in "+je+_e,i),y=e(h,$+"<TId>[Id]","A "+h+" in a "+p,i),v=e(h+Ue,u+"<TId>[Id]","A "+h+" in a "+p+_e,i),T=e(m+ge,`Extract<keyof ${y}<TId>, Id>`,"A "+m+" Id in a "+h,i),V=e(m,Te+`<${r}[TId]>[Id][CId]`,"A "+m+" in a "+h,`<TId extends ${I}, CId extends ${T}<TId>>`),x=e("CellIdCellArray",`CId extends ${T}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,m+" Ids and types in a "+h,`<TId extends ${I}, CId = ${T}<TId>>`,0),k=e(m+ie,`(...[cellId, cell]: ${x}<TId>)`+Fe,nt(se+m+" Id, and "+m),i),P=e(h+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Fe+") "+Fe,nt(se+h+" Id, and a "+m+" iterator"),i),S=e(p+m+ie,`(cellId: ${T}<TId>, count: number) `+Fe,nt(se+m+" Id, and count of how many times it appears"),i),A=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${P}<TId>)${Fe}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),O=e(p+ie,`(...[tableId, forEachRow]: ${A})`+Fe,nt(se+p+" Id, and a "+h+" iterator"),a),E=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${T}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${E}) => CellChange`,Ie+" returning information about any Cell's changes during a "+Ge),j=e(b+c,`(${d}, getCellChange: ${D}${ve})`+Fe,ot(1)),N=e(C+c,`(${d})`+Fe,ot(2)),L=e(p+c,`(${d}, tableId: ${I}, getCellChange: ${D}${ve})`+Fe,ot(3)),G=e(p+w+c,`(${d}, tableId: ${I})`+Fe,ot(14,3)),M=e(g+c,`(${d}, tableId: ${I})`+Fe,ot(4,3)),J=e(f+c,"("+At(d,"tableId: "+I,"cellId: Id"+ve,"descending: boolean","offset: number","limit: number"+ve,"sortedRowIds: Ids")+")"+Fe,ot(13,3)),z=e(h+c,"("+At(""+d,"tableId: "+I,Se,`getCellChange: ${D}${ve}`)+")"+Fe,ot(5,3)),W=e(w+c,"("+At(""+d,"tableId: "+I,Se)+")"+Fe,ot(6,5)),B=e("CellListenerArgsArrayInner",`CId extends ${T}<TId> ? [${d}, tableId: TId, ${Se}, cellId: CId, newCell: ${V}<TId, CId> ${ve}, oldCell: ${V}<TId, CId> ${ve}, getCellChange: ${D} ${ve}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${T}<TId>>`,0),F=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+B+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[r,s,I,$,u,y,v,T,V,k,P,S,O,j,N,L,G,M,J,z,W,e(m+c,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${F})`+Fe,ot(7,5)),e(fe+m+c,`(${d}, tableId: Id, ${Se}, cellId: Id, invalidCells: any[])`+Fe,ot(8))]},(t,l)=>{const o=t+": "+l,d=e(v,Ot(...n(((e,t,l)=>`'${e}'${R(l)?"?":a}: ${t}`))),Ye(2,5)),r=e(v+Ue,Ot(...n(((e,t)=>`'${e}'?: ${t}`))),Ye(2,5,1)),s=e(y+ge,"keyof "+d,"A "+y+" Id in "+je),I=e(y,Te+`<${d}[VId]>`,"A "+y+" Id in "+je,`<VId extends ${s}>`),i=e("ValueIdValueArray",`VId extends ${s} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+je,`<VId = ${s}>`,0),$=e(y+ie,`(...[valueId, value]: ${i})`+Fe,nt(se+y+" Id, and "+y)),u=e("GetValueChange",`(valueId: ${s}) => ValueChange`,Ie+" returning information about any Value's changes during a "+Ge),p=e(v+c,`(${o}, getValueChange: ${u}${ve})`+Fe,ot(9)),b=e(T+c,`(${o})`+Fe,ot(10)),C=e("ValueListenerArgsArray",`VId extends ${s} ? [${o}, valueId: VId, newValue: ${I}<VId> ${ve}, oldValue: ${I}<VId> ${ve}, getValueChange: ${u} ${ve}] : never`,"Value args for ValueListener",`<VId = ${s}>`,0);return[d,r,s,I,$,p,b,e(y+c,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+Fe,ot(11)),e(fe+y+c,`(${o}, valueId: Id, invalidValues: any[])`+Fe,ot(12))]},(t,l)=>e(Ne+c,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Fe,Ie+" listening to the completion of a "+Ge)],Gt=(e,t=a,l=a)=>`store.${e}(${t})`+(l?" as "+l:a),Mt=(e,t=a)=>`fluent(() => ${Gt(e,t)})`,Jt=(e,t=a,l=a)=>`store.${e}(${t?t+", ":a}proxy(listener)${l?", "+l:a})`,zt=(e,t,n)=>{const[o,r,i,V,x,k,S,A]=Dt(),[O,E,N]=Nt(e,t,x),[L,G,J]=Lt(i,O,E,N),W=ee(),B=(e=0)=>ae(W,(([t,l,n,o,d],r)=>{const s=e?[r+`: ${d}(${t}): ${l} => ${n},`]:[r+d+`(${t}): ${l};`];return e||z(s,St(o)),M(s,a),s})),F=(e,t,l,n,o,d=a)=>Tt(W,e,[t,l,n,o,d]),U=(e,t,l,n,o,d=a,r=a,s=a)=>F(pt[e]+t+(4==e?Ve:a)+l,d,n,(n==H?Mt:Gt)(pt[e]+(4==e?Ve:a)+l,r,e?void 0:n),o,s),_=(e,t,l,n=a,o=a,d=1,r=a)=>F($+e+c,(n?n+", ":a)+we+": "+t+(d?", mutator?: boolean":a),ge,Jt($+e+c,o,d?"mutator":a),l,r),Z=`./${kt(n)}.d`,H=kt(n,1),q=kt(H),X=[],Y=ee();let oe=[],de=[];if(r(1,Z,H,`create${H} as create${H}Decl`),Q(e))r(null,l,b);else{r(0,l,"CellChange"),r(null,l,u);const[e,t,n,o,c,$,y,v,T,V,k,S,A,N,G,J,z,W,B,F,Q,le,ae]=L(q,H),de=ee();O(((e,t)=>{const l=`<'${e}'>`,a=[i(t+p,o+l,Pe+` the '${e}' `+p),i(t+p+Ue,c+l,Pe+` the '${e}' `+p+_e),i(t+h,$+l,et(e)),i(t+h+Ue,y+l,et(e,1)),i(t+m+ge,v+l,`A Cell Id for the '${e}' `+p),i(t+m+ie,V+l,nt(`a Cell Id and value from a Row in the '${e}' `+p)),i(t+h+ie,k+l,nt(`a Row Id from the '${e}' Table, and a Cell iterator`)),i(t+p+m+ie,S+l,nt(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ne(de,e,a),r(1,Z,...a)})),r(1,Z,e,t,n,v,A,N,G,J,z,W,B,F,Q,le,ae),oe=[e,t,n,v,N,G,J,z,W,B,F,Q,le,de],D([[e],[d],[H,"tables: "+t,"tables"],[H]],(([e,t,l],n)=>U(n,a,b,e,Ye(1,n),t,l))),U(0,a,C,n+De,tt(p,je)),U(5,a,p,Be,lt(p,je),"tableCallback: "+A,"tableCallback as any"),O(((e,t,l)=>{const[n,o,r,s,I,c,i,$]=te(de,e);D([[n],[d],[H,"table: "+o,", table"],[H]],(([n,o,d=a],r)=>U(r,t,p,n,It(e,r),o,l+d))),U(0,t,p+w,u,tt(m,"the whole of "+rt(e)),a,l),U(5,t,p+m,Be,lt(p+m,"the whole of "+rt(e)),"tableCellCallback: "+$,l+", tableCellCallback as any"),U(0,t,g,u,tt(h,rt(e)),a,l),U(0,t,f,u,tt(h,rt(e),1),"cellId?: "+I+Ee,l+", cellId, descending, offset, limit"),U(5,t,h,Be,lt(h,rt(e)),"rowCallback: "+i,l+", rowCallback as any"),D([[r],[d],[H,", row: "+s,", row"],[H],[H,", partialRow: "+s,", partialRow"]],(([n,o=a,d=a],r)=>U(r,t,h,n,ct(e,r),Se+o,l+", rowId"+d))),U(6,t,h,ge+ve,"Add a new Row to "+rt(e),"row: "+s+", reuseIds?: boolean",l+", row, reuseIds"),U(0,t,w,I+De,tt(m,st(e)),Se,l+", rowId"),U(5,t,m,Be,lt(m,st(e)),Se+", cellCallback: "+c,l+", rowId, cellCallback as any"),E(e,((n,o,r,s,I)=>{const c="Map"+kt(o,1);ne(Y,o,c);const i=o+(R(r)?ve:a);D([[i],[d],[H,`, cell: ${o} | `+c,", cell as any"],[H]],(([o,d=a,r=a],c)=>U(c,t+I,m,o,it(e,n,c),Se+d,l+", rowId, "+s+r))),U(1,t+I,p+m,d,ut[1]+` the '${n}' Cell anywhere in `+rt(e),a,l+", "+s)}))})),U(0,a,b+me,me,Ye(1,6)),U(2,a,b+me,H,Ye(1,7),"tablesJson: "+me,"tables"+me),_(b,N,Ye(1,8)+" changes"),_(C,G,dt(2,0,1)),_(p,J,dt(3,0),`tableId: ${n} | null`,"tableId"),_(p+w,z,dt(14,3,1),`tableId: ${n} | null`,"tableId"),_(g,W,dt(4,3,1),`tableId: ${n} | null`,"tableId"),_(f,B,dt(13,3,1),At("tableId: TId",`cellId: ${v}<TId>`+ve,"descending: boolean","offset: number","limit: number"+ve),At("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(h,F,dt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(w,Q,dt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(m,le,dt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${j(O((e=>{var t,l;return null!=(l=null==(t=te(de,e))?void 0:t[4])?l:a}))," | ")} | null`,"tableId, rowId, cellId"),_(fe+m,ae,ke+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),r(1,Z,...K(Y)),M(X,".set"+b+Ae+"({",Rt(O(((e,t,l)=>[`[${l}]: {`,...E(e,((e,t,l,n)=>`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(l)?a:`, [${x(Pt(I),`'${I}'`)}]: `+(P(l)?x(Pt(l),`'${l}'`):l)}},`)),"},"]))),"})")}if(Q(t))r(null,l,v);else{const[e,t,n,o,c,i,$,u,p]=G(q,H);r(1,Z,e,t,n,c,i,$,u,p),de=[e,t,n,i,$,u],D([[e],[d],[H,"values: "+t,"values"],[H],[H,"partialValues: "+t,"partialValues"]],(([e,t,l],n)=>U(n,a,v,e,Ye(2,n),t,l))),U(0,a,T,n+De,tt(y,je)),U(5,a,y,"void",lt(y,je),"valueCallback: "+c,"valueCallback as any"),N(((e,t,l,n,o)=>{const r="Map"+kt(t,1);ne(Y,t,r),D([[t],[d],[H,`value: ${t} | `+r,", value as any"],[H]],(([t,l,d=a],r)=>U(r,o,y,t,$t(e,r),l,n+d)))})),U(0,a,v+me,me,Ye(2,6)),U(2,a,v+me,H,Ye(2,7),"valuesJson: "+me,"values"+me),_(v,i,Ye(2,8)+" changes"),_(T,$,dt(10,0,1)),_(y,u,dt(11,0),`valueId: ${n} | null`,"valueId"),_(fe+y,p,ke+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),r(1,Z,...K(Y)),r(0,l,"ValueChange"),M(X,".set"+v+Ae+"({",N(((e,t,l,n)=>[`[${n}]: {[${x(Pt(s),`'${s}'`)}]: ${x(Pt(t),`'${t}'`)}${R(l)?a:`, [${x(Pt(I),`'${I}'`)}]: `+(P(l)?x(Pt(l),`'${l}'`):l)}},`])),"})")}U(0,a,"Content",`[${b}, ${v}]`,Ye(0,0)),U(2,a,"Content",H,Ye(0,2),`[tables, values]: [${b}, ${v}]`,"[tables, values]"),U(2,a,Le,H,`Applies a set of ${Le} to the Store`,"transactionChanges: "+Le,"transactionChanges"),le(Y,((e,t)=>i(t,`(cell: ${e}${ve}) => `+e,`Takes a ${e} Cell value and returns another`))),r(null,l,"DoRollback",ge,"IdOrNull",me,"Store",Le),r(0,l,"Get"+Le,"GetTransactionLog"),U(0,a,me,me,Ye(0,6)),U(2,a,me,H,Ye(0,7),"tablesAndValuesJson: "+me,"tablesAndValuesJson"),U(7,a,Ge,"Return",Me,Ce,"actions, doRollback","<Return>"),U(7,a,"start"+Ne,H,Je),U(7,a,"finish"+Ne,H,ze,be,"doRollback");const re=J(q,H);return _("Start"+Ne,re,ke+" just before the start of the "+Ge,a,a,0),_("WillFinish"+Ne,re,ke+" just before "+We,a,a,0),_("DidFinish"+Ne,re,ke+" just after "+We,a,a,0),U(7,a,"call"+c,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,c,H,"Remove a listener that was previously added to "+je,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",ut[0]+" the underlying Store object"),r(1,l,"createStore"),r(1,Z,H,`create${H} as create${H}Decl`,re),x("store",["createStore()",...X]),V("fluent","actions: () => Store",["actions();",`return ${q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),x(q,["{",...B(1),"}"]),[o(...k(0),...S(),he+" interface "+H+" {",...B(0),"}",a,St(`Creates a ${H} object`),he+" function create"+H+"(): "+H+";"),o(...k(1),he+" const create"+H+": typeof create"+H+"Decl = () => {",...A(),`return Object.freeze(${q});`,"};"),oe,de]},Wt=e=>i+e,Bt=e=>At(Wt(e),Wt(e)+ue),Ft="debugIds?: boolean",Ut="debugIds={debugIds}",_t="then"+pe,Zt="Parameter",Ht=": (parameter: "+Zt+", store: Store) => ",Qt="const contextValue = useContext(Context);",qt=", based on a parameter",Kt=": ",Xt="<"+Zt+",>",Yt=Zt+"ized"+ie+"<"+Zt+">",el="rowId",tl="rowId={rowId}",ll=", separator, debugIds",al="separator?: ReactElement | string",nl="then?: (store: Store",ol=At(nl+")"+Fe,_t),dl="then, then"+ue,rl=el+Kt+ge,sl="View",Il=(e,...t)=>At(...t,we+": "+e,we+pe,"mutator?: boolean"),cl=(...e)=>At(...e,we,we+ue,"mutator"),il=(e,t,n,o,d)=>{const[r,s,I,i,$,V,x,k]=Dt(),[P,S,A]=Nt(e,t,$),O=`./${kt(n)}.d`,E=`./${kt(n)}-ui-react.d`,D="tinybase/ui-react",N=kt(n,1),L=kt(N),G=N+"Or"+N+ge,J=L+"Or"+N+ge,W=L+`={${L}}`,B=ee(),F=(e,t,l,n,o,d=a)=>(s(1,E,e+" as "+e+"Decl"),Tt(B,e,[t,l,n,o,d])),U=(e,t,l,n,o,d=a)=>F("use"+e,t,l,n,o,d),_=(e,t,l,n,o=a,d=a,r=a,I=a,c=a)=>(s(1,D,`use${t} as use${t}Core`),U(e,At(o,X,I),l,le+`(${J}, use${t}Core, [`+(d||a)+(c?"], ["+c:a)+"]);",n,r)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>ae(B,(([t,l,n,o,d],r)=>{const s=e?[he+` const ${r}: typeof ${r}Decl = ${d}(${t}): ${1==l?"any":l} =>`,n]:[he+` function ${r}${d}(${t}): ${1==l?"ComponentReturnType":l};`];return e||z(s,St(o)),M(s,a),s}));s(null,l,ge,"Store",ie,Zt+"ized"+ie),s(0,D,"ComponentReturnType"),s(null,D,"ExtraProps"),s(0,O,N);const q=I(G,N+" | "+ge,`Used when you need to refer to a ${N} in a React hook or component`),K=I(Re+xe,Et(L+ye+N,L+`ById?: {[${L}Id: Id]: ${N}}`),`Used with the ${Re} component, so that a `+N+" can be passed into the context of an application");s(0,"react","ReactElement","ComponentType"),s(1,"react","React"),s(1,E,q,K);const X=J+ye+q;$("{createContext, useContext, useMemo}","React"),$("Context",`createContext<[${N}?, {[${L}Id: Id]: ${N}}?]>([])`),U("Create"+N,`create: () => ${N}, create`+pe,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=U(N,"id?: Id",N+ve,["{",Qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${N} from within a ${Re} component context`),le=i("useHook",J+`: ${q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${L} = ${Y}(${J} as Id);`,`return hook(...preParams, ((${J} == null || typeof ${J} == 'string')`,`? ${L} : ${J})?.getStore(), ...postParams)`]),ne=i("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=i("wrap",At("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("NullComponent","() => null");if(!Q(e)){const[e,t,n,d,r,$,y,v,T,V,x,k,A,D]=o;s(null,O,e,t,n,r,$,y,v,T,V,x,k,A),s(0,O,d),s(1,O,N),s(null,l,u,"IdOrNull");const G=i("tableView",`{${L}, rowComponent, getRowComponentProps`+ll+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",tl,W,Ut,"/>","))",ll,", tableId,",");"]),M=i("getDefaultTableComponent","tableId: Id",j(P(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+de),J=i("getDefaultCellComponent","tableId: Id, cellId: Id",j(P(((e,t,l)=>`tableId == ${l} ? ${j(S(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+de} : `)))+de);_(b,b,e,Ye(1,0)+ce);const z=_(C,C,n+De,tt(p,je)+ce);_(Oe+b+ie,Oe+b+ie,Yt,Ye(1,9)+qt,At(Wt(b)+Ht+t,Wt(b)+pe),Bt(b),Xt,At(nl,`tables: ${t})`+Fe,_t),dl),_($e+b+ie,$e+b+ie,ie,Ye(1,12),a,a,a,ol,dl);const B=I(m+xe,Et("tableId?: TId","rowId: Id","cellId?: CId",L+ye+N,Ft),at(se+m),`<TId extends ${n}, CId extends ${d}<TId>>`),F=I(h+xe,Et("tableId?: TId","rowId: Id",L+ye+N,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${B}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,al,Ft),at(se+h),`<TId extends ${n}>`),U=I(p+xe,Et("tableId?: TId",L+ye+N,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps",al,Ft),at(se+p),`<TId extends ${n}>`),H=I("Sorted"+p+xe,Et("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",L+ye+N,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps",al,Ft),at(se+"sorted "+p),`<TId extends ${n}>`),Q=I(b+xe,Et(L+ye+N,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${U}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,al,Ft),at(Xe(1,1)));s(1,E,Q,U,H,F,B),Z(b+sl,"{"+L+", tableComponents, getTableComponentProps"+ll+"}: "+Q,[oe+`(${z}(${L}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+M+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",W,Ut,"/>;","}), separator)"],Ye(1,13)+ce),P(((e,t,l)=>{const[n,o,d,r,I]=te(D,e);s(null,O,n,o,d,r,I),_(t+p,p,n,It(e)+ce,a,l),_(t+p+w,p+w,u,tt(m,"the whole of "+rt(e))+ce,a,l);const c=_(t+g,g,u,tt(h,rt(e))+ce,a,l),i=_(t+f,f,u,tt(h,rt(e),1)+ce,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",l+", cellId, descending, offset, limit");_(t+h,h,d,ct(e)+ce,rl,At(l,el));const $=_(t+w,w,I+De,tt(m,st(e))+ce,rl,At(l,el));_(Oe+t+p+ie,Oe+p+ie,Yt,It(e,9)+qt,At(Wt(p)+Ht+o,Wt(p)+pe),At(l,Bt(p)),Xt,At(nl,`table: ${o})`+Fe,_t),dl),_($e+t+p+ie,$e+p+ie,ie,It(e,12),a,l,a,ol,dl),_(Oe+t+h+ie,Oe+h+ie,Yt,ct(e,9)+qt,At(rl,Wt(h)+Ht+r,Wt(h)+pe),At(l,el,Bt(h)),Xt,At(nl,`row: ${r})`+Fe,_t),dl),_("Add"+t+h+ie,"Add"+h+ie,Yt,ct(e,10)+qt,At(Wt(h)+Ht+r,Wt(h)+pe),At(l,Bt(h)),Xt,"then?: ("+At(rl+ve,"store: Store","row: "+r+")"+Fe,"then"+pe)+", reuseRowIds?: boolean",dl+", reuseRowIds"),_(Oe+t+Ve+h+ie,Oe+Ve+h+ie,Yt,ct(e,11)+qt,At(rl,Wt(Ve+h)+Ht+r,Wt(Ve+h)+pe),At(l,el,Bt(Ve+h)),Xt,At(nl,`partialRow: ${r})`+Fe,_t),dl),_($e+t+h+ie,$e+h+ie,ie,ct(e,12),rl,At(l,el),a,ol,dl);const b=Z(t+h+sl,"{rowId, "+L+", cellComponents, getCellComponentProps"+ll+`}: ${F}<'${e}'>`,[oe+`(${$}(rowId, ${L}).map((cellId) => {`,"const Cell = (cellComponents?.[cellId] ?? "+J+`(${l}, cellId)) as React.ComponentType<CellProps<typeof `+l+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${l}}`,tl,"cellId={cellId}",W,Ut,"/>;","})"+ll+", rowId)"],ct(e,13)+ce);Z(t+"Sorted"+p+sl,"{cellId, descending, offset, limit, ...props}: "+H+`<'${e}'>`,G+"(props, "+i+`(cellId, descending, offset, limit, props.${L}), ${l}, ${b});`,It(e,13)+", sorted"+ce),Z(t+p+sl,`props: ${U}<'${e}'>`,G+"(props, "+c+`(props.${L}), ${l}, ${b});`,It(e,13)+ce),S(e,((n,o,d,r,I)=>{const c="Map"+kt(o,1);s(0,O,c),s(1,O,c);const i=_(t+I+m,m,o+(R(d)?ve:a),it(e,n)+ce,rl,At(l,el,r));_(Oe+t+I+m+ie,Oe+m+ie,Yt,it(e,n,9)+qt,At(rl,Wt(m)+Ht+o+" | "+c,Wt(m)+pe),At(l,el,r,Bt(m)),Xt,At(nl,`cell: ${o} | ${c})`+Fe,_t),dl),_($e+t+I+m+ie,$e+m+ie,ie,it(e,n,12),At(rl,"forceDel?: boolean"),At(l,el,r,"forceDel"),a,ol,dl),Z(t+I+m+sl,`{rowId, ${L}, debugIds}: `+B+`<'${e}', '${n}'>`,[oe+`('' + ${i}(rowId, `+L+`) ?? '', undefined, debugIds, ${r})`],it(e,n,13)+ce)}))}));const q=j(P((e=>{var t,l;return null!=(l=null==(t=te(D,e))?void 0:t[4])?l:a}))," | ");_(b+c,b+c,Be,Ye(1,8)+" changes",Il(r),cl()),_(C+c,C+c,Be,dt(2,0,1),Il($),cl()),_(p+c,p+c,Be,dt(3,0),Il(y,`tableId: ${n} | null`),cl("tableId")),_(p+w+c,p+w+c,Be,dt(14,3,1),Il(v,`tableId: ${n} | null`),cl("tableId")),_(g+c,g+c,Be,dt(4,3,1),Il(T,`tableId: ${n} | null`),cl("tableId")),_(f+c,f+c,Be,dt(13,3,1),Il(V,`tableId: ${n} | null`,"cellId: "+q+ve,"descending: boolean","offset: number","limit: number"+ve),cl("tableId","cellId","descending","offset","limit")),_(h+c,h+c,Be,dt(5,3),Il(x,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(w+c,w+c,Be,dt(6,5,1),Il(k,`tableId: ${n} | null`,el+": IdOrNull"),cl("tableId",el)),_(m+c,m+c,Be,dt(7,5),Il(A,`tableId: ${n} | null`,el+": IdOrNull",`cellId: ${q} | null`),cl("tableId",el,"cellId"))}if(!Q(t)){const[e,t,l,n,o,r]=d;s(null,O,...d),s(1,O,N);const $=i("getDefaultValueComponent","valueId: Id",j(A(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+de);_(v,v,e,Ye(2,0)+ce);const u=_(T,T,l+De,tt(y,je)+ce);_(Oe+v+ie,Oe+v+ie,Yt,Ye(2,9)+qt,At(Wt(v)+Ht+t,Wt(v)+pe),Bt(v),Xt,At(nl,`values: ${t})`+Fe,_t),dl),_(Oe+Ve+v+ie,Oe+Ve+v+ie,Yt,Ye(2,11)+qt,At(Wt(Ve+v)+Ht+t,Wt(Ve+v)+pe),Bt(Ve+v),Xt,At(nl,`partialValues: ${t})`+Fe,_t),dl),_($e+v+ie,$e+v+ie,ie,Ye(2,12),a,a,a,ol,dl);const p=I(y+xe,Et("valueId?: VId",L+ye+N,Ft),at("a Value"),`<VId extends ${l}>`),b=I(v+xe,Et(L+ye+N,"valueComponents?: {readonly [VId in "+l+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${l}) => ExtraProps`,al,Ft),at(Xe(2,1)));s(1,E,b,p),Z(v+sl,"{"+L+", valueComponents, getValueComponentProps"+ll+"}: "+b,[oe+`(${u}(${L}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+$+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",W,Ut,"/>;","}), separator)"],Ye(2,13)+ce),A(((e,t,l,n,o)=>{const d="Map"+kt(t,1);s(0,O,d),s(1,O,d);const r=_(o+y,y,t,$t(e)+ce,a,n);_(Oe+o+y+ie,Oe+y+ie,Yt,$t(e,9)+qt,At(Wt(y)+Ht+t+" | "+d,Wt(y)+pe),At(n,Bt(y)),Xt,At(nl,`value: ${t} | ${d})`+Fe,_t),dl),_($e+o+y+ie,$e+y+ie,ie,$t(e,12),a,n,a,ol,dl),Z(o+y+sl,`{${L}, debugIds}: ${p}<'${e}'>`,[oe+`('' + ${r}(`+L+`) ?? '', undefined, debugIds, ${n})`],$t(e,13)+ce)})),_(v+c,v+c,Be,Ye(2,8)+" changes",Il(n),cl()),_(T+c,T+c,Be,dt(10,0,1),Il(o),cl()),_(y+c,y+c,Be,dt(11,0),Il(r,`valueId: ${l} | null`),cl("valueId"))}return Z(Re,`{${L}, ${L}ById, children}: `+K+" & {children: React.ReactNode}",["{",Qt,"return (","<Context."+Re,"value={useMemo(",`() => [${L} ?? contextValue[0], {...contextValue[1], ...${L}ById}],`,`[${L}, ${L}ById, contextValue],`,")}>","{children}",`</Context.${Re}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...V(0),...x(),...H(0)),r(...V(1),...k(),...H(1))]},$l=(e,t,l)=>{if(Q(e)&&Q(t))return[a,a,a,a];const[n,o,d,r]=zt(e,t,l);return[n,o,...il(e,t,l,d,r)]},ul=JSON.parse;var pl=Object.defineProperty,bl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptors,hl=Object.getOwnPropertySymbols,gl=Object.prototype.hasOwnProperty,fl=Object.prototype.propertyIsEnumerable,ml=(e,t,l)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,wl=(e,t)=>{for(var l in t||(t={}))gl.call(t,l)&&ml(e,l,t[l]);if(hl)for(var l of hl(t))fl.call(t,l)&&ml(e,l,t[l]);return e},yl=(e,t)=>bl(e,Cl(t)),vl=(e,t,l)=>new Promise(((a,n)=>{var o=e=>{try{r(l.next(e))}catch(e){n(e)}},d=e=>{try{r(l.throw(e))}catch(e){n(e)}},r=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,d);r((l=l.apply(e,t)).next())}));const Tl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Vl=jt((e=>{const t=()=>{const t=ul(e.getTablesSchemaJson());return!Q(t)||O(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=ee();if(O(a,(t=>O(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=oe(n,a,(()=>[A(o),ee(),[0],0])),[r,s,[I]]=d,c=oe(s,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),ne(s,o,c),d[3]++,r==A(o)})))))return t[l]={},X(n,(([e,,[,n],o],d)=>{t[l][d]=wl({[s]:e},o==L(a)?{[I]:n}:{})})),1}))?t:{}},l=()=>{const t=ul(e.getValuesSchemaJson());return Q(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:A(l)}})),t},a=e=>$l(t(),l(),e),n=e=>vl(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 N(a(e),((e,a)=>Vt(l(e,yl(wl({},Tl),{filepath:"_."+t[a]})))))}));return U({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let r=0,s=0;const I={};d(((e,l)=>{r++;let a=0;l((()=>a++)),s+=a,t&&(I[e]={rowCells:a})})),a+=r,n+=s,t&&(o[e]={tableRows:r,tableCells:s,rows:I})})),wl({totalTables:l,totalRows:a,totalCells:n,totalValues:L(e.getValueIds()),jsonLength:xt(e.getJson())},t?{detail:{tables:o}}:{})},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=Vl},"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,l="",o=t(l),r="Ids",u="Table",n=u+"s",d=u+r,i="Row",a=i+r,c="Sorted"+i+r,I="Cell",w=I+r,p="Value",b=p+"s",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)==o,m=()=>{},{createContext:y,useContext:h}=s,f=y([]),L=(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},V=(e,s)=>{const t=L(e,s);return k(e)||g(e)?t:e},S=e=>V(e,0),T=e=>V(e,2),P=e=>V(e,4),x=e=>V(e,6),q=e=>V(e,8),O=e=>V(e,10),{useCallback:B,useEffect:M,useMemo:j,useRef:D,useState:A}=s,E=(e,s,t=[])=>{const l=j((()=>s(e)),[e,...t]);return M((()=>()=>l.destroy()),[l]),l},F=(e,s,t,l=[],o)=>{const[,r]=A(),u=B((()=>{var o,r;return null!=(r=null==(o=null==s?void 0:s["get"+e])?void 0:o.call(s,...l))?r:t}),[s,...l]),[n]=A(u),d=D(n);return j((()=>d.current=u()),[u]),G(e,s,((...e)=>{d.current=k(o)?u():e[o],r([])}),[],l),d.current},G=(e,s,t,l=[],o=[],...r)=>M((()=>{var l;const u=null==(l=null==s?void 0:s["add"+e+"Listener"])?void 0:l.call(s,...o,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...o,...l,...r]),Q=(e,s,t,l=[],o=m,r=[],...u)=>{const n=S(e);return B((e=>v(n,(l=>v(t(e,l),(e=>o(l["set"+s](...u,e),e)))))),[n,s,...l,...r,...u])},U=(e,s,t=m,l=[],...o)=>{const r=S(e);return B((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},z=(e,s,t)=>{const l=O(e);return B((()=>null==l?void 0:l[s](t)),[l,s,t])},H=e=>F(d,S(e),[],[]),J=(e,s)=>F(a,S(s),[],[e]),K=(e,s,t,l=0,o,r)=>F(c,S(r),[],[e,s,t,l,o],6),N=(e,s,t)=>F(w,S(t),[],[e,s]),W=(e,s,t,l)=>F(I,S(l),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]),le=(e,s)=>F("ResultRowIds",q(s),[],[e]),oe=(e,s,t,l=0,o,r)=>F("ResultSortedRowIds",q(r),[],[e,s,t,l,o],6),re=(e,s,t)=>F("ResultCellIds",q(t),[],[e,s]),ue=(e,s,t,l)=>F("ResultCell",q(l),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 l in e)be.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&pe)for(var l of pe(e))s.indexOf(l)<0&&Re.call(e,l)&&(t[l]=e[l]);return t};const{createElement:me,useMemo:ye}=s,he=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:l,separator:o,debugIds:r},u)=>Pe(C(u,(o=>me(t,ve(ke({},Te(l,o)),{key:o,tableId:e,rowId:o,store:s,debugIds:r})))),o,r,e),fe=({queryId:e,queries:s,resultRowComponent:t=De,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Pe(C(u,(o=>me(t,ve(ke({},Te(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Le=e=>{const s=x(e);return[s,null==s?void 0:s.getStore()]},Ve=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i]=Le(s),a=null==d?void 0:d.getLocalTableId(e),c=u(e,n,d);return Pe(C(c,(e=>me(t,ve(ke({},Te(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},Se=e=>({checkpoints:s,checkpointComponent:t=Ae,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=O(s);return Pe(C(e(ne(u)),(e=>me(t,ve(ke({},Te(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Te=(e,s)=>k(e)?{}:e(s),Pe=(e,s,t,l)=>{const o=k(s)||!Array.isArray(e)?e:C(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},xe=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Pe(l+(null!=(u=W(e,s,t,o))?u:l),void 0,r,t)},qe=({tableId:e,rowId:s,store:t,cellComponent:l=xe,getCellComponentProps:o,separator:r,debugIds:u})=>Pe(C(N(e,s,t),(r=>me(l,ve(ke({},Te(o,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 o;return Pe(l+(null!=(o=Y(e,s))?o:l),void 0,t,e)},Me=({indexId:e,sliceId:s,indexes:t,rowComponent:l=qe,getRowComponentProps:o,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(l,ve(ke({},Te(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},je=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Pe(l+(null!=(u=ue(e,s,t,o))?u:l),void 0,r,t)},De=({queryId:e,rowId:s,queries:t,resultCellComponent:l=je,getResultCellComponentProps:o,separator:r,debugIds:u})=>Pe(C(re(e,s,t),(r=>me(l,ve(ke({},Te(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ae=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Pe(null!=(o=de(s,e))?o:l,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:l,separator:o,debugIds:r})=>Pe(C($(e,s),(o=>me(t,ve(ke({},Te(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Ve(e,te,e.firstRowId),e.LocalRowsView=e=>Ve(e,se,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Pe(null!=(o=Z(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:l,metricsById:o,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!=l?l:p[2],ke(ke({},p[3]),o),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,l,o,r,u,n,d,i,a,c,I,p])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=qe,getRowComponentProps:o,debugIds:r})=>{const[u,n]=Le(t),d=null==u?void 0:u.getRemoteTableId(e),i=ee(e,s,u);return Pe(k(d)||k(i)?null:me(l,ve(ke({},Te(o,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:l,offset:o,limit:r}=s,u=ge(s,["cellId","descending","offset","limit"]);return fe(u,oe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>fe(e,le(e.queryId,e.queries)),e.RowView=qe,e.SliceView=Me,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ge(s,["cellId","descending","offset","limit"]);return he(u,K(u.tableId,t,l,o,r,u.store))},e.TableView=Oe,e.TablesView=({store:e,tableComponent:s=Oe,getTableComponentProps:t,separator:l,debugIds:o})=>Pe(C(H(e),(l=>me(s,ve(ke({},Te(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=Be,e.ValuesView=({store:e,valueComponent:s=Be,getValueComponentProps:t,separator:l,debugIds:o})=>Pe(C(X(e),(l=>me(s,ve(ke({},Te(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.tableView=he,e.useAddRowCallback=(e,s,t=[],l,o=m,r=[],u=!0)=>{const n=S(l);return B((t=>v(n,(l=>v(s(t,l),(s=>o(l.addRow(e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=W,e.useCellIds=N,e.useCellIdsListener=(e,s,t,l,o,r)=>G(w,S(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>G(I,S(u),l,o,[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,l)=>G("Checkpoint",O(l),s,t,[e]),e.useCheckpoints=e=>L(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=[],l,o=[])=>{const[,r]=A(),u=j((()=>s(e)),[e,...t]);return M((()=>{var e;return e=function*(){yield null==l?void 0:l(u),r(1)},new Promise(((s,t)=>{var l=s=>{try{r(e.next(s))}catch(e){t(e)}},o=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(l,o);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...o]),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,l,o,r,u)=>U(o,I,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>U(t,i,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>U(s,u,t,l,e),e.useDelTablesCallback=(e,s,t)=>U(e,n,s,t),e.useDelValueCallback=(e,s,t,l)=>U(s,p,t,l,e),e.useDelValuesCallback=(e,s,t)=>U(e,b,s,t),e.useGoBackwardCallback=ie,e.useGoForwardCallback=ae,e.useGoToCallback=(e,s=[],t,l=m,o=[])=>{const r=O(t);return B((s=>v(r,(t=>v(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useIndexes=e=>L(e,4),e.useLinkedRowIds=te,e.useLinkedRowIdsListener=(e,s,t,l,o)=>G("LinkedRowIds",x(o),t,l,[e,s]),e.useLocalRowIds=se,e.useLocalRowIdsListener=(e,s,t,l,o)=>G("LocalRowIds",x(o),t,l,[e,s]),e.useMetric=Z,e.useMetricListener=(e,s,t,l)=>G("Metric",T(l),s,t,[e]),e.useMetrics=e=>L(e,2),e.useQueries=e=>L(e,8),e.useRedoInformation=e=>{var s;const t=O(e),[,,[o]]=ne(t);return[!k(o),ae(t),o,null!=(s=v(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationships=e=>L(e,6),e.useRemoteRowId=ee,e.useRemoteRowIdListener=(e,s,t,l,o)=>G("RemoteRowId",x(o),t,l,[e,s]),e.useResultCell=ue,e.useResultCellIds=re,e.useResultCellIdsListener=(e,s,t,l,o)=>G("ResultCellIds",q(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>G("ResultCell",q(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>F("ResultRow",q(t),{},[e,s]),e.useResultRowIds=le,e.useResultRowIdsListener=(e,s,t,l)=>G("ResultRowIds",q(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>G("ResultRow",q(o),t,l,[e,s]),e.useResultSortedRowIds=oe,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,n)=>G("ResultSortedRowIds",q(n),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>F("ResultTable",q(s),{},[e]),e.useResultTableListener=(e,s,t,l)=>G("ResultTable",q(l),s,t,[e]),e.useRow=(e,s,t)=>F(i,S(t),{},[e,s]),e.useRowIds=J,e.useRowIdsListener=(e,s,t,l,o)=>G(a,S(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>G(i,S(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>Q(r,I,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,l=m,o=[])=>{const r=O(t);return B((s=>v(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>Q(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>Q(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>Q(o,i,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>Q(l,u,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>Q(t,n,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>Q(l,p,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>Q(t,b,e,s,l,o),e.useSliceIds=$,e.useSliceIdsListener=(e,s,t,l)=>G("SliceIds",P(l),s,t,[e]),e.useSliceRowIds=_,e.useSliceRowIdsListener=(e,s,t,l,o)=>G("SliceRowIds",P(o),t,l,[e,s]),e.useSortedRowIds=K,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>G(c,S(d),r,u,[e,s,t,l,o],n),e.useStore=e=>L(e,0),e.useTable=(e,s)=>F(u,S(s),{},[e]),e.useTableCellIds=(e,s)=>F(u+w,S(s),[],[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>G(u+w,S(o),s,t,[e],l),e.useTableIds=H,e.useTableIdsListener=(e,s,t,l)=>G(d,S(l),e,s,[],t),e.useTableListener=(e,s,t,l,o)=>G(u,S(o),s,t,[e],l),e.useTables=e=>F(n,S(e),{}),e.useTablesListener=(e,s,t,l)=>G(n,S(l),e,s,[],t),e.useUndoInformation=e=>{var s;const t=O(e),[o,r]=ne(t);return[(u=o,!(0==(e=>e.length)(u))),ie(t),r,null!=(s=v(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Y,e.useValueIds=X,e.useValueIdsListener=(e,s,t,l)=>G(R,S(l),e,s,[],t),e.useValueListener=(e,s,t,l,o)=>G(p,S(o),s,t,[e],l),e.useValues=e=>F(b,S(e),{}),e.useValuesListener=(e,s,t,l)=>G(b,S(l),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,l="",o=t(l),r="Ids",u="Table",n=u+"s",d=u+r,i="Row",a=i+r,c="Sorted"+i+r,I="Cell",w=I+r,p="Value",b=p+"s",R=p+r,C=e=>null==e,k=(e,s,t)=>C(e)?null==t?void 0:t():s(e),v=e=>t(e)==o,g=()=>{},m=(e,s)=>e.map(s),{createContext:y,useContext:h}=s,f=y([]),L=(e,s)=>{const t=h(f);return C(e)?t[s]:v(e)?((e,s)=>k(e,(e=>e[s])))(t[s+1],e):e},V=(e,s)=>{const t=L(e,s);return C(e)||v(e)?t:e},S=e=>V(e,0),T=e=>V(e,2),P=e=>V(e,4),x=e=>V(e,6),q=e=>V(e,8),O=e=>V(e,10),{useCallback:B,useEffect:M,useMemo:j,useRef:D,useState:A}=s,E=(e,s,t=[])=>{const l=j((()=>s(e)),[e,...t]);return M((()=>()=>l.destroy()),[l]),l},F=(e,s,t,l=[],o)=>{const[,r]=A(),u=B((()=>{var o,r;return null!=(r=null==(o=null==s?void 0:s["get"+e])?void 0:o.call(s,...l))?r:t}),[s,...l]),[n]=A(u),d=D(n);return j((()=>d.current=u()),[u]),G(e,s,((...e)=>{d.current=C(o)?u():e[o],r([])}),[],l),d.current},G=(e,s,t,l=[],o=[],...r)=>M((()=>{var l;const u=null==(l=null==s?void 0:s["add"+e+"Listener"])?void 0:l.call(s,...o,t,...r);return()=>null==s?void 0:s.delListener(u)}),[s,...o,...l,...r]),Q=(e,s,t,l=[],o=g,r=[],...u)=>{const n=S(e);return B((e=>k(n,(l=>k(t(e,l),(e=>o(l["set"+s](...u,e),e)))))),[n,s,...l,...r,...u])},U=(e,s,t=g,l=[],...o)=>{const r=S(e);return B((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},z=(e,s,t)=>{const l=O(e);return B((()=>null==l?void 0:l[s](t)),[l,s,t])},H=e=>F(d,S(e),[],[]),J=(e,s)=>F(a,S(s),[],[e]),K=(e,s,t,l=0,o,r)=>F(c,S(r),[],[e,s,t,l,o],6),N=(e,s,t)=>F(w,S(t),[],[e,s]),W=(e,s,t,l)=>F(I,S(l),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]),le=(e,s)=>F("ResultRowIds",q(s),[],[e]),oe=(e,s,t,l=0,o,r)=>F("ResultSortedRowIds",q(r),[],[e,s,t,l,o],6),re=(e,s,t)=>F("ResultCellIds",q(t),[],[e,s]),ue=(e,s,t,l)=>F("ResultCell",q(l),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 l in e)be.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&pe)for(var l of pe(e))s.indexOf(l)<0&&Re.call(e,l)&&(t[l]=e[l]);return t};const{createElement:me,useMemo:ye}=s,he=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:l,separator:o,debugIds:r},u)=>Pe(m(u,(o=>me(t,ve(ke({},Te(l,o)),{key:o,tableId:e,rowId:o,store:s,debugIds:r})))),o,r,e),fe=({queryId:e,queries:s,resultRowComponent:t=De,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Pe(m(u,(o=>me(t,ve(ke({},Te(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Le=e=>{const s=x(e);return[s,null==s?void 0:s.getStore()]},Ve=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i]=Le(s),a=null==d?void 0:d.getLocalTableId(e),c=u(e,n,d);return Pe(m(c,(e=>me(t,ve(ke({},Te(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},Se=e=>({checkpoints:s,checkpointComponent:t=Ae,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=O(s);return Pe(m(e(ne(u)),(e=>me(t,ve(ke({},Te(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Te=(e,s)=>C(e)?{}:e(s),Pe=(e,s,t,l)=>{const o=C(s)||!Array.isArray(e)?e:m(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},xe=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Pe(l+(null!=(u=W(e,s,t,o))?u:l),void 0,r,t)},qe=({tableId:e,rowId:s,store:t,cellComponent:l=xe,getCellComponentProps:o,separator:r,debugIds:u})=>Pe(m(N(e,s,t),(r=>me(l,ve(ke({},Te(o,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 o;return Pe(l+(null!=(o=Y(e,s))?o:l),void 0,t,e)},Me=({indexId:e,sliceId:s,indexes:t,rowComponent:l=qe,getRowComponentProps:o,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(m(a,(e=>me(l,ve(ke({},Te(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},je=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Pe(l+(null!=(u=ue(e,s,t,o))?u:l),void 0,r,t)},De=({queryId:e,rowId:s,queries:t,resultCellComponent:l=je,getResultCellComponentProps:o,separator:r,debugIds:u})=>Pe(m(re(e,s,t),(r=>me(l,ve(ke({},Te(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ae=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Pe(null!=(o=de(s,e))?o:l,void 0,t,s)},Ee=Se((e=>e[0])),Fe=Se((e=>C(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:l,separator:o,debugIds:r})=>Pe(m($(e,s),(o=>me(t,ve(ke({},Te(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Ve(e,te,e.firstRowId),e.LocalRowsView=e=>Ve(e,se,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Pe(null!=(o=Z(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:l,metricsById:o,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!=l?l:p[2],ke(ke({},p[3]),o),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,l,o,r,u,n,d,i,a,c,I,p])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=qe,getRowComponentProps:o,debugIds:r})=>{const[u,n]=Le(t),d=null==u?void 0:u.getRemoteTableId(e),i=ee(e,s,u);return Pe(C(d)||C(i)?null:me(l,ve(ke({},Te(o,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:l,offset:o,limit:r}=s,u=ge(s,["cellId","descending","offset","limit"]);return fe(u,oe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>fe(e,le(e.queryId,e.queries)),e.RowView=qe,e.SliceView=Me,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ge(s,["cellId","descending","offset","limit"]);return he(u,K(u.tableId,t,l,o,r,u.store))},e.TableView=Oe,e.TablesView=({store:e,tableComponent:s=Oe,getTableComponentProps:t,separator:l,debugIds:o})=>Pe(m(H(e),(l=>me(s,ve(ke({},Te(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=Be,e.ValuesView=({store:e,valueComponent:s=Be,getValueComponentProps:t,separator:l,debugIds:o})=>Pe(m(X(e),(l=>me(s,ve(ke({},Te(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.tableView=he,e.useAddRowCallback=(e,s,t=[],l,o=g,r=[],u=!0)=>{const n=S(l);return B((t=>k(n,(l=>k(s(t,l),(s=>o(l.addRow(e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=W,e.useCellIds=N,e.useCellIdsListener=(e,s,t,l,o,r)=>G(w,S(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>G(I,S(u),l,o,[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,l)=>G("Checkpoint",O(l),s,t,[e]),e.useCheckpoints=e=>L(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=[],l,o=[])=>{const[,r]=A(),u=j((()=>s(e)),[e,...t]);return M((()=>{var e;return e=function*(){yield null==l?void 0:l(u),r(1)},new Promise(((s,t)=>{var l=s=>{try{r(e.next(s))}catch(e){t(e)}},o=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(l,o);r((e=e.apply(void 0,null)).next())})),()=>{u.destroy()}}),[u,...o]),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,l,o,r,u)=>U(o,I,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>U(t,i,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>U(s,u,t,l,e),e.useDelTablesCallback=(e,s,t)=>U(e,n,s,t),e.useDelValueCallback=(e,s,t,l)=>U(s,p,t,l,e),e.useDelValuesCallback=(e,s,t)=>U(e,b,s,t),e.useGoBackwardCallback=ie,e.useGoForwardCallback=ae,e.useGoToCallback=(e,s=[],t,l=g,o=[])=>{const r=O(t);return B((s=>k(r,(t=>k(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useIndexes=e=>L(e,4),e.useLinkedRowIds=te,e.useLinkedRowIdsListener=(e,s,t,l,o)=>G("LinkedRowIds",x(o),t,l,[e,s]),e.useLocalRowIds=se,e.useLocalRowIdsListener=(e,s,t,l,o)=>G("LocalRowIds",x(o),t,l,[e,s]),e.useMetric=Z,e.useMetricListener=(e,s,t,l)=>G("Metric",T(l),s,t,[e]),e.useMetrics=e=>L(e,2),e.useQueries=e=>L(e,8),e.useRedoInformation=e=>{var s;const t=O(e),[,,[o]]=ne(t);return[!C(o),ae(t),o,null!=(s=k(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationships=e=>L(e,6),e.useRemoteRowId=ee,e.useRemoteRowIdListener=(e,s,t,l,o)=>G("RemoteRowId",x(o),t,l,[e,s]),e.useResultCell=ue,e.useResultCellIds=re,e.useResultCellIdsListener=(e,s,t,l,o)=>G("ResultCellIds",q(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>G("ResultCell",q(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>F("ResultRow",q(t),{},[e,s]),e.useResultRowIds=le,e.useResultRowIdsListener=(e,s,t,l)=>G("ResultRowIds",q(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>G("ResultRow",q(o),t,l,[e,s]),e.useResultSortedRowIds=oe,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,n)=>G("ResultSortedRowIds",q(n),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>F("ResultTable",q(s),{},[e]),e.useResultTableListener=(e,s,t,l)=>G("ResultTable",q(l),s,t,[e]),e.useRow=(e,s,t)=>F(i,S(t),{},[e,s]),e.useRowIds=J,e.useRowIdsListener=(e,s,t,l,o)=>G(a,S(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>G(i,S(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>Q(r,I,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=g,s=[],t,l=g,o=[])=>{const r=O(t);return B((s=>k(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>Q(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>Q(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>Q(o,i,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>Q(l,u,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>Q(t,n,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>Q(l,p,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>Q(t,b,e,s,l,o),e.useSliceIds=$,e.useSliceIdsListener=(e,s,t,l)=>G("SliceIds",P(l),s,t,[e]),e.useSliceRowIds=_,e.useSliceRowIdsListener=(e,s,t,l,o)=>G("SliceRowIds",P(o),t,l,[e,s]),e.useSortedRowIds=K,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>G(c,S(d),r,u,[e,s,t,l,o],n),e.useStore=e=>L(e,0),e.useTable=(e,s)=>F(u,S(s),{},[e]),e.useTableCellIds=(e,s)=>F(u+w,S(s),[],[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>G(u+w,S(o),s,t,[e],l),e.useTableIds=H,e.useTableIdsListener=(e,s,t,l)=>G(d,S(l),e,s,[],t),e.useTableListener=(e,s,t,l,o)=>G(u,S(o),s,t,[e],l),e.useTables=e=>F(n,S(e),{}),e.useTablesListener=(e,s,t,l)=>G(n,S(l),e,s,[],t),e.useUndoInformation=e=>{var s;const t=O(e),[o,r]=ne(t);return[(u=o,!(0==(e=>e.length)(u))),ie(t),r,null!=(s=k(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Y,e.useValueIds=X,e.useValueIdsListener=(e,s,t,l)=>G(R,S(l),e,s,[],t),e.useValueListener=(e,s,t,l,o)=>G(p,S(o),s,t,[e],l),e.useValues=e=>F(b,S(e),{}),e.useValuesListener=(e,s,t,l)=>G(b,S(l),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": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -211,80 +211,80 @@
211
211
  },
212
212
  "devDependencies": {
213
213
  "@automerge/automerge": "^2.1.0-alpha.6",
214
- "@babel/cli": "^7.22.5",
215
- "@babel/core": "^7.22.5",
216
- "@babel/preset-env": "^7.22.5",
214
+ "@babel/cli": "^7.22.9",
215
+ "@babel/core": "^7.22.9",
216
+ "@babel/preset-env": "^7.22.9",
217
217
  "@babel/preset-react": "^7.22.5",
218
218
  "@babel/preset-typescript": "^7.22.5",
219
219
  "@rollup/plugin-replace": "^5.0.2",
220
220
  "@rollup/plugin-terser": "^0.4.3",
221
- "@sqlite.org/sqlite-wasm": "^3.42.0-build2",
221
+ "@sqlite.org/sqlite-wasm": "^3.42.0-build4",
222
222
  "@types/asciichart": "^1.5.6",
223
223
  "@types/expect-puppeteer": "^5.0.3",
224
224
  "@types/http-server": "^0.12.1",
225
- "@types/jest": "^29.5.2",
225
+ "@types/jest": "^29.5.3",
226
226
  "@types/jest-environment-puppeteer": "^5.0.3",
227
227
  "@types/less": "^3.0.3",
228
- "@types/node": "^20.3.2",
228
+ "@types/node": "^20.4.5",
229
229
  "@types/puppeteer": "^5.4.7",
230
- "@types/react": "^18.2.14",
231
- "@types/react-dom": "^18.2.6",
230
+ "@types/react": "^18.2.17",
231
+ "@types/react-dom": "^18.2.7",
232
232
  "@types/react-test-renderer": "^18.0.0",
233
233
  "@types/tmp": "^0.2.3",
234
- "@typescript-eslint/eslint-plugin": "^5.60.1",
235
- "@typescript-eslint/parser": "^5.60.1",
236
- "@vlcn.io/crsqlite-wasm": "^0.13.0",
234
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
235
+ "@typescript-eslint/parser": "^6.2.0",
236
+ "@vlcn.io/crsqlite-wasm": "^0.14.0",
237
237
  "asciichart": "^1.5.25",
238
238
  "automerge-repo": "^0.1.0",
239
239
  "babel-eslint": "^10.1.0",
240
- "babel-jest": "^29.5.0",
240
+ "babel-jest": "^29.6.2",
241
241
  "babel-plugin-transform-import-meta": "^2.2.0",
242
242
  "babel-preset-minify": "^0.5.2",
243
243
  "buffer-replace": "^1.0.0",
244
244
  "country-flag-emoji-json": "^2.0.0",
245
- "cspell": "^6.31.1",
246
- "esbuild": "^0.18.10",
247
- "eslint": "^8.43.0",
248
- "eslint-config-prettier": "^8.8.0",
249
- "eslint-plugin-jest": "^27.2.2",
250
- "eslint-plugin-jsdoc": "^46.4.2",
251
- "eslint-plugin-react": "^7.32.2",
245
+ "cspell": "^6.31.2",
246
+ "esbuild": "^0.18.17",
247
+ "eslint": "^8.45.0",
248
+ "eslint-config-prettier": "^8.9.0",
249
+ "eslint-plugin-jest": "^27.2.3",
250
+ "eslint-plugin-jsdoc": "^46.4.5",
251
+ "eslint-plugin-react": "7.32.2",
252
252
  "eslint-plugin-react-hooks": "^4.6.0",
253
- "fake-indexeddb": "^4.0.1",
253
+ "fake-indexeddb": "^4.0.2",
254
254
  "gulp": "^4.0.2",
255
255
  "gulp-gzip": "^1.4.2",
256
256
  "http-server": "^14.1.1",
257
- "jest": "^29.5.0",
258
- "jest-environment-jsdom": "^29.5.0",
257
+ "jest": "^29.6.2",
258
+ "jest-environment-jsdom": "^29.6.2",
259
259
  "jest-fetch-mock": "^3.0.3",
260
260
  "jest-puppeteer": "^9.0.0",
261
261
  "less": "^4.1.3",
262
262
  "prettier": "^2.8.8",
263
- "puppeteer": "^20.7.4",
263
+ "puppeteer": "^20.9.0",
264
264
  "react": "^18.2.0",
265
265
  "react-dom": "^18.2.0",
266
266
  "react-test-renderer": "^18.2.0",
267
- "rollup": "^3.26.0",
267
+ "rollup": "^3.26.3",
268
268
  "rollup-plugin-esbuild": "^5.0.0",
269
269
  "rollup-plugin-gzip": "^3.1.0",
270
270
  "rollup-plugin-preserve-shebang": "^1.0.1",
271
271
  "rollup-plugin-prettier": "^3.0.0",
272
272
  "sqlite3": "^5.1.6",
273
273
  "tinybase": "file:./",
274
- "tinydocs": "^0.1.27",
274
+ "tinydocs": "^0.1.29",
275
275
  "tmp": "^0.2.1",
276
276
  "ts-unused-exports": "^9.0.5",
277
277
  "typescript": "5.1.6",
278
- "yjs": "^13.6.6"
278
+ "yjs": "^13.6.7"
279
279
  },
280
280
  "peerDependencies": {
281
- "@sqlite.org/sqlite-wasm": "^3.42.0-build2",
282
- "@vlcn.io/crsqlite-wasm": "^0.13.0",
281
+ "@sqlite.org/sqlite-wasm": "^3.42.0-build4",
282
+ "@vlcn.io/crsqlite-wasm": "^0.14.0",
283
283
  "automerge-repo": "^0.1.0",
284
284
  "prettier": "^2.8.8",
285
285
  "react": "^18.2.0",
286
286
  "sqlite3": "^5.1.6",
287
- "yjs": "^13.6.6"
287
+ "yjs": "^13.6.7"
288
288
  },
289
289
  "peerDependenciesMeta": {
290
290
  "@sqlite.org/sqlite-wasm": {
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Why sacrifice store features for bundle size? And why should the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p><em>TinyBase is a smart new way to structure your local app data:</em></p><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-and-values">schematization</a> to model it.</li><li><a href="#register-listeners-at-any-granularity">Flexibly reactive</a> to reconciled updates, so you only spend cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively.</li><li><a href="#create-indexes-for-fast-lookups">Indexing</a>, <a href="#define-metrics-and-aggregations">metrics</a>, <a href="#configure-relationships-between-tables">relationships</a> - and even an <a href="#use-checkpoints-for-an-easy-undo-stack">undo stack</a> for your app state.</li><li><a href="#type-definitions-orm-like-apis">Type definitions &amp; ORM-like APIs</a> (<em>new!</em>), based on a schema or inference.</li><li>Easily <a href="#persist-to-storage-sqlite-or-crdts">sync your data</a> to storage, (<em>new!</em>) SQLite, or (<em>new!</em>) CRDTs.</li><li>Use idiomatic, optional, <a href="#call-hooks-to-bind-to-data">bindings to React</a> for a fully reactive UI.</li></ul><p><em>Tiny by name, tiny by nature</em>, TinyBase only costs <a href="#did-we-say-tiny">4.7kB - 8.9kB</a> when compressed, and has zero dependencies. And of course it&#x27;s <a href="#well-tested-and-documented">well tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and <a href="https://github.com/tinyplex/tinybase">open source</a>. Other <a href="https://tinybase.org/guides/faq/">FAQs</a>?</p></section><p><a id="new" href="https://tinybase.org/guides/releases/#v4-0"><em>NEW!</em> v4.0 release</a></p><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h3 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h3><p><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></p></section><section><h3 id="excited-to-be-used-by">Excited to be used by:</h3><p><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></p></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
1
+ <section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Why sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p><em>TinyBase is a smart new way to structure your local app data:</em></p><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model it.</li><li><a href="#register-listeners-at-any-granularity">Flexibly reactive</a> to reconciled updates, so you only spend cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively.</li><li><a href="#create-indexes-for-fast-lookups">Indexing</a>, <a href="#define-metrics-and-aggregations">metrics</a>, <a href="#model-relationships-between-tables">relationships</a> - and even an <a href="#use-checkpoints-for-an-easy-undo-stack">undo stack</a> for your app state.</li><li><a href="#type-definitions-orm-like-apis">Type definitions &amp; ORM-like APIs</a> (<em>new!</em>), based on a schema or inference.</li><li>Easily <a href="#persist-to-storage-sqlite-or-crdts">sync your data</a> to storage, (<em>new!</em>) SQLite, or (<em>new!</em>) CRDTs.</li><li>Use idiomatic, optional, <a href="#call-hooks-to-bind-to-data">bindings to React</a> for a fully reactive UI.</li></ul><p><em>Tiny by name, tiny by nature</em>, TinyBase only costs <a href="#did-we-say-tiny">4.7kB - 8.9kB</a> when compressed, and has zero dependencies. And of course it&#x27;s <a href="#well-tested-and-documented">well tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and <a href="https://github.com/tinyplex/tinybase">open source</a>.</p></section><p><a id="new" href="https://tinybase.org/guides/releases/#v4-0"><em>NEW!</em> v4.0 release</a></p><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h3 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h3><p><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></p></section><section><h3 id="excited-to-be-used-by">Excited to be used by:</h3><p><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></p></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
2
2
 
3
3
  ```js
4
4
  const store = createStore()
@@ -52,7 +52,7 @@ console.log(app.innerHTML);
52
52
  // -> 'Color: walnut'
53
53
  ```
54
54
 
55
- <section><h2 id="use-components-for-reactive-apps">Use components for reactive apps.</h2><p>The react module provides simple React components with bindings that make it easy to create a fully reactive user interface based on a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>In this example, the library&#x27;s <a href="https://tinybase.org/api/ui-react/functions/store-components/rowview/"><code>RowView</code></a> component just needs a reference to the <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>, the <code>tableId</code>, and the <code>rowId</code> in order to render the contents of that row. An optional <code>cellComponent</code> prop lets you override how you want each <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> rendered. Again, all the listeners and updates are taken care of for you.</p><p>The module also includes a context Provider that sets up default for an entire app to use, reducing the need to drill all your props down into your app&#x27;s hierarchy.</p><p>Most of the demos showcase the use of these React hooks and components. Take a look at <a href="https://tinybase.org/demos/todo-app/todo-app-v1-the-basics/">Todo App v1 (the basics)</a> to see these user interface binding patterns in action.</p><p>Read more about the <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module in the <a href="https://tinybase.org/guides/building-uis/">Building UIs</a> guides.</p></section>
55
+ <section><h2 id="use-components-for-reactive-apps">Use components for reactive apps.</h2><p>The react module provides simple React components with bindings that make it easy to create a fully reactive user interface based on the content of a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>In this example, the library&#x27;s <a href="https://tinybase.org/api/ui-react/functions/store-components/rowview/"><code>RowView</code></a> component just needs a reference to the <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>, the <code>tableId</code>, and the <code>rowId</code> in order to render the contents of that row. An optional <code>cellComponent</code> prop lets you override how you want each <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> rendered. Again, all the listeners and updates are taken care of for you.</p><p>The module also includes a context Provider that sets up default for an entire app to use, reducing the need to drill all your props down into your app&#x27;s hierarchy.</p><p>Most of the demos showcase the use of these React hooks and components. Take a look at <a href="https://tinybase.org/demos/todo-app/todo-app-v1-the-basics/">Todo App v1 (the basics)</a> to see these user interface binding patterns in action.</p><p>Read more about the <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module in the <a href="https://tinybase.org/guides/building-uis/">Building UIs</a> guides.</p></section>
56
56
 
57
57
  ```jsx
58
58
  const MyCellView = (props) => (
@@ -82,7 +82,7 @@ console.log(app.innerHTML);
82
82
  root.unmount();
83
83
  ```
84
84
 
85
- <section><h2 id="apply-schemas-to-tables-and-values">Apply schemas to tables and values.</h2><p>By default, a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>, and a <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>. But you can add a <a href="https://tinybase.org/api/store/type-aliases/schema/valuesschema/"><code>ValuesSchema</code></a> or a <a href="https://tinybase.org/api/store/type-aliases/schema/tablesschema/"><code>TablesSchema</code></a> to a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> to ensure that the values are always what you expect: constraining their types, and providing defaults.</p><p>In this example, we set a second <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> without the <code>sold</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> in it. The schema ensures it&#x27;s present with default of <code>false</code>.</p><p>Read more about schemas in the <a href="https://tinybase.org/guides/schemas-and-persistence/using-schemas/">Using Schemas</a> guide.</p></section>
85
+ <section><h2 id="apply-schemas-to-tables-values">Apply schemas to tables &amp; values.</h2><p>By default, a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>, and a <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>. But you can add a <a href="https://tinybase.org/api/store/type-aliases/schema/valuesschema/"><code>ValuesSchema</code></a> or a <a href="https://tinybase.org/api/store/type-aliases/schema/tablesschema/"><code>TablesSchema</code></a> to a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> to ensure that the values are always what you expect: constraining their types, and providing defaults.</p><p>In this example, we set a second <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> without the <code>sold</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> in it. The schema ensures it&#x27;s present with default of <code>false</code>.</p><p>Read more about schemas in the <a href="https://tinybase.org/guides/schemas-and-persistence/using-schemas/">Using Schemas</a> guide.</p></section>
86
86
 
87
87
  ```js
88
88
  store.setTablesSchema({
@@ -247,7 +247,7 @@ console.log(store.getCell('pets', 'felix', 'sold'));
247
247
  // -> false
248
248
  ```
249
249
 
250
- <section><h2 id="type-definitions-orm-like-apis">Type definitions &amp; ORM-like APIs</h2><p>TinyBase has comprehensive type definitions, and even offers definitions that infer API types from the data schemas you apply.</p><p>Furthermore, you can easily create TypeScript <code>.d.ts</code> definitions that model your data and encourage type-safety when reading and writing data - as well as <code>.ts</code> implementations that provide ORM-like methods for your named tables.</p><p>Read more about the type support in the <a href="https://tinybase.org/guides/the-basics/tinybase-and-typescript/">TinyBase and TypeScript</a> guide.</p></section>
250
+ <section><h2 id="type-definitions-orm-like-apis">Type definitions &amp; ORM-like APIs</h2><p>TinyBase has comprehensive type definitions, and even offers definitions that infer API types from the data schemas you apply.</p><p>Furthermore, you can easily create TypeScript <code>.d.ts</code> definitions that model your data and encourage type-safety when reading and writing data - as well as <code>.ts</code> implementations that provide ORM-like methods for your named tables.</p><p>Read more about type support in the <a href="https://tinybase.org/guides/the-basics/tinybase-and-typescript/">TinyBase and TypeScript</a> guide.</p></section>
251
251
 
252
252
  ```js yolo
253
253
  const tools = createTools(store);
@@ -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://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.7kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>8.9kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.3kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://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://tinybase.org/api/store/">store</a></th><td>4.7kB</td><td>11.1kB</td><td>47.8kB</td><td>212.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.9kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.7kB</td><td>33.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.7kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.7kB</td><td>5.5kB</td><td>25.0kB</td><td>112.7kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.6kB</td><td>1.2kB</td><td>3.9kB</td><td>41.9kB</td></tr><tr><th class="right"><a href="https://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.9kB</td><td>21.9kB</td><td>95.0kB</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://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,817</td><td>1,817</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,959</td><td>1,959</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>777</td><td>777</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>669</td><td>669</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,093</td></tr><tr><th class="right">Assertions</th><td colspan="3">14,355</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://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/discussions">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://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.0.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://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://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://tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.7kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>8.9kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.2kB</em>, and everything is super fast. Life&#x27;s easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://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://tinybase.org/api/store/">store</a></th><td>4.7kB</td><td>11.1kB</td><td>47.6kB</td><td>212.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.9kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.7kB</td><td>33.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.7kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.7kB</td><td>5.5kB</td><td>25.0kB</td><td>112.7kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.6kB</td><td>1.2kB</td><td>3.9kB</td><td>41.9kB</td></tr><tr><th class="right"><a href="https://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.9kB</td><td>21.9kB</td><td>94.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 for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://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,815</td><td>1,815</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,957</td><td>1,957</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>776</td><td>776</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>669</td><td>669</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,093</td></tr><tr><th class="right">Assertions</th><td colspan="3">14,355</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://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/discussions">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://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.0.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://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it!</p></section>