tinybase 5.2.1 → 5.2.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 (75) hide show
  1. package/cjs/es6/min/ui-react/index.cjs +1 -1
  2. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  3. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  4. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  5. package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
  6. package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
  7. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  8. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  9. package/cjs/es6/ui-react/index.cjs +10 -1
  10. package/cjs/es6/ui-react/with-schemas/index.cjs +10 -1
  11. package/cjs/es6/ui-react-inspector/index.cjs +1 -1
  12. package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +1 -1
  13. package/cjs/min/ui-react/index.cjs +1 -1
  14. package/cjs/min/ui-react/index.cjs.gz +0 -0
  15. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  16. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  17. package/cjs/min/ui-react-inspector/index.cjs +1 -1
  18. package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
  19. package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  20. package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  21. package/cjs/ui-react/index.cjs +10 -1
  22. package/cjs/ui-react/with-schemas/index.cjs +10 -1
  23. package/cjs/ui-react-inspector/index.cjs +1 -1
  24. package/cjs/ui-react-inspector/with-schemas/index.cjs +1 -1
  25. package/es6/min/ui-react/index.js +1 -1
  26. package/es6/min/ui-react/index.js.gz +0 -0
  27. package/es6/min/ui-react/with-schemas/index.js +1 -1
  28. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  29. package/es6/min/ui-react-inspector/index.js +1 -1
  30. package/es6/min/ui-react-inspector/index.js.gz +0 -0
  31. package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  32. package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  33. package/es6/ui-react/index.js +10 -1
  34. package/es6/ui-react/with-schemas/index.js +10 -1
  35. package/es6/ui-react-inspector/index.js +1 -1
  36. package/es6/ui-react-inspector/with-schemas/index.js +1 -1
  37. package/min/ui-react/index.js +1 -1
  38. package/min/ui-react/index.js.gz +0 -0
  39. package/min/ui-react/with-schemas/index.js +1 -1
  40. package/min/ui-react/with-schemas/index.js.gz +0 -0
  41. package/min/ui-react-inspector/index.js +1 -1
  42. package/min/ui-react-inspector/index.js.gz +0 -0
  43. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  44. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  45. package/package.json +1 -1
  46. package/readme.md +13 -13
  47. package/releases.md +23 -23
  48. package/ui-react/index.js +10 -1
  49. package/ui-react/with-schemas/index.js +10 -1
  50. package/ui-react-inspector/index.js +1 -1
  51. package/ui-react-inspector/with-schemas/index.js +1 -1
  52. package/umd/es6/min/ui-react/index.js +1 -1
  53. package/umd/es6/min/ui-react/index.js.gz +0 -0
  54. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  55. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  56. package/umd/es6/min/ui-react-inspector/index.js +1 -1
  57. package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
  58. package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  59. package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  60. package/umd/es6/ui-react/index.js +12 -1
  61. package/umd/es6/ui-react/with-schemas/index.js +12 -1
  62. package/umd/es6/ui-react-inspector/index.js +2 -1
  63. package/umd/es6/ui-react-inspector/with-schemas/index.js +2 -1
  64. package/umd/min/ui-react/index.js +1 -1
  65. package/umd/min/ui-react/index.js.gz +0 -0
  66. package/umd/min/ui-react/with-schemas/index.js +1 -1
  67. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  68. package/umd/min/ui-react-inspector/index.js +1 -1
  69. package/umd/min/ui-react-inspector/index.js.gz +0 -0
  70. package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
  71. package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  72. package/umd/ui-react/index.js +12 -1
  73. package/umd/ui-react/with-schemas/index.js +12 -1
  74. package/umd/ui-react-inspector/index.js +2 -1
  75. package/umd/ui-react-inspector/with-schemas/index.js +2 -1
Binary file
@@ -1 +1 @@
1
- import e from"react";import{useCell as t,useValue as n,useSetValueCallback as s,useSetCellCallback as l,useValueIds as a,ValueView as r,useStoreOrStoreById as o,useRowCount as i,useSortedRowIds as d,useTableCellIds as c,useIndexesOrIndexesById as u,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useRowIds as g,useResultRowCount as p,useResultSortedRowIds as b,useResultTableCellIds as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as v,useIndexIds as C,useSliceIds as k,useMetrics as T,useMetricIds as x,useMetric as S,useQueries as q,useQueryIds as N,useRelationships as V,useRelationshipIds as M,useStore as L,useTableIds as R,useValues as E,useStoreIds as z,useMetricsIds as $,useIndexesIds as A,useRelationshipsIds as F,useQueriesIds as J,useCreateStore as O,useCreatePersister as P}from"../../ui-react/with-schemas/index.js";const D=e=>typeof e,j="",B=D(j),H=D(!0),W=D(0),Q=D(D),G="type",K="default",U="Has",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",ne=ee+X,se="Cell",le=se+X,ae="Value",re=ae+"s",oe=ae+X,ie="currentTarget",de="value",ce=e=>j+e,ue=globalThis.window,he=Math,me=he.min,ge=he.floor,pe=isFinite,be=e=>null==e,fe=(e,t,n)=>be(e)?n?.():t(e),ye=e=>e==B||e==H,Ie=e=>D(e)==Q,we=e=>Array.isArray(e),ve=(e,t,n)=>e.slice(t,n),Ce=e=>e.length,ke=e=>{throw Error(e)},{PureComponent:Te,Fragment:xe,createElement:Se,useCallback:qe,useLayoutEffect:Ne,useRef:Ve,useState:Me}=e,Le=(e,...t)=>be(e)?{}:e(...t),Re=(e,t)=>e.sort(t),Ee=(e,t)=>e.forEach(t),ze=(e,t)=>e.map(t),$e=e=>0==Ce(e),Ae=(e,...t)=>e.push(...t),Fe=e=>e.shift(),Je=Object,Oe=e=>Je.getPrototypeOf(e),Pe=Je.entries,De=Je.isFrozen,je=e=>!be(e)&&fe(Oe(e),(e=>e==Je.prototype||be(Oe(e))),(()=>!0)),Be=Je.keys,He=Je.freeze,We=(e=[])=>Je.fromEntries(e),Qe=(e,t)=>t in e,Ge=(e,t)=>(delete e[t],e),Ke=(e,t)=>ze(Pe(e),(([e,n])=>t(n,e))),Ue=e=>je(e)&&0==(e=>Ce(Be(e)))(e),Xe=(e,t,n,s=0)=>be(e)||!je(e)||!s&&Ue(e)||De(e)?(n?.(),!1):(Ke(e,((n,s)=>{t(n,s)||Ge(e,s)})),!!s||!Ue(e)),Ye=JSON.stringify,Ze=JSON.parse,_e=e=>Ye(e,((e,t)=>t instanceof Map?Je.fromEntries([...t]):t)),et="tinybaseInspector",tt="TinyBase Inspector",nt=["left","top","bottom","right","full"],st="state",lt="sort",at="open",rt="position",ot=at,it="editable",dt=(...e)=>_e(e),ct=(e,t)=>ze(Re(e),t),ut=(e,n)=>[!!t(st,e,it,n),qe((t=>{n.setCell(st,e,it,(e=>!e)),t.preventDefault()}),[n,e])],ht="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",mt='content:url("',gt=mt+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",pt='</svg>")',bt=mt+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",ft=ze([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,n,s])=>gt+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${n}' height='${s}' fill='white'/>`+pt)),yt=gt+"<path d='M20 20l60 60M20 80l60-60' />"+pt,It=gt+`<path d='${ht}' />`+pt,wt=gt+`<path d='${ht}M20 20l60 60' />`+pt,vt="*::-webkit-scrollbar",Ct=((e,t="")=>e.join(t))(Ke({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[vt]:"width:0.5rem;height:0.5rem;",[vt+"-track"]:"background:#111",[vt+"-thumb"]:"background:#999;border:1px solid #111",[vt+"-thumb:hover"]:"background:#fff",[vt+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+bt,...We(ze(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...We(ze(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":bt,"header>img:nth-of-type(6)":yt,...We(ze(ft,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":It,"details[open]>summary img.done":wt,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${et} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${et} ${t}{${e}}`:""))),kt=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!0),[],e);return n(ot,e)?null:Se("img",{onClick:l,title:tt,"data-position":t})},Tt=({uniqueId:e,summary:n,editable:s,handleEditable:a,children:r,s:o})=>{const i=!!t(st,e,at,o),d=l(st,e,at,(e=>e[ie].open),[],o);return Se("details",{open:i,onToggle:d},Se("summary",null,n,a?Se("img",{onClick:a,className:s?"done":"edit"}):null),r)},xt=e=>{const t=D(e);return ye(t)||t==W&&pe(e)?t:void 0},St=(e,t,n,s,l)=>be(l)?e.delCell(t,n,s,!0):e.setCell(t,n,s,l),qt=(e,t,n)=>be(n)?e.delValue(t):e.setValue(t,n),Nt=(e,t,n,s)=>e==B?t:e==W?n:s,{useCallback:Vt,useMemo:Mt,useState:Lt}=e,Rt="editable",Et=(e,t)=>ze(c(e,t),(t=>e+"."+t)),zt=(e,t,n)=>{const s=Vt(e,t);return n?s:void 0},$t=(...e)=>Mt((()=>e),e),At=(e,t)=>Mt((()=>({store:e,tableId:t})),[e,t]),Ft=(e,t)=>Mt((()=>({queries:e,queryId:t})),[e,t]),Jt=(e,t=!1,n,s=0,l,a,r,o)=>{const[[i,d,c],u]=Lt([e,t,s]),h=Vt((e=>{u(e),o?.(e)}),[o]),m=zt((e=>h([e,e==i&&!d,c])),[h,i,d,c],n),g=Vt((e=>h([i,d,e])),[h,i,d]),p=!0===r?Yt:r;return[[i,d,c],m,Mt((()=>!1===r?null:Se(p,{offset:c,limit:l,total:a,onChange:g})),[r,p,c,l,a,g])]},Ot=(e,t,n)=>Mt((()=>{const s=t??e;return l=we(s)?We(ze(s,(e=>[e,e]))):s,a=(e,t)=>{return{label:t,component:n,...(s=e,D(s)==B?{label:e}:e)};var s},We(Ke(l,((e,t)=>[t,a(e,t)])));var l,a}),[t,n,e]),Pt=({className:e,headerRow:t,idColumn:n,params:[s,l,a,r,o,i]})=>Se("table",{className:e},i?Se("caption",null,i):null,!1===t?null:Se("thead",null,Se("tr",null,!1===n?null:Se(Dt,{sort:r??[],label:"Id",onClick:o}),Ke(s,(({label:e},t)=>Se(Dt,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),Se("tbody",null,ze(a,(e=>Se("tr",{key:e},!1===n?null:Se("th",null,e),Ke(s,(({component:t,getComponentProps:n},s)=>Se("td",{key:s},Se(t,{...Le(n,e,s),...l,rowId:e,cellId:s}))))))))),Dt=({cellId:e,sort:[t,n],label:s=e??j,onClick:l})=>Se("th",{onClick:zt((()=>l?.(e)),[l,e],l),className:be(n)||t!=e?void 0:`sorted ${n?"de":"a"}scending`},be(n)||t!=e?null:(n?"↓":"↑")+" ",s),jt=({localRowId:t,params:[n,s,l,a,r,o,i]})=>{const d=y(r,t,o);return Se("tr",null,!1===n?null:Se(e.Fragment,null,Se("th",null,t),Se("th",null,d)),Ke(s,(({component:e,getComponentProps:n},s)=>{const[r,o]=s.split(".",2),c=r===l?t:r===a?d:null;return be(c)?null:Se("td",{key:s},Se(e,{...Le(n,c,o),store:i,tableId:r,rowId:c,cellId:o}))})))},Bt=({thing:e,onThingChange:t,className:n,hasSchema:s,showType:l=!0})=>{const[a,r]=Lt(),[o,i]=Lt(),[d,c]=Lt(),[u,h]=Lt(),[m,g]=Lt();o!==e&&(r(xt(e)),i(e),c(e+""),h(Number(e)||0),g(!!e));const p=Vt(((e,n)=>{n(e),i(e),t(e)}),[t]),b=Vt((()=>{if(!s?.()){const e=Nt(a,W,H,B),n=Nt(e,d,u,m);r(e),i(n),t(n)}}),[s,t,d,u,m,a]);return Se("div",{className:n},l?Se("button",{className:a,onClick:b},a):null,Nt(a,Se("input",{key:a,value:d,onChange:Vt((e=>p(e[ie][de]+"",c)),[p])}),Se("input",{key:a,type:"number",value:u,onChange:Vt((e=>p(Number(e[ie][de]||0),h)),[p])}),Se("input",{key:a,type:"checkbox",checked:m,onChange:Vt((e=>p(!!e[ie].checked,g)),[p])})))},Ht=({tableId:e,cellId:t,descending:n,offset:s,limit:l,store:a,editable:r,sortOnClick:o,paginator:u=!1,onChange:h,customCells:m,...g})=>{const[p,b,f]=Jt(t,n,o,s,l,i(e,a),u,h);return Se(Pt,{...g,params:$t(Ot(c(e,a),m,r?Ut:I),At(a,e),d(e,...p,l,a),p,b,f)})},Wt=({store:e,editable:t=!1,valueComponent:n=(t?Xt:r),getValueComponentProps:s,className:l,headerRow:o,idColumn:i})=>Se("table",{className:l},!1===o?null:Se("thead",null,Se("tr",null,!1===i?null:Se("th",null,"Id"),Se("th",null,ae))),Se("tbody",null,ze(a(e),(t=>Se("tr",{key:t},!1===i?null:Se("th",null,t),Se("td",null,Se(n,{...Le(s,t),valueId:t,store:e}))))))),Qt=({indexId:e,sliceId:t,indexes:n,editable:s,customCells:l,...a})=>{const[r,o,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(u(n),e);return Se(Pt,{...a,params:$t(Ot(c(i,o),l,s?Ut:I),At(o,i),h(e,t,r))})},Gt=({relationshipId:t,relationships:n,editable:s,customCells:l,className:a,headerRow:r,idColumn:o=!0})=>{const[i,d,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(m(n),t),h=Ot([...Et(c,d),...Et(u,d)],l,s?Ut:I),p=$t(o,h,c,u,t,i,d);return Se("table",{className:a},!1===r?null:Se("thead",null,Se("tr",null,!1===o?null:Se(e.Fragment,null,Se("th",null,c,".Id"),Se("th",null,u,".Id")),Ke(h,(({label:e},t)=>Se("th",{key:t},e))))),Se("tbody",null,ze(g(c,d),(e=>Se(jt,{key:e,localRowId:e,params:p})))))},Kt=({queryId:e,cellId:t,descending:n,offset:s,limit:l,queries:a,sortOnClick:r,paginator:o=!1,customCells:i,onChange:d,...c})=>{const[u,h,m]=Jt(t,n,r,s,l,p(e,a),o,d);return Se(Pt,{...c,params:$t(Ot(f(e,a),i,w),Ft(a,e),b(e,...u,l,a),u,h,m)})},Ut=({tableId:e,rowId:n,cellId:s,store:a,className:r,showType:i})=>Se(Bt,{thing:t(e,n,s,a),onThingChange:l(e,n,s,(e=>e),[],a),className:r??Rt+se,showType:i,hasSchema:o(a)?.hasTablesSchema}),Xt=({valueId:e,store:t,className:l,showType:a})=>Se(Bt,{thing:n(e,t),onThingChange:s(e,(e=>e),[],t),className:l??Rt+ae,showType:a,hasSchema:o(t)?.hasValuesSchema}),Yt=({onChange:t,total:n,offset:s=0,limit:l=n,singular:a="row",plural:r=a+"s"})=>{(s>n||s<0)&&(s=0,t(0));const o=zt((()=>t(s-l)),[t,s,l],s>0),i=zt((()=>t(s+l)),[t,s,l],s+l<n);return Se(e.Fragment,null,n>l&&Se(e.Fragment,null,Se("button",{className:"previous",disabled:0==s,onClick:o},"←"),Se("button",{className:"next",disabled:s+l>=n,onClick:i},"→"),s+1," to ",me(n,s+l)," of "),n," ",1!=n?r:a)},Zt=({indexes:e,indexesId:t,indexId:n,s:s})=>Se(Tt,{uniqueId:dt("i",t,n),summary:"Index: "+n,s:s},ze(k(n,e),(l=>Se(_t,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),_t=({indexes:e,indexesId:t,indexId:n,sliceId:s,s:l})=>{const a=dt("i",t,n,s),[r,o]=ut(a,l);return Se(Tt,{uniqueId:a,summary:"Slice: "+s,editable:r,handleEditable:o,s:l},Se(Qt,{sliceId:s,indexId:n,indexes:e,editable:r}))},en=({indexesId:e,s:t})=>{const n=v(e),s=C(n);return be(n)?null:Se(Tt,{uniqueId:dt("i",e),summary:"Indexes: "+(e??K),s:t},$e(s)?"No indexes defined":ct(s,(s=>Se(Zt,{indexes:n,indexesId:e,indexId:s,s:t,key:s}))))},tn=({metrics:e,metricId:t})=>Se("tr",null,Se("th",null,t),Se("td",null,e?.getTableId(t)),Se("td",null,S(t,e))),nn=({metricsId:e,s:t})=>{const n=T(e),s=x(n);return be(n)?null:Se(Tt,{uniqueId:dt("m",e),summary:"Metrics: "+(e??K),s:t},$e(s)?"No metrics defined":Se("table",null,Se("thead",null,Se("th",null,"Metric Id"),Se("th",null,"Table Id"),Se("th",null,"Metric")),Se("tbody",null,ze(s,(e=>Se(tn,{metrics:n,metricId:e,key:e}))))))},sn=({queries:e,queriesId:n,queryId:s,s:a})=>{const r=dt("q",n,s),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a);return Se(Tt,{uniqueId:r,summary:"Query: "+s,s:a},Se(Kt,{queryId:s,queries:e,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},ln=({queriesId:e,s:t})=>{const n=q(e),s=N(n);return be(n)?null:Se(Tt,{uniqueId:dt("q",e),summary:"Queries: "+(e??K),s:t},$e(s)?"No queries defined":ct(s,(s=>Se(sn,{queries:n,queriesId:e,queryId:s,s:t,key:s}))))},an=({relationships:e,relationshipsId:t,relationshipId:n,s:s})=>{const l=dt("r",t,n),[a,r]=ut(l,s);return Se(Tt,{uniqueId:l,summary:"Relationship: "+n,editable:a,handleEditable:r,s:s},Se(Gt,{relationshipId:n,relationships:e,editable:a}))},rn=({relationshipsId:e,s:t})=>{const n=V(e),s=M(n);return be(n)?null:Se(Tt,{uniqueId:dt("r",e),summary:"Relationships: "+(e??K),s:t},$e(s)?"No relationships defined":ct(s,(s=>Se(an,{relationships:n,relationshipsId:e,relationshipId:s,s:t,key:s}))))},on=({tableId:e,store:n,storeId:s,s:a})=>{const r=dt("t",s,e),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a),[u,h]=ut(r,a);return Se(Tt,{uniqueId:r,summary:Y+": "+e,editable:u,handleEditable:h,s:a},Se(Ht,{tableId:e,store:n,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:u}))},dn=({store:e,storeId:t,s:n})=>{const s=dt("v",t),[l,r]=ut(s,n);return $e(a(e))?null:Se(Tt,{uniqueId:s,summary:re,editable:l,handleEditable:r,s:n},Se(Wt,{store:e,editable:l}))},cn=({storeId:e,s:t})=>{const n=L(e),s=R(n);return be(n)?null:Se(Tt,{uniqueId:dt("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(e??K),s:t},Se(dn,{storeId:e,store:n,s:t}),ct(s,(s=>Se(on,{store:n,storeId:e,tableId:s,s:t,key:s}))))},un=({s:e})=>{const t=Ve(null),n=Ve(0),[s,l]=Me(!1),{scrollLeft:a,scrollTop:r}=E(e);Ne((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=ge(a)+e.clientWidth&&e.scrollHeight>=ge(r)+e.clientHeight&&e.scrollTo(a,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,r]);const o=qe((t=>{const{scrollLeft:s,scrollTop:a}=t[ie];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{l(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),i=L(),d=z(),c=T(),u=$(),h=v(),m=A(),g=V(),p=F(),b=q(),f=J();return be(i)&&$e(d)&&be(c)&&$e(u)&&be(h)&&$e(m)&&be(g)&&$e(p)&&be(b)&&$e(f)?Se("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):Se("article",{ref:t,onScroll:o},Se(cn,{s:e}),ze(d,(t=>Se(cn,{storeId:t,s:e,key:t}))),Se(nn,{s:e}),ze(u,(t=>Se(nn,{metricsId:t,s:e,key:t}))),Se(en,{s:e}),ze(m,(t=>Se(en,{indexesId:t,s:e,key:t}))),Se(rn,{s:e}),ze(p,(t=>Se(rn,{relationshipsId:t,s:e,key:t}))),Se(ln,{s:e}),ze(f,(t=>Se(ln,{queriesId:t,s:e,key:t}))))};class hn extends Te{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?Se("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const mn=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!1),[],e),a=s(rt,(e=>Number(e[ie].dataset.id)),[],e);return Se("header",null,Se("img",{title:tt}),Se("span",null,tt),ze(nt,((e,n)=>n==t?null:Se("img",{onClick:a,"data-id":n,title:"Dock to "+e,key:n}))),Se("img",{onClick:l,title:"Close"}))},gn=({s:e})=>{const t=n(rt,e)??1;return n(ot,e)?Se("main",{"data-position":t},Se(mn,{s:e}),Se(hn,null,Se(un,{s:e}))):null},pn=e=>t=>{return n=(t,n)=>t+e(n),Cn(t).reduce(n,0);var n},bn=e=>e?.size??0,fn=pn(bn),yn=pn(fn),In=pn(yn),wn=(e,t)=>e?.has(t)??!1,vn=e=>be(e)||0==bn(e),Cn=e=>[...e?.values()??[]],kn=e=>e.clear(),Tn=(e,t)=>e?.forEach(t),xn=(e,t)=>e?.delete(t),Sn=e=>new Map(e),qn=e=>[...e?.keys()??[]],Nn=(e,t)=>e?.get(t),Vn=(e,t)=>Tn(e,((e,n)=>t(n,e))),Mn=(e,t,n)=>be(n)?(xn(e,t),e):e?.set(t,n),Ln=(e,t,n,s)=>(wn(e,t)?s?.(Nn(e,t)):Mn(e,t,n()),Nn(e,t)),Rn=(e,t,n,s=Mn)=>(Ke(t,((t,s)=>n(e,s,t))),Vn(e,(n=>Qe(t,n)?0:s(e,n))),e),En=(e,t,n,s)=>{const l={};return Tn(e,((e,a)=>{if(!n?.(e,a)){const n=t?t(e,a):e;s?.(n)||(l[a]=n)}})),l},zn=(e,t,n)=>En(e,(e=>En(e,t,n)),vn,Ue),$n=(e,t,n)=>En(e,(e=>zn(e,t,n)),vn,Ue),An=(e,t)=>{const n=Sn();return Tn(e,((e,s)=>n.set(s,t?.(e)??e))),n},Fn=e=>An(e,An),Jn=e=>An(e,Fn),On=(e,t,n,s,l=0)=>fe((n?Ln:Nn)(e,t[l],l>Ce(t)-2?n:Sn),(a=>{if(l>Ce(t)-2)return s?.(a)&&Mn(e,t[l]),a;const r=On(a,t,n,s,l+1);return vn(a)&&Mn(e,t[l]),r})),Pn=Sn(),Dn=Sn(),jn="storage",Bn=e=>new Set(we(e)||be(e)?e:[e]),Hn=(e,t)=>e?.add(t),Wn=/^\d+$/,Qn=()=>{const e=[];let t=0;return[n=>(n?Fe(e):null)??j+t++,t=>{Wn.test(t)&&Ce(e)<1e3&&Ae(e,t)}]},Gn=e=>[e,e],Kn=(e,t=fn)=>t(e[0])+t(e[1]),Un=()=>[Sn(),Sn()],Xn=e=>[...e],Yn=([e,t])=>e===t;Sn(ze("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(j),((e,t)=>[e,t])));const Zn=(e,t,n)=>Mn(e,t,Nn(e,t)==-n?void 0:n),_n=()=>{let e,t,n=!1,s=!1,l=0,a=[];const r=Sn(),o=Sn(),i=Sn(),d=Sn(),c=Sn(),u=Sn(),h=Sn(),m=Sn(),g=Sn(),p=Sn(),b=Sn(),f=Sn(),y=Sn(),I=Sn(),w=Bn(),v=Sn(),C=Sn(),k=Sn(),T=Sn(),x=Un(),S=Un(),q=Un(),N=Un(),V=Un(),M=Un(),L=Un(),R=Un(),E=Un(),z=Un(),$=Un(),A=Un(),F=Un(),J=Un(),O=Un(),P=Un(),D=Un(),B=Un(),H=Un(),Q=Un(),X=Un(),ie=Un(),de=Sn(),ue=Un(),[he,me,ge,pe]=(()=>{let e;const[t,n]=Qn(),s=Sn();return[(n,l,a,r=[],o=()=>[])=>{e??=ln;const i=t(1);return Mn(s,i,[n,l,a,r,o]),Hn(On(l,a??[j],Bn),i),i},(t,n,...l)=>Ee(((e,t=[j])=>{const n=[],s=(e,l)=>l==Ce(t)?Ae(n,e):null===t[l]?Tn(e,(e=>s(e,l+1))):Ee([t[l],null],(t=>s(Nn(e,t),l+1)));return s(e,0),n})(t,n),(t=>Tn(t,(t=>Nn(s,t)[0](e,...n??[],...l))))),e=>fe(Nn(s,e),(([,t,l])=>(On(t,l??[j],void 0,(t=>(xn(t,e),vn(t)?1:0))),Mn(s,e),n(e),l))),t=>fe(Nn(s,t),(([t,,n=[],s,l])=>{const a=(...r)=>{const o=Ce(r);o==Ce(n)?t(e,...r,...l(r)):be(n[o])?Ee(s[o]?.(...r)??[],(e=>a(...r,e))):a(...r,n[o])};a()}))]})(),ke=e=>{if(!Xe(e,((e,t)=>[G,K].includes(t))))return!1;const t=e[G];return!(!ye(t)&&t!=W||(xt(e[K])!=t&&Ge(e,K),0))},Te=we,xe=(t,n)=>(!e||wn(b,n)||mt(n))&&Xe(t,((e,t)=>Se(n,t,e)),(()=>mt(n))),Se=(e,t,n,s)=>Xe(s?n:Me(n,e,t),((s,l)=>fe(qe(e,t,l,s),(e=>(n[l]=e,!0)),(()=>!1))),(()=>mt(e,t))),qe=(t,n,s,l)=>e?fe(Nn(Nn(b,t),s),(e=>xt(l)!=e[G]?mt(t,n,s,l,e[K]):l),(()=>mt(t,n,s,l))):be(xt(l))?mt(t,n,s,l):l,Ne=(e,t)=>Xe(t?e:Le(e),((t,n)=>fe(Ve(n,t),(t=>(e[n]=t,!0)),(()=>!1))),(()=>gt())),Ve=(e,n)=>t?fe(Nn(y,e),(t=>xt(n)!=t[G]?gt(e,n,t[K]):n),(()=>gt(e,n))):be(xt(n))?gt(e,n):n,Me=(e,t,n)=>(fe(Nn(f,t),(([s,l])=>{Tn(s,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(l,(s=>{Qe(e,s)||mt(t,n,s)}))})),e),Le=e=>(t&&(Tn(I,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(w,(t=>{Qe(e,t)||gt(t)}))),e),$e=e=>Rn(b,e,((e,t,n)=>{const s=Sn(),l=Bn();Rn(Ln(b,t,Sn),n,((e,t,n)=>{Mn(e,t,n),fe(n[K],(e=>Mn(s,t,e)),(()=>Hn(l,t)))})),Mn(f,t,[s,l])}),((e,t)=>{Mn(b,t),Mn(f,t)})),Fe=e=>Rn(y,e,((e,t,n)=>{Mn(y,t,n),fe(n[K],(e=>Mn(I,t,e)),(()=>Hn(w,t)))}),((e,t)=>{Mn(y,t),Mn(I,t),xn(w,t)})),Je=e=>Ue(e)?Ut():Ht(e),Oe=e=>Rn(k,e,((e,t,n)=>Pe(t,n)),((e,t)=>st(t))),Pe=(e,t)=>Rn(Ln(k,e,(()=>(ot(e,1),Mn(v,e,Qn()),Mn(C,e,Sn()),Sn()))),t,((t,n,s)=>De(e,t,n,s)),((t,n)=>lt(e,t,n))),De=(e,t,n,s,l)=>Rn(Ln(t,n,(()=>(it(e,n,1),Sn()))),s,((t,s,l)=>je(e,n,t,s,l)),((s,a)=>at(e,t,n,s,a,l))),je=(e,t,n,s,l)=>{wn(n,s)||dt(e,t,s,1);const a=Nn(n,s);l!==a&&(ct(e,t,s,a,l),Mn(n,s,l))},Be=(e,t,n,s,l)=>fe(Nn(t,n),(t=>je(e,n,t,s,l)),(()=>De(e,t,n,Me({[s]:l},e,n)))),We=e=>Ue(e)?Zt():Wt(e),Ye=e=>Rn(T,e,((e,t,n)=>et(t,n)),((e,t)=>rt(t))),et=(e,t)=>{wn(T,e)||ut(e,1);const n=Nn(T,e);t!==n&&(ht(e,n,t),Mn(T,e,t))},tt=(e,t)=>{const[n]=Nn(v,e),s=n(t);return wn(Nn(k,e),s)?tt(e,t):s},nt=e=>Nn(k,e)??Pe(e,{}),st=e=>Pe(e,{}),lt=(e,t,n)=>{const[,s]=Nn(v,e);s(n),De(e,t,n,{},!0)},at=(e,t,n,s,l,a)=>{const r=Nn(Nn(f,e)?.[0],l);if(!be(r)&&!a)return je(e,n,s,l,r);const o=t=>{ct(e,n,t,Nn(s,t)),dt(e,n,t,-1),Mn(s,t)};be(r)?o(l):Vn(s,o),vn(s)&&(it(e,n,-1),vn(Mn(t,n))&&(ot(e,-1),Mn(k,e),Mn(v,e),Mn(C,e)))},rt=e=>{const t=Nn(I,e);if(!be(t))return et(e,t);ht(e,Nn(T,e)),ut(e,-1),Mn(T,e)},ot=(e,t)=>Zn(r,e,t),it=(e,t,n)=>Zn(Ln(d,e,Sn),t,n)&&Mn(i,e,Ln(i,e,(()=>0))+n),dt=(e,t,n,s)=>{const l=Nn(C,e),a=Nn(l,n)??0;(0==a&&1==s||1==a&&-1==s)&&Zn(Ln(o,e,Sn),n,s),Mn(l,n,a!=-s?a+s:null),Zn(Ln(Ln(c,e,Sn),t,Sn),n,s)},ct=(e,t,n,s,l)=>{Ln(Ln(Ln(u,e,Sn),t,Sn),n,(()=>[s,0]))[1]=l,a[3]?.(e,t,n,l)},ut=(e,t)=>Zn(h,e,t),ht=(e,t,n)=>{Ln(m,e,(()=>[t,0]))[1]=n,a[4]?.(e,n)},mt=(e,t,n,s,l)=>(Ae(Ln(Ln(Ln(g,e,Sn),t,Sn),n,(()=>[])),s),l),gt=(e,t,n)=>(Ae(Ln(p,e,(()=>[])),t),n),pt=(e,t,n)=>fe(Nn(Nn(Nn(u,e),t),n),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(Et(e,t,n))])),bt=e=>fe(Nn(m,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(At(e))])),ft=e=>vn(g)||vn(P[e])?0:Tn(e?Jn(g):g,((t,n)=>Tn(t,((t,s)=>Tn(t,((t,l)=>me(P[e],[n,s,l],t))))))),yt=e=>vn(p)||vn(D[e])?0:Tn(e?An(p):p,((t,n)=>me(D[e],[n],t))),It=(e,t,n,s)=>{if(!vn(e))return me(t,s,(()=>En(e))),Vn(e,((e,t)=>me(n,[...s??[],e],1==t))),1},wt=e=>{const t=Ft();t!=n&&me(x[e],void 0,t);const s=vn(z[e]),l=vn(F[e])&&vn(J[e])&&vn(E[e])&&vn($[e])&&vn(M[e])&&vn(L[e])&&vn(R[e])&&s&&vn(q[e])&&vn(N[e]),a=vn(O[e])&&vn(A[e])&&vn(V[e])&&vn(S[e]);if(!l||!a){const t=e?[An(r),Fn(o),An(i),Fn(d),Jn(c),Jn(u)]:[r,o,i,d,c,u];if(!l){It(t[0],q[e],N[e]),Tn(t[1],((t,n)=>It(t,M[e],L[e],[n]))),Tn(t[2],((t,n)=>{0!=t&&me(R[e],[n],Vt(n))}));const n=Bn();Tn(t[3],((t,l)=>{It(t,E[e],$[e],[l])&&!s&&(me(z[e],[l,null]),Hn(n,l))})),s||Tn(t[5],((t,s)=>{if(!wn(n,s)){const n=Bn();Tn(t,(e=>Tn(e,(([t,s],l)=>s!==t?Hn(n,l):xn(e,l))))),Tn(n,(t=>me(z[e],[s,t])))}})),Tn(t[4],((t,n)=>Tn(t,((t,s)=>It(t,F[e],J[e],[n,s])))))}if(!a){let n;Tn(t[5],((t,s)=>{let l;Tn(t,((t,a)=>{let r;Tn(t,(([t,o],i)=>{o!==t&&(me(O[e],[s,a,i],o,t,pt),n=l=r=1)})),r&&me(A[e],[s,a],pt)})),l&&me(V[e],[s],pt)})),n&&me(S[e],void 0,pt)}}},vt=e=>{const t=jt();t!=s&&me(B[e],void 0,t);const n=vn(Q[e])&&vn(X[e]),l=vn(ie[e])&&vn(H[e]);if(!n||!l){const t=e?[An(h),An(m)]:[h,m];if(n||It(t[0],Q[e],X[e]),!l){let n;Tn(t[1],(([t,s],l)=>{s!==t&&(me(ie[e],[l],s,t,bt),n=1)})),n&&me(H[e],void 0,bt)}}},Ct=(e,...t)=>(tn((()=>e(...ze(t,ce)))),ln),kt=()=>$n(k),Tt=()=>qn(k),Nt=e=>qn(Nn(C,ce(e))),Vt=e=>bn(Nn(k,ce(e))),Mt=e=>qn(Nn(k,ce(e))),Lt=(e,t,n,s=0,l)=>{return ze(ve(Re((a=Nn(k,ce(e)),r=(e,n)=>[be(t)?n:Nn(e,ce(t)),n],ze([...a?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>((e??0)<(t??0)?-1:1)*(n?-1:1))),s,be(l)?l:s+l),(([,e])=>e));var a,r},Rt=(e,t)=>qn(Nn(Nn(k,ce(e)),ce(t))),Et=(e,t,n)=>Nn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),zt=()=>En(T),$t=()=>qn(T),At=e=>Nn(T,ce(e)),Ft=()=>!vn(k),Jt=e=>wn(k,ce(e)),Ot=(e,t)=>wn(Nn(C,ce(e)),ce(t)),Pt=(e,t)=>wn(Nn(k,ce(e)),ce(t)),Dt=(e,t,n)=>wn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),jt=()=>!vn(T),Bt=e=>wn(T,ce(e)),Ht=e=>Ct((()=>(e=>Xe(e,xe,mt))(e)?Oe(e):0)),Wt=e=>Ct((()=>Ne(e)?Ye(e):0)),Qt=e=>{try{Je(Ze(e))}catch{}return ln},Gt=t=>Ct((()=>{if((e=Xe(t,(e=>Xe(e,ke))))&&($e(t),!vn(k))){const e=kt();Ut(),Ht(e)}})),Kt=e=>Ct((()=>{if(t=(e=>Xe(e,ke))(e)){const n=zt();en(),Zt(),t=!0,Fe(e),Wt(n)}})),Ut=()=>Ct((()=>Oe({}))),Xt=e=>Ct((e=>wn(k,e)?st(e):0),e),Yt=(e,t)=>Ct(((e,t)=>fe(Nn(k,e),(n=>wn(n,t)?lt(e,n,t):0))),e,t),Zt=()=>Ct((()=>Ye({}))),_t=()=>Ct((()=>{$e({}),e=!1})),en=()=>Ct((()=>{Fe({}),t=!1})),tn=(e,t)=>{if(-1!=l){nn();const n=e();return sn(t),n}},nn=()=>(-1!=l&&l++,1==l&&(a[0]?.(),me(de)),ln),sn=e=>(l>0&&(l--,0==l&&(l=1,ft(1),vn(u)||wt(1),yt(1),vn(m)||vt(1),e?.(ln)&&(Tn(u,((e,t)=>Tn(e,((e,n)=>Tn(e,(([e],s)=>St(ln,t,n,s,e))))))),kn(u),Tn(m,(([e],t)=>qt(ln,t,e))),kn(m)),me(ue[0],void 0),l=-1,ft(0),vn(u)||wt(0),yt(0),vn(m)||vt(0),a[1]?.(),me(ue[1],void 0),a[2]?.(),l=0,n=Ft(),s=jt(),Ee([r,o,i,d,c,u,g,h,m,p],kn))),ln),ln={getContent:()=>[kt(),zt()],getTables:kt,getTableIds:Tt,getTable:e=>zn(Nn(k,ce(e))),getTableCellIds:Nt,getRowCount:Vt,getRowIds:Mt,getSortedRowIds:Lt,getRow:(e,t)=>En(Nn(Nn(k,ce(e)),ce(t))),getCellIds:Rt,getCell:Et,getValues:zt,getValueIds:$t,getValue:At,hasTables:Ft,hasTable:Jt,hasTableCell:Ot,hasRow:Pt,hasCell:Dt,hasValues:jt,hasValue:Bt,getTablesJson:()=>_e(k),getValuesJson:()=>_e(T),getJson:()=>_e([k,T]),getTablesSchemaJson:()=>_e(b),getValuesSchemaJson:()=>_e(y),getSchemaJson:()=>_e([b,y]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>Ct((()=>Te(e)?(([e,t])=>{(Ue(e)?Ut:Ht)(e),(Ue(t)?Zt:Wt)(t)})(e):0)),setTables:Ht,setTable:(e,t)=>Ct((e=>xe(t,e)?Pe(e,t):0),e),setRow:(e,t,n)=>Ct(((e,t)=>Se(e,t,n)?De(e,nt(e),t,n):0),e,t),addRow:(e,t,n=!0)=>tn((()=>{let s;return Se(e,s,t)&&(e=ce(e),De(e,nt(e),s=tt(e,n?1:0),t)),s})),setPartialRow:(e,t,n)=>Ct(((e,t)=>{if(Se(e,t,n,1)){const s=nt(e);Ke(n,((n,l)=>Be(e,s,t,l,n)))}}),e,t),setCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(qe(e,t,n,Ie(s)?s(Et(e,t,n)):s),(s=>Be(e,nt(e),t,n,s)))),e,t,n),setValues:Wt,setPartialValues:e=>Ct((()=>Ne(e,1)?Ke(e,((e,t)=>et(t,e))):0)),setValue:(e,t)=>Ct((e=>fe(Ve(e,Ie(t)?t(At(e)):t),(t=>et(e,t)))),e),applyChanges:e=>Ct((()=>{Ke(e[0],((e,t)=>be(e)?Xt(t):Ke(e,((e,n)=>be(e)?Yt(t,n):Ke(e,((e,s)=>St(ln,t,n,s,e))))))),Ke(e[1],((e,t)=>qt(ln,t,e)))})),setTablesJson:Qt,setValuesJson:e=>{try{We(Ze(e))}catch{}return ln},setJson:e=>Ct((()=>{try{const[t,n]=Ze(e);Je(t),We(n)}catch{Qt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>Ct((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:Xt,delRow:Yt,delCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Nn(k,e),(l=>fe(Nn(l,t),(a=>wn(a,n)?at(e,l,t,a,n,s):0))))),e,t,n),delValues:Zt,delValue:e=>Ct((e=>wn(T,e)?rt(e):0),e),delTablesSchema:_t,delValuesSchema:en,delSchema:()=>Ct((()=>{_t(),en()})),transaction:tn,startTransaction:nn,getTransactionChanges:()=>[En(u,((e,t)=>-1===Nn(r,t)?void 0:En(e,((e,n)=>-1===Nn(Nn(d,t),n)?void 0:En(e,(([,e])=>e),(e=>Yn(e)))),vn,Ue)),vn,Ue),En(m,(([,e])=>e),(e=>Yn(e))),1],getTransactionLog:()=>[!vn(u),!vn(m),$n(u,Xn,Yn),$n(g),En(m,Xn,Yn),En(p),En(r),zn(d),$n(c),En(h)],finishTransaction:sn,forEachTable:e=>Tn(k,((t,n)=>e(n,(e=>Tn(t,((t,n)=>e(n,(e=>Vn(t,e))))))))),forEachTableCell:(e,t)=>Vn(Nn(C,ce(e)),t),forEachRow:(e,t)=>Tn(Nn(k,ce(e)),((e,n)=>t(n,(t=>Vn(e,t))))),forEachCell:(e,t,n)=>Vn(Nn(Nn(k,ce(e)),ce(t)),n),forEachValue:e=>Vn(T,e),addSortedRowIdsListener:(e,t,n,s,l,a,r)=>{let o=Lt(e,t,n,s,l);return he((()=>{const r=Lt(e,t,n,s,l);var i,d,c;d=o,Ce(i=r)===Ce(d)&&(c=(e,t)=>d[t]===e,i.every(c))||(o=r,a(ln,e,t,n,s,l,o))}),z[r?1:0],[e,t],[Tt])},addStartTransactionListener:e=>he(e,de),addWillFinishTransactionListener:e=>he(e,ue[0]),addDidFinishTransactionListener:e=>he(e,ue[1]),callListener:e=>(pe(e),ln),delListener:e=>(ge(e),ln),getListenerStats:()=>({hasTables:Kn(x),tables:Kn(S),tableIds:Kn(q),hasTable:Kn(N),table:Kn(V),tableCellIds:Kn(M),hasTableCell:Kn(L,yn),rowCount:Kn(R),rowIds:Kn(E),sortedRowIds:Kn(z),hasRow:Kn($,yn),row:Kn(A,yn),cellIds:Kn(F,yn),hasCell:Kn(J,In),cell:Kn(O,In),invalidCell:Kn(P,In),hasValues:Kn(B),values:Kn(H),valueIds:Kn(Q),hasValue:Kn(X),value:Kn(ie),invalidValue:Kn(D),transaction:fn(de)+Kn(ue)}),isMergeable:()=>!1,createStore:_n,addListener:he,callListeners:me,setInternalListeners:(e,t,n,s,l)=>a=[e,t,n,s,l]};return Ke({[U+Z]:[0,x,[],()=>[Ft()]],[Z]:[0,S],[_]:[0,q],[U+Y]:[1,N,[Tt],e=>[Jt(...e)]],[Y]:[1,V,[Tt]],[Y+le]:[1,M,[Tt]],[U+Y+se]:[2,L,[Tt,Nt],e=>[Ot(...e)]],[te]:[1,R,[Tt]],[ne]:[1,E,[Tt]],[U+ee]:[2,$,[Tt,Mt],e=>[Pt(...e)]],[ee]:[2,A,[Tt,Mt]],[le]:[2,F,[Tt,Mt]],[U+se]:[3,J,[Tt,Mt,Rt],e=>[Dt(...e)]],[se]:[3,O,[Tt,Mt,Rt],e=>Gn(Et(...e))],InvalidCell:[3,P],[U+re]:[0,B,[],()=>[jt()]],[re]:[0,H],[oe]:[0,Q],[U+ae]:[1,X,[$t],e=>[Bt(...e)]],[ae]:[1,ie,[$t],e=>Gn(At(e[0]))],InvalidValue:[1,D]},(([e,t,n,s],l)=>{ln["add"+l+"Listener"]=(...l)=>he(l[e],t[l[e+1]?1:0],e>0?ve(l,0,e):void 0,n,s)})),He(ln)},es=({position:e="right",open:t=!1})=>{const n=O(_n),s=nt.indexOf(e);return P(n,(e=>{return t=et,n=sessionStorage,((e,t,n,s,l,a,r,o={},i=[])=>{let d,c,u,h=0,m=0,g=0;Ln(Pn,i,(()=>0)),Ln(Dn,i,(()=>[]));const[p,b,f,y,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ue(e)||!Ue(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ue(e)||!Ue(t),t.setContent]:ke("Store type not supported by this Persister"))(r,e),w=t=>{(p&&we(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},v=async e=>(2!=h&&(h=1,m++,await x((async()=>{try{const e=await t();we(e)?w(e):ke("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))),S),C=()=>(c&&(l(c),c=void 0),S),k=async e=>(1!=h&&(h=2,g++,await x((async()=>{try{await n(b,e)}catch(e){}h=0}))),S),T=()=>(fe(u,e.delListener),u=void 0,S),x=async(...e)=>(Ae(Nn(Dn,i),...e),await(async()=>{if(!Nn(Pn,i)){for(Mn(Pn,i,1);!be(d=Fe(Nn(Dn,i)));)try{await d()}catch(e){}Mn(Pn,i,0)}})(),S),S={load:v,startAutoLoad:async e=>{await C().load(e);try{c=await s((async(e,t)=>{t||e?2!=h&&(h=1,m++,w(t??e),h=0):await v()}))}catch(e){}return S},stopAutoLoad:C,isAutoLoading:()=>!be(c),save:k,startAutoSave:async()=>(await T().save(),u=e.addDidFinishTransactionListener((()=>{const e=f();y(e)&&k(e)})),S),stopAutoSave:T,isAutoSaving:()=>!be(u),schedule:x,getStore:()=>e,destroy:()=>(Nn(Dn,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:g}),...o};return He(S)})(e,(async()=>{return e=n.getItem(t),Ze(e,((e,t)=>""===t?void 0:t));var e}),(async e=>{return n.setItem(t,(s=e(),Ye(s,((e,t)=>void 0===t?"":t))));var s}),(e=>{const s=s=>{if(s.storageArea===n&&s.key===t)try{e(Ze(s.newValue))}catch{e()}};return ue.addEventListener(jn,s),s}),(e=>ue.removeEventListener(jn,e)),0,3,{getStorageName:()=>t});var t,n}),void 0,(async e=>{await e.load([{},{position:-1==s?1:s,open:!!t}]),await e.startAutoSave()})),Se(xe,null,Se("aside",{id:et},Se(kt,{s:n}),Se(gn,{s:n})),Se("style",null,Ct))};export{es as Inspector};
1
+ import e from"react";import{useCell as t,useValue as n,useSetValueCallback as s,useSetCellCallback as l,useValueIds as a,ValueView as r,useStoreOrStoreById as o,useRowCount as i,useSortedRowIds as d,useTableCellIds as c,useIndexesOrIndexesById as u,useSliceRowIds as h,useRelationshipsOrRelationshipsById as m,useRowIds as g,useResultRowCount as p,useResultSortedRowIds as b,useResultTableCellIds as f,useRemoteRowId as y,CellView as I,ResultCellView as w,useIndexes as v,useIndexIds as C,useSliceIds as k,useMetrics as T,useMetricIds as x,useMetric as S,useQueries as q,useQueryIds as N,useRelationships as V,useRelationshipIds as M,useStore as L,useTableIds as R,useValues as E,useStoreIds as z,useMetricsIds as $,useIndexesIds as A,useRelationshipsIds as F,useQueriesIds as J,useCreateStore as O,useCreatePersister as P}from"../../ui-react/with-schemas/index.js";const D=e=>typeof e,j="",B=D(j),H=D(!0),W=D(0),Q=D(D),G="type",K="default",U="Has",X="Ids",Y="Table",Z=Y+"s",_=Y+X,ee="Row",te=ee+"Count",ne=ee+X,se="Cell",le=se+X,ae="Value",re=ae+"s",oe=ae+X,ie="currentTarget",de="value",ce=e=>j+e,ue=globalThis.window,he=Math,me=he.min,ge=he.floor,pe=isFinite,be=e=>null==e,fe=(e,t,n)=>be(e)?n?.():t(e),ye=e=>e==B||e==H,Ie=e=>D(e)==Q,we=e=>Array.isArray(e),ve=(e,t,n)=>e.slice(t,n),Ce=e=>e.length,ke=e=>{throw Error(e)},{PureComponent:Te,Fragment:xe,createElement:Se,useCallback:qe,useLayoutEffect:Ne,useRef:Ve,useState:Me}=e,Le=(e,...t)=>be(e)?{}:e(...t),Re=(e,t)=>e.sort(t),Ee=(e,t)=>e.forEach(t),ze=(e,t)=>e.map(t),$e=e=>0==Ce(e),Ae=(e,...t)=>e.push(...t),Fe=e=>e.shift(),Je=Object,Oe=e=>Je.getPrototypeOf(e),Pe=Je.entries,De=Je.isFrozen,je=e=>!be(e)&&fe(Oe(e),(e=>e==Je.prototype||be(Oe(e))),(()=>!0)),Be=Je.keys,He=Je.freeze,We=(e=[])=>Je.fromEntries(e),Qe=(e,t)=>t in e,Ge=(e,t)=>(delete e[t],e),Ke=(e,t)=>ze(Pe(e),(([e,n])=>t(n,e))),Ue=e=>je(e)&&0==(e=>Ce(Be(e)))(e),Xe=(e,t,n,s=0)=>be(e)||!je(e)||!s&&Ue(e)||De(e)?(n?.(),!1):(Ke(e,((n,s)=>{t(n,s)||Ge(e,s)})),!!s||!Ue(e)),Ye=JSON.stringify,Ze=JSON.parse,_e=e=>Ye(e,((e,t)=>t instanceof Map?Je.fromEntries([...t]):t)),et="tinybaseInspector",tt="TinyBase Inspector",nt=["left","top","bottom","right","full"],st="state",lt="sort",at="open",rt="position",ot=at,it="editable",dt=(...e)=>_e(e),ct=(e,t)=>ze(Re([...e]),t),ut=(e,n)=>[!!t(st,e,it,n),qe((t=>{n.setCell(st,e,it,(e=>!e)),t.preventDefault()}),[n,e])],ht="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",mt='content:url("',gt=mt+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",pt='</svg>")',bt=mt+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",ft=ze([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,n,s])=>gt+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${n}' height='${s}' fill='white'/>`+pt)),yt=gt+"<path d='M20 20l60 60M20 80l60-60' />"+pt,It=gt+`<path d='${ht}' />`+pt,wt=gt+`<path d='${ht}M20 20l60 60' />`+pt,vt="*::-webkit-scrollbar",Ct=((e,t="")=>e.join(t))(Ke({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[vt]:"width:0.5rem;height:0.5rem;",[vt+"-track"]:"background:#111",[vt+"-thumb"]:"background:#999;border:1px solid #111",[vt+"-thumb:hover"]:"background:#fff",[vt+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+bt,...We(ze(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e]))),main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;",...We(ze(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e]))),header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":bt,"header>img:nth-of-type(6)":yt,...We(ze(ft,((e,t)=>[`header>img[data-id='${t}']`,e]))),"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":It,"details[open]>summary img.done":wt,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${et} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"},((e,t)=>e?`#${et} ${t}{${e}}`:""))),kt=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!0),[],e);return n(ot,e)?null:Se("img",{onClick:l,title:tt,"data-position":t})},Tt=({uniqueId:e,summary:n,editable:s,handleEditable:a,children:r,s:o})=>{const i=!!t(st,e,at,o),d=l(st,e,at,(e=>e[ie].open),[],o);return Se("details",{open:i,onToggle:d},Se("summary",null,n,a?Se("img",{onClick:a,className:s?"done":"edit"}):null),r)},xt=e=>{const t=D(e);return ye(t)||t==W&&pe(e)?t:void 0},St=(e,t,n,s,l)=>be(l)?e.delCell(t,n,s,!0):e.setCell(t,n,s,l),qt=(e,t,n)=>be(n)?e.delValue(t):e.setValue(t,n),Nt=(e,t,n,s)=>e==B?t:e==W?n:s,{useCallback:Vt,useMemo:Mt,useState:Lt}=e,Rt="editable",Et=(e,t)=>ze(c(e,t),(t=>e+"."+t)),zt=(e,t,n)=>{const s=Vt(e,t);return n?s:void 0},$t=(...e)=>Mt((()=>e),e),At=(e,t)=>Mt((()=>({store:e,tableId:t})),[e,t]),Ft=(e,t)=>Mt((()=>({queries:e,queryId:t})),[e,t]),Jt=(e,t=!1,n,s=0,l,a,r,o)=>{const[[i,d,c],u]=Lt([e,t,s]),h=Vt((e=>{u(e),o?.(e)}),[o]),m=zt((e=>h([e,e==i&&!d,c])),[h,i,d,c],n),g=Vt((e=>h([i,d,e])),[h,i,d]),p=!0===r?Yt:r;return[[i,d,c],m,Mt((()=>!1===r?null:Se(p,{offset:c,limit:l,total:a,onChange:g})),[r,p,c,l,a,g])]},Ot=(e,t,n)=>Mt((()=>{const s=t??e;return l=we(s)?We(ze(s,(e=>[e,e]))):s,a=(e,t)=>{return{label:t,component:n,...(s=e,D(s)==B?{label:e}:e)};var s},We(Ke(l,((e,t)=>[t,a(e,t)])));var l,a}),[t,n,e]),Pt=({className:e,headerRow:t,idColumn:n,params:[s,l,a,r,o,i]})=>Se("table",{className:e},i?Se("caption",null,i):null,!1===t?null:Se("thead",null,Se("tr",null,!1===n?null:Se(Dt,{sort:r??[],label:"Id",onClick:o}),Ke(s,(({label:e},t)=>Se(Dt,{key:t,cellId:t,label:e,sort:r??[],onClick:o}))))),Se("tbody",null,ze(a,(e=>Se("tr",{key:e},!1===n?null:Se("th",null,e),Ke(s,(({component:t,getComponentProps:n},s)=>Se("td",{key:s},Se(t,{...Le(n,e,s),...l,rowId:e,cellId:s}))))))))),Dt=({cellId:e,sort:[t,n],label:s=e??j,onClick:l})=>Se("th",{onClick:zt((()=>l?.(e)),[l,e],l),className:be(n)||t!=e?void 0:`sorted ${n?"de":"a"}scending`},be(n)||t!=e?null:(n?"↓":"↑")+" ",s),jt=({localRowId:t,params:[n,s,l,a,r,o,i]})=>{const d=y(r,t,o);return Se("tr",null,!1===n?null:Se(e.Fragment,null,Se("th",null,t),Se("th",null,d)),Ke(s,(({component:e,getComponentProps:n},s)=>{const[r,o]=s.split(".",2),c=r===l?t:r===a?d:null;return be(c)?null:Se("td",{key:s},Se(e,{...Le(n,c,o),store:i,tableId:r,rowId:c,cellId:o}))})))},Bt=({thing:e,onThingChange:t,className:n,hasSchema:s,showType:l=!0})=>{const[a,r]=Lt(),[o,i]=Lt(),[d,c]=Lt(),[u,h]=Lt(),[m,g]=Lt();o!==e&&(r(xt(e)),i(e),c(e+""),h(Number(e)||0),g(!!e));const p=Vt(((e,n)=>{n(e),i(e),t(e)}),[t]),b=Vt((()=>{if(!s?.()){const e=Nt(a,W,H,B),n=Nt(e,d,u,m);r(e),i(n),t(n)}}),[s,t,d,u,m,a]);return Se("div",{className:n},l?Se("button",{className:a,onClick:b},a):null,Nt(a,Se("input",{key:a,value:d,onChange:Vt((e=>p(e[ie][de]+"",c)),[p])}),Se("input",{key:a,type:"number",value:u,onChange:Vt((e=>p(Number(e[ie][de]||0),h)),[p])}),Se("input",{key:a,type:"checkbox",checked:m,onChange:Vt((e=>p(!!e[ie].checked,g)),[p])})))},Ht=({tableId:e,cellId:t,descending:n,offset:s,limit:l,store:a,editable:r,sortOnClick:o,paginator:u=!1,onChange:h,customCells:m,...g})=>{const[p,b,f]=Jt(t,n,o,s,l,i(e,a),u,h);return Se(Pt,{...g,params:$t(Ot(c(e,a),m,r?Ut:I),At(a,e),d(e,...p,l,a),p,b,f)})},Wt=({store:e,editable:t=!1,valueComponent:n=(t?Xt:r),getValueComponentProps:s,className:l,headerRow:o,idColumn:i})=>Se("table",{className:l},!1===o?null:Se("thead",null,Se("tr",null,!1===i?null:Se("th",null,"Id"),Se("th",null,ae))),Se("tbody",null,ze(a(e),(t=>Se("tr",{key:t},!1===i?null:Se("th",null,t),Se("td",null,Se(n,{...Le(s,t),valueId:t,store:e}))))))),Qt=({indexId:e,sliceId:t,indexes:n,editable:s,customCells:l,...a})=>{const[r,o,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(u(n),e);return Se(Pt,{...a,params:$t(Ot(c(i,o),l,s?Ut:I),At(o,i),h(e,t,r))})},Gt=({relationshipId:t,relationships:n,editable:s,customCells:l,className:a,headerRow:r,idColumn:o=!0})=>{const[i,d,c,u]=((e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)])(m(n),t),h=Ot([...Et(c,d),...Et(u,d)],l,s?Ut:I),p=$t(o,h,c,u,t,i,d);return Se("table",{className:a},!1===r?null:Se("thead",null,Se("tr",null,!1===o?null:Se(e.Fragment,null,Se("th",null,c,".Id"),Se("th",null,u,".Id")),Ke(h,(({label:e},t)=>Se("th",{key:t},e))))),Se("tbody",null,ze(g(c,d),(e=>Se(jt,{key:e,localRowId:e,params:p})))))},Kt=({queryId:e,cellId:t,descending:n,offset:s,limit:l,queries:a,sortOnClick:r,paginator:o=!1,customCells:i,onChange:d,...c})=>{const[u,h,m]=Jt(t,n,r,s,l,p(e,a),o,d);return Se(Pt,{...c,params:$t(Ot(f(e,a),i,w),Ft(a,e),b(e,...u,l,a),u,h,m)})},Ut=({tableId:e,rowId:n,cellId:s,store:a,className:r,showType:i})=>Se(Bt,{thing:t(e,n,s,a),onThingChange:l(e,n,s,(e=>e),[],a),className:r??Rt+se,showType:i,hasSchema:o(a)?.hasTablesSchema}),Xt=({valueId:e,store:t,className:l,showType:a})=>Se(Bt,{thing:n(e,t),onThingChange:s(e,(e=>e),[],t),className:l??Rt+ae,showType:a,hasSchema:o(t)?.hasValuesSchema}),Yt=({onChange:t,total:n,offset:s=0,limit:l=n,singular:a="row",plural:r=a+"s"})=>{(s>n||s<0)&&(s=0,t(0));const o=zt((()=>t(s-l)),[t,s,l],s>0),i=zt((()=>t(s+l)),[t,s,l],s+l<n);return Se(e.Fragment,null,n>l&&Se(e.Fragment,null,Se("button",{className:"previous",disabled:0==s,onClick:o},"←"),Se("button",{className:"next",disabled:s+l>=n,onClick:i},"→"),s+1," to ",me(n,s+l)," of "),n," ",1!=n?r:a)},Zt=({indexes:e,indexesId:t,indexId:n,s:s})=>Se(Tt,{uniqueId:dt("i",t,n),summary:"Index: "+n,s:s},ze(k(n,e),(l=>Se(_t,{indexes:e,indexesId:t,indexId:n,sliceId:l,s:s,key:l})))),_t=({indexes:e,indexesId:t,indexId:n,sliceId:s,s:l})=>{const a=dt("i",t,n,s),[r,o]=ut(a,l);return Se(Tt,{uniqueId:a,summary:"Slice: "+s,editable:r,handleEditable:o,s:l},Se(Qt,{sliceId:s,indexId:n,indexes:e,editable:r}))},en=({indexesId:e,s:t})=>{const n=v(e),s=C(n);return be(n)?null:Se(Tt,{uniqueId:dt("i",e),summary:"Indexes: "+(e??K),s:t},$e(s)?"No indexes defined":ct(s,(s=>Se(Zt,{indexes:n,indexesId:e,indexId:s,s:t,key:s}))))},tn=({metrics:e,metricId:t})=>Se("tr",null,Se("th",null,t),Se("td",null,e?.getTableId(t)),Se("td",null,S(t,e))),nn=({metricsId:e,s:t})=>{const n=T(e),s=x(n);return be(n)?null:Se(Tt,{uniqueId:dt("m",e),summary:"Metrics: "+(e??K),s:t},$e(s)?"No metrics defined":Se("table",null,Se("thead",null,Se("th",null,"Metric Id"),Se("th",null,"Table Id"),Se("th",null,"Metric")),Se("tbody",null,ze(s,(e=>Se(tn,{metrics:n,metricId:e,key:e}))))))},sn=({queries:e,queriesId:n,queryId:s,s:a})=>{const r=dt("q",n,s),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a);return Se(Tt,{uniqueId:r,summary:"Query: "+s,s:a},Se(Kt,{queryId:s,queries:e,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c}))},ln=({queriesId:e,s:t})=>{const n=q(e),s=N(n);return be(n)?null:Se(Tt,{uniqueId:dt("q",e),summary:"Queries: "+(e??K),s:t},$e(s)?"No queries defined":ct(s,(s=>Se(sn,{queries:n,queriesId:e,queryId:s,s:t,key:s}))))},an=({relationships:e,relationshipsId:t,relationshipId:n,s:s})=>{const l=dt("r",t,n),[a,r]=ut(l,s);return Se(Tt,{uniqueId:l,summary:"Relationship: "+n,editable:a,handleEditable:r,s:s},Se(Gt,{relationshipId:n,relationships:e,editable:a}))},rn=({relationshipsId:e,s:t})=>{const n=V(e),s=M(n);return be(n)?null:Se(Tt,{uniqueId:dt("r",e),summary:"Relationships: "+(e??K),s:t},$e(s)?"No relationships defined":ct(s,(s=>Se(an,{relationships:n,relationshipsId:e,relationshipId:s,s:t,key:s}))))},on=({tableId:e,store:n,storeId:s,s:a})=>{const r=dt("t",s,e),[o,i,d]=Ze(t(st,r,lt,a)??"[]"),c=l(st,r,lt,_e,[],a),[u,h]=ut(r,a);return Se(Tt,{uniqueId:r,summary:Y+": "+e,editable:u,handleEditable:h,s:a},Se(Ht,{tableId:e,store:n,cellId:o,descending:i,offset:d,limit:10,paginator:!0,sortOnClick:!0,onChange:c,editable:u}))},dn=({store:e,storeId:t,s:n})=>{const s=dt("v",t),[l,r]=ut(s,n);return $e(a(e))?null:Se(Tt,{uniqueId:s,summary:re,editable:l,handleEditable:r,s:n},Se(Wt,{store:e,editable:l}))},cn=({storeId:e,s:t})=>{const n=L(e),s=R(n);return be(n)?null:Se(Tt,{uniqueId:dt("s",e),summary:(n.isMergeable()?"Mergeable":"")+"Store: "+(e??K),s:t},Se(dn,{storeId:e,store:n,s:t}),ct(s,(s=>Se(on,{store:n,storeId:e,tableId:s,s:t,key:s}))))},un=({s:e})=>{const t=Ve(null),n=Ve(0),[s,l]=Me(!1),{scrollLeft:a,scrollTop:r}=E(e);Ne((()=>{const e=t.current;if(e&&!s){const t=new MutationObserver((()=>{e.scrollWidth>=ge(a)+e.clientWidth&&e.scrollHeight>=ge(r)+e.clientHeight&&e.scrollTo(a,r)}));return t.observe(e,{childList:!0,subtree:!0}),()=>t.disconnect()}}),[s,a,r]);const o=qe((t=>{const{scrollLeft:s,scrollTop:a}=t[ie];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{l(!0),e.setPartialValues({scrollLeft:s,scrollTop:a})}))}),[e]),i=L(),d=z(),c=T(),u=$(),h=v(),m=A(),g=V(),p=F(),b=q(),f=J();return be(i)&&$e(d)&&be(c)&&$e(u)&&be(h)&&$e(m)&&be(g)&&$e(p)&&be(b)&&$e(f)?Se("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the Inspector inside a Provider component."):Se("article",{ref:t,onScroll:o},Se(cn,{s:e}),ze(d,(t=>Se(cn,{storeId:t,s:e,key:t}))),Se(nn,{s:e}),ze(u,(t=>Se(nn,{metricsId:t,s:e,key:t}))),Se(en,{s:e}),ze(m,(t=>Se(en,{indexesId:t,s:e,key:t}))),Se(rn,{s:e}),ze(p,(t=>Se(rn,{relationshipsId:t,s:e,key:t}))),Se(ln,{s:e}),ze(f,(t=>Se(ln,{queriesId:t,s:e,key:t}))))};class hn extends Te{constructor(e){super(e),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}componentDidCatch=(e,t)=>console.error(e,t.componentStack);render(){return this.state.e?Se("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const mn=({s:e})=>{const t=n(rt,e)??1,l=s(ot,(()=>!1),[],e),a=s(rt,(e=>Number(e[ie].dataset.id)),[],e);return Se("header",null,Se("img",{title:tt}),Se("span",null,tt),ze(nt,((e,n)=>n==t?null:Se("img",{onClick:a,"data-id":n,title:"Dock to "+e,key:n}))),Se("img",{onClick:l,title:"Close"}))},gn=({s:e})=>{const t=n(rt,e)??1;return n(ot,e)?Se("main",{"data-position":t},Se(mn,{s:e}),Se(hn,null,Se(un,{s:e}))):null},pn=e=>t=>{return n=(t,n)=>t+e(n),Cn(t).reduce(n,0);var n},bn=e=>e?.size??0,fn=pn(bn),yn=pn(fn),In=pn(yn),wn=(e,t)=>e?.has(t)??!1,vn=e=>be(e)||0==bn(e),Cn=e=>[...e?.values()??[]],kn=e=>e.clear(),Tn=(e,t)=>e?.forEach(t),xn=(e,t)=>e?.delete(t),Sn=e=>new Map(e),qn=e=>[...e?.keys()??[]],Nn=(e,t)=>e?.get(t),Vn=(e,t)=>Tn(e,((e,n)=>t(n,e))),Mn=(e,t,n)=>be(n)?(xn(e,t),e):e?.set(t,n),Ln=(e,t,n,s)=>(wn(e,t)?s?.(Nn(e,t)):Mn(e,t,n()),Nn(e,t)),Rn=(e,t,n,s=Mn)=>(Ke(t,((t,s)=>n(e,s,t))),Vn(e,(n=>Qe(t,n)?0:s(e,n))),e),En=(e,t,n,s)=>{const l={};return Tn(e,((e,a)=>{if(!n?.(e,a)){const n=t?t(e,a):e;s?.(n)||(l[a]=n)}})),l},zn=(e,t,n)=>En(e,(e=>En(e,t,n)),vn,Ue),$n=(e,t,n)=>En(e,(e=>zn(e,t,n)),vn,Ue),An=(e,t)=>{const n=Sn();return Tn(e,((e,s)=>n.set(s,t?.(e)??e))),n},Fn=e=>An(e,An),Jn=e=>An(e,Fn),On=(e,t,n,s,l=0)=>fe((n?Ln:Nn)(e,t[l],l>Ce(t)-2?n:Sn),(a=>{if(l>Ce(t)-2)return s?.(a)&&Mn(e,t[l]),a;const r=On(a,t,n,s,l+1);return vn(a)&&Mn(e,t[l]),r})),Pn=Sn(),Dn=Sn(),jn="storage",Bn=e=>new Set(we(e)||be(e)?e:[e]),Hn=(e,t)=>e?.add(t),Wn=/^\d+$/,Qn=()=>{const e=[];let t=0;return[n=>(n?Fe(e):null)??j+t++,t=>{Wn.test(t)&&Ce(e)<1e3&&Ae(e,t)}]},Gn=e=>[e,e],Kn=(e,t=fn)=>t(e[0])+t(e[1]),Un=()=>[Sn(),Sn()],Xn=e=>[...e],Yn=([e,t])=>e===t;Sn(ze("-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(j),((e,t)=>[e,t])));const Zn=(e,t,n)=>Mn(e,t,Nn(e,t)==-n?void 0:n),_n=()=>{let e,t,n=!1,s=!1,l=0,a=[];const r=Sn(),o=Sn(),i=Sn(),d=Sn(),c=Sn(),u=Sn(),h=Sn(),m=Sn(),g=Sn(),p=Sn(),b=Sn(),f=Sn(),y=Sn(),I=Sn(),w=Bn(),v=Sn(),C=Sn(),k=Sn(),T=Sn(),x=Un(),S=Un(),q=Un(),N=Un(),V=Un(),M=Un(),L=Un(),R=Un(),E=Un(),z=Un(),$=Un(),A=Un(),F=Un(),J=Un(),O=Un(),P=Un(),D=Un(),B=Un(),H=Un(),Q=Un(),X=Un(),ie=Un(),de=Sn(),ue=Un(),[he,me,ge,pe]=(()=>{let e;const[t,n]=Qn(),s=Sn();return[(n,l,a,r=[],o=()=>[])=>{e??=ln;const i=t(1);return Mn(s,i,[n,l,a,r,o]),Hn(On(l,a??[j],Bn),i),i},(t,n,...l)=>Ee(((e,t=[j])=>{const n=[],s=(e,l)=>l==Ce(t)?Ae(n,e):null===t[l]?Tn(e,(e=>s(e,l+1))):Ee([t[l],null],(t=>s(Nn(e,t),l+1)));return s(e,0),n})(t,n),(t=>Tn(t,(t=>Nn(s,t)[0](e,...n??[],...l))))),e=>fe(Nn(s,e),(([,t,l])=>(On(t,l??[j],void 0,(t=>(xn(t,e),vn(t)?1:0))),Mn(s,e),n(e),l))),t=>fe(Nn(s,t),(([t,,n=[],s,l])=>{const a=(...r)=>{const o=Ce(r);o==Ce(n)?t(e,...r,...l(r)):be(n[o])?Ee(s[o]?.(...r)??[],(e=>a(...r,e))):a(...r,n[o])};a()}))]})(),ke=e=>{if(!Xe(e,((e,t)=>[G,K].includes(t))))return!1;const t=e[G];return!(!ye(t)&&t!=W||(xt(e[K])!=t&&Ge(e,K),0))},Te=we,xe=(t,n)=>(!e||wn(b,n)||mt(n))&&Xe(t,((e,t)=>Se(n,t,e)),(()=>mt(n))),Se=(e,t,n,s)=>Xe(s?n:Me(n,e,t),((s,l)=>fe(qe(e,t,l,s),(e=>(n[l]=e,!0)),(()=>!1))),(()=>mt(e,t))),qe=(t,n,s,l)=>e?fe(Nn(Nn(b,t),s),(e=>xt(l)!=e[G]?mt(t,n,s,l,e[K]):l),(()=>mt(t,n,s,l))):be(xt(l))?mt(t,n,s,l):l,Ne=(e,t)=>Xe(t?e:Le(e),((t,n)=>fe(Ve(n,t),(t=>(e[n]=t,!0)),(()=>!1))),(()=>gt())),Ve=(e,n)=>t?fe(Nn(y,e),(t=>xt(n)!=t[G]?gt(e,n,t[K]):n),(()=>gt(e,n))):be(xt(n))?gt(e,n):n,Me=(e,t,n)=>(fe(Nn(f,t),(([s,l])=>{Tn(s,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(l,(s=>{Qe(e,s)||mt(t,n,s)}))})),e),Le=e=>(t&&(Tn(I,((t,n)=>{Qe(e,n)||(e[n]=t)})),Tn(w,(t=>{Qe(e,t)||gt(t)}))),e),$e=e=>Rn(b,e,((e,t,n)=>{const s=Sn(),l=Bn();Rn(Ln(b,t,Sn),n,((e,t,n)=>{Mn(e,t,n),fe(n[K],(e=>Mn(s,t,e)),(()=>Hn(l,t)))})),Mn(f,t,[s,l])}),((e,t)=>{Mn(b,t),Mn(f,t)})),Fe=e=>Rn(y,e,((e,t,n)=>{Mn(y,t,n),fe(n[K],(e=>Mn(I,t,e)),(()=>Hn(w,t)))}),((e,t)=>{Mn(y,t),Mn(I,t),xn(w,t)})),Je=e=>Ue(e)?Ut():Ht(e),Oe=e=>Rn(k,e,((e,t,n)=>Pe(t,n)),((e,t)=>st(t))),Pe=(e,t)=>Rn(Ln(k,e,(()=>(ot(e,1),Mn(v,e,Qn()),Mn(C,e,Sn()),Sn()))),t,((t,n,s)=>De(e,t,n,s)),((t,n)=>lt(e,t,n))),De=(e,t,n,s,l)=>Rn(Ln(t,n,(()=>(it(e,n,1),Sn()))),s,((t,s,l)=>je(e,n,t,s,l)),((s,a)=>at(e,t,n,s,a,l))),je=(e,t,n,s,l)=>{wn(n,s)||dt(e,t,s,1);const a=Nn(n,s);l!==a&&(ct(e,t,s,a,l),Mn(n,s,l))},Be=(e,t,n,s,l)=>fe(Nn(t,n),(t=>je(e,n,t,s,l)),(()=>De(e,t,n,Me({[s]:l},e,n)))),We=e=>Ue(e)?Zt():Wt(e),Ye=e=>Rn(T,e,((e,t,n)=>et(t,n)),((e,t)=>rt(t))),et=(e,t)=>{wn(T,e)||ut(e,1);const n=Nn(T,e);t!==n&&(ht(e,n,t),Mn(T,e,t))},tt=(e,t)=>{const[n]=Nn(v,e),s=n(t);return wn(Nn(k,e),s)?tt(e,t):s},nt=e=>Nn(k,e)??Pe(e,{}),st=e=>Pe(e,{}),lt=(e,t,n)=>{const[,s]=Nn(v,e);s(n),De(e,t,n,{},!0)},at=(e,t,n,s,l,a)=>{const r=Nn(Nn(f,e)?.[0],l);if(!be(r)&&!a)return je(e,n,s,l,r);const o=t=>{ct(e,n,t,Nn(s,t)),dt(e,n,t,-1),Mn(s,t)};be(r)?o(l):Vn(s,o),vn(s)&&(it(e,n,-1),vn(Mn(t,n))&&(ot(e,-1),Mn(k,e),Mn(v,e),Mn(C,e)))},rt=e=>{const t=Nn(I,e);if(!be(t))return et(e,t);ht(e,Nn(T,e)),ut(e,-1),Mn(T,e)},ot=(e,t)=>Zn(r,e,t),it=(e,t,n)=>Zn(Ln(d,e,Sn),t,n)&&Mn(i,e,Ln(i,e,(()=>0))+n),dt=(e,t,n,s)=>{const l=Nn(C,e),a=Nn(l,n)??0;(0==a&&1==s||1==a&&-1==s)&&Zn(Ln(o,e,Sn),n,s),Mn(l,n,a!=-s?a+s:null),Zn(Ln(Ln(c,e,Sn),t,Sn),n,s)},ct=(e,t,n,s,l)=>{Ln(Ln(Ln(u,e,Sn),t,Sn),n,(()=>[s,0]))[1]=l,a[3]?.(e,t,n,l)},ut=(e,t)=>Zn(h,e,t),ht=(e,t,n)=>{Ln(m,e,(()=>[t,0]))[1]=n,a[4]?.(e,n)},mt=(e,t,n,s,l)=>(Ae(Ln(Ln(Ln(g,e,Sn),t,Sn),n,(()=>[])),s),l),gt=(e,t,n)=>(Ae(Ln(p,e,(()=>[])),t),n),pt=(e,t,n)=>fe(Nn(Nn(Nn(u,e),t),n),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(Et(e,t,n))])),bt=e=>fe(Nn(m,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Gn(At(e))])),ft=e=>vn(g)||vn(P[e])?0:Tn(e?Jn(g):g,((t,n)=>Tn(t,((t,s)=>Tn(t,((t,l)=>me(P[e],[n,s,l],t))))))),yt=e=>vn(p)||vn(D[e])?0:Tn(e?An(p):p,((t,n)=>me(D[e],[n],t))),It=(e,t,n,s)=>{if(!vn(e))return me(t,s,(()=>En(e))),Vn(e,((e,t)=>me(n,[...s??[],e],1==t))),1},wt=e=>{const t=Ft();t!=n&&me(x[e],void 0,t);const s=vn(z[e]),l=vn(F[e])&&vn(J[e])&&vn(E[e])&&vn($[e])&&vn(M[e])&&vn(L[e])&&vn(R[e])&&s&&vn(q[e])&&vn(N[e]),a=vn(O[e])&&vn(A[e])&&vn(V[e])&&vn(S[e]);if(!l||!a){const t=e?[An(r),Fn(o),An(i),Fn(d),Jn(c),Jn(u)]:[r,o,i,d,c,u];if(!l){It(t[0],q[e],N[e]),Tn(t[1],((t,n)=>It(t,M[e],L[e],[n]))),Tn(t[2],((t,n)=>{0!=t&&me(R[e],[n],Vt(n))}));const n=Bn();Tn(t[3],((t,l)=>{It(t,E[e],$[e],[l])&&!s&&(me(z[e],[l,null]),Hn(n,l))})),s||Tn(t[5],((t,s)=>{if(!wn(n,s)){const n=Bn();Tn(t,(e=>Tn(e,(([t,s],l)=>s!==t?Hn(n,l):xn(e,l))))),Tn(n,(t=>me(z[e],[s,t])))}})),Tn(t[4],((t,n)=>Tn(t,((t,s)=>It(t,F[e],J[e],[n,s])))))}if(!a){let n;Tn(t[5],((t,s)=>{let l;Tn(t,((t,a)=>{let r;Tn(t,(([t,o],i)=>{o!==t&&(me(O[e],[s,a,i],o,t,pt),n=l=r=1)})),r&&me(A[e],[s,a],pt)})),l&&me(V[e],[s],pt)})),n&&me(S[e],void 0,pt)}}},vt=e=>{const t=jt();t!=s&&me(B[e],void 0,t);const n=vn(Q[e])&&vn(X[e]),l=vn(ie[e])&&vn(H[e]);if(!n||!l){const t=e?[An(h),An(m)]:[h,m];if(n||It(t[0],Q[e],X[e]),!l){let n;Tn(t[1],(([t,s],l)=>{s!==t&&(me(ie[e],[l],s,t,bt),n=1)})),n&&me(H[e],void 0,bt)}}},Ct=(e,...t)=>(tn((()=>e(...ze(t,ce)))),ln),kt=()=>$n(k),Tt=()=>qn(k),Nt=e=>qn(Nn(C,ce(e))),Vt=e=>bn(Nn(k,ce(e))),Mt=e=>qn(Nn(k,ce(e))),Lt=(e,t,n,s=0,l)=>{return ze(ve(Re((a=Nn(k,ce(e)),r=(e,n)=>[be(t)?n:Nn(e,ce(t)),n],ze([...a?.entries()??[]],(([e,t])=>r(t,e)))),(([e],[t])=>((e??0)<(t??0)?-1:1)*(n?-1:1))),s,be(l)?l:s+l),(([,e])=>e));var a,r},Rt=(e,t)=>qn(Nn(Nn(k,ce(e)),ce(t))),Et=(e,t,n)=>Nn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),zt=()=>En(T),$t=()=>qn(T),At=e=>Nn(T,ce(e)),Ft=()=>!vn(k),Jt=e=>wn(k,ce(e)),Ot=(e,t)=>wn(Nn(C,ce(e)),ce(t)),Pt=(e,t)=>wn(Nn(k,ce(e)),ce(t)),Dt=(e,t,n)=>wn(Nn(Nn(k,ce(e)),ce(t)),ce(n)),jt=()=>!vn(T),Bt=e=>wn(T,ce(e)),Ht=e=>Ct((()=>(e=>Xe(e,xe,mt))(e)?Oe(e):0)),Wt=e=>Ct((()=>Ne(e)?Ye(e):0)),Qt=e=>{try{Je(Ze(e))}catch{}return ln},Gt=t=>Ct((()=>{if((e=Xe(t,(e=>Xe(e,ke))))&&($e(t),!vn(k))){const e=kt();Ut(),Ht(e)}})),Kt=e=>Ct((()=>{if(t=(e=>Xe(e,ke))(e)){const n=zt();en(),Zt(),t=!0,Fe(e),Wt(n)}})),Ut=()=>Ct((()=>Oe({}))),Xt=e=>Ct((e=>wn(k,e)?st(e):0),e),Yt=(e,t)=>Ct(((e,t)=>fe(Nn(k,e),(n=>wn(n,t)?lt(e,n,t):0))),e,t),Zt=()=>Ct((()=>Ye({}))),_t=()=>Ct((()=>{$e({}),e=!1})),en=()=>Ct((()=>{Fe({}),t=!1})),tn=(e,t)=>{if(-1!=l){nn();const n=e();return sn(t),n}},nn=()=>(-1!=l&&l++,1==l&&(a[0]?.(),me(de)),ln),sn=e=>(l>0&&(l--,0==l&&(l=1,ft(1),vn(u)||wt(1),yt(1),vn(m)||vt(1),e?.(ln)&&(Tn(u,((e,t)=>Tn(e,((e,n)=>Tn(e,(([e],s)=>St(ln,t,n,s,e))))))),kn(u),Tn(m,(([e],t)=>qt(ln,t,e))),kn(m)),me(ue[0],void 0),l=-1,ft(0),vn(u)||wt(0),yt(0),vn(m)||vt(0),a[1]?.(),me(ue[1],void 0),a[2]?.(),l=0,n=Ft(),s=jt(),Ee([r,o,i,d,c,u,g,h,m,p],kn))),ln),ln={getContent:()=>[kt(),zt()],getTables:kt,getTableIds:Tt,getTable:e=>zn(Nn(k,ce(e))),getTableCellIds:Nt,getRowCount:Vt,getRowIds:Mt,getSortedRowIds:Lt,getRow:(e,t)=>En(Nn(Nn(k,ce(e)),ce(t))),getCellIds:Rt,getCell:Et,getValues:zt,getValueIds:$t,getValue:At,hasTables:Ft,hasTable:Jt,hasTableCell:Ot,hasRow:Pt,hasCell:Dt,hasValues:jt,hasValue:Bt,getTablesJson:()=>_e(k),getValuesJson:()=>_e(T),getJson:()=>_e([k,T]),getTablesSchemaJson:()=>_e(b),getValuesSchemaJson:()=>_e(y),getSchemaJson:()=>_e([b,y]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>Ct((()=>Te(e)?(([e,t])=>{(Ue(e)?Ut:Ht)(e),(Ue(t)?Zt:Wt)(t)})(e):0)),setTables:Ht,setTable:(e,t)=>Ct((e=>xe(t,e)?Pe(e,t):0),e),setRow:(e,t,n)=>Ct(((e,t)=>Se(e,t,n)?De(e,nt(e),t,n):0),e,t),addRow:(e,t,n=!0)=>tn((()=>{let s;return Se(e,s,t)&&(e=ce(e),De(e,nt(e),s=tt(e,n?1:0),t)),s})),setPartialRow:(e,t,n)=>Ct(((e,t)=>{if(Se(e,t,n,1)){const s=nt(e);Ke(n,((n,l)=>Be(e,s,t,l,n)))}}),e,t),setCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(qe(e,t,n,Ie(s)?s(Et(e,t,n)):s),(s=>Be(e,nt(e),t,n,s)))),e,t,n),setValues:Wt,setPartialValues:e=>Ct((()=>Ne(e,1)?Ke(e,((e,t)=>et(t,e))):0)),setValue:(e,t)=>Ct((e=>fe(Ve(e,Ie(t)?t(At(e)):t),(t=>et(e,t)))),e),applyChanges:e=>Ct((()=>{Ke(e[0],((e,t)=>be(e)?Xt(t):Ke(e,((e,n)=>be(e)?Yt(t,n):Ke(e,((e,s)=>St(ln,t,n,s,e))))))),Ke(e[1],((e,t)=>qt(ln,t,e)))})),setTablesJson:Qt,setValuesJson:e=>{try{We(Ze(e))}catch{}return ln},setJson:e=>Ct((()=>{try{const[t,n]=Ze(e);Je(t),We(n)}catch{Qt(e)}})),setTablesSchema:Gt,setValuesSchema:Kt,setSchema:(e,t)=>Ct((()=>{Gt(e),Kt(t)})),delTables:Ut,delTable:Xt,delRow:Yt,delCell:(e,t,n,s)=>Ct(((e,t,n)=>fe(Nn(k,e),(l=>fe(Nn(l,t),(a=>wn(a,n)?at(e,l,t,a,n,s):0))))),e,t,n),delValues:Zt,delValue:e=>Ct((e=>wn(T,e)?rt(e):0),e),delTablesSchema:_t,delValuesSchema:en,delSchema:()=>Ct((()=>{_t(),en()})),transaction:tn,startTransaction:nn,getTransactionChanges:()=>[En(u,((e,t)=>-1===Nn(r,t)?void 0:En(e,((e,n)=>-1===Nn(Nn(d,t),n)?void 0:En(e,(([,e])=>e),(e=>Yn(e)))),vn,Ue)),vn,Ue),En(m,(([,e])=>e),(e=>Yn(e))),1],getTransactionLog:()=>[!vn(u),!vn(m),$n(u,Xn,Yn),$n(g),En(m,Xn,Yn),En(p),En(r),zn(d),$n(c),En(h)],finishTransaction:sn,forEachTable:e=>Tn(k,((t,n)=>e(n,(e=>Tn(t,((t,n)=>e(n,(e=>Vn(t,e))))))))),forEachTableCell:(e,t)=>Vn(Nn(C,ce(e)),t),forEachRow:(e,t)=>Tn(Nn(k,ce(e)),((e,n)=>t(n,(t=>Vn(e,t))))),forEachCell:(e,t,n)=>Vn(Nn(Nn(k,ce(e)),ce(t)),n),forEachValue:e=>Vn(T,e),addSortedRowIdsListener:(e,t,n,s,l,a,r)=>{let o=Lt(e,t,n,s,l);return he((()=>{const r=Lt(e,t,n,s,l);var i,d,c;d=o,Ce(i=r)===Ce(d)&&(c=(e,t)=>d[t]===e,i.every(c))||(o=r,a(ln,e,t,n,s,l,o))}),z[r?1:0],[e,t],[Tt])},addStartTransactionListener:e=>he(e,de),addWillFinishTransactionListener:e=>he(e,ue[0]),addDidFinishTransactionListener:e=>he(e,ue[1]),callListener:e=>(pe(e),ln),delListener:e=>(ge(e),ln),getListenerStats:()=>({hasTables:Kn(x),tables:Kn(S),tableIds:Kn(q),hasTable:Kn(N),table:Kn(V),tableCellIds:Kn(M),hasTableCell:Kn(L,yn),rowCount:Kn(R),rowIds:Kn(E),sortedRowIds:Kn(z),hasRow:Kn($,yn),row:Kn(A,yn),cellIds:Kn(F,yn),hasCell:Kn(J,In),cell:Kn(O,In),invalidCell:Kn(P,In),hasValues:Kn(B),values:Kn(H),valueIds:Kn(Q),hasValue:Kn(X),value:Kn(ie),invalidValue:Kn(D),transaction:fn(de)+Kn(ue)}),isMergeable:()=>!1,createStore:_n,addListener:he,callListeners:me,setInternalListeners:(e,t,n,s,l)=>a=[e,t,n,s,l]};return Ke({[U+Z]:[0,x,[],()=>[Ft()]],[Z]:[0,S],[_]:[0,q],[U+Y]:[1,N,[Tt],e=>[Jt(...e)]],[Y]:[1,V,[Tt]],[Y+le]:[1,M,[Tt]],[U+Y+se]:[2,L,[Tt,Nt],e=>[Ot(...e)]],[te]:[1,R,[Tt]],[ne]:[1,E,[Tt]],[U+ee]:[2,$,[Tt,Mt],e=>[Pt(...e)]],[ee]:[2,A,[Tt,Mt]],[le]:[2,F,[Tt,Mt]],[U+se]:[3,J,[Tt,Mt,Rt],e=>[Dt(...e)]],[se]:[3,O,[Tt,Mt,Rt],e=>Gn(Et(...e))],InvalidCell:[3,P],[U+re]:[0,B,[],()=>[jt()]],[re]:[0,H],[oe]:[0,Q],[U+ae]:[1,X,[$t],e=>[Bt(...e)]],[ae]:[1,ie,[$t],e=>Gn(At(e[0]))],InvalidValue:[1,D]},(([e,t,n,s],l)=>{ln["add"+l+"Listener"]=(...l)=>he(l[e],t[l[e+1]?1:0],e>0?ve(l,0,e):void 0,n,s)})),He(ln)},es=({position:e="right",open:t=!1})=>{const n=O(_n),s=nt.indexOf(e);return P(n,(e=>{return t=et,n=sessionStorage,((e,t,n,s,l,a,r,o={},i=[])=>{let d,c,u,h=0,m=0,g=0;Ln(Pn,i,(()=>0)),Ln(Dn,i,(()=>[]));const[p,b,f,y,I]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!Ue(e)||!Ue(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!Ue(e)||!Ue(t),t.setContent]:ke("Store type not supported by this Persister"))(r,e),w=t=>{(p&&we(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},v=async e=>(2!=h&&(h=1,m++,await x((async()=>{try{const e=await t();we(e)?w(e):ke("Content is not an array "+e)}catch(t){e&&I(e)}h=0}))),S),C=()=>(c&&(l(c),c=void 0),S),k=async e=>(1!=h&&(h=2,g++,await x((async()=>{try{await n(b,e)}catch(e){}h=0}))),S),T=()=>(fe(u,e.delListener),u=void 0,S),x=async(...e)=>(Ae(Nn(Dn,i),...e),await(async()=>{if(!Nn(Pn,i)){for(Mn(Pn,i,1);!be(d=Fe(Nn(Dn,i)));)try{await d()}catch(e){}Mn(Pn,i,0)}})(),S),S={load:v,startAutoLoad:async e=>{await C().load(e);try{c=await s((async(e,t)=>{t||e?2!=h&&(h=1,m++,w(t??e),h=0):await v()}))}catch(e){}return S},stopAutoLoad:C,isAutoLoading:()=>!be(c),save:k,startAutoSave:async()=>(await T().save(),u=e.addDidFinishTransactionListener((()=>{const e=f();y(e)&&k(e)})),S),stopAutoSave:T,isAutoSaving:()=>!be(u),schedule:x,getStore:()=>e,destroy:()=>(Nn(Dn,i).splice(0,void 0),C().stopAutoSave()),getStats:()=>({loads:m,saves:g}),...o};return He(S)})(e,(async()=>{return e=n.getItem(t),Ze(e,((e,t)=>""===t?void 0:t));var e}),(async e=>{return n.setItem(t,(s=e(),Ye(s,((e,t)=>void 0===t?"":t))));var s}),(e=>{const s=s=>{if(s.storageArea===n&&s.key===t)try{e(Ze(s.newValue))}catch{e()}};return ue.addEventListener(jn,s),s}),(e=>ue.removeEventListener(jn,e)),0,3,{getStorageName:()=>t});var t,n}),void 0,(async e=>{await e.load([{},{position:-1==s?1:s,open:!!t}]),await e.startAutoSave()})),Se(xe,null,Se("aside",{id:et},Se(kt,{s:n}),Se(gn,{s:n})),Se("style",null,Ct))};export{es as Inspector};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinybase",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinybase",
6
6
  "license": "MIT",
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></section><p><a href="https://tinybase.org/guides/releases/#v5-2"><em>NEW!</em> v5.2 release</a></p><p><span id="one-with">&quot;The One With PostgreSQL!&quot;</span></p><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="it-s-reactive">It&#x27;s <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It&#x27;s <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 11.4kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/postgresql.svg"> PostgreSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/pglite.svg"> PGlite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg"> Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg"> ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg"> Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg"> PowerSync</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.2.0" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></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></section><p><a href="https://tinybase.org/guides/releases/#v5-2"><em>NEW!</em> v5.2 release</a></p><p><span id="one-with">&quot;The One With PostgreSQL!&quot;</span></p><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="it-s-reactive">It&#x27;s <em>Reactive</em></h2><p>TinyBase lets you <a href="#register-granular-listeners">listen to changes</a> made to any part of your data. This means your app will be fast, since you only spend rendering cycles on things that change. The optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and <a href="#pre-built-reactive-components">pre-built components</a> let you easily build fully reactive UIs on top of TinyBase. You even get a built-in <a href="#set-checkpoints-for-an-undo-stack">undo stack</a>, and <a href="#an-inspector-for-your-data">developer tools</a>!</p></section><section><h2 id="it-s-database-like">It&#x27;s <em>Database-Like</em></h2><p>Consumer app? Enterprise app? Or even a game? Model <a href="#start-with-a-simple-key-value-store">key-value data</a> and <a href="#level-up-to-use-tabular-data">tabular data</a> with optional typed <a href="#apply-schemas-to-tables-values">schematization</a>, whatever its data structures. There are built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, and tabular <a href="#model-table-relationships">relationships</a> APIs - and a powerful <a href="#build-complex-queries-with-tinyql">query engine</a> to select, join, filter, and group data (reactively!) without SQL.</p></section><section><h2 id="it-synchronizes">It <em>Synchronizes</em></h2><p>TinyBase has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can deterministically <a href="https://tinybase.org/guides/synchronization/">synchronize</a> and merge data across multiple sources, clients, and servers. And although TinyBase is an in-memory data store, you can easily <a href="#persist-to-storage-databases-more">persist</a> your data to file, <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, <a href="https://tinybase.org/guides/persistence/database-persistence/">SQLite or PostgreSQL databases</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It&#x27;s Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it&#x27;s especially great for local-first apps: where data is stored locally on the user&#x27;s device and that can be run offline. It&#x27;s tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 11.4kB</a> and with no dependencies - yet <a href="#well-tested-and-documented">100% tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and of course, <a href="https://github.com/tinyplex/tinybase">open source</a>!</p></section><hr><section id="friends"><h2 id="tinybase-works-great-on-its-own-but-also-plays-well-with-friends">TinyBase works great on its own, but also plays well with friends!</h2><div><a href="https://tinybase.org/guides/building-uis/getting-started-with-ui-react"><img width="48" src="https://tinybase.org/react.svg"> React</a></div><div><a href="https://tinybase.org/api/persister-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/postgresql.svg"> PostgreSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/pglite.svg"> PGlite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/sqlite.svg"> SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/expo.svg"> Expo SQLite</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/electric.svg"> ElectricSQL</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/turso.svg"> Turso</a></div><div><a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence"><img width="48" src="https://tinybase.org/powersync.svg"> PowerSync</a></div><div><a href="https://tinybase.org/api/persister-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</a></div><div><a href="https://tinybase.org/api/persister-yjs/functions/creation/createyjspersister"><img width="48" src="https://tinybase.org/yjs.svg"> YJS</a></div><div><a href="https://tinybase.org/api/persister-cr-sqlite-wasm"><img width="48" src="https://tinybase.org/crsqlite.png"> CR-SQLite</a></div><div><a href="https://tinybase.org/api/persister-automerge"><img width="48" src="https://tinybase.org/automerge.svg"> Automerge</a></div></section><hr><section id="follow"><a href="https://github.com/tinyplex/tinybase" target="_blank"><img src="https://img.shields.io/github/stars/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=GitHub&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&amp;logo=discord&amp;logoColor=%23fff&amp;label=Discord&amp;labelColor=%233131e8&amp;color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&amp;logo=x&amp;logoColor=%23fff&amp;label=Twitter&amp;labelColor=%23333&amp;color=%23333"></a><br><a href="https://github.com/tinyplex/tinybase/discussions" target="_blank"><img src="https://img.shields.io/github/discussions/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Ideas&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="https://github.com/tinyplex/tinybase/issues" target="_blank"><img src="https://img.shields.io/github/issues/tinyplex/tinybase?style=for-the-badge&amp;logo=GitHub&amp;logoColor=%23fff&amp;label=Issues&amp;labelColor=%23d81b60&amp;color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&amp;logo=jest&amp;logoColor=%23fff&amp;color=%23333&amp;labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.2.2" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&amp;logo=npm&amp;logoColor=%23fff&amp;labelColor=%23bd0005&amp;color=%23333"></a></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a Store requires just a simple call to the createStore function. Once you have one, you can easily set Values in it by unique Id. 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
  import {createStore} from 'tinybase';
@@ -11,7 +11,7 @@ console.log(store.getValues());
11
11
  // -> {employees: 3, open: true}
12
12
  ```
13
13
 
14
- <section><h2 id="level-up-to-use-tabular-data">Level up to use tabular data.</h2><p>For other types of data applications, a tabular data structure is more useful. TinyBase lets you set and get nested <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a>, or <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> data, by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a> - and in the same <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> as the keyed values!</p><p>Read more about setting and changing data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
14
+ <section><h2 id="level-up-to-use-tabular-data">Level up to use tabular data.</h2><p>For other types of data applications, a tabular data structure is more useful. TinyBase lets you set and get nested Table, Row, or Cell data, by unique Id - and in the same Store as the keyed values!</p><p>Read more about setting and changing data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
15
15
 
16
16
  ```js
17
17
  store
@@ -22,7 +22,7 @@ console.log(store.getRow('pets', 'fido'));
22
22
  // -> {species: 'dog', color: 'brown'}
23
23
  ```
24
24
 
25
- <section><h2 id="register-granular-listeners">Register granular listeners.</h2><p>The magic starts to happen when you register listeners on a <a href="https://tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>, <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a>, or <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>. They get called when any part of that object changes. You can also use wildcards - useful when you don&#x27;t know the <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a> of the objects that might change.</p><p>Read more about listeners in the <a href="https://tinybase.org/guides/the-basics/listening-to-stores/">Listening To Stores</a> guide.</p></section>
25
+ <section><h2 id="register-granular-listeners">Register granular listeners.</h2><p>The magic starts to happen when you register listeners on a Value, Table, Row, or Cell. They get called when any part of that object changes. You can also use wildcards - useful when you don&#x27;t know the Id of the objects that might change.</p><p>Read more about listeners in the <a href="https://tinybase.org/guides/the-basics/listening-to-stores/">Listening To Stores</a> guide.</p></section>
26
26
 
27
27
  ```js
28
28
  const listenerId = store.addTableListener('pets', () =>
@@ -35,7 +35,7 @@ store.setCell('pets', 'fido', 'sold', false);
35
35
  store.delListener(listenerId);
36
36
  ```
37
37
 
38
- <section><h2 id="call-hooks-to-bind-to-data">Call hooks to bind to data.</h2><p>If you&#x27;re using React in your application, the optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module provides hooks to bind to the data in a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>More magic! The <a href="https://tinybase.org/api/ui-react/functions/store-hooks/usecell/"><code>useCell</code></a> hook in this example fetches the dog&#x27;s color. But it also registers a listener on that cell that will fire and re-render the component whenever the value changes.</p><p>Basically you simply describe what data you want in your user interface and TinyBase will take care of the whole lifecycle of updating it for you.</p><p>Read more about the using hooks in the <a href="https://tinybase.org/guides/building-uis/using-react-hooks/">Using React Hooks</a> guide.</p></section>
38
+ <section><h2 id="call-hooks-to-bind-to-data">Call hooks to bind to data.</h2><p>If you&#x27;re using React in your application, the optional ui-react module provides hooks to bind to the data in a Store.</p><p>More magic! The useCell hook in this example fetches the dog&#x27;s color. But it also registers a listener on that cell that will fire and re-render the component whenever the value changes.</p><p>Basically you simply describe what data you want in your user interface and TinyBase will take care of the whole lifecycle of updating it for you.</p><p>Read more about the using hooks in the <a href="https://tinybase.org/guides/building-uis/using-react-hooks/">Using React Hooks</a> guide.</p></section>
39
39
 
40
40
  ```jsx
41
41
  import React from 'react';
@@ -60,7 +60,7 @@ console.log(app.innerHTML);
60
60
  root.unmount();
61
61
  ```
62
62
 
63
- <section><h2 id="pre-built-reactive-components">Pre-built reactive components.</h2><p>The <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module provides bare React components that let you build up a fully reactive user interface based on a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>For web applications in particular, the new <a href="https://tinybase.org/api/ui-react-dom/"><code>ui-react-dom</code></a> module provides pre-built components for tabular display of your data, with lots of customization and interactivity options.</p><p>Try them out in the <a href="https://tinybase.org/demos/ui-components/">UI Components</a> demos, and read more about the underlying <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><img src="https://tinybase.org/ui-react-dom.webp"><section><h2 id="an-inspector-for-your-data">An inspector for your data.</h2><p>If you are building a web application, the new <a href="https://tinybase.org/api/ui-react-inspector/functions/development-components/inspector/"><code>Inspector</code></a> component lets you overlay a view of the data in your <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>, <a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes/"><code>Indexes</code></a>, <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships/"><code>Relationships</code></a>, and so on. You can even edit the data in place and see it update in your app immediately.</p><p>Read more about this powerful new tool in the <a href="https://tinybase.org/guides/developer-tools/inspecting-data/">Inspecting Data</a> guide.</p></section><img src="https://tinybase.org/store-inspector.webp"><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 new <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/">Schemas</a> guide.</p></section>
63
+ <section><h2 id="pre-built-reactive-components">Pre-built reactive components.</h2><p>The ui-react module provides bare React components that let you build up a fully reactive user interface based on a Store.</p><p>For web applications in particular, the new ui-react-dom module provides pre-built components for tabular display of your data, with lots of customization and interactivity options.</p><p>Try them out in the <a href="https://tinybase.org/demos/ui-components/">UI Components</a> demos, and read more about the underlying ui-react module in the <a href="https://tinybase.org/guides/building-uis/">Building UIs</a> guides.</p></section><img src="https://tinybase.org/ui-react-dom.webp"><section><h2 id="an-inspector-for-your-data">An inspector for your data.</h2><p>If you are building a web application, the new Inspector component lets you overlay a view of the data in your Store, Indexes, Relationships, and so on. You can even edit the data in place and see it update in your app immediately.</p><p>Read more about this powerful new tool in the <a href="https://tinybase.org/guides/developer-tools/inspecting-data/">Inspecting Data</a> guide.</p></section><img src="https://tinybase.org/store-inspector.webp"><section><h2 id="apply-schemas-to-tables-values">Apply schemas to tables &amp; values.</h2><p>By default, a Store can contain any arbitrary Value, and a Row can contain any arbitrary Cell. But you can add a ValuesSchema or a TablesSchema to a Store to ensure that the values are always what you expect: constraining their types, and providing defaults.</p><p>In this example, we set a new Row without the <code>sold</code> Cell 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/">Schemas</a> guide.</p></section>
64
64
 
65
65
  ```js
66
66
  store.setTablesSchema({
@@ -78,7 +78,7 @@ console.log(store.getRow('pets', 'polly'));
78
78
  store.delTablesSchema();
79
79
  ```
80
80
 
81
- <section><h2 id="synchronize-between-devices">Synchronize between devices.</h2><p>The <a href="https://tinybase.org/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> type acts as a native CRDT, letting you merge data and synchronize it between clients and systems - or even a server. The synchronization protocol can run over WebSockets, the browser BroadcastChannel, or your own custom synchronization medium.</p><p>Read more about these techniques in the <a href="https://tinybase.org/guides/synchronization/">Synchronization</a> guides.</p></section>
81
+ <section><h2 id="synchronize-between-devices">Synchronize between devices.</h2><p>The MergeableStore type acts as a native CRDT, letting you merge data and synchronize it between clients and systems - or even a server. The synchronization protocol can run over WebSockets, the browser BroadcastChannel, or your own custom synchronization medium.</p><p>Read more about these techniques in the <a href="https://tinybase.org/guides/synchronization/">Synchronization</a> guides.</p></section>
82
82
 
83
83
  ```js
84
84
  import {WebSocketServer, WebSocket} from 'ws';
@@ -105,7 +105,7 @@ synchronizer1.destroy();
105
105
  server.destroy();
106
106
  ```
107
107
 
108
- <section><h2 id="persist-to-storage-databases-more">Persist to storage, databases, &amp; more.</h2><p>You can easily persist a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> between browser page reloads or sessions. You can also synchronize it with a web endpoint, or (if you&#x27;re using TinyBase in an appropriate environment), load and save it to a file. You can bind TinyBase to various flavors of <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">database</a>, or to <a href="https://yjs.dev/">Yjs</a> and <a href="https://automerge.org/">Automerge</a> CRDT documents.</p><p>Read more about persisters in the <a href="https://tinybase.org/guides/persistence/">Persistence</a> guides.</p></section>
108
+ <section><h2 id="persist-to-storage-databases-more">Persist to storage, databases, &amp; more.</h2><p>You can easily persist a Store between browser page reloads or sessions. You can also synchronize it with a web endpoint, or (if you&#x27;re using TinyBase in an appropriate environment), load and save it to a file. You can bind TinyBase to various flavors of <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">database</a>, or to <a href="https://yjs.dev/">Yjs</a> and <a href="https://automerge.org/">Automerge</a> CRDT documents.</p><p>Read more about persisters in the <a href="https://tinybase.org/guides/persistence/">Persistence</a> guides.</p></section>
109
109
 
110
110
  ```js
111
111
  import {createSessionPersister} from 'tinybase/persisters/persister-browser';
@@ -131,7 +131,7 @@ persister.destroy();
131
131
  sessionStorage.clear();
132
132
  ```
133
133
 
134
- <section><h2 id="build-complex-queries-with-tinyql">Build complex queries with <a href="https://tinybase.org/guides/using-queries/tinyql/">TinyQL</a>.</h2><p>The <a href="https://tinybase.org/api/queries/interfaces/queries/queries/"><code>Queries</code></a> object lets you query data across tables, with filtering and aggregation - using a SQL-adjacent syntax called <a href="https://tinybase.org/guides/using-queries/tinyql/">TinyQL</a>.</p><p>Accessors and listeners let you sort and paginate the results efficiently, making building rich tabular interfaces easier than ever.</p><p>In this example, we have two tables: of pets and their owners. They are joined together by the pet&#x27;s ownerId <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>. We select the pet&#x27;s species, and the owner&#x27;s state, and then aggregate the prices for the combinations.</p><p>We access the results by descending price, essentially answering the question: &quot;which is the highest-priced species, and in which state?&quot;</p><p>Needless to say, the results are reactive too! You can add listeners to queries just as easily as you do to raw tables.</p><p>Read more about <a href="https://tinybase.org/api/queries/interfaces/queries/queries/"><code>Queries</code></a> in the <a href="https://tinybase.org/guides/releases/#v2-0">v2.0 Release Notes</a>, the <a href="https://tinybase.org/guides/using-queries/">Using Queries</a> guide, and the <a href="https://tinybase.org/demos/car-analysis/">Car Analysis</a> demo and <a href="https://tinybase.org/demos/movie-database/">Movie Database</a> demo.</p></section>
134
+ <section><h2 id="build-complex-queries-with-tinyql">Build complex queries with <a href="https://tinybase.org/guides/using-queries/tinyql/">TinyQL</a>.</h2><p>The Queries object lets you query data across tables, with filtering and aggregation - using a SQL-adjacent syntax called <a href="https://tinybase.org/guides/using-queries/tinyql/">TinyQL</a>.</p><p>Accessors and listeners let you sort and paginate the results efficiently, making building rich tabular interfaces easier than ever.</p><p>In this example, we have two tables: of pets and their owners. They are joined together by the pet&#x27;s ownerId Cell. We select the pet&#x27;s species, and the owner&#x27;s state, and then aggregate the prices for the combinations.</p><p>We access the results by descending price, essentially answering the question: &quot;which is the highest-priced species, and in which state?&quot;</p><p>Needless to say, the results are reactive too! You can add listeners to queries just as easily as you do to raw tables.</p><p>Read more about Queries in the <a href="https://tinybase.org/guides/releases/#v2-0">v2.0 Release Notes</a>, the <a href="https://tinybase.org/guides/using-queries/">Using Queries</a> guide, and the <a href="https://tinybase.org/demos/car-analysis/">Car Analysis</a> demo and <a href="https://tinybase.org/demos/movie-database/">Movie Database</a> demo.</p></section>
135
135
 
136
136
  ```js
137
137
  import {createQueries} from 'tinybase';
@@ -174,7 +174,7 @@ queries
174
174
  queries.destroy();
175
175
  ```
176
176
 
177
- <section><h2 id="define-metrics-and-aggregations">Define metrics and aggregations.</h2><p>A <a href="https://tinybase.org/api/metrics/interfaces/metrics/metrics/"><code>Metrics</code></a> object makes it easy to keep a running aggregation of <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> values in each <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> of a <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>. This is useful for counting rows, but also supports averages, ranges of values, or arbitrary aggregations.</p><p>In this example, we create a new table of the pet species, and keep a track of which is most expensive. When we add horses to our pet store, the listener detects that the highest price has changed.</p><p>Read more about <a href="https://tinybase.org/api/metrics/interfaces/metrics/metrics/"><code>Metrics</code></a> in the <a href="https://tinybase.org/guides/using-metrics/">Using Metrics</a> guide.</p></section>
177
+ <section><h2 id="define-metrics-and-aggregations">Define metrics and aggregations.</h2><p>A Metrics object makes it easy to keep a running aggregation of Cell values in each Row of a Table. This is useful for counting rows, but also supports averages, ranges of values, or arbitrary aggregations.</p><p>In this example, we create a new table of the pet species, and keep a track of which is most expensive. When we add horses to our pet store, the listener detects that the highest price has changed.</p><p>Read more about Metrics in the <a href="https://tinybase.org/guides/using-metrics/">Using Metrics</a> guide.</p></section>
178
178
 
179
179
  ```js
180
180
  import {createMetrics} from 'tinybase';
@@ -205,7 +205,7 @@ store.setCell('species', 'horse', 'price', 20);
205
205
  metrics.destroy();
206
206
  ```
207
207
 
208
- <section><h2 id="create-indexes-for-fast-lookups">Create indexes for fast lookups.</h2><p>An <a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes/"><code>Indexes</code></a> object makes it easy to look up all the <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> objects that have a certain value in a <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>.</p><p>In this example, we create an index on the <code>species</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> values. We can then get the the list of distinct <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> value present for that index (known as &#x27;slices&#x27;), and the set of <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> objects that match each value.</p><p><a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes/"><code>Indexes</code></a> objects are reactive too. So you can set listeners on them just as you do for the data in the underlying <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>Read more about <a href="https://tinybase.org/api/indexes/interfaces/indexes/indexes/"><code>Indexes</code></a> in the <a href="https://tinybase.org/guides/using-indexes/">Using Indexes</a> guide.</p></section>
208
+ <section><h2 id="create-indexes-for-fast-lookups">Create indexes for fast lookups.</h2><p>An Indexes object makes it easy to look up all the Row objects that have a certain value in a Cell.</p><p>In this example, we create an index on the <code>species</code> Cell values. We can then get the the list of distinct Cell value present for that index (known as &#x27;slices&#x27;), and the set of Row objects that match each value.</p><p>Indexes objects are reactive too. So you can set listeners on them just as you do for the data in the underlying Store.</p><p>Read more about Indexes in the <a href="https://tinybase.org/guides/using-indexes/">Using Indexes</a> guide.</p></section>
209
209
 
210
210
  ```js
211
211
  import {createIndexes} from 'tinybase';
@@ -231,7 +231,7 @@ store.setRow('pets', 'lowly', {species: 'worm'});
231
231
  indexes.destroy();
232
232
  ```
233
233
 
234
- <section><h2 id="model-table-relationships">Model table relationships.</h2><p>A <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships/"><code>Relationships</code></a> object lets you associate a <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> in a local <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a> with the <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a> of a <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> in a remote <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>. You can also reference a table to itself to create linked lists.</p><p>In this example, the <code>species</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> of the <code>pets</code> <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a> is used to create a relationship to the <code>species</code> <a href="https://tinybase.org/api/store/type-aliases/store/table/"><code>Table</code></a>, so that we can access the price of a given pet.</p><p>Like everything else, you can set listeners on <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships/"><code>Relationships</code></a> too.</p><p>Read more about <a href="https://tinybase.org/api/relationships/interfaces/relationships/relationships/"><code>Relationships</code></a> in the <a href="https://tinybase.org/guides/using-relationships/">Using Relationships</a> guide.</p></section>
234
+ <section><h2 id="model-table-relationships">Model table relationships.</h2><p>A Relationships object lets you associate a Row in a local Table with the Id of a Row in a remote Table. You can also reference a table to itself to create linked lists.</p><p>In this example, the <code>species</code> Cell of the <code>pets</code> Table is used to create a relationship to the <code>species</code> Table, so that we can access the price of a given pet.</p><p>Like everything else, you can set listeners on Relationships too.</p><p>Read more about Relationships in the <a href="https://tinybase.org/guides/using-relationships/">Using Relationships</a> guide.</p></section>
235
235
 
236
236
  ```js
237
237
  import {createRelationships} from 'tinybase';
@@ -256,7 +256,7 @@ console.log(
256
256
  relationships.destroy();
257
257
  ```
258
258
 
259
- <section><h2 id="set-checkpoints-for-an-undo-stack">Set checkpoints for an undo stack.</h2><p>A <a href="https://tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints/"><code>Checkpoints</code></a> object lets you set checkpoints on a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>. Move forward and backward through them to create undo and redo functions.</p><p>In this example, we set a checkpoint, then sell one of the pets. Later, the pet is brought back to the shop, and we go back to that checkpoint to revert the store to its previous state.</p><p>Read more about <a href="https://tinybase.org/api/checkpoints/interfaces/checkpoints/checkpoints/"><code>Checkpoints</code></a> in the <a href="https://tinybase.org/guides/using-checkpoints/">Using Checkpoints</a> guide.</p></section>
259
+ <section><h2 id="set-checkpoints-for-an-undo-stack">Set checkpoints for an undo stack.</h2><p>A Checkpoints object lets you set checkpoints on a Store. Move forward and backward through them to create undo and redo functions.</p><p>In this example, we set a checkpoint, then sell one of the pets. Later, the pet is brought back to the shop, and we go back to that checkpoint to revert the store to its previous state.</p><p>Read more about Checkpoints in the <a href="https://tinybase.org/guides/using-checkpoints/">Using Checkpoints</a> guide.</p></section>
260
260
 
261
261
  ```js
262
262
  import {createCheckpoints} from 'tinybase';
@@ -294,4 +294,4 @@ export const createShop: typeof createShopDecl = () => {
294
294
  };
295
295
  ```
296
296
 
297
- <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>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.4kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just <em>4.6kB</em>, the ui-react-dom components are another <em>2.5kB</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> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.4kB</td><td>118.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.6kB</td><td>48.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</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>2,224</td><td>2,224</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,400</td><td>2,400</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>958</td><td>958</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>858</td><td>858</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,339</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,971</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><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/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.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></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><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/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.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/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.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/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.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/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.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/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.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/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.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/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.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/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.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/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.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/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.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/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.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></section><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 id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or 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>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>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 as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>
297
+ <section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic store module alone, you&#x27;ll only add a gzipped <em>5.3kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>11.4kB</em>.</p><p>The optional ui-react module is just <em>4.7kB</em>, the ui-react-dom components are another <em>2.5kB</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> </th><th>Minified .js.gz</th><th>Source .js</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">tinybase/store</a> (minimal)</th><td>5.3kB</td><td>52.6kB</td></tr><tr><th class="right">tinybase (complete)</th><td>11.4kB</td><td>118.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react/">ui-react</a></th><td>4.7kB</td><td>48.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/ui-react-dom/">ui-react-dom</a></th><td>2.5kB</td><td>20.4kB</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>2,231</td><td>2,231</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,409</td><td>2,409</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>961</td><td>961</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>860</td><td>859</td><td>99.9%</td></tr><tr><th class="right">Tests</th><td colspan="3">7,339</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,954</td></tr></tbody></table></div><hr><section id="sponsors"><h2 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h2><a href="https://github.com/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.png?size=48" width="48" height="48"></a><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/beekeeb" target="_blank"><img title="beekeeb" src="https://github.com/beekeeb.png?size=48" width="48" height="48"></a><a href="https://github.com/cancelself" target="_blank"><img title="cancelself" src="https://github.com/cancelself.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></section><section id="users"><h2 id="excited-to-be-used-by">Excited to be used by:</h2><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/byCedric" target="_blank"><img title="byCedric" src="https://github.com/byCedric.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/cpojer" target="_blank"><img title="cpojer" src="https://github.com/cpojer.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/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/ezra-en" target="_blank"><img title="ezra-en" src="https://github.com/ezra-en.png?size=48" width="48" height="48"></a><a href="https://github.com/fdfontes" target="_blank"><img title="fdfontes" src="https://github.com/fdfontes.png?size=48" width="48" height="48"></a><a href="https://github.com/feychenie" target="_blank"><img title="feychenie" src="https://github.com/feychenie.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/fostertheweb" target="_blank"><img title="fostertheweb" src="https://github.com/fostertheweb.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/itsdevcoffee" target="_blank"><img title="itsdevcoffee" src="https://github.com/itsdevcoffee.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/jbolda" target="_blank"><img title="jbolda" src="https://github.com/jbolda.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/Kudo" target="_blank"><img title="Kudo" src="https://github.com/Kudo.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/lluc" target="_blank"><img title="lluc" src="https://github.com/lluc.png?size=48" width="48" height="48"></a><a href="https://github.com/marksteve" target="_blank"><img title="marksteve" src="https://github.com/marksteve.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/mjamesderocher" target="_blank"><img title="mjamesderocher" src="https://github.com/mjamesderocher.png?size=48" width="48" height="48"></a><a href="https://github.com/mouktardev" target="_blank"><img title="mouktardev" src="https://github.com/mouktardev.png?size=48" width="48" height="48"></a><a href="https://github.com/nickmessing" target="_blank"><img title="nickmessing" src="https://github.com/nickmessing.png?size=48" width="48" height="48"></a><a href="https://github.com/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/nkzw-tech" target="_blank"><img title="nkzw-tech" src="https://github.com/nkzw-tech.png?size=48" width="48" height="48"></a><a href="https://github.com/palerdot" target="_blank"><img title="palerdot" src="https://github.com/palerdot.png?size=48" width="48" height="48"></a><a href="https://github.com/PorcoRosso85" target="_blank"><img title="PorcoRosso85" src="https://github.com/PorcoRosso85.png?size=48" width="48" height="48"></a><a href="https://github.com/primodiumxyz" target="_blank"><img title="primodiumxyz" src="https://github.com/primodiumxyz.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/sudo-self" target="_blank"><img title="sudo-self" src="https://github.com/sudo-self.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/ViktorZhurbin" target="_blank"><img title="ViktorZhurbin" src="https://github.com/ViktorZhurbin.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></section><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 id="about"><h2 id="about">About</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Or 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>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://tripleodeon.com">me</a> in API design, minification, and documentation. But now it has taken on a life of its own, and has grown beyond my wildest expectations.</p><p>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 as much as I do building it!</p></section><section id="story"><h2 id="the-story">The story</h2><a href="https://youtu.be/hXL7OkW-Prk?t=1232" target="_blank"><img src="https://tinybase.org/youtube.webp"></a></section>