tinybase 4.1.0-beta.1 → 4.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) 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/queries.cjs +1 -1
  23. package/lib/cjs/queries.cjs.gz +0 -0
  24. package/lib/cjs/relationships.cjs +1 -1
  25. package/lib/cjs/relationships.cjs.gz +0 -0
  26. package/lib/cjs/store.cjs +1 -1
  27. package/lib/cjs/store.cjs.gz +0 -0
  28. package/lib/cjs/tinybase.cjs +1 -1
  29. package/lib/cjs/tinybase.cjs.gz +0 -0
  30. package/lib/cjs/tools.cjs +1 -1
  31. package/lib/cjs/tools.cjs.gz +0 -0
  32. package/lib/cjs/ui-react-dom.cjs +1 -1
  33. package/lib/cjs/ui-react-dom.cjs.gz +0 -0
  34. package/lib/cjs/ui-react.cjs +1 -1
  35. package/lib/cjs/ui-react.cjs.gz +0 -0
  36. package/lib/cjs-es6/checkpoints.cjs +1 -1
  37. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  38. package/lib/cjs-es6/indexes.cjs +1 -1
  39. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  40. package/lib/cjs-es6/metrics.cjs +1 -1
  41. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  42. package/lib/cjs-es6/persisters/persister-browser.cjs +1 -1
  43. package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
  44. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  45. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  46. package/lib/cjs-es6/persisters/persister-file.cjs +1 -1
  47. package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
  48. package/lib/cjs-es6/persisters/persister-remote.cjs +1 -1
  49. package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
  50. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
  51. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  52. package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
  53. package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
  54. package/lib/cjs-es6/queries.cjs +1 -1
  55. package/lib/cjs-es6/queries.cjs.gz +0 -0
  56. package/lib/cjs-es6/relationships.cjs +1 -1
  57. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  58. package/lib/cjs-es6/store.cjs +1 -1
  59. package/lib/cjs-es6/store.cjs.gz +0 -0
  60. package/lib/cjs-es6/tinybase.cjs +1 -1
  61. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  62. package/lib/cjs-es6/tools.cjs +1 -1
  63. package/lib/cjs-es6/tools.cjs.gz +0 -0
  64. package/lib/cjs-es6/ui-react-dom.cjs +1 -1
  65. package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
  66. package/lib/cjs-es6/ui-react.cjs +1 -1
  67. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  68. package/lib/debug/checkpoints.js +6 -6
  69. package/lib/debug/indexes.js +7 -7
  70. package/lib/debug/metrics.js +12 -12
  71. package/lib/debug/persisters/persister-browser.js +10 -19
  72. package/lib/debug/persisters/persister-cr-sqlite-wasm.js +6 -15
  73. package/lib/debug/persisters/persister-file.js +10 -19
  74. package/lib/debug/persisters/persister-remote.js +10 -19
  75. package/lib/debug/persisters/persister-sqlite-wasm.js +6 -15
  76. package/lib/debug/persisters/persister-sqlite3.js +6 -15
  77. package/lib/debug/persisters.js +4 -4
  78. package/lib/debug/queries.js +1 -0
  79. package/lib/debug/relationships.js +7 -7
  80. package/lib/debug/store.js +16 -24
  81. package/lib/debug/tinybase.js +21 -28
  82. package/lib/debug/tools.js +14 -13
  83. package/lib/debug/ui-react-dom.js +253 -33
  84. package/lib/debug/ui-react.js +26 -4
  85. package/lib/es6/checkpoints.js +1 -1
  86. package/lib/es6/checkpoints.js.gz +0 -0
  87. package/lib/es6/indexes.js +1 -1
  88. package/lib/es6/indexes.js.gz +0 -0
  89. package/lib/es6/metrics.js +1 -1
  90. package/lib/es6/metrics.js.gz +0 -0
  91. package/lib/es6/persisters/persister-browser.js +1 -1
  92. package/lib/es6/persisters/persister-browser.js.gz +0 -0
  93. package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  94. package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  95. package/lib/es6/persisters/persister-file.js +1 -1
  96. package/lib/es6/persisters/persister-file.js.gz +0 -0
  97. package/lib/es6/persisters/persister-remote.js +1 -1
  98. package/lib/es6/persisters/persister-remote.js.gz +0 -0
  99. package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
  100. package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  101. package/lib/es6/persisters/persister-sqlite3.js +1 -1
  102. package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
  103. package/lib/es6/queries.js +1 -1
  104. package/lib/es6/queries.js.gz +0 -0
  105. package/lib/es6/relationships.js +1 -1
  106. package/lib/es6/relationships.js.gz +0 -0
  107. package/lib/es6/store.js +1 -1
  108. package/lib/es6/store.js.gz +0 -0
  109. package/lib/es6/tinybase.js +1 -1
  110. package/lib/es6/tinybase.js.gz +0 -0
  111. package/lib/es6/tools.js +1 -1
  112. package/lib/es6/tools.js.gz +0 -0
  113. package/lib/es6/ui-react-dom.js +1 -1
  114. package/lib/es6/ui-react-dom.js.gz +0 -0
  115. package/lib/es6/ui-react.js +1 -1
  116. package/lib/es6/ui-react.js.gz +0 -0
  117. package/lib/indexes.js +1 -1
  118. package/lib/indexes.js.gz +0 -0
  119. package/lib/metrics.js +1 -1
  120. package/lib/metrics.js.gz +0 -0
  121. package/lib/persisters/persister-browser.js +1 -1
  122. package/lib/persisters/persister-browser.js.gz +0 -0
  123. package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
  124. package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  125. package/lib/persisters/persister-file.js +1 -1
  126. package/lib/persisters/persister-file.js.gz +0 -0
  127. package/lib/persisters/persister-remote.js +1 -1
  128. package/lib/persisters/persister-remote.js.gz +0 -0
  129. package/lib/persisters/persister-sqlite-wasm.js +1 -1
  130. package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
  131. package/lib/persisters/persister-sqlite3.js +1 -1
  132. package/lib/persisters/persister-sqlite3.js.gz +0 -0
  133. package/lib/queries.js +1 -1
  134. package/lib/queries.js.gz +0 -0
  135. package/lib/relationships.js +1 -1
  136. package/lib/relationships.js.gz +0 -0
  137. package/lib/store.js +1 -1
  138. package/lib/store.js.gz +0 -0
  139. package/lib/tinybase.js +1 -1
  140. package/lib/tinybase.js.gz +0 -0
  141. package/lib/tools.js +1 -1
  142. package/lib/tools.js.gz +0 -0
  143. package/lib/types/queries.d.ts +167 -0
  144. package/lib/types/ui-react-dom.d.ts +568 -70
  145. package/lib/types/ui-react.d.ts +269 -58
  146. package/lib/types/with-schemas/internal/ui-react.d.ts +32 -22
  147. package/lib/types/with-schemas/queries.d.ts +185 -0
  148. package/lib/types/with-schemas/ui-react-dom.d.ts +647 -93
  149. package/lib/types/with-schemas/ui-react.d.ts +281 -50
  150. package/lib/ui-react-dom.js +1 -1
  151. package/lib/ui-react-dom.js.gz +0 -0
  152. package/lib/ui-react.js +1 -1
  153. package/lib/ui-react.js.gz +0 -0
  154. package/lib/umd/checkpoints.js +1 -1
  155. package/lib/umd/checkpoints.js.gz +0 -0
  156. package/lib/umd/indexes.js +1 -1
  157. package/lib/umd/indexes.js.gz +0 -0
  158. package/lib/umd/metrics.js +1 -1
  159. package/lib/umd/metrics.js.gz +0 -0
  160. package/lib/umd/persisters/persister-browser.js +1 -1
  161. package/lib/umd/persisters/persister-browser.js.gz +0 -0
  162. package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
  163. package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  164. package/lib/umd/persisters/persister-file.js +1 -1
  165. package/lib/umd/persisters/persister-file.js.gz +0 -0
  166. package/lib/umd/persisters/persister-remote.js +1 -1
  167. package/lib/umd/persisters/persister-remote.js.gz +0 -0
  168. package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
  169. package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
  170. package/lib/umd/persisters/persister-sqlite3.js +1 -1
  171. package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
  172. package/lib/umd/queries.js +1 -1
  173. package/lib/umd/queries.js.gz +0 -0
  174. package/lib/umd/relationships.js +1 -1
  175. package/lib/umd/relationships.js.gz +0 -0
  176. package/lib/umd/store.js +1 -1
  177. package/lib/umd/store.js.gz +0 -0
  178. package/lib/umd/tinybase.js +1 -1
  179. package/lib/umd/tinybase.js.gz +0 -0
  180. package/lib/umd/tools.js +1 -1
  181. package/lib/umd/tools.js.gz +0 -0
  182. package/lib/umd/ui-react-dom.js +1 -1
  183. package/lib/umd/ui-react-dom.js.gz +0 -0
  184. package/lib/umd/ui-react.js +1 -1
  185. package/lib/umd/ui-react.js.gz +0 -0
  186. package/lib/umd-es6/checkpoints.js +1 -1
  187. package/lib/umd-es6/checkpoints.js.gz +0 -0
  188. package/lib/umd-es6/indexes.js +1 -1
  189. package/lib/umd-es6/indexes.js.gz +0 -0
  190. package/lib/umd-es6/metrics.js +1 -1
  191. package/lib/umd-es6/metrics.js.gz +0 -0
  192. package/lib/umd-es6/persisters/persister-browser.js +1 -1
  193. package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
  194. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  195. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  196. package/lib/umd-es6/persisters/persister-file.js +1 -1
  197. package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
  198. package/lib/umd-es6/persisters/persister-remote.js +1 -1
  199. package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
  200. package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
  201. package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  202. package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
  203. package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
  204. package/lib/umd-es6/queries.js +1 -1
  205. package/lib/umd-es6/queries.js.gz +0 -0
  206. package/lib/umd-es6/relationships.js +1 -1
  207. package/lib/umd-es6/relationships.js.gz +0 -0
  208. package/lib/umd-es6/store.js +1 -1
  209. package/lib/umd-es6/store.js.gz +0 -0
  210. package/lib/umd-es6/tinybase.js +1 -1
  211. package/lib/umd-es6/tinybase.js.gz +0 -0
  212. package/lib/umd-es6/tools.js +1 -1
  213. package/lib/umd-es6/tools.js.gz +0 -0
  214. package/lib/umd-es6/ui-react-dom.js +1 -1
  215. package/lib/umd-es6/ui-react-dom.js.gz +0 -0
  216. package/lib/umd-es6/ui-react.js +1 -1
  217. package/lib/umd-es6/ui-react.js.gz +0 -0
  218. package/package.json +17 -17
  219. package/readme.md +2 -2
@@ -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",C=p+r,R=(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,...s)=>k(e)?{}:e(...s),T=e=>V(e,0),P=e=>V(e,2),x=e=>V(e,4),q=e=>V(e,6),O=e=>V(e,8),B=e=>V(e,10),{useCallback:M,useEffect:j,useMemo:D,useRef:A,useState:E}=s,F=(e,s,t=[])=>{const l=D((()=>s(e)),[e,...t]);return j((()=>()=>l.destroy()),[l]),l},G=(e,s,t,l=[],o)=>{const[,r]=E(),u=M((()=>{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]=E(u),d=A(n);return D((()=>d.current=u()),[u]),Q(e,s,((...e)=>{d.current=k(o)?u():e[o],r([])}),[],l),d.current},Q=(e,s,t,l=[],o=[],...r)=>j((()=>{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]),U=(e,s,t,l=[],o=m,r=[],...u)=>{const n=T(e);return M((e=>v(n,(l=>v(t(e,l),(e=>o(l["set"+s](...u,e),e)))))),[n,s,...l,...r,...u])},z=(e,s,t=m,l=[],...o)=>{const r=T(e);return M((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},H=(e,s,t)=>{const l=B(e);return M((()=>null==l?void 0:l[s](t)),[l,s,t])},J=e=>G(d,T(e),[],[]),K=(e,s)=>G(a,T(s),[],[e]),N=(e,s,t,l=0,o,r)=>G(c,T(r),[],[e,s,t,l,o],6),W=(e,s,t)=>G(w,T(t),[],[e,s]),X=(e,s,t,l)=>G(I,T(l),void 0,[e,s,t],4),Y=e=>G(C,T(e),[],[]),Z=(e,s)=>G(p,T(s),void 0,[e]),$=(e,s)=>G("Metric",P(s),void 0,[e]),_=(e,s)=>G("SliceIds",x(s),[],[e]),ee=(e,s,t)=>G("SliceRowIds",x(t),[],[e,s]),se=(e,s,t)=>G("RemoteRowId",q(t),void 0,[e,s]),te=(e,s,t)=>G("LocalRowIds",q(t),[],[e,s]),le=(e,s,t)=>G("LinkedRowIds",q(t),[],[e,s]),oe=(e,s)=>G("ResultRowIds",O(s),[],[e]),re=(e,s,t,l=0,o,r)=>G("ResultSortedRowIds",O(r),[],[e,s,t,l,o],6),ue=(e,s,t)=>G("ResultCellIds",O(t),[],[e,s]),ne=(e,s,t,l)=>G("ResultCell",O(l),void 0,[e,s,t]),de=e=>G("CheckpointIds",B(e),[[],void 0,[]]),ie=(e,s)=>G("Checkpoint",B(s),void 0,[e]),ae=e=>H(e,"goBackward"),ce=e=>H(e,"goForward");var Ie=Object.defineProperty,we=Object.defineProperties,pe=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,ke=(e,s,t)=>s in e?Ie(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ve=(e,s)=>{for(var t in s||(s={}))Ce.call(s,t)&&ke(e,t,s[t]);if(be)for(var t of be(s))Re.call(s,t)&&ke(e,t,s[t]);return e},ge=(e,s)=>we(e,pe(s)),me=(e,s)=>{var t={};for(var l in e)Ce.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&be)for(var l of be(e))s.indexOf(l)<0&&Re.call(e,l)&&(t[l]=e[l]);return t};const{createElement:ye,useMemo:he}=s,fe=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Pe(R(n,(r=>ye(t,ge(ve({},S(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),Le=({queryId:e,queries:s,resultRowComponent:t=De,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Pe(R(u,(o=>ye(t,ge(ve({},S(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Ve=e=>{const s=q(e);return[s,null==s?void 0:s.getStore()]},Se=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i]=Ve(s),a=null==d?void 0:d.getLocalTableId(e),c=u(e,n,d);return Pe(R(c,(e=>ye(t,ge(ve({},S(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},Te=e=>({checkpoints:s,checkpointComponent:t=Ae,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=B(s);return Pe(R(e(de(u)),(e=>ye(t,ge(ve({},S(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Pe=(e,s,t,l)=>{const o=k(s)||!Array.isArray(e)?e:R(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=X(e,s,t,o))?u:l),void 0,r,t)},qe=({tableId:e,rowId:s,store:t,cellComponent:l=xe,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Pe(R(((e,s,t,l)=>{const o=W(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>ye(l,ge(ve({},S(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Oe=e=>fe(e,K(e.tableId,e.store)),Be=({valueId:e,store:s,debugIds:t})=>{var o;return Pe(l+(null!=(o=Z(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=x(t),d=null==n?void 0:n.getStore(),i=null==n?void 0:n.getTableId(e),a=ee(e,s,n);return Pe(R(a,(e=>ye(l,ge(ve({},S(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=ne(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(R(ue(e,s,t),(r=>ye(l,ge(ve({},S(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=ie(s,e))?o:l,void 0,t,s)},Ee=Te((e=>e[0])),Fe=Te((e=>k(e[1])?[]:[e[1]])),Ge=Te((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(R(_(e,s),(o=>ye(t,ge(ve({},S(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Se(e,le,e.firstRowId),e.LocalRowsView=e=>Se(e,te,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Pe(null!=(o=$(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 ye(f.Provider,{value:he((()=>[null!=e?e:p[0],ve(ve({},p[1]),t),null!=l?l:p[2],ve(ve({},p[3]),o),null!=r?r:p[4],ve(ve({},p[5]),u),null!=n?n:p[6],ve(ve({},p[7]),d),null!=i?i:p[8],ve(ve({},p[9]),a),null!=c?c:p[10],ve(ve({},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]=Ve(t),d=null==u?void 0:u.getRemoteTableId(e),i=se(e,s,u);return Pe(k(d)||k(i)?null:ye(l,ge(ve({},S(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=me(s,["cellId","descending","offset","limit"]);return Le(u,re(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>Le(e,oe(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=me(s,["cellId","descending","offset","limit"]);return fe(u,N(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(R(J(e),(l=>ye(s,ge(ve({},S(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(R(Y(e),(l=>ye(s,ge(ve({},S(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=[],l,o=m,r=[],u=!0)=>{const n=T(l);return M((t=>v(n,(l=>v(s(t,l),(s=>o(l.addRow(e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=X,e.useCellIds=W,e.useCellIdsListener=(e,s,t,l,o,r)=>Q(w,T(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Q(I,T(u),l,o,[e,s,t],r),e.useCheckpoint=ie,e.useCheckpointIds=de,e.useCheckpointIdsListener=(e,s,t)=>Q("CheckpointIds",B(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Q("Checkpoint",B(l),s,t,[e]),e.useCheckpoints=e=>L(e,10),e.useCreateCheckpoints=(e,s,t)=>F(e,s,t),e.useCreateIndexes=(e,s,t)=>F(e,s,t),e.useCreateMetrics=(e,s,t)=>F(e,s,t),e.useCreatePersister=(e,s,t=[],l,o=[])=>{const[,r]=E(),u=D((()=>s(e)),[e,...t]);return j((()=>{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)=>F(e,s,t),e.useCreateRelationships=(e,s,t)=>F(e,s,t),e.useCreateStore=(e,s=[])=>D(e,s),e.useDelCellCallback=(e,s,t,l,o,r,u)=>z(o,I,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>z(t,i,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>z(s,u,t,l,e),e.useDelTablesCallback=(e,s,t)=>z(e,n,s,t),e.useDelValueCallback=(e,s,t,l)=>z(s,p,t,l,e),e.useDelValuesCallback=(e,s,t)=>z(e,b,s,t),e.useGoBackwardCallback=ae,e.useGoForwardCallback=ce,e.useGoToCallback=(e,s=[],t,l=m,o=[])=>{const r=B(t);return M((s=>v(r,(t=>v(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useIndexes=e=>L(e,4),e.useLinkedRowIds=le,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Q("LinkedRowIds",q(o),t,l,[e,s]),e.useLocalRowIds=te,e.useLocalRowIdsListener=(e,s,t,l,o)=>Q("LocalRowIds",q(o),t,l,[e,s]),e.useMetric=$,e.useMetricListener=(e,s,t,l)=>Q("Metric",P(l),s,t,[e]),e.useMetrics=e=>L(e,2),e.useQueries=e=>L(e,8),e.useRedoInformation=e=>{var s;const t=B(e),[,,[o]]=de(t);return[!k(o),ce(t),o,null!=(s=v(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationships=e=>L(e,6),e.useRemoteRowId=se,e.useRemoteRowIdListener=(e,s,t,l,o)=>Q("RemoteRowId",q(o),t,l,[e,s]),e.useResultCell=ne,e.useResultCellIds=ue,e.useResultCellIdsListener=(e,s,t,l,o)=>Q("ResultCellIds",O(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Q("ResultCell",O(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>G("ResultRow",O(t),{},[e,s]),e.useResultRowIds=oe,e.useResultRowIdsListener=(e,s,t,l)=>Q("ResultRowIds",O(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Q("ResultRow",O(o),t,l,[e,s]),e.useResultSortedRowIds=re,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,n)=>Q("ResultSortedRowIds",O(n),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>G("ResultTable",O(s),{},[e]),e.useResultTableListener=(e,s,t,l)=>Q("ResultTable",O(l),s,t,[e]),e.useRow=(e,s,t)=>G(i,T(t),{},[e,s]),e.useRowIds=K,e.useRowIdsListener=(e,s,t,l,o)=>Q(a,T(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Q(i,T(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>U(r,I,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,l=m,o=[])=>{const r=B(t);return M((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)=>U(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>U(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>U(o,i,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>U(l,u,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>U(t,n,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>U(l,p,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>U(t,b,e,s,l,o),e.useSliceIds=_,e.useSliceIdsListener=(e,s,t,l)=>Q("SliceIds",x(l),s,t,[e]),e.useSliceRowIds=ee,e.useSliceRowIdsListener=(e,s,t,l,o)=>Q("SliceRowIds",x(o),t,l,[e,s]),e.useSortedRowIds=N,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Q(c,T(d),r,u,[e,s,t,l,o],n),e.useStore=e=>L(e,0),e.useTable=(e,s)=>G(u,T(s),{},[e]),e.useTableCellIds=(e,s)=>G(u+w,T(s),[],[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Q(u+w,T(o),s,t,[e],l),e.useTableIds=J,e.useTableIdsListener=(e,s,t,l)=>Q(d,T(l),e,s,[],t),e.useTableListener=(e,s,t,l,o)=>Q(u,T(o),s,t,[e],l),e.useTables=e=>G(n,T(e),{}),e.useTablesListener=(e,s,t,l)=>Q(n,T(l),e,s,[],t),e.useUndoInformation=e=>{var s;const t=B(e),[o,r]=de(t);return[(u=o,!(0==(e=>e.length)(u))),ae(t),r,null!=(s=v(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Z,e.useValueIds=Y,e.useValueIdsListener=(e,s,t,l)=>Q(C,T(l),e,s,[],t),e.useValueListener=(e,s,t,l,o)=>Q(p,T(o),s,t,[e],l),e.useValues=e=>G(b,T(e),{}),e.useValuesListener=(e,s,t,l)=>Q(b,T(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",d=u+"s",n=u+r,i="Row",a=i+r,c="Sorted"+i+r,I="Cell",b=I+r,w="Value",p=w+"s",C=w+r,R=e=>null==e,k=(e,s,t)=>R(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 R(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 R(e)||v(e)?t:e},T=(e,...s)=>R(e)?{}:e(...s),S=e=>V(e,0),P=e=>V(e,2),x=e=>V(e,4),q=e=>V(e,6),O=e=>V(e,8),B=e=>V(e,10),{useCallback:M,useEffect:j,useMemo:D,useRef:A,useState:E}=s,F=(e,s,t=[])=>{const l=D((()=>s(e)),[e,...t]);return j((()=>()=>l.destroy()),[l]),l},G=(e,s,t,l=[],o)=>{const[,r]=E(),u=M((()=>{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]),[d]=E(u),n=A(d);return D((()=>n.current=u()),[u]),Q(e,s,((...e)=>{n.current=R(o)?u():e[o],r([])}),[],l),n.current},Q=(e,s,t,l=[],o=[],...r)=>j((()=>{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]),U=(e,s,t,l=[],o=g,r=[],...u)=>{const d=S(e);return M((e=>k(d,(l=>k(t(e,l),(e=>o(l["set"+s](...u,e),e)))))),[d,s,...l,...r,...u])},z=(e,s,t=g,l=[],...o)=>{const r=S(e);return M((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},H=(e,s,t)=>{const l=B(e);return M((()=>null==l?void 0:l[s](t)),[l,s,t])},J=e=>G(n,S(e),[],[]),K=(e,s)=>G(a,S(s),[],[e]),N=(e,s,t,l=0,o,r)=>G(c,S(r),[],[e,s,t,l,o],6),W=(e,s,t)=>G(b,S(t),[],[e,s]),X=(e,s,t,l)=>G(I,S(l),void 0,[e,s,t],4),Y=e=>G(C,S(e),[],[]),Z=(e,s)=>G(w,S(s),void 0,[e]),$=(e,s)=>G("Metric",P(s),void 0,[e]),_=(e,s)=>G("SliceIds",x(s),[],[e]),ee=(e,s,t)=>G("SliceRowIds",x(t),[],[e,s]),se=(e,s,t)=>G("RemoteRowId",q(t),void 0,[e,s]),te=(e,s,t)=>G("LocalRowIds",q(t),[],[e,s]),le=(e,s,t)=>G("LinkedRowIds",q(t),[],[e,s]),oe=(e,s)=>G("ResultRowIds",O(s),[],[e]),re=(e,s,t,l=0,o,r)=>G("ResultSortedRowIds",O(r),[],[e,s,t,l,o],6),ue=(e,s,t)=>G("ResultCellIds",O(t),[],[e,s]),de=(e,s,t,l)=>G("ResultCell",O(l),void 0,[e,s,t]),ne=e=>G("CheckpointIds",B(e),[[],void 0,[]]),ie=(e,s)=>G("Checkpoint",B(s),void 0,[e]),ae=e=>H(e,"goBackward"),ce=e=>H(e,"goForward");var Ie=Object.defineProperty,be=Object.defineProperties,we=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable,ke=(e,s,t)=>s in e?Ie(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ve=(e,s)=>{for(var t in s||(s={}))Ce.call(s,t)&&ke(e,t,s[t]);if(pe)for(var t of pe(s))Re.call(s,t)&&ke(e,t,s[t]);return e},ge=(e,s)=>be(e,we(s)),me=(e,s)=>{var t={};for(var l in e)Ce.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:ye,useMemo:he}=s,fe=({tableId:e,store:s,rowComponent:t=qe,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},d)=>Pe(m(d,(r=>ye(t,ge(ve({},T(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),Le=({queryId:e,queries:s,resultRowComponent:t=De,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Pe(m(u,(o=>ye(t,ge(ve({},T(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Ve=e=>{const s=q(e);return[s,null==s?void 0:s.getStore()]},Te=({relationshipId:e,relationships:s,rowComponent:t=qe,getRowComponentProps:l,separator:o,debugIds:r},u,d)=>{const[n,i]=Ve(s),a=null==n?void 0:n.getLocalTableId(e),c=u(e,d,n);return Pe(m(c,(e=>ye(t,ge(ve({},T(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,d)},Se=e=>({checkpoints:s,checkpointComponent:t=Ae,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=B(s);return Pe(m(e(ne(u)),(e=>ye(t,ge(ve({},T(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Pe=(e,s,t,l)=>{const o=R(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=X(e,s,t,o))?u:l),void 0,r,t)},qe=({tableId:e,rowId:s,store:t,cellComponent:l=xe,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:d})=>Pe(m(((e,s,t,l)=>{const o=W(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>ye(l,ge(ve({},T(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:d})))),u,d,s),Oe=e=>fe(e,K(e.tableId,e.store)),Be=({valueId:e,store:s,debugIds:t})=>{var o;return Pe(l+(null!=(o=Z(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 d=x(t),n=null==d?void 0:d.getStore(),i=null==d?void 0:d.getTableId(e),a=ee(e,s,d);return Pe(m(a,(e=>ye(l,ge(ve({},T(o,e)),{key:e,tableId:i,rowId:e,store:n,debugIds:u})))),r,u,s)},je=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Pe(l+(null!=(u=de(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(ue(e,s,t),(r=>ye(l,ge(ve({},T(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=ie(s,e))?o:l,void 0,t,s)},Ee=Se((e=>e[0])),Fe=Se((e=>R(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=>ye(t,ge(ve({},T(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Te(e,le,e.firstRowId),e.LocalRowsView=e=>Te(e,te,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Pe(null!=(o=$(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:l,metricsById:o,indexes:r,indexesById:u,relationships:d,relationshipsById:n,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:b})=>{const w=s.useContext(f);return ye(f.Provider,{value:he((()=>[null!=e?e:w[0],ve(ve({},w[1]),t),null!=l?l:w[2],ve(ve({},w[3]),o),null!=r?r:w[4],ve(ve({},w[5]),u),null!=d?d:w[6],ve(ve({},w[7]),n),null!=i?i:w[8],ve(ve({},w[9]),a),null!=c?c:w[10],ve(ve({},w[11]),I)]),[e,t,l,o,r,u,d,n,i,a,c,I,w])},b)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=qe,getRowComponentProps:o,debugIds:r})=>{const[u,d]=Ve(t),n=null==u?void 0:u.getRemoteTableId(e),i=se(e,s,u);return Pe(R(n)||R(i)?null:ye(l,ge(ve({},T(o,i)),{key:i,tableId:n,rowId:i,store:d,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=me(s,["cellId","descending","offset","limit"]);return Le(u,re(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>Le(e,oe(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=me(s,["cellId","descending","offset","limit"]);return fe(u,N(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(J(e),(l=>ye(s,ge(ve({},T(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(Y(e),(l=>ye(s,ge(ve({},T(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=[],l,o=g,r=[],u=!0)=>{const d=S(l);return M((t=>k(d,(l=>k(s(t,l),(s=>o(l.addRow(e,s,u),l,s)))))),[d,e,...t,...r,u])},e.useCell=X,e.useCellIds=W,e.useCellIdsListener=(e,s,t,l,o,r)=>Q(b,S(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Q(I,S(u),l,o,[e,s,t],r),e.useCheckpoint=ie,e.useCheckpointIds=ne,e.useCheckpointIdsListener=(e,s,t)=>Q("CheckpointIds",B(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Q("Checkpoint",B(l),s,t,[e]),e.useCheckpoints=e=>L(e,10),e.useCreateCheckpoints=(e,s,t)=>F(e,s,t),e.useCreateIndexes=(e,s,t)=>F(e,s,t),e.useCreateMetrics=(e,s,t)=>F(e,s,t),e.useCreatePersister=(e,s,t=[],l,o=[])=>{const[,r]=E(),u=D((()=>s(e)),[e,...t]);return j((()=>{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)=>F(e,s,t),e.useCreateRelationships=(e,s,t)=>F(e,s,t),e.useCreateStore=(e,s=[])=>D(e,s),e.useDelCellCallback=(e,s,t,l,o,r,u)=>z(o,I,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>z(t,i,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>z(s,u,t,l,e),e.useDelTablesCallback=(e,s,t)=>z(e,d,s,t),e.useDelValueCallback=(e,s,t,l)=>z(s,w,t,l,e),e.useDelValuesCallback=(e,s,t)=>z(e,p,s,t),e.useGoBackwardCallback=ae,e.useGoForwardCallback=ce,e.useGoToCallback=(e,s=[],t,l=g,o=[])=>{const r=B(t);return M((s=>k(r,(t=>k(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useIndexes=e=>L(e,4),e.useLinkedRowIds=le,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Q("LinkedRowIds",q(o),t,l,[e,s]),e.useLocalRowIds=te,e.useLocalRowIdsListener=(e,s,t,l,o)=>Q("LocalRowIds",q(o),t,l,[e,s]),e.useMetric=$,e.useMetricListener=(e,s,t,l)=>Q("Metric",P(l),s,t,[e]),e.useMetrics=e=>L(e,2),e.useQueries=e=>L(e,8),e.useRedoInformation=e=>{var s;const t=B(e),[,,[o]]=ne(t);return[!R(o),ce(t),o,null!=(s=k(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationships=e=>L(e,6),e.useRemoteRowId=se,e.useRemoteRowIdListener=(e,s,t,l,o)=>Q("RemoteRowId",q(o),t,l,[e,s]),e.useResultCell=de,e.useResultCellIds=ue,e.useResultCellIdsListener=(e,s,t,l,o)=>Q("ResultCellIds",O(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Q("ResultCell",O(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>G("ResultRow",O(t),{},[e,s]),e.useResultRowIds=oe,e.useResultRowIdsListener=(e,s,t,l)=>Q("ResultRowIds",O(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Q("ResultRow",O(o),t,l,[e,s]),e.useResultSortedRowIds=re,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Q("ResultSortedRowIds",O(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>G("ResultTable",O(s),{},[e]),e.useResultTableCellIds=(e,s)=>G("ResultTableCellIds",O(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Q("ResultTableCellIds",O(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Q("ResultTable",O(l),s,t,[e]),e.useRow=(e,s,t)=>G(i,S(t),{},[e,s]),e.useRowIds=K,e.useRowIdsListener=(e,s,t,l,o)=>Q(a,S(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Q(i,S(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,d)=>U(r,I,l,o,u,d,e,s,t),e.useSetCheckpointCallback=(e=g,s=[],t,l=g,o=[])=>{const r=B(t);return M((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)=>U(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>U(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>U(o,i,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>U(l,u,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>U(t,d,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>U(l,w,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>U(t,p,e,s,l,o),e.useSliceIds=_,e.useSliceIdsListener=(e,s,t,l)=>Q("SliceIds",x(l),s,t,[e]),e.useSliceRowIds=ee,e.useSliceRowIdsListener=(e,s,t,l,o)=>Q("SliceRowIds",x(o),t,l,[e,s]),e.useSortedRowIds=N,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,d,n)=>Q(c,S(n),r,u,[e,s,t,l,o],d),e.useStore=e=>L(e,0),e.useTable=(e,s)=>G(u,S(s),{},[e]),e.useTableCellIds=(e,s)=>G(u+b,S(s),[],[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Q(u+b,S(o),s,t,[e],l),e.useTableIds=J,e.useTableIdsListener=(e,s,t,l)=>Q(n,S(l),e,s,[],t),e.useTableListener=(e,s,t,l,o)=>Q(u,S(o),s,t,[e],l),e.useTables=e=>G(d,S(e),{}),e.useTablesListener=(e,s,t,l)=>Q(d,S(l),e,s,[],t),e.useUndoInformation=e=>{var s;const t=B(e),[o,r]=ne(t);return[(u=o,!(0==(e=>e.length)(u))),ae(t),r,null!=(s=k(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Z,e.useValueIds=Y,e.useValueIdsListener=(e,s,t,l)=>Q(C,S(l),e,s,[],t),e.useValueListener=(e,s,t,l,o)=>Q(w,S(o),s,t,[e],l),e.useValues=e=>G(p,S(e),{}),e.useValuesListener=(e,s,t,l)=>Q(p,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.1.0-beta.1",
3
+ "version": "4.1.0-beta.3",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
@@ -218,53 +218,53 @@
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
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.4.2",
228
+ "@types/node": "^20.4.5",
229
229
  "@types/puppeteer": "^5.4.7",
230
- "@types/react": "^18.2.15",
230
+ "@types/react": "^18.2.17",
231
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": "^6.1.0",
235
- "@typescript-eslint/parser": "^6.1.0",
234
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
235
+ "@typescript-eslint/parser": "^6.2.0",
236
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.6.1",
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
245
  "cspell": "^6.31.2",
246
- "esbuild": "^0.18.14",
247
- "eslint": "^8.45.0",
248
- "eslint-config-prettier": "^8.8.0",
246
+ "esbuild": "^0.18.17",
247
+ "eslint": "^8.46.0",
248
+ "eslint-config-prettier": "^8.9.0",
249
249
  "eslint-plugin-jest": "^27.2.3",
250
- "eslint-plugin-jsdoc": "^46.4.4",
251
- "eslint-plugin-react": "^7.32.2",
250
+ "eslint-plugin-jsdoc": "^46.4.5",
251
+ "eslint-plugin-react": "7.33.0",
252
252
  "eslint-plugin-react-hooks": "^4.6.0",
253
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.6.1",
258
- "jest-environment-jsdom": "^29.6.1",
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.8.3",
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.3",
267
+ "rollup": "^3.27.0",
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",
@@ -278,7 +278,7 @@
278
278
  "yjs": "^13.6.7"
279
279
  },
280
280
  "peerDependencies": {
281
- "@sqlite.org/sqlite-wasm": "3.42.0-build2",
281
+ "@sqlite.org/sqlite-wasm": "^3.42.0-build4",
282
282
  "@vlcn.io/crsqlite-wasm": "^0.14.0",
283
283
  "automerge-repo": "^0.1.0",
284
284
  "prettier": "^2.8.8",
package/readme.md CHANGED
@@ -60,7 +60,7 @@ const App2 = () => (
60
60
  store={store}
61
61
  tableId="pets"
62
62
  cellId="color"
63
- customCellIds={['color', 'sold']}
63
+ customCells={['color', 'sold']}
64
64
  />
65
65
  );
66
66
 
@@ -283,4 +283,4 @@ export const createShop: typeof createShopDecl = () => {
283
283
  };
284
284
  ```
285
285
 
286
- <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.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://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.5kB</em>, the auxiliary <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.4kB</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://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">store</a></th><td>4.7kB</td><td>11.1kB</td><td>47.8kB</td><td>212.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.9kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.7kB</td><td>33.8kB</td></tr><tr><th class="right"><a href="https://beta.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://beta.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://beta.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://beta.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://beta.tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.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 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://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,820</td><td>1,820</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,962</td><td>1,962</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>778</td><td>778</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>671</td><td>671</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,117</td></tr><tr><th class="right">Assertions</th><td colspan="3">14,394</td></tr></tbody></table></div><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/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://beta.tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.1.0-beta.1">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section>
286
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://beta.tinybase.org/api/store/"><code>store</code></a> module alone, you&#x27;ll only add a gzipped <em>4.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://beta.tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.5kB</em>, the auxiliary <a href="https://beta.tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.4kB</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://beta.tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/store/">store</a></th><td>4.7kB</td><td>11.1kB</td><td>47.6kB</td><td>212.9kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.9kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://beta.tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.7kB</td><td>33.8kB</td></tr><tr><th class="right"><a href="https://beta.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://beta.tinybase.org/api/queries/">queries</a></th><td>2.7kB</td><td>5.6kB</td><td>25.0kB</td><td>118.6kB</td></tr><tr><th class="right"><a href="https://beta.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://beta.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://beta.tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.9kB</td><td>21.9kB</td><td>94.9kB</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://beta.tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,822</td><td>1,822</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,964</td><td>1,964</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>779</td><td>779</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>671</td><td>671</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,155</td></tr><tr><th class="right">Assertions</th><td colspan="3">14,512</td></tr></tbody></table></div><hr><p><a class="start" href="https://beta.tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://beta.tinybase.org/demos/">Try the demos</a></p><p><a href="https://beta.tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/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://beta.tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.1.0-beta.3">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://beta.tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it as much as I do building it!</p></section>