tinybase 5.0.1 → 5.0.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.
- package/@types/synchronizers/synchronizer-ws-server/index.d.cts +32 -27
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +32 -27
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +32 -27
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +32 -27
- package/@types/ui-react/index.d.cts +62 -45
- package/@types/ui-react/index.d.ts +62 -45
- package/@types/ui-react/with-schemas/index.d.cts +83 -59
- package/@types/ui-react/with-schemas/index.d.ts +83 -59
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/index.cjs +1 -1
- package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +4 -6
- package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +4 -6
- package/cjs/es6/ui-react/index.cjs +13 -6
- package/cjs/es6/ui-react/with-schemas/index.cjs +13 -6
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/ui-react/index.cjs +1 -1
- package/cjs/min/ui-react/index.cjs.gz +0 -0
- package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/synchronizers/synchronizer-ws-server/index.cjs +4 -4
- package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +4 -4
- package/cjs/ui-react/index.cjs +11 -6
- package/cjs/ui-react/with-schemas/index.cjs +11 -6
- package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/es6/min/ui-react/index.js +1 -1
- package/es6/min/ui-react/index.js.gz +0 -0
- package/es6/min/ui-react/with-schemas/index.js +1 -1
- package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/es6/synchronizers/synchronizer-ws-server/index.js +4 -6
- package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -6
- package/es6/ui-react/index.js +13 -6
- package/es6/ui-react/with-schemas/index.js +13 -6
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/package.json +1 -1
- package/readme.md +2 -2
- package/synchronizers/synchronizer-ws-server/index.js +4 -4
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -4
- package/ui-react/index.js +11 -6
- package/ui-react/with-schemas/index.js +11 -6
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/ui-react/index.js +1 -1
- package/umd/es6/min/ui-react/index.js.gz +0 -0
- package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/es6/synchronizers/synchronizer-ws-server/index.js +4 -6
- package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -6
- package/umd/es6/ui-react/index.js +16 -6
- package/umd/es6/ui-react/with-schemas/index.js +16 -6
- package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/min/ui-react/index.js +1 -1
- package/umd/min/ui-react/index.js.gz +0 -0
- package/umd/min/ui-react/with-schemas/index.js +1 -1
- package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/synchronizers/synchronizer-ws-server/index.js +4 -6
- package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +4 -6
- package/umd/ui-react/index.js +12 -6
- package/umd/ui-react/with-schemas/index.js +12 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",I="Table",i=I+"s",l=I+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=y+c,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),f=e=>t(e)==s,v=e=>t(e)==r,q=e=>e.length,P=()=>{},x=(e,t)=>e.every(t),S=(e,t)=>q(e)===q(t)&&x(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),B=Object,T=e=>B.getPrototypeOf(e),E=B.entries,M=e=>!h(e)&&R(T(e),(e=>e==B.prototype||h(T(e))),(()=>!0)),F=B.keys,V=(e,t)=>R(e,(e=>e[t])),A=(e,t)=>(delete e[t],e),O=(e,t)=>{const o=E(e);return q(o)===q(F(t))&&x(o,(([e,o])=>M(o)?!!M(t[e])&&O(t[e],o):t[e]===o))},{createContext:j,useContext:D,useEffect:H}=e,Q=j([]),W=(e,t)=>{const o=D(Q);return h(e)?o[t]:f(e)?V(o[t+1]??{},e):e},z=(e,t)=>{const o=W(e,t);return h(e)||f(e)?o:e},G=e=>F(D(Q)[e]??{}),J=e=>W(e,0),K=e=>z(e,0),N=(e,t)=>{const{12:o,13:s}=D(Q);H((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},U=e=>W(e,2),X=e=>z(e,2),Y=e=>W(e,4),Z=e=>z(e,4),$=e=>W(e,6),_=e=>z(e,6),ee=e=>W(e,8),te=e=>z(e,8),oe=e=>W(e,10),se=e=>z(e,10),re=e=>e.toLowerCase();re(d);const de="Transaction";re(de);const{useCallback:ne,useEffect:ue,useMemo:ce,useLayoutEffect:Ie,useRef:ie,useState:le,useSyncExternalStore:ae}=e,pe=[],ge=[{},[],[pe,void 0,pe],void 0,!1,0],be=[O,S,([e,t,o],[s,r,d])=>t===r&&S(e,s)&&S(o,d)],Ce=(e,t)=>e===t,me=(e,t,o=pe)=>{const[,s]=le(),[r,d]=le();return ue((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},ye=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},ke=(e,t,s,r=pe)=>{const d=ie(ge[s]),n=ne((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ge[s];return(be[s]??Ce)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ne((d=>ye(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return ae(c,n)},we=(e,t,o,s=pe,r=pe,...d)=>Ie((()=>ye(t,e,...r,o,...d)),[t,e,...r,...s,...d]),he=(e,t,o,s=pe,r=P,d=pe,...n)=>{const u=K(e);return ne((e=>R(u,(s=>R(o(e,s),(o=>r(s["set"+t](...L(n,(t=>v(t)?t(e,s):t)),o),o)))))),[u,t,...s,...d,...n])},Re=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((()=>o(d?.["del"+t](...r))),[d,t,...s,...r])},fe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},ve=(e,t=pe)=>ce(e,t),qe=(e,t=pe)=>ce(e,t),Pe=()=>G(1),xe=e=>ke(i,K(e),4,[]),Se=e=>ke(i,K(e),0),Le=e=>ke(l,K(e),1),Be=(e,t)=>ke(I,K(t),4,[e]),Te=(e,t)=>ke(I,K(t),0,[e]),Ee=(e,t)=>ke(I+m,K(t),1,[e]),Me=(e,t,o)=>ke(I+C,K(o),4,[e,t]),Fe=(e,t)=>ke(p,K(t),5,[e]),Ve=(e,t)=>ke(g,K(t),1,[e]),Ae=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),Oe=(e,t,o)=>ke(a,K(o),4,[e,t]),je=(e,t,o)=>ke(a,K(o),0,[e,t]),De=(e,t,o)=>ke(m,K(o),1,[e,t]),He=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),Qe=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),We=e=>ke(k,K(e),4,[]),ze=e=>ke(k,K(e),0),Ge=e=>ke(w,K(e),1),Je=(e,t)=>ke(y,K(t),4,[e]),Ke=(e,t)=>ke(y,K(t),3,[e]),Ne=(e,t,o,s,r)=>he(o,i,e,t,s,r),Ue=(e,t,o,s,r,d)=>he(s,I,t,o,r,d,e),Xe=(e,t,o,s,r,d,n)=>he(r,a,o,s,d,n,e,t),Ye=(e,t,o=pe,s,r=P,d=pe,n=!0)=>{const u=K(s);return ne((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(v(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},Ze=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),$e=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),_e=(e,t,o,s,r)=>he(o,k,e,t,s,r),et=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),tt=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),ot=(e,t,o)=>Re(e,i,t,o),st=(e,t,o,s)=>Re(t,I,o,s,e),rt=(e,t,o,s,r)=>Re(o,a,s,r,e,t),dt=(e,t,o,s,r,d,n)=>Re(r,C,d,n,e,t,o,s),nt=(e,t,o)=>Re(e,k,t,o),ut=(e,t,o,s)=>Re(t,y,o,s,e),ct=(e,t,o,s)=>we(u+i,K(s),e,t,[],o),It=(e,t,o,s)=>we(i,K(s),e,t,pe,o),it=(e,t,o,s)=>we(l,K(s),e,t,pe,o),lt=(e,t,o,s,r)=>we(u+I,K(r),t,o,[e],s),at=(e,t,o,s,r)=>we(I,K(r),t,o,[e],s),pt=(e,t,o,s,r)=>we(I+m,K(r),t,o,[e],s),gt=(e,t,o,s,r,d)=>we(u+I+C,K(d),o,s,[e,t],r),bt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),Ct=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),mt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),yt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),kt=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),wt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),Rt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),ft=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),vt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),qt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),Pt=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),xt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),St=(e,t,o)=>we("Start"+de,K(o),e,t),Lt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Bt=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Tt=(e,t,o)=>me(e,t,o),Et=()=>G(3),Mt=e=>ke("MetricIds",X(e),1),Ft=(e,t)=>ke("Metric",X(t),3,[e]),Vt=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),At=(e,t,o)=>me(e,t,o),Ot=()=>G(5),jt=(e,t)=>ke("SliceIds",Z(t),1,[e]),Dt=e=>ke("IndexIds",Z(e),1),Ht=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),Qt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Wt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),zt=(e,t,o)=>me(e,t,o),Gt=()=>G(7),Jt=e=>ke("RelationshipIds",_(e),1),Kt=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Nt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Ut=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Xt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),Yt=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),Zt=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),$t=(e,t,o)=>me(e,t,o),_t=()=>G(9),eo=e=>ke("QueryIds",te(e),1),to=(e,t)=>ke(n+I,te(t),0,[e]),oo=(e,t)=>ke(n+I+m,te(t),1,[e]),so=(e,t)=>ke(n+p,te(t),5,[e]),ro=(e,t)=>ke(n+g,te(t),1,[e]),no=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),uo=(e,t,o)=>ke(n+a,te(o),0,[e,t]),co=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),io=(e,t,o,s)=>we(n+I,te(s),t,o,[e]),lo=(e,t,o,s)=>we(n+I+m,te(s),t,o,[e]),ao=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),go=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),bo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),Co=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),mo=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),yo=(e,t,o)=>me(e,t,o),ko=()=>G(11),wo=e=>ke("CheckpointIds",se(e),2),ho=(e,t)=>ke("Checkpoint",se(t),3,[e]),Ro=(e=P,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},fo=e=>fe(e,"goBackward"),vo=e=>fe(e,"goForward"),qo=(e,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},Po=e=>{const t=se(e),[s,r]=wo(t);return[(d=s,!(0==q(d))),fo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},xo=e=>{const t=se(e),[,,[s]]=wo(t);return[!h(s),vo(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},So=(e,t,o)=>we("CheckpointIds",se(o),e,t),Lo=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Bo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=le(),[c,I]=le();return ue((()=>{const o=e?t(e):void 0;I(o),o&&s&&(async()=>{await s(o),u([])})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},To=(e,t,o=pe,s,r=pe)=>{const[d,n]=le();return ue((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),ue((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:Eo,Fragment:Mo,createElement:Fo,useCallback:Vo,useLayoutEffect:Ao,useRef:Oo,useState:jo}=e,Do=(e,...t)=>h(e)?{}:e(...t),Ho=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:Qo,useContext:Wo,useMemo:zo,useState:Go}=e,Jo=({tableId:e,store:t,rowComponent:o=$o,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>Yo(L(u,(d=>Fo(o,{...Do(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Ko=({queryId:e,queries:t,resultRowComponent:o=ls,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>Yo(L(n,(r=>Fo(o,{...Do(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),No=({relationshipId:e,relationships:t,rowComponent:o=$o,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,I,i]=Ho(_(t),e),l=n(e,u,c);return Yo(L(l,(e=>Fo(o,{...Do(s,e),key:e,tableId:i,rowId:e,store:I,debugIds:d}))),r,d,u)},Uo=e=>({checkpoints:t,checkpointComponent:o=gs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return Yo(L(e(wo(n)),(e=>Fo(o,{...Do(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Xo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:I,checkpoints:i,checkpointsById:l,children:a})=>{const p=Wo(Q),[g,b]=Go({}),C=Qo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=Qo((e=>b((t=>({...A(t,e)})))),[]);return Fo(Q.Provider,{value:zo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...I},i??p[10],{...p[11],...l},C,m]),[e,t,g,o,s,r,d,n,u,c,I,i,l,p,C,m])},a)},Yo=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},Zo=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>Yo(o+(Qe(e,t,s,r)??o),void 0,d,s),$o=({tableId:e,rowId:t,store:o,cellComponent:s=Zo,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>Yo(L(((e,t,o,s)=>{const r=De(t,o,s);return e??r})(d,e,t,o),(d=>Fo(s,{...Do(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),_o=e=>Jo(e,Ve(e.tableId,e.store)),es=({cellId:e,descending:t,offset:o,limit:s,...r})=>Jo(r,Ae(r.tableId,e,t,o,s,r.store)),ts=({store:e,tableComponent:t=_o,getTableComponentProps:o,separator:s,debugIds:r})=>Yo(L(Le(e),(s=>Fo(t,{...Do(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),os=({valueId:e,store:t,debugIds:s})=>Yo(o+(Ke(e,t)??o),void 0,s,e),ss=({store:e,valueComponent:t=os,getValueComponentProps:o,separator:s,debugIds:r})=>Yo(L(Ge(e),(s=>Fo(t,{...Do(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),rs=({metricId:e,metrics:t,debugIds:s})=>Yo(Ft(e,t)??o,void 0,s,e),ds=({indexId:e,sliceId:t,indexes:o,rowComponent:s=$o,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,I]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),i=Ht(e,t,u);return Yo(L(i,(e=>Fo(s,{...Do(r,e),key:e,tableId:I,rowId:e,store:c,debugIds:n}))),d,n,t)},ns=({indexId:e,indexes:t,sliceComponent:o=ds,getSliceComponentProps:s,separator:r,debugIds:d})=>Yo(L(jt(e,t),(r=>Fo(o,{...Do(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),us=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=$o,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Ho(_(o),e),I=Kt(e,t,n);return Yo(h(c)||h(I)?null:Fo(s,{...Do(r,I),key:I,tableId:c,rowId:I,store:u,debugIds:d}),void 0,d,t)},cs=e=>No(e,Nt,e.remoteRowId),Is=e=>No(e,Ut,e.firstRowId),is=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>Yo(o+(Io(e,t,s,r)??o),void 0,d,s),ls=({queryId:e,rowId:t,queries:o,resultCellComponent:s=is,getResultCellComponentProps:r,separator:d,debugIds:n})=>Yo(L(co(e,t,o),(d=>Fo(s,{...Do(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),as=e=>Ko(e,ro(e.queryId,e.queries)),ps=({cellId:e,descending:t,offset:o,limit:s,...r})=>Ko(r,no(r.queryId,e,t,o,s,r.queries)),gs=({checkpoints:e,checkpointId:t,debugIds:s})=>Yo(ho(t,e)??o,void 0,s,t),bs=Uo((e=>e[0])),Cs=Uo((e=>h(e[1])?[]:[e[1]])),ms=Uo((e=>e[2]));export{bs as BackwardCheckpointsView,Zo as CellView,gs as CheckpointView,Cs as CurrentCheckpointView,ms as ForwardCheckpointsView,ns as IndexView,Is as LinkedRowsView,cs as LocalRowsView,rs as MetricView,Xo as Provider,us as RemoteRowView,is as ResultCellView,ls as ResultRowView,ps as ResultSortedTableView,as as ResultTableView,$o as RowView,ds as SliceView,es as SortedTableView,_o as TableView,ts as TablesView,os as ValueView,ss as ValuesView,Ye as useAddRowCallback,Qe as useCell,De as useCellIds,wt as useCellIdsListener,Rt as useCellListener,ho as useCheckpoint,wo as useCheckpointIds,So as useCheckpointIdsListener,Lo as useCheckpointListener,oe as useCheckpoints,ko as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,yo as useCreateCheckpoints,At as useCreateIndexes,qe as useCreateMergeableStore,Tt as useCreateMetrics,Bo as useCreatePersister,$t as useCreateQueries,zt as useCreateRelationships,ve as useCreateStore,To as useCreateSynchronizer,dt as useDelCellCallback,rt as useDelRowCallback,st as useDelTableCallback,ot as useDelTablesCallback,ut as useDelValueCallback,nt as useDelValuesCallback,Bt as useDidFinishTransactionListener,fo as useGoBackwardCallback,vo as useGoForwardCallback,qo as useGoToCallback,He as useHasCell,ht as useHasCellListener,Oe as useHasRow,yt as useHasRowListener,Be as useHasTable,Me as useHasTableCell,gt as useHasTableCellListener,lt as useHasTableListener,xe as useHasTables,ct as useHasTablesListener,Je as useHasValue,Pt as useHasValueListener,We as useHasValues,ft as useHasValuesListener,Dt as useIndexIds,Y as useIndexes,Ot as useIndexesIds,Z as useIndexesOrIndexesById,Ut as useLinkedRowIds,Zt as useLinkedRowIdsListener,Nt as useLocalRowIds,Yt as useLocalRowIdsListener,Ft as useMetric,Mt as useMetricIds,Vt as useMetricListener,U as useMetrics,Et as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,_t as useQueriesIds,te as useQueriesOrQueriesById,eo as useQueryIds,xo as useRedoInformation,Jt as useRelationshipIds,$ as useRelationships,Gt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Kt as useRemoteRowId,Xt as useRemoteRowIdListener,Io as useResultCell,co as useResultCellIds,Co as useResultCellIdsListener,mo as useResultCellListener,uo as useResultRow,so as useResultRowCount,ao as useResultRowCountListener,ro as useResultRowIds,po as useResultRowIdsListener,bo as useResultRowListener,no as useResultSortedRowIds,go as useResultSortedRowIdsListener,to as useResultTable,oo as useResultTableCellIds,lo as useResultTableCellIdsListener,io as useResultTableListener,je as useRow,Fe as useRowCount,bt as useRowCountListener,Ve as useRowIds,Ct as useRowIdsListener,kt as useRowListener,$e as useSetCellCallback,Ro as useSetCheckpointCallback,Ze as useSetPartialRowCallback,et as useSetPartialValuesCallback,Xe as useSetRowCallback,Ue as useSetTableCallback,Ne as useSetTablesCallback,tt as useSetValueCallback,_e as useSetValuesCallback,jt as useSliceIds,Qt as useSliceIdsListener,Ht as useSliceRowIds,Wt as useSliceRowIdsListener,Ae as useSortedRowIds,mt as useSortedRowIdsListener,St as useStartTransactionListener,J as useStore,Pe as useStoreIds,K as useStoreOrStoreById,Te as useTable,Ee as useTableCellIds,pt as useTableCellIdsListener,Le as useTableIds,it as useTableIdsListener,at as useTableListener,Se as useTables,It as useTablesListener,Po as useUndoInformation,Ke as useValue,Ge as useValueIds,qt as useValueIdsListener,xt as useValueListener,ze as useValues,vt as useValuesListener,Lt as useWillFinishTransactionListener};
|
|
1
|
+
import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),d="Listener",n="Result",u="Has",c="Ids",i="Table",l=i+"s",I=i+c,a="Row",p=a+"Count",g=a+c,b="Sorted"+a+c,C="Cell",m=C+c,y="Value",k=y+"s",w=y+c,h=e=>null==e,R=(e,t,o)=>h(e)?o?.():t(e),f=e=>t(e)==s,v=e=>t(e)==r,q=e=>e.length,P=()=>{},x=(e,t)=>e.every(t),S=(e,t)=>q(e)===q(t)&&x(e,((e,o)=>t[o]===e)),L=(e,t)=>e.map(t),B=Object,T=e=>B.getPrototypeOf(e),E=B.entries,M=e=>!h(e)&&R(T(e),(e=>e==B.prototype||h(T(e))),(()=>!0)),F=B.keys,V=(e,t)=>R(e,(e=>e[t])),A=(e,t)=>(delete e[t],e),O=(e,t)=>{const o=E(e);return q(o)===q(F(t))&&x(o,(([e,o])=>M(o)?!!M(t[e])&&O(t[e],o):t[e]===o))},{createContext:j,useContext:D,useEffect:H}=e,Q=j([]),W=(e,t)=>{const o=D(Q);return h(e)?o[t]:f(e)?V(o[t+1]??{},e):e},z=(e,t)=>{const o=W(e,t);return h(e)||f(e)?o:e},G=e=>F(D(Q)[e]??{}),J=e=>W(e,0),K=e=>z(e,0),N=(e,t)=>{const{12:o,13:s}=D(Q);H((()=>(o?.(e,t),()=>s?.(e))),[o,e,t,s])},U=e=>W(e,2),X=e=>z(e,2),Y=e=>W(e,4),Z=e=>z(e,4),$=e=>W(e,6),_=e=>z(e,6),ee=e=>W(e,8),te=e=>z(e,8),oe=e=>W(e,10),se=e=>z(e,10),re=e=>e.toLowerCase();re(d);const de="Transaction";re(de);const{useCallback:ne,useEffect:ue,useMemo:ce,useLayoutEffect:ie,useRef:le,useState:Ie,useSyncExternalStore:ae}=e,pe=[],ge=[{},[],[pe,void 0,pe],void 0,!1,0],be=[O,S,([e,t,o],[s,r,d])=>t===r&&S(e,s)&&S(o,d)],Ce=(e,t)=>e===t,me=(e,t,o=pe)=>{const[,s]=Ie(),[r,d]=Ie();return ue((()=>{const o=e?t(e):void 0;return d(o),s([]),o?.destroy}),[e,...o]),r},ye=(e,t,...o)=>{const s=e?.["add"+t+d]?.(...o);return()=>e?.delListener(s)},ke=(e,t,s,r=pe)=>{const d=le(ge[s]),n=ne((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??ge[s];return(be[s]??Ce)(o,d.current)?d.current:d.current=o}),[t,s,e,...r]),c=ne((d=>ye(t,(4==s?u:o)+e,...r,d)),[t,s,e,...r]);return ae(c,n)},we=(e,t,o,s=pe,r=pe,...d)=>ie((()=>ye(t,e,...r,o,...d)),[t,e,...r,...s,...d]),he=(e,t,o,s=pe,r=P,d=pe,...n)=>{const u=K(e);return ne((e=>R(u,(s=>R(o(e,s),(o=>r(s["set"+t](...Re(n,s,e),o),o)))))),[u,t,...s,...d,...fe(n)])},Re=(e,t,o)=>L(e,(e=>v(e)?e(o,t):e)),fe=e=>{return t=e=>!v(e),e.filter(t);var t},ve=(e,t,o=P,s=pe,...r)=>{const d=K(e);return ne((e=>o(d?.["del"+t](...Re(r,d,e)))),[d,t,...s,...fe(r)])},qe=(e,t,o)=>{const s=se(e);return ne((()=>s?.[t](o)),[s,t,o])},Pe=(e,t=pe)=>ce(e,t),xe=(e,t=pe)=>ce(e,t),Se=()=>G(1),Le=e=>ke(l,K(e),4,[]),Be=e=>ke(l,K(e),0),Te=e=>ke(I,K(e),1),Ee=(e,t)=>ke(i,K(t),4,[e]),Me=(e,t)=>ke(i,K(t),0,[e]),Fe=(e,t)=>ke(i+m,K(t),1,[e]),Ve=(e,t,o)=>ke(i+C,K(o),4,[e,t]),Ae=(e,t)=>ke(p,K(t),5,[e]),Oe=(e,t)=>ke(g,K(t),1,[e]),je=(e,t,o,s=0,r,d)=>ke(b,K(d),1,[e,t,o,s,r]),De=(e,t,o)=>ke(a,K(o),4,[e,t]),He=(e,t,o)=>ke(a,K(o),0,[e,t]),Qe=(e,t,o)=>ke(m,K(o),1,[e,t]),We=(e,t,o,s)=>ke(C,K(s),4,[e,t,o]),ze=(e,t,o,s)=>ke(C,K(s),3,[e,t,o]),Ge=e=>ke(k,K(e),4,[]),Je=e=>ke(k,K(e),0),Ke=e=>ke(w,K(e),1),Ne=(e,t)=>ke(y,K(t),4,[e]),Ue=(e,t)=>ke(y,K(t),3,[e]),Xe=(e,t,o,s,r)=>he(o,l,e,t,s,r),Ye=(e,t,o,s,r,d)=>he(s,i,t,o,r,d,e),Ze=(e,t,o,s,r,d,n)=>he(r,a,o,s,d,n,e,t),$e=(e,t,o=pe,s,r=P,d=pe,n=!0)=>{const u=K(s);return ne((o=>R(u,(s=>R(t(o,s),(t=>r(s.addRow(v(e)?e(o,s):e,t,n),s,t)))))),[u,e,...o,...d,n])},_e=(e,t,o,s,r,d,n)=>he(r,"PartialRow",o,s,d,n,e,t),et=(e,t,o,s,r,d,n,u)=>he(d,C,s,r,n,u,e,t,o),tt=(e,t,o,s,r)=>he(o,k,e,t,s,r),ot=(e,t,o,s,r)=>he(o,"PartialValues",e,t,s,r),st=(e,t,o,s,r,d)=>he(s,y,t,o,r,d,e),rt=(e,t,o)=>ve(e,l,t,o),dt=(e,t,o,s)=>ve(t,i,o,s,e),nt=(e,t,o,s,r)=>ve(o,a,s,r,e,t),ut=(e,t,o,s,r,d,n)=>ve(r,C,d,n,e,t,o,s),ct=(e,t,o)=>ve(e,k,t,o),it=(e,t,o,s)=>ve(t,y,o,s,e),lt=(e,t,o,s)=>we(u+l,K(s),e,t,[],o),It=(e,t,o,s)=>we(l,K(s),e,t,pe,o),at=(e,t,o,s)=>we(I,K(s),e,t,pe,o),pt=(e,t,o,s,r)=>we(u+i,K(r),t,o,[e],s),gt=(e,t,o,s,r)=>we(i,K(r),t,o,[e],s),bt=(e,t,o,s,r)=>we(i+m,K(r),t,o,[e],s),Ct=(e,t,o,s,r,d)=>we(u+i+C,K(d),o,s,[e,t],r),mt=(e,t,o,s,r)=>we(p,K(r),t,o,[e],s),yt=(e,t,o,s,r)=>we(g,K(r),t,o,[e],s),kt=(e,t,o,s,r,d,n,u,c)=>we(b,K(c),d,n,[e,t,o,s,r],u),wt=(e,t,o,s,r,d)=>we(u+a,K(d),o,s,[e,t],r),ht=(e,t,o,s,r,d)=>we(a,K(d),o,s,[e,t],r),Rt=(e,t,o,s,r,d)=>we(m,K(d),o,s,[e,t],r),ft=(e,t,o,s,r,d,n)=>we(u+C,K(n),s,r,[e,t,o],d),vt=(e,t,o,s,r,d,n)=>we(C,K(n),s,r,[e,t,o],d),qt=(e,t,o,s)=>we(u+k,K(s),e,t,[],o),Pt=(e,t,o,s)=>we(k,K(s),e,t,pe,o),xt=(e,t,o,s)=>we(w,K(s),e,t,pe,o),St=(e,t,o,s,r)=>we(u+y,K(r),t,o,[e],s),Lt=(e,t,o,s,r)=>we(y,K(r),t,o,[e],s),Bt=(e,t,o)=>we("Start"+de,K(o),e,t),Tt=(e,t,o)=>we("WillFinish"+de,K(o),e,t),Et=(e,t,o)=>we("DidFinish"+de,K(o),e,t),Mt=(e,t,o)=>me(e,t,o),Ft=()=>G(3),Vt=e=>ke("MetricIds",X(e),1),At=(e,t)=>ke("Metric",X(t),3,[e]),Ot=(e,t,o,s)=>we("Metric",X(s),t,o,[e]),jt=(e,t,o)=>me(e,t,o),Dt=()=>G(5),Ht=(e,t)=>ke("SliceIds",Z(t),1,[e]),Qt=e=>ke("IndexIds",Z(e),1),Wt=(e,t,o)=>ke("Slice"+g,Z(o),1,[e,t]),zt=(e,t,o,s)=>we("SliceIds",Z(s),t,o,[e]),Gt=(e,t,o,s,r)=>we("Slice"+g,Z(r),o,s,[e,t]),Jt=(e,t,o)=>me(e,t,o),Kt=()=>G(7),Nt=e=>ke("RelationshipIds",_(e),1),Ut=(e,t,o)=>ke("RemoteRowId",_(o),3,[e,t]),Xt=(e,t,o)=>ke("Local"+g,_(o),1,[e,t]),Yt=(e,t,o)=>ke("Linked"+g,_(o),1,[e,t]),Zt=(e,t,o,s,r)=>we("RemoteRowId",_(r),o,s,[e,t]),$t=(e,t,o,s,r)=>we("Local"+g,_(r),o,s,[e,t]),_t=(e,t,o,s,r)=>we("Linked"+g,_(r),o,s,[e,t]),eo=(e,t,o)=>me(e,t,o),to=()=>G(9),oo=e=>ke("QueryIds",te(e),1),so=(e,t)=>ke(n+i,te(t),0,[e]),ro=(e,t)=>ke(n+i+m,te(t),1,[e]),no=(e,t)=>ke(n+p,te(t),5,[e]),uo=(e,t)=>ke(n+g,te(t),1,[e]),co=(e,t,o,s=0,r,d)=>ke(n+b,te(d),1,[e,t,o,s,r]),io=(e,t,o)=>ke(n+a,te(o),0,[e,t]),lo=(e,t,o)=>ke(n+m,te(o),1,[e,t]),Io=(e,t,o,s)=>ke(n+C,te(s),3,[e,t,o]),ao=(e,t,o,s)=>we(n+i,te(s),t,o,[e]),po=(e,t,o,s)=>we(n+i+m,te(s),t,o,[e]),go=(e,t,o,s)=>we(n+p,te(s),t,o,[e]),bo=(e,t,o,s)=>we(n+g,te(s),t,o,[e]),Co=(e,t,o,s,r,d,u,c)=>we(n+b,te(c),d,u,[e,t,o,s,r]),mo=(e,t,o,s,r)=>we(n+a,te(r),o,s,[e,t]),yo=(e,t,o,s,r)=>we(n+m,te(r),o,s,[e,t]),ko=(e,t,o,s,r,d)=>we(n+C,te(d),s,r,[e,t,o]),wo=(e,t,o)=>me(e,t,o),ho=()=>G(11),Ro=e=>ke("CheckpointIds",se(e),2),fo=(e,t)=>ke("Checkpoint",se(t),3,[e]),vo=(e=P,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[d,...t,...r])},qo=e=>qe(e,"goBackward"),Po=e=>qe(e,"goForward"),xo=(e,t=pe,o,s=P,r=pe)=>{const d=se(o);return ne((t=>R(d,(o=>R(e(t),(e=>s(o.goTo(e),e)))))),[d,...t,...r])},So=e=>{const t=se(e),[s,r]=Ro(t);return[(d=s,!(0==q(d))),qo(t),r,R(r,(e=>t?.getCheckpoint(e)))??o];var d},Lo=e=>{const t=se(e),[,,[s]]=Ro(t);return[!h(s),Po(t),s,R(s,(e=>t?.getCheckpoint(e)))??o]},Bo=(e,t,o)=>we("CheckpointIds",se(o),e,t),To=(e,t,o,s)=>we("Checkpoint",se(s),t,o,[e]),Eo=(e,t,o=pe,s,r=pe,d,n=pe)=>{const[,u]=Ie(),[c,i]=Ie();return ue((()=>{const o=e?t(e):void 0;i(o),o&&s&&(async()=>{await s(o),u([])})()}),[e,...o,...r]),ue((()=>()=>{c&&(c.destroy(),d?.(c))}),[c,...n]),c},Mo=(e,t,o=pe,s,r=pe)=>{const[d,n]=Ie();return ue((()=>{(async()=>{const o=e?await t(e):void 0;n(o)})()}),[e,...o]),ue((()=>()=>{d&&(d.destroy(),s?.(d))}),[d,...r]),d},{PureComponent:Fo,Fragment:Vo,createElement:Ao,useCallback:Oo,useLayoutEffect:jo,useRef:Do,useState:Ho}=e,Qo=(e,...t)=>h(e)?{}:e(...t),Wo=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:zo,useContext:Go,useMemo:Jo,useState:Ko}=e,No=({tableId:e,store:t,rowComponent:o=es,getRowComponentProps:s,customCellIds:r,separator:d,debugIds:n},u)=>$o(L(u,(d=>Ao(o,{...Qo(s,d),key:d,tableId:e,rowId:d,customCellIds:r,store:t,debugIds:n}))),d,n,e),Uo=({queryId:e,queries:t,resultRowComponent:o=ps,getResultRowComponentProps:s,separator:r,debugIds:d},n)=>$o(L(n,(r=>Ao(o,{...Qo(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:d}))),r,d,e),Xo=({relationshipId:e,relationships:t,rowComponent:o=es,getRowComponentProps:s,separator:r,debugIds:d},n,u)=>{const[c,i,l]=Wo(_(t),e),I=n(e,u,c);return $o(L(I,(e=>Ao(o,{...Qo(s,e),key:e,tableId:l,rowId:e,store:i,debugIds:d}))),r,d,u)},Yo=e=>({checkpoints:t,checkpointComponent:o=Cs,getCheckpointComponentProps:s,separator:r,debugIds:d})=>{const n=se(t);return $o(L(e(Ro(n)),(e=>Ao(o,{...Qo(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:d}))),r)},Zo=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:d,relationships:n,relationshipsById:u,queries:c,queriesById:i,checkpoints:l,checkpointsById:I,children:a})=>{const p=Go(Q),[g,b]=Ko({}),C=zo(((e,t)=>b((o=>V(o,e)==t?o:{...o,[e]:t}))),[]),m=zo((e=>b((t=>({...A(t,e)})))),[]);return Ao(Q.Provider,{value:Jo((()=>[e??p[0],{...p[1],...t,...g},o??p[2],{...p[3],...s},r??p[4],{...p[5],...d},n??p[6],{...p[7],...u},c??p[8],{...p[9],...i},l??p[10],{...p[11],...I},C,m]),[e,t,g,o,s,r,d,n,u,c,i,l,I,p,C,m])},a)},$o=(e,t,o,s)=>{const r=h(t)||!Array.isArray(e)?e:L(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},_o=({tableId:e,rowId:t,cellId:s,store:r,debugIds:d})=>$o(o+(ze(e,t,s,r)??o),void 0,d,s),es=({tableId:e,rowId:t,store:o,cellComponent:s=_o,getCellComponentProps:r,customCellIds:d,separator:n,debugIds:u})=>$o(L(((e,t,o,s)=>{const r=Qe(t,o,s);return e??r})(d,e,t,o),(d=>Ao(s,{...Qo(r,d),key:d,tableId:e,rowId:t,cellId:d,store:o,debugIds:u}))),n,u,t),ts=e=>No(e,Oe(e.tableId,e.store)),os=({cellId:e,descending:t,offset:o,limit:s,...r})=>No(r,je(r.tableId,e,t,o,s,r.store)),ss=({store:e,tableComponent:t=ts,getTableComponentProps:o,separator:s,debugIds:r})=>$o(L(Te(e),(s=>Ao(t,{...Qo(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),rs=({valueId:e,store:t,debugIds:s})=>$o(o+(Ue(e,t)??o),void 0,s,e),ds=({store:e,valueComponent:t=rs,getValueComponentProps:o,separator:s,debugIds:r})=>$o(L(Ke(e),(s=>Ao(t,{...Qo(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),ns=({metricId:e,metrics:t,debugIds:s})=>$o(At(e,t)??o,void 0,s,e),us=({indexId:e,sliceId:t,indexes:o,rowComponent:s=es,getRowComponentProps:r,separator:d,debugIds:n})=>{const[u,c,i]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(Z(o),e),l=Wt(e,t,u);return $o(L(l,(e=>Ao(s,{...Qo(r,e),key:e,tableId:i,rowId:e,store:c,debugIds:n}))),d,n,t)},cs=({indexId:e,indexes:t,sliceComponent:o=us,getSliceComponentProps:s,separator:r,debugIds:d})=>$o(L(Ht(e,t),(r=>Ao(o,{...Qo(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:d}))),r,d,e),is=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=es,getRowComponentProps:r,debugIds:d})=>{const[n,u,,c]=Wo(_(o),e),i=Ut(e,t,n);return $o(h(c)||h(i)?null:Ao(s,{...Qo(r,i),key:i,tableId:c,rowId:i,store:u,debugIds:d}),void 0,d,t)},ls=e=>Xo(e,Xt,e.remoteRowId),Is=e=>Xo(e,Yt,e.firstRowId),as=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:d})=>$o(o+(Io(e,t,s,r)??o),void 0,d,s),ps=({queryId:e,rowId:t,queries:o,resultCellComponent:s=as,getResultCellComponentProps:r,separator:d,debugIds:n})=>$o(L(lo(e,t,o),(d=>Ao(s,{...Qo(r,d),key:d,queryId:e,rowId:t,cellId:d,queries:o,debugIds:n}))),d,n,t),gs=e=>Uo(e,uo(e.queryId,e.queries)),bs=({cellId:e,descending:t,offset:o,limit:s,...r})=>Uo(r,co(r.queryId,e,t,o,s,r.queries)),Cs=({checkpoints:e,checkpointId:t,debugIds:s})=>$o(fo(t,e)??o,void 0,s,t),ms=Yo((e=>e[0])),ys=Yo((e=>h(e[1])?[]:[e[1]])),ks=Yo((e=>e[2]));export{ms as BackwardCheckpointsView,_o as CellView,Cs as CheckpointView,ys as CurrentCheckpointView,ks as ForwardCheckpointsView,cs as IndexView,Is as LinkedRowsView,ls as LocalRowsView,ns as MetricView,Zo as Provider,is as RemoteRowView,as as ResultCellView,ps as ResultRowView,bs as ResultSortedTableView,gs as ResultTableView,es as RowView,us as SliceView,os as SortedTableView,ts as TableView,ss as TablesView,rs as ValueView,ds as ValuesView,$e as useAddRowCallback,ze as useCell,Qe as useCellIds,Rt as useCellIdsListener,vt as useCellListener,fo as useCheckpoint,Ro as useCheckpointIds,Bo as useCheckpointIdsListener,To as useCheckpointListener,oe as useCheckpoints,ho as useCheckpointsIds,se as useCheckpointsOrCheckpointsById,wo as useCreateCheckpoints,jt as useCreateIndexes,xe as useCreateMergeableStore,Mt as useCreateMetrics,Eo as useCreatePersister,eo as useCreateQueries,Jt as useCreateRelationships,Pe as useCreateStore,Mo as useCreateSynchronizer,ut as useDelCellCallback,nt as useDelRowCallback,dt as useDelTableCallback,rt as useDelTablesCallback,it as useDelValueCallback,ct as useDelValuesCallback,Et as useDidFinishTransactionListener,qo as useGoBackwardCallback,Po as useGoForwardCallback,xo as useGoToCallback,We as useHasCell,ft as useHasCellListener,De as useHasRow,wt as useHasRowListener,Ee as useHasTable,Ve as useHasTableCell,Ct as useHasTableCellListener,pt as useHasTableListener,Le as useHasTables,lt as useHasTablesListener,Ne as useHasValue,St as useHasValueListener,Ge as useHasValues,qt as useHasValuesListener,Qt as useIndexIds,Y as useIndexes,Dt as useIndexesIds,Z as useIndexesOrIndexesById,Yt as useLinkedRowIds,_t as useLinkedRowIdsListener,Xt as useLocalRowIds,$t as useLocalRowIdsListener,At as useMetric,Vt as useMetricIds,Ot as useMetricListener,U as useMetrics,Ft as useMetricsIds,X as useMetricsOrMetricsById,N as useProvideStore,ee as useQueries,to as useQueriesIds,te as useQueriesOrQueriesById,oo as useQueryIds,Lo as useRedoInformation,Nt as useRelationshipIds,$ as useRelationships,Kt as useRelationshipsIds,_ as useRelationshipsOrRelationshipsById,Ut as useRemoteRowId,Zt as useRemoteRowIdListener,Io as useResultCell,lo as useResultCellIds,yo as useResultCellIdsListener,ko as useResultCellListener,io as useResultRow,no as useResultRowCount,go as useResultRowCountListener,uo as useResultRowIds,bo as useResultRowIdsListener,mo as useResultRowListener,co as useResultSortedRowIds,Co as useResultSortedRowIdsListener,so as useResultTable,ro as useResultTableCellIds,po as useResultTableCellIdsListener,ao as useResultTableListener,He as useRow,Ae as useRowCount,mt as useRowCountListener,Oe as useRowIds,yt as useRowIdsListener,ht as useRowListener,et as useSetCellCallback,vo as useSetCheckpointCallback,_e as useSetPartialRowCallback,ot as useSetPartialValuesCallback,Ze as useSetRowCallback,Ye as useSetTableCallback,Xe as useSetTablesCallback,st as useSetValueCallback,tt as useSetValuesCallback,Ht as useSliceIds,zt as useSliceIdsListener,Wt as useSliceRowIds,Gt as useSliceRowIdsListener,je as useSortedRowIds,kt as useSortedRowIdsListener,Bt as useStartTransactionListener,J as useStore,Se as useStoreIds,K as useStoreOrStoreById,Me as useTable,Fe as useTableCellIds,bt as useTableCellIdsListener,Te as useTableIds,at as useTableIdsListener,gt as useTableListener,Be as useTables,It as useTablesListener,So as useUndoInformation,Ue as useValue,Ke as useValueIds,xt as useValueIdsListener,Lt as useValueListener,Je as useValues,Pt as useValuesListener,Tt as useWillFinishTransactionListener};
|
|
Binary file
|
package/package.json
CHANGED
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-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">"The One You Can Sync"</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'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's <em>Database-Like</em></h2><p><a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> <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> to model your app's data structures. TinyBase provides 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 - or the 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 is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, many flavors of <a href="https://tinybase.org/guides/persistence/database-persistence/">database</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>. TinyBase now has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can <a href="https://tinybase.org/guides/synchronization/">natively synchronize</a> and merge data across multiple sources and clients.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</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-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</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/sqlite.svg"> SQLite</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-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</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&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&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&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&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&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.
|
|
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-0"><em>NEW!</em> v5.0 release</a> <span id="one-with">"The One You Can Sync"</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'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's <em>Database-Like</em></h2><p><a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> <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> to model your app's data structures. TinyBase provides 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 - or the 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 is an in-memory data store, but you can easily <a href="#persist-to-storage-sqlite-more">persist</a> your data to <a href="https://tinybase.org/api/persister-browser">browser storage</a>, <a href="https://tinybase.org/api/persister-indexed-db">IndexedDB</a>, many flavors of <a href="https://tinybase.org/guides/persistence/database-persistence/">database</a>, and <a href="https://tinybase.org/guides/persistence/third-party-crdt-persistence/">more</a>. TinyBase now has <a href="#synchronize-between-devices">native CRDT</a> support, meaning that you can <a href="https://tinybase.org/guides/synchronization/">natively synchronize</a> and merge data across multiple sources and clients.</p></section><section><h2 id="it-s-built-for-a-local-first-world">It's Built For A <em>Local-First</em> World</h2><p>TinyBase works anywhere that JavaScript does, but it's especially great for local-first apps: where data is stored locally on the user's device and that can be run offline. It's tiny by name, tiny by nature: just <a href="#did-we-say-tiny">5.3kB - 12.7kB</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-partykit-client"><img width="48" src="https://tinybase.org/partykit.svg"> PartyKit</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/sqlite.svg"> SQLite</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-indexed-db/functions/creation/createindexeddbpersister"><img width="48" src="https://tinybase.org/indexeddb.svg"> IndexedDB</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&logo=GitHub&logoColor=%23fff&label=GitHub&labelColor=%23d81b60&color=%23333"> </a><a href="https://discord.com/invite/mGz3mevwP8" target="_blank"><img src="https://img.shields.io/discord/1027918215323590676?style=for-the-badge&logo=discord&logoColor=%23fff&label=Discord&labelColor=%233131e8&color=%23333"> </a><a href="https://twitter.com/tinybasejs" target="_blank"><img src="https://img.shields.io/twitter/follow/tinybasejs?style=for-the-badge&logo=x&logoColor=%23fff&label=Twitter&labelColor=%23333&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&logo=GitHub&logoColor=%23fff&label=Ideas&labelColor=%23d81b60&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&logo=GitHub&logoColor=%23fff&label=Issues&labelColor=%23d81b60&color=%23333"> </a><a href="#well-tested-and-documented"><img src="https://img.shields.io/badge/Tests-100%25-green?style=for-the-badge&logo=jest&logoColor=%23fff&color=%23333&labelColor=%2387c305"> </a><a href="https://www.npmjs.com/package/tinybase/v/5.0.2" target="_blank"><img src="https://img.shields.io/npm/v/tinybase?style=for-the-badge&logo=npm&logoColor=%23fff&labelColor=%23bd0005&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>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
import {createStore} from 'tinybase';
|
|
@@ -292,4 +292,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
292
292
|
};
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
<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'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>12.7kB</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'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.3kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>129.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.1kB</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,371</td><td>2,371</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,555</td><td>2,555</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,000</td><td>1,000</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>951</td><td>951</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,816</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,001</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>
|
|
295
|
+
<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'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>12.7kB</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'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.3kB</td></tr><tr><th class="right">tinybase (complete)</th><td>12.7kB</td><td>129.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,373</td><td>2,373</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,561</td><td>2,561</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>1,004</td><td>1,004</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>947</td><td>947</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">6,821</td></tr><tr><th class="right">Assertions</th><td colspan="3">32,030</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>
|
|
@@ -173,9 +173,9 @@ const createWsServer = (webSocketServer) => {
|
|
|
173
173
|
const clients = mapEnsure(clientsByPath, pathId, mapNew);
|
|
174
174
|
mapSet(clients, clientId, webSocket);
|
|
175
175
|
if (clients.size == 1) {
|
|
176
|
-
callListeners(pathIdListeners, void 0,
|
|
176
|
+
callListeners(pathIdListeners, void 0, pathId, 1);
|
|
177
177
|
}
|
|
178
|
-
callListeners(clientIdListeners, [pathId],
|
|
178
|
+
callListeners(clientIdListeners, [pathId], clientId, 1);
|
|
179
179
|
webSocket.on('message', (data) => {
|
|
180
180
|
const payload = data.toString(UTF8);
|
|
181
181
|
const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
|
|
@@ -197,10 +197,10 @@ const createWsServer = (webSocketServer) => {
|
|
|
197
197
|
});
|
|
198
198
|
webSocket.on('close', () => {
|
|
199
199
|
collDel(clients, clientId);
|
|
200
|
-
callListeners(clientIdListeners, [pathId],
|
|
200
|
+
callListeners(clientIdListeners, [pathId], clientId, -1);
|
|
201
201
|
if (collIsEmpty(clients)) {
|
|
202
202
|
collDel(clientsByPath, pathId);
|
|
203
|
-
callListeners(pathIdListeners, void 0,
|
|
203
|
+
callListeners(pathIdListeners, void 0, pathId, -1);
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}),
|
|
@@ -173,9 +173,9 @@ const createWsServer = (webSocketServer) => {
|
|
|
173
173
|
const clients = mapEnsure(clientsByPath, pathId, mapNew);
|
|
174
174
|
mapSet(clients, clientId, webSocket);
|
|
175
175
|
if (clients.size == 1) {
|
|
176
|
-
callListeners(pathIdListeners, void 0,
|
|
176
|
+
callListeners(pathIdListeners, void 0, pathId, 1);
|
|
177
177
|
}
|
|
178
|
-
callListeners(clientIdListeners, [pathId],
|
|
178
|
+
callListeners(clientIdListeners, [pathId], clientId, 1);
|
|
179
179
|
webSocket.on('message', (data) => {
|
|
180
180
|
const payload = data.toString(UTF8);
|
|
181
181
|
const splitAt = payload.indexOf(MESSAGE_SEPARATOR);
|
|
@@ -197,10 +197,10 @@ const createWsServer = (webSocketServer) => {
|
|
|
197
197
|
});
|
|
198
198
|
webSocket.on('close', () => {
|
|
199
199
|
collDel(clients, clientId);
|
|
200
|
-
callListeners(clientIdListeners, [pathId],
|
|
200
|
+
callListeners(clientIdListeners, [pathId], clientId, -1);
|
|
201
201
|
if (collIsEmpty(clients)) {
|
|
202
202
|
collDel(clientsByPath, pathId);
|
|
203
|
-
callListeners(pathIdListeners, void 0,
|
|
203
|
+
callListeners(pathIdListeners, void 0, pathId, -1);
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}),
|
package/ui-react/index.js
CHANGED
|
@@ -39,6 +39,7 @@ const arrayIsEqual = (array1, array2) =>
|
|
|
39
39
|
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
40
40
|
const arrayMap = (array, cb) => array.map(cb);
|
|
41
41
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
42
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
42
43
|
|
|
43
44
|
const object = Object;
|
|
44
45
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -223,9 +224,7 @@ const useSetCallback = (
|
|
|
223
224
|
ifNotUndefined(get(parameter, store2), (thing) =>
|
|
224
225
|
then(
|
|
225
226
|
store2['set' + settable](
|
|
226
|
-
...
|
|
227
|
-
isFunction(arg) ? arg(parameter, store2) : arg,
|
|
228
|
-
),
|
|
227
|
+
...argsOrGetArgs(args, store2, parameter),
|
|
229
228
|
thing,
|
|
230
229
|
),
|
|
231
230
|
thing,
|
|
@@ -233,9 +232,12 @@ const useSetCallback = (
|
|
|
233
232
|
),
|
|
234
233
|
),
|
|
235
234
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
236
|
-
[store, settable, ...getDeps, ...thenDeps, ...args],
|
|
235
|
+
[store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
|
|
237
236
|
);
|
|
238
237
|
};
|
|
238
|
+
const argsOrGetArgs = (args, store, parameter) =>
|
|
239
|
+
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
240
|
+
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
239
241
|
const useDel = (
|
|
240
242
|
storeOrStoreId,
|
|
241
243
|
deletable,
|
|
@@ -245,9 +247,12 @@ const useDel = (
|
|
|
245
247
|
) => {
|
|
246
248
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
247
249
|
return useCallback$2(
|
|
248
|
-
() =>
|
|
250
|
+
(parameter) =>
|
|
251
|
+
then(
|
|
252
|
+
store?.['del' + deletable](...argsOrGetArgs(args, store, parameter)),
|
|
253
|
+
),
|
|
249
254
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
250
|
-
[store, deletable, ...thenDeps, ...args],
|
|
255
|
+
[store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
|
|
251
256
|
);
|
|
252
257
|
};
|
|
253
258
|
const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
|
|
@@ -39,6 +39,7 @@ const arrayIsEqual = (array1, array2) =>
|
|
|
39
39
|
arrayEvery(array1, (value1, index) => array2[index] === value1);
|
|
40
40
|
const arrayMap = (array, cb) => array.map(cb);
|
|
41
41
|
const arrayIsEmpty = (array) => size(array) == 0;
|
|
42
|
+
const arrayFilter = (array, cb) => array.filter(cb);
|
|
42
43
|
|
|
43
44
|
const object = Object;
|
|
44
45
|
const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
|
|
@@ -223,9 +224,7 @@ const useSetCallback = (
|
|
|
223
224
|
ifNotUndefined(get(parameter, store2), (thing) =>
|
|
224
225
|
then(
|
|
225
226
|
store2['set' + settable](
|
|
226
|
-
...
|
|
227
|
-
isFunction(arg) ? arg(parameter, store2) : arg,
|
|
228
|
-
),
|
|
227
|
+
...argsOrGetArgs(args, store2, parameter),
|
|
229
228
|
thing,
|
|
230
229
|
),
|
|
231
230
|
thing,
|
|
@@ -233,9 +232,12 @@ const useSetCallback = (
|
|
|
233
232
|
),
|
|
234
233
|
),
|
|
235
234
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
236
|
-
[store, settable, ...getDeps, ...thenDeps, ...args],
|
|
235
|
+
[store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
|
|
237
236
|
);
|
|
238
237
|
};
|
|
238
|
+
const argsOrGetArgs = (args, store, parameter) =>
|
|
239
|
+
arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
|
|
240
|
+
const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
|
|
239
241
|
const useDel = (
|
|
240
242
|
storeOrStoreId,
|
|
241
243
|
deletable,
|
|
@@ -245,9 +247,12 @@ const useDel = (
|
|
|
245
247
|
) => {
|
|
246
248
|
const store = useStoreOrStoreById(storeOrStoreId);
|
|
247
249
|
return useCallback$2(
|
|
248
|
-
() =>
|
|
250
|
+
(parameter) =>
|
|
251
|
+
then(
|
|
252
|
+
store?.['del' + deletable](...argsOrGetArgs(args, store, parameter)),
|
|
253
|
+
),
|
|
249
254
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
250
|
-
[store, deletable, ...thenDeps, ...args],
|
|
255
|
+
[store, deletable, ...thenDeps, ...nonFunctionDeps(args)],
|
|
251
256
|
);
|
|
252
257
|
};
|
|
253
258
|
const useCheckpointAction = (checkpointsOrCheckpointsId, action, arg) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,
|
|
1
|
+
var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,r,1),L(v,[r],n,1),e.on("message",(e=>{var r;const s=e.toString("utf8"),o=s.indexOf("\n");if(-1!==o){const e=t(s,0,o),i=t(s,o+1);""===e?(u=(e,l)=>e!=n?l.send(n+"\n"+i):0,f(l,((e,n)=>u(n,e)))):null==(r=p(l,e))||r.send(n+"\n"+i)}var u})),e.on("close",(()=>{h(l,n),L(v,[r],n,-1),c(l)&&(h(I,r),L(a,void 0,r,-1))}))}))))}));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,a),addClientIdsListener:(e,n)=>w(n,v,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:i(I),clients:d(I)}),destroy:()=>{e.close(),I.clear()}};return u(W)}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,
|
|
1
|
+
var e,n;e=this,n=function(e){"use strict";const n=e=>null==e,l=(e,l,t)=>n(e)?null==t?void 0:t():l(e),t=(e,n,l)=>e.slice(n,l),r=e=>e.length,s=(e,n)=>e.forEach(n),o=(e,...n)=>e.push(...n),u=Object.freeze,i=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},d=(a=i,e=>{return n=(e,n)=>e+a(n),v(e).reduce(n,0);var n});var a;const c=e=>n(e)||0==i(e),v=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},f=(e,n)=>null==e?void 0:e.forEach(n),h=(e,n)=>null==e?void 0:e.delete(n),y=e=>new Map(e),g=e=>{var n;return[...null!=(n=null==e?void 0:e.keys())?n:[]]},p=(e,n)=>null==e?void 0:e.get(n),S=(e,l,t)=>n(t)?(h(e,l),e):null==e?void 0:e.set(l,t),b=(e,n,l,t)=>{var r,s,o;return s=n,null!=(o=null==(r=e)?void 0:r.has(s))&&o?null==t||t(p(e,n)):S(e,n,l()),p(e,n)},k=(e,n,t,s,o=0)=>l((t?b:p)(e,n[o],o>r(n)-2?t:y),(l=>{if(o>r(n)-2)return(null==s?void 0:s(l))&&S(e,n[o]),l;const u=k(l,n,t,s,o+1);return c(l)&&S(e,n[o]),u})),m=e=>new Set(Array.isArray(e)||n(e)?e:[e]),x=/^\d+$/,z=/\/([^?]*)/;e.createWsServer=e=>{const a=y(),v=y(),I=y(),[w,L,T]=(e=>{let t;const[u,i]=(()=>{const e=[];let n=0;return[l=>{var t;return null!=(t=l?e.shift():null)?t:""+n++},n=>{x.test(n)&&r(e)<1e3&&o(e,n)}]})(),d=y();return[(e,n,l,r=[],s=(()=>[]))=>{null!=t||(t=W);const o=u(1);var i,a;return S(d,o,[e,n,l,r,s]),a=o,null==(i=k(n,null!=l?l:[""],m))||i.add(a),o},(e,n,...l)=>s(((e,n=[""])=>{const l=[],t=(e,u)=>u==r(n)?o(l,e):null===n[u]?f(e,(e=>t(e,u+1))):s([n[u],null],(n=>t(p(e,n),u+1)));return t(e,0),l})(e,n),(e=>f(e,(e=>p(d,e)[0](t,...null!=n?n:[],...l))))),e=>l(p(d,e),(([,n,l])=>(k(n,null!=l?l:[""],void 0,(n=>(h(n,e),c(n)?1:0))),S(d,e),i(e),l))),e=>l(p(d,e),(([e,,l=[],o,u])=>{const i=(...d)=>{var a,c;const v=r(d);v==r(l)?e(t,...d,...u(d)):n(l[v])?s(null!=(c=null==(a=o[v])?void 0:a.call(o,...d))?c:[],(e=>i(...d,e))):i(...d,l[v])};i()}))]})();e.on("connection",((e,n)=>{var r;return l(null==(r=n.url)?void 0:r.match(z),(([,r])=>l(n.headers["sec-websocket-key"],(n=>{const l=b(I,r,y);S(l,n,e),1==l.size&&L(a,void 0,r,1),L(v,[r],n,1),e.on("message",(e=>{var r;const s=e.toString("utf8"),o=s.indexOf("\n");if(-1!==o){const e=t(s,0,o),i=t(s,o+1);""===e?(u=(e,l)=>e!=n?l.send(n+"\n"+i):0,f(l,((e,n)=>u(n,e)))):null==(r=p(l,e))||r.send(n+"\n"+i)}var u})),e.on("close",(()=>{h(l,n),L(v,[r],n,-1),c(l)&&(h(I,r),L(a,void 0,r,-1))}))}))))}));const W={getWebSocketServer:()=>e,getPathIds:()=>g(I),getClientIds:e=>g(p(I,e)),addPathIdsListener:e=>w(e,a),addClientIdsListener:(e,n)=>w(n,v,[e]),delListener:e=>(T(e),W),getStats:()=>({paths:i(I),clients:d(I)}),destroy:()=>{e.close(),I.clear()}};return u(W)}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizerWsServer={});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",C=p+"Count",b=p+i,w="Sorted"+p+i,R="Cell",k=R+i,v="Value",y=v+"s",g=v+i,h=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=e=>t(e)==r,S=e=>e.length,T=()=>{},V=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&V(e,((e,t)=>s[t]===e)),x=(e,s)=>e.map(s),O=Object,q=e=>O.getPrototypeOf(e),B=O.entries,H=e=>!h(e)&&m(q(e),(e=>e==O.prototype||h(q(e))),(()=>!0)),M=O.keys,D=(e,s)=>m(e,(e=>e[s])),j=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&j(s[e],t):s[e]===t))},{createContext:F,useContext:E,useEffect:Q}=s,A=F([]),G=(e,s)=>{var t;const l=E(A);return h(e)?l[s]:L(e)?D(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||L(e)?t:e},W=e=>{var s;return M(null!=(s=E(A)[e])?s:{})},z=e=>U(e,0),J=e=>U(e,2),K=e=>U(e,4),N=e=>U(e,6),X=e=>U(e,8),Y=e=>U(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);var _=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:le,useRef:oe,useState:re,useSyncExternalStore:ue}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ie=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ae=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},Ie=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},pe=(e,s,t,o=ne)=>{const r=oe(de[t]),u=ee((()=>{var l,u,n;const d=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:de[t];return(null!=(n=ie[t])?n:ae)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=ee((r=>Ie(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ue(n,u)},Ce=(e,s,t,l=ne,o=ne,...r)=>le((()=>Ie(s,e,...o,t,...r)),[s,e,...o,...l,...r]),be=(e,s,t,l=ne,o=T,r=ne,...u)=>{const n=z(e);return ee((e=>m(n,(l=>m(t(e,l),(t=>o(l["set"+s](...x(u,(s=>f(s)?s(e,l):s)),t),t)))))),[n,s,...l,...r,...u])},we=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},Re=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ke=e=>pe(I,z(e),1),ve=(e,s)=>pe(b,z(s),1,[e]),ye=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),ge=(e,s,t)=>pe(k,z(t),1,[e,s]),he=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),me=e=>pe(g,z(e),1),Le=(e,s)=>pe(v,z(s),3,[e]),fe=(e,s)=>pe("Metric",J(s),3,[e]),Se=(e,s)=>pe("SliceIds",K(s),1,[e]),Te=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),Ve=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Pe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),xe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Oe=(e,s)=>pe(n+b,X(s),1,[e]),qe=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Be=(e,s,t)=>pe(n+k,X(t),1,[e,s]),He=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),Me=e=>pe("CheckpointIds",Y(e),2),De=(e,s)=>pe("Checkpoint",Y(s),3,[e]),je=e=>Re(e,"goBackward"),Fe=e=>Re(e,"goForward"),{PureComponent:Ee,Fragment:Qe,createElement:Ae,useCallback:Ge,useLayoutEffect:Ue,useRef:We,useState:ze}=s,Je=(e,...s)=>h(e)?{}:e(...s),Ke=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ne=Object.defineProperty,Xe=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,Ze=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,es=(e,s,t)=>s in e?Ne(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ss=(e,s)=>{for(var t in s||(s={}))$e.call(s,t)&&es(e,t,s[t]);if(Ze)for(var t of Ze(s))_e.call(s,t)&&es(e,t,s[t]);return e},ts=(e,s)=>Xe(e,Ye(s)),ls=(e,s)=>{var t={};for(var l in e)$e.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Ze)for(var l of Ze(e))s.indexOf(l)<0&&_e.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:os,useContext:rs,useMemo:us,useState:ns}=s,ds=({tableId:e,store:s,rowComponent:t=Cs,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Is(x(n,(r=>Ae(t,ts(ss({},Je(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),is=({queryId:e,queries:s,resultRowComponent:t=vs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Is(x(u,(o=>Ae(t,ts(ss({},Je(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),as=({relationshipId:e,relationships:s,rowComponent:t=Cs,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Ke(N(s),e),c=u(e,n,d);return Is(x(c,(e=>Ae(t,ts(ss({},Je(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},cs=e=>({checkpoints:s,checkpointComponent:t=ys,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Is(x(e(Me(u)),(e=>Ae(t,ts(ss({},Je(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Is=(e,s,t,l)=>{const o=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},ps=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Is(l+(null!=(u=he(e,s,t,o))?u:l),void 0,r,t)},Cs=({tableId:e,rowId:s,store:t,cellComponent:l=ps,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Is(x(((e,s,t,l)=>{const o=ge(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ae(l,ts(ss({},Je(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),bs=e=>ds(e,ve(e.tableId,e.store)),ws=({valueId:e,store:s,debugIds:t})=>{var o;return Is(l+(null!=(o=Le(e,s))?o:l),void 0,t,e)},Rs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=Cs,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(K(t),e),a=Te(e,s,n);return Is(x(a,(e=>Ae(l,ts(ss({},Je(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ks=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Is(l+(null!=(u=He(e,s,t,o))?u:l),void 0,r,t)},vs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ks,getResultCellComponentProps:o,separator:r,debugIds:u})=>Is(x(Be(e,s,t),(r=>Ae(l,ts(ss({},Je(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),ys=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Is(null!=(o=De(s,e))?o:l,void 0,t,s)},gs=cs((e=>e[0])),hs=cs((e=>h(e[1])?[]:[e[1]])),ms=cs((e=>e[2]));e.BackwardCheckpointsView=gs,e.CellView=ps,e.CheckpointView=ys,e.CurrentCheckpointView=hs,e.ForwardCheckpointsView=ms,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Rs,getSliceComponentProps:l,separator:o,debugIds:r})=>Is(x(Se(e,s),(o=>Ae(t,ts(ss({},Je(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>as(e,xe,e.firstRowId),e.LocalRowsView=e=>as(e,Pe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Is(null!=(o=fe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=rs(A),[C,b]=ns({}),w=os(((e,s)=>b((t=>D(t,e)==s?t:ts(ss({},t),{[e]:s})))),[]),R=os((e=>b((s=>ss({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ae(A.Provider,{value:us((()=>[null!=e?e:p[0],ss(ss(ss({},p[1]),s),C),null!=t?t:p[2],ss(ss({},p[3]),l),null!=o?o:p[4],ss(ss({},p[5]),r),null!=u?u:p[6],ss(ss({},p[7]),n),null!=d?d:p[8],ss(ss({},p[9]),i),null!=a?a:p[10],ss(ss({},p[11]),c),w,R]),[e,s,C,t,l,o,r,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=Cs,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Ke(N(t),e),i=Ve(e,s,u);return Is(h(d)||h(i)?null:Ae(l,ts(ss({},Je(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ks,e.ResultRowView=vs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ls(s,["cellId","descending","offset","limit"]);return is(u,qe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>is(e,Oe(e.queryId,e.queries)),e.RowView=Cs,e.SliceView=Rs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ls(s,["cellId","descending","offset","limit"]);return ds(u,ye(u.tableId,t,l,o,r,u.store))},e.TableView=bs,e.TablesView=({store:e,tableComponent:s=bs,getTableComponentProps:t,separator:l,debugIds:o})=>Is(x(ke(e),(l=>Ae(s,ts(ss({},Je(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ws,e.ValuesView=({store:e,valueComponent:s=ws,getValueComponentProps:t,separator:l,debugIds:o})=>Is(x(me(e),(l=>Ae(s,ts(ss({},Je(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ne,l,o=T,r=ne,u=!0)=>{const n=z(l);return ee((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(f(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=he,e.useCellIds=ge,e.useCellIdsListener=(e,s,t,l,o,r)=>Ce(k,z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Ce(R,z(u),l,o,[e,s,t],r),e.useCheckpoint=De,e.useCheckpointIds=Me,e.useCheckpointIdsListener=(e,s,t)=>Ce("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Ce("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,l,o=ne,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{const t=e?s(e):void 0;i(t),t&&l&&_(void 0,null,(function*(){yield l(t),n([])}))}),[e,...t,...o]),se((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,l,o=ne)=>{const[r,u]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>we(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>we(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>we(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>we(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>we(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>we(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=je,e.useGoForwardCallback=Fe,e.useGoToCallback=(e,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>pe(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>Ce(d+R,z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>pe(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>Ce(d+p,z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>pe(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>pe(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>Ce(d+a+R,z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>Ce(d+a,z(o),s,t,[e],l),e.useHasTables=e=>pe(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>Ce(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>pe(v,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+v,z(o),s,t,[e],l),e.useHasValues=e=>pe(y,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+y,z(l),e,s,[],t),e.useIndexIds=e=>pe("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=xe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Pe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=fe,e.useMetricIds=e=>pe("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>Ce("Metric",J(l),s,t,[e]),e.useMetrics=e=>G(e,2),e.useMetricsIds=()=>W(3),e.useMetricsOrMetricsById=J,e.useProvideStore=(e,s)=>{const{12:t,13:l}=E(A);Q((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>G(e,8),e.useQueriesIds=()=>W(9),e.useQueriesOrQueriesById=X,e.useQueryIds=e=>pe("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[o]]=Me(t);return[!h(o),Fe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>pe("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=Ve,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=He,e.useResultCellIds=Be,e.useResultCellIdsListener=(e,s,t,l,o)=>Ce(n+k,X(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Ce(n+R,X(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>pe(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>pe(n+C,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>Ce(n+C,X(l),s,t,[e]),e.useResultRowIds=Oe,e.useResultRowIdsListener=(e,s,t,l)=>Ce(n+b,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Ce(n+p,X(o),t,l,[e,s]),e.useResultSortedRowIds=qe,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Ce(n+w,X(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>pe(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>pe(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Ce(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Ce(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>pe(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>pe(C,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>Ce(C,z(o),s,t,[e],l),e.useRowIds=ve,e.useRowIdsListener=(e,s,t,l,o)=>Ce(b,z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Ce(p,z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>be(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>be(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>be(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>be(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>be(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>be(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>be(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,y,e,s,l,o),e.useSliceIds=Se,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Te,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=ye,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Ce(w,z(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>Ce("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>pe(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>pe(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Ce(a+k,z(o),s,t,[e],l),e.useTableIds=ke,e.useTableIdsListener=(e,s,t,l)=>Ce(I,z(l),e,s,ne,t),e.useTableListener=(e,s,t,l,o)=>Ce(a,z(o),s,t,[e],l),e.useTables=e=>pe(c,z(e),0),e.useTablesListener=(e,s,t,l)=>Ce(c,z(l),e,s,ne,t),e.useUndoInformation=e=>{var s;const t=Y(e),[o,r]=Me(t);return[(u=o,!(0==S(u))),je(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Le,e.useValueIds=me,e.useValueIdsListener=(e,s,t,l)=>Ce(g,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(v,z(o),s,t,[e],l),e.useValues=e=>pe(y,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(y,z(l),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>Ce("WillFinish"+$,z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",C=p+"Count",b=p+i,w="Sorted"+p+i,R="Cell",k=R+i,v="Value",y=v+"s",g=v+i,h=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=e=>t(e)==r,S=e=>e.length,T=()=>{},V=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&V(e,((e,t)=>s[t]===e)),x=(e,s)=>e.map(s),O=Object,q=e=>O.getPrototypeOf(e),B=O.entries,H=e=>!h(e)&&m(q(e),(e=>e==O.prototype||h(q(e))),(()=>!0)),M=O.keys,D=(e,s)=>m(e,(e=>e[s])),j=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&j(s[e],t):s[e]===t))},{createContext:F,useContext:E,useEffect:Q}=s,A=F([]),G=(e,s)=>{var t;const l=E(A);return h(e)?l[s]:L(e)?D(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||L(e)?t:e},W=e=>{var s;return M(null!=(s=E(A)[e])?s:{})},z=e=>U(e,0),J=e=>U(e,2),K=e=>U(e,4),N=e=>U(e,6),X=e=>U(e,8),Y=e=>U(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);var _=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:le,useRef:oe,useState:re,useSyncExternalStore:ue}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ie=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ae=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},Ie=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},pe=(e,s,t,o=ne)=>{const r=oe(de[t]),u=ee((()=>{var l,u,n;const d=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:de[t];return(null!=(n=ie[t])?n:ae)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=ee((r=>Ie(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ue(n,u)},Ce=(e,s,t,l=ne,o=ne,...r)=>le((()=>Ie(s,e,...o,t,...r)),[s,e,...o,...l,...r]),be=(e,s,t,l=ne,o=T,r=ne,...u)=>{const n=z(e);return ee((e=>m(n,(l=>m(t(e,l),(t=>o(l["set"+s](...we(u,l,e),t),t)))))),[n,s,...l,...r,...Re(u)])},we=(e,s,t)=>x(e,(e=>f(e)?e(t,s):e)),Re=e=>{return s=e=>!f(e),e.filter(s);var s},ke=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((e=>t(null==r?void 0:r["del"+s](...we(o,r,e)))),[r,s,...l,...Re(o)])},ve=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ye=e=>pe(I,z(e),1),ge=(e,s)=>pe(b,z(s),1,[e]),he=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),me=(e,s,t)=>pe(k,z(t),1,[e,s]),Le=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),fe=e=>pe(g,z(e),1),Se=(e,s)=>pe(v,z(s),3,[e]),Te=(e,s)=>pe("Metric",J(s),3,[e]),Ve=(e,s)=>pe("SliceIds",K(s),1,[e]),Pe=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),xe=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Oe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),qe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Be=(e,s)=>pe(n+b,X(s),1,[e]),He=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Me=(e,s,t)=>pe(n+k,X(t),1,[e,s]),De=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),je=e=>pe("CheckpointIds",Y(e),2),Fe=(e,s)=>pe("Checkpoint",Y(s),3,[e]),Ee=e=>ve(e,"goBackward"),Qe=e=>ve(e,"goForward"),{PureComponent:Ae,Fragment:Ge,createElement:Ue,useCallback:We,useLayoutEffect:ze,useRef:Je,useState:Ke}=s,Ne=(e,...s)=>h(e)?{}:e(...s),Xe=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ye=Object.defineProperty,Ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,es=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable,ts=(e,s,t)=>s in e?Ye(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ls=(e,s)=>{for(var t in s||(s={}))es.call(s,t)&&ts(e,t,s[t]);if(_e)for(var t of _e(s))ss.call(s,t)&&ts(e,t,s[t]);return e},os=(e,s)=>Ze(e,$e(s)),rs=(e,s)=>{var t={};for(var l in e)es.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&_e)for(var l of _e(e))s.indexOf(l)<0&&ss.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:us,useContext:ns,useMemo:ds,useState:is}=s,as=({tableId:e,store:s,rowComponent:t=ws,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Cs(x(n,(r=>Ue(t,os(ls({},Ne(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),cs=({queryId:e,queries:s,resultRowComponent:t=gs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Cs(x(u,(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Is=({relationshipId:e,relationships:s,rowComponent:t=ws,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Xe(N(s),e),c=u(e,n,d);return Cs(x(c,(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},ps=e=>({checkpoints:s,checkpointComponent:t=hs,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Cs(x(e(je(u)),(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Cs=(e,s,t,l)=>{const o=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},bs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=Le(e,s,t,o))?u:l),void 0,r,t)},ws=({tableId:e,rowId:s,store:t,cellComponent:l=bs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Cs(x(((e,s,t,l)=>{const o=me(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Rs=e=>as(e,ge(e.tableId,e.store)),ks=({valueId:e,store:s,debugIds:t})=>{var o;return Cs(l+(null!=(o=Se(e,s))?o:l),void 0,t,e)},vs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ws,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(K(t),e),a=Pe(e,s,n);return Cs(x(a,(e=>Ue(l,os(ls({},Ne(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ys=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=De(e,s,t,o))?u:l),void 0,r,t)},gs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ys,getResultCellComponentProps:o,separator:r,debugIds:u})=>Cs(x(Me(e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),hs=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Cs(null!=(o=Fe(s,e))?o:l,void 0,t,s)},ms=ps((e=>e[0])),Ls=ps((e=>h(e[1])?[]:[e[1]])),fs=ps((e=>e[2]));e.BackwardCheckpointsView=ms,e.CellView=bs,e.CheckpointView=hs,e.CurrentCheckpointView=Ls,e.ForwardCheckpointsView=fs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=vs,getSliceComponentProps:l,separator:o,debugIds:r})=>Cs(x(Ve(e,s),(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Is(e,qe,e.firstRowId),e.LocalRowsView=e=>Is(e,Oe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Cs(null!=(o=Te(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=ns(A),[C,b]=is({}),w=us(((e,s)=>b((t=>D(t,e)==s?t:os(ls({},t),{[e]:s})))),[]),R=us((e=>b((s=>ls({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ue(A.Provider,{value:ds((()=>[null!=e?e:p[0],ls(ls(ls({},p[1]),s),C),null!=t?t:p[2],ls(ls({},p[3]),l),null!=o?o:p[4],ls(ls({},p[5]),r),null!=u?u:p[6],ls(ls({},p[7]),n),null!=d?d:p[8],ls(ls({},p[9]),i),null!=a?a:p[10],ls(ls({},p[11]),c),w,R]),[e,s,C,t,l,o,r,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ws,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Xe(N(t),e),i=xe(e,s,u);return Cs(h(d)||h(i)?null:Ue(l,os(ls({},Ne(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ys,e.ResultRowView=gs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return cs(u,He(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>cs(e,Be(e.queryId,e.queries)),e.RowView=ws,e.SliceView=vs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return as(u,he(u.tableId,t,l,o,r,u.store))},e.TableView=Rs,e.TablesView=({store:e,tableComponent:s=Rs,getTableComponentProps:t,separator:l,debugIds:o})=>Cs(x(ye(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ks,e.ValuesView=({store:e,valueComponent:s=ks,getValueComponentProps:t,separator:l,debugIds:o})=>Cs(x(fe(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ne,l,o=T,r=ne,u=!0)=>{const n=z(l);return ee((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(f(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Le,e.useCellIds=me,e.useCellIdsListener=(e,s,t,l,o,r)=>Ce(k,z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Ce(R,z(u),l,o,[e,s,t],r),e.useCheckpoint=Fe,e.useCheckpointIds=je,e.useCheckpointIdsListener=(e,s,t)=>Ce("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Ce("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,l,o=ne,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{const t=e?s(e):void 0;i(t),t&&l&&_(void 0,null,(function*(){yield l(t),n([])}))}),[e,...t,...o]),se((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,l,o=ne)=>{const[r,u]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>ke(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>ke(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>ke(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>ke(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>ke(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>ke(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=Ee,e.useGoForwardCallback=Qe,e.useGoToCallback=(e,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>pe(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>Ce(d+R,z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>pe(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>Ce(d+p,z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>pe(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>pe(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>Ce(d+a+R,z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>Ce(d+a,z(o),s,t,[e],l),e.useHasTables=e=>pe(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>Ce(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>pe(v,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+v,z(o),s,t,[e],l),e.useHasValues=e=>pe(y,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+y,z(l),e,s,[],t),e.useIndexIds=e=>pe("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=qe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Oe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=Te,e.useMetricIds=e=>pe("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>Ce("Metric",J(l),s,t,[e]),e.useMetrics=e=>G(e,2),e.useMetricsIds=()=>W(3),e.useMetricsOrMetricsById=J,e.useProvideStore=(e,s)=>{const{12:t,13:l}=E(A);Q((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>G(e,8),e.useQueriesIds=()=>W(9),e.useQueriesOrQueriesById=X,e.useQueryIds=e=>pe("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[o]]=je(t);return[!h(o),Qe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>pe("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=xe,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=De,e.useResultCellIds=Me,e.useResultCellIdsListener=(e,s,t,l,o)=>Ce(n+k,X(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Ce(n+R,X(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>pe(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>pe(n+C,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>Ce(n+C,X(l),s,t,[e]),e.useResultRowIds=Be,e.useResultRowIdsListener=(e,s,t,l)=>Ce(n+b,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Ce(n+p,X(o),t,l,[e,s]),e.useResultSortedRowIds=He,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Ce(n+w,X(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>pe(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>pe(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Ce(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Ce(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>pe(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>pe(C,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>Ce(C,z(o),s,t,[e],l),e.useRowIds=ge,e.useRowIdsListener=(e,s,t,l,o)=>Ce(b,z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Ce(p,z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>be(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>be(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>be(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>be(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>be(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>be(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>be(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,y,e,s,l,o),e.useSliceIds=Ve,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Pe,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=he,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Ce(w,z(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>Ce("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>pe(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>pe(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Ce(a+k,z(o),s,t,[e],l),e.useTableIds=ye,e.useTableIdsListener=(e,s,t,l)=>Ce(I,z(l),e,s,ne,t),e.useTableListener=(e,s,t,l,o)=>Ce(a,z(o),s,t,[e],l),e.useTables=e=>pe(c,z(e),0),e.useTablesListener=(e,s,t,l)=>Ce(c,z(l),e,s,ne,t),e.useUndoInformation=e=>{var s;const t=Y(e),[o,r]=je(t);return[(u=o,!(0==S(u))),Ee(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Se,e.useValueIds=fe,e.useValueIdsListener=(e,s,t,l)=>Ce(g,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(v,z(o),s,t,[e],l),e.useValues=e=>pe(y,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(y,z(l),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>Ce("WillFinish"+$,z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",C=p+"Count",b=p+i,w="Sorted"+p+i,R="Cell",k=R+i,v="Value",y=v+"s",g=v+i,h=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=e=>t(e)==r,S=e=>e.length,T=()=>{},V=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&V(e,((e,t)=>s[t]===e)),x=(e,s)=>e.map(s),O=Object,q=e=>O.getPrototypeOf(e),B=O.entries,H=e=>!h(e)&&m(q(e),(e=>e==O.prototype||h(q(e))),(()=>!0)),M=O.keys,D=(e,s)=>m(e,(e=>e[s])),j=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&j(s[e],t):s[e]===t))},{createContext:F,useContext:E,useEffect:Q}=s,A=F([]),G=(e,s)=>{var t;const l=E(A);return h(e)?l[s]:L(e)?D(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||L(e)?t:e},W=e=>{var s;return M(null!=(s=E(A)[e])?s:{})},z=e=>U(e,0),J=e=>U(e,2),K=e=>U(e,4),N=e=>U(e,6),X=e=>U(e,8),Y=e=>U(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);var _=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:le,useRef:oe,useState:re,useSyncExternalStore:ue}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ie=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ae=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},Ie=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},pe=(e,s,t,o=ne)=>{const r=oe(de[t]),u=ee((()=>{var l,u,n;const d=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:de[t];return(null!=(n=ie[t])?n:ae)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=ee((r=>Ie(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ue(n,u)},Ce=(e,s,t,l=ne,o=ne,...r)=>le((()=>Ie(s,e,...o,t,...r)),[s,e,...o,...l,...r]),be=(e,s,t,l=ne,o=T,r=ne,...u)=>{const n=z(e);return ee((e=>m(n,(l=>m(t(e,l),(t=>o(l["set"+s](...x(u,(s=>f(s)?s(e,l):s)),t),t)))))),[n,s,...l,...r,...u])},we=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((()=>t(null==r?void 0:r["del"+s](...o))),[r,s,...l,...o])},Re=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ke=e=>pe(I,z(e),1),ve=(e,s)=>pe(b,z(s),1,[e]),ye=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),ge=(e,s,t)=>pe(k,z(t),1,[e,s]),he=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),me=e=>pe(g,z(e),1),Le=(e,s)=>pe(v,z(s),3,[e]),fe=(e,s)=>pe("Metric",J(s),3,[e]),Se=(e,s)=>pe("SliceIds",K(s),1,[e]),Te=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),Ve=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Pe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),xe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Oe=(e,s)=>pe(n+b,X(s),1,[e]),qe=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Be=(e,s,t)=>pe(n+k,X(t),1,[e,s]),He=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),Me=e=>pe("CheckpointIds",Y(e),2),De=(e,s)=>pe("Checkpoint",Y(s),3,[e]),je=e=>Re(e,"goBackward"),Fe=e=>Re(e,"goForward"),{PureComponent:Ee,Fragment:Qe,createElement:Ae,useCallback:Ge,useLayoutEffect:Ue,useRef:We,useState:ze}=s,Je=(e,...s)=>h(e)?{}:e(...s),Ke=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ne=Object.defineProperty,Xe=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,Ze=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,es=(e,s,t)=>s in e?Ne(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ss=(e,s)=>{for(var t in s||(s={}))$e.call(s,t)&&es(e,t,s[t]);if(Ze)for(var t of Ze(s))_e.call(s,t)&&es(e,t,s[t]);return e},ts=(e,s)=>Xe(e,Ye(s)),ls=(e,s)=>{var t={};for(var l in e)$e.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&Ze)for(var l of Ze(e))s.indexOf(l)<0&&_e.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:os,useContext:rs,useMemo:us,useState:ns}=s,ds=({tableId:e,store:s,rowComponent:t=Cs,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Is(x(n,(r=>Ae(t,ts(ss({},Je(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),is=({queryId:e,queries:s,resultRowComponent:t=vs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Is(x(u,(o=>Ae(t,ts(ss({},Je(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),as=({relationshipId:e,relationships:s,rowComponent:t=Cs,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Ke(N(s),e),c=u(e,n,d);return Is(x(c,(e=>Ae(t,ts(ss({},Je(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},cs=e=>({checkpoints:s,checkpointComponent:t=ys,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Is(x(e(Me(u)),(e=>Ae(t,ts(ss({},Je(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Is=(e,s,t,l)=>{const o=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},ps=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Is(l+(null!=(u=he(e,s,t,o))?u:l),void 0,r,t)},Cs=({tableId:e,rowId:s,store:t,cellComponent:l=ps,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Is(x(((e,s,t,l)=>{const o=ge(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ae(l,ts(ss({},Je(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),bs=e=>ds(e,ve(e.tableId,e.store)),ws=({valueId:e,store:s,debugIds:t})=>{var o;return Is(l+(null!=(o=Le(e,s))?o:l),void 0,t,e)},Rs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=Cs,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(K(t),e),a=Te(e,s,n);return Is(x(a,(e=>Ae(l,ts(ss({},Je(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ks=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Is(l+(null!=(u=He(e,s,t,o))?u:l),void 0,r,t)},vs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ks,getResultCellComponentProps:o,separator:r,debugIds:u})=>Is(x(Be(e,s,t),(r=>Ae(l,ts(ss({},Je(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),ys=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Is(null!=(o=De(s,e))?o:l,void 0,t,s)},gs=cs((e=>e[0])),hs=cs((e=>h(e[1])?[]:[e[1]])),ms=cs((e=>e[2]));e.BackwardCheckpointsView=gs,e.CellView=ps,e.CheckpointView=ys,e.CurrentCheckpointView=hs,e.ForwardCheckpointsView=ms,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Rs,getSliceComponentProps:l,separator:o,debugIds:r})=>Is(x(Se(e,s),(o=>Ae(t,ts(ss({},Je(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>as(e,xe,e.firstRowId),e.LocalRowsView=e=>as(e,Pe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Is(null!=(o=fe(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=rs(A),[C,b]=ns({}),w=os(((e,s)=>b((t=>D(t,e)==s?t:ts(ss({},t),{[e]:s})))),[]),R=os((e=>b((s=>ss({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ae(A.Provider,{value:us((()=>[null!=e?e:p[0],ss(ss(ss({},p[1]),s),C),null!=t?t:p[2],ss(ss({},p[3]),l),null!=o?o:p[4],ss(ss({},p[5]),r),null!=u?u:p[6],ss(ss({},p[7]),n),null!=d?d:p[8],ss(ss({},p[9]),i),null!=a?a:p[10],ss(ss({},p[11]),c),w,R]),[e,s,C,t,l,o,r,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=Cs,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Ke(N(t),e),i=Ve(e,s,u);return Is(h(d)||h(i)?null:Ae(l,ts(ss({},Je(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ks,e.ResultRowView=vs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ls(s,["cellId","descending","offset","limit"]);return is(u,qe(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>is(e,Oe(e.queryId,e.queries)),e.RowView=Cs,e.SliceView=Rs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=ls(s,["cellId","descending","offset","limit"]);return ds(u,ye(u.tableId,t,l,o,r,u.store))},e.TableView=bs,e.TablesView=({store:e,tableComponent:s=bs,getTableComponentProps:t,separator:l,debugIds:o})=>Is(x(ke(e),(l=>Ae(s,ts(ss({},Je(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ws,e.ValuesView=({store:e,valueComponent:s=ws,getValueComponentProps:t,separator:l,debugIds:o})=>Is(x(me(e),(l=>Ae(s,ts(ss({},Je(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ne,l,o=T,r=ne,u=!0)=>{const n=z(l);return ee((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(f(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=he,e.useCellIds=ge,e.useCellIdsListener=(e,s,t,l,o,r)=>Ce(k,z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Ce(R,z(u),l,o,[e,s,t],r),e.useCheckpoint=De,e.useCheckpointIds=Me,e.useCheckpointIdsListener=(e,s,t)=>Ce("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Ce("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,l,o=ne,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{const t=e?s(e):void 0;i(t),t&&l&&_(void 0,null,(function*(){yield l(t),n([])}))}),[e,...t,...o]),se((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,l,o=ne)=>{const[r,u]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>we(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>we(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>we(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>we(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>we(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>we(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=je,e.useGoForwardCallback=Fe,e.useGoToCallback=(e,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>pe(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>Ce(d+R,z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>pe(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>Ce(d+p,z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>pe(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>pe(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>Ce(d+a+R,z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>Ce(d+a,z(o),s,t,[e],l),e.useHasTables=e=>pe(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>Ce(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>pe(v,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+v,z(o),s,t,[e],l),e.useHasValues=e=>pe(y,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+y,z(l),e,s,[],t),e.useIndexIds=e=>pe("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=xe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Pe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=fe,e.useMetricIds=e=>pe("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>Ce("Metric",J(l),s,t,[e]),e.useMetrics=e=>G(e,2),e.useMetricsIds=()=>W(3),e.useMetricsOrMetricsById=J,e.useProvideStore=(e,s)=>{const{12:t,13:l}=E(A);Q((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>G(e,8),e.useQueriesIds=()=>W(9),e.useQueriesOrQueriesById=X,e.useQueryIds=e=>pe("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[o]]=Me(t);return[!h(o),Fe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>pe("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=Ve,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=He,e.useResultCellIds=Be,e.useResultCellIdsListener=(e,s,t,l,o)=>Ce(n+k,X(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Ce(n+R,X(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>pe(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>pe(n+C,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>Ce(n+C,X(l),s,t,[e]),e.useResultRowIds=Oe,e.useResultRowIdsListener=(e,s,t,l)=>Ce(n+b,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Ce(n+p,X(o),t,l,[e,s]),e.useResultSortedRowIds=qe,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Ce(n+w,X(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>pe(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>pe(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Ce(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Ce(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>pe(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>pe(C,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>Ce(C,z(o),s,t,[e],l),e.useRowIds=ve,e.useRowIdsListener=(e,s,t,l,o)=>Ce(b,z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Ce(p,z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>be(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>be(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>be(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>be(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>be(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>be(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>be(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,y,e,s,l,o),e.useSliceIds=Se,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Te,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=ye,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Ce(w,z(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>Ce("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>pe(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>pe(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Ce(a+k,z(o),s,t,[e],l),e.useTableIds=ke,e.useTableIdsListener=(e,s,t,l)=>Ce(I,z(l),e,s,ne,t),e.useTableListener=(e,s,t,l,o)=>Ce(a,z(o),s,t,[e],l),e.useTables=e=>pe(c,z(e),0),e.useTablesListener=(e,s,t,l)=>Ce(c,z(l),e,s,ne,t),e.useUndoInformation=e=>{var s;const t=Y(e),[o,r]=Me(t);return[(u=o,!(0==S(u))),je(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Le,e.useValueIds=me,e.useValueIdsListener=(e,s,t,l)=>Ce(g,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(v,z(o),s,t,[e],l),e.useValues=e=>pe(y,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(y,z(l),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>Ce("WillFinish"+$,z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,l="",o=t(l),r=t(t),u="Listener",n="Result",d="Has",i="Ids",a="Table",c=a+"s",I=a+i,p="Row",C=p+"Count",b=p+i,w="Sorted"+p+i,R="Cell",k=R+i,v="Value",y=v+"s",g=v+i,h=e=>null==e,m=(e,s,t)=>h(e)?null==t?void 0:t():s(e),L=e=>t(e)==o,f=e=>t(e)==r,S=e=>e.length,T=()=>{},V=(e,s)=>e.every(s),P=(e,s)=>S(e)===S(s)&&V(e,((e,t)=>s[t]===e)),x=(e,s)=>e.map(s),O=Object,q=e=>O.getPrototypeOf(e),B=O.entries,H=e=>!h(e)&&m(q(e),(e=>e==O.prototype||h(q(e))),(()=>!0)),M=O.keys,D=(e,s)=>m(e,(e=>e[s])),j=(e,s)=>{const t=B(e);return S(t)===S(M(s))&&V(t,(([e,t])=>H(t)?!!H(s[e])&&j(s[e],t):s[e]===t))},{createContext:F,useContext:E,useEffect:Q}=s,A=F([]),G=(e,s)=>{var t;const l=E(A);return h(e)?l[s]:L(e)?D(null!=(t=l[s+1])?t:{},e):e},U=(e,s)=>{const t=G(e,s);return h(e)||L(e)?t:e},W=e=>{var s;return M(null!=(s=E(A)[e])?s:{})},z=e=>U(e,0),J=e=>U(e,2),K=e=>U(e,4),N=e=>U(e,6),X=e=>U(e,8),Y=e=>U(e,10),Z=e=>e.toLowerCase();Z(u);const $="Transaction";Z($);var _=(e,s,t)=>new Promise(((l,o)=>{var r=e=>{try{n(t.next(e))}catch(e){o(e)}},u=e=>{try{n(t.throw(e))}catch(e){o(e)}},n=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,u);n((t=t.apply(e,s)).next())}));const{useCallback:ee,useEffect:se,useMemo:te,useLayoutEffect:le,useRef:oe,useState:re,useSyncExternalStore:ue}=s,ne=[],de=[{},[],[ne,void 0,ne],void 0,!1,0],ie=[j,P,([e,s,t],[l,o,r])=>s===o&&P(e,l)&&P(t,r)],ae=(e,s)=>e===s,ce=(e,s,t=ne)=>{const[,l]=re(),[o,r]=re();return se((()=>{const t=e?s(e):void 0;return r(t),l([]),null==t?void 0:t.destroy}),[e,...t]),o},Ie=(e,s,...t)=>{var l;const o=null==(l=null==e?void 0:e["add"+s+u])?void 0:l.call(e,...t);return()=>null==e?void 0:e.delListener(o)},pe=(e,s,t,o=ne)=>{const r=oe(de[t]),u=ee((()=>{var l,u,n;const d=null!=(u=null==(l=null==s?void 0:s[(4==t?"has":"get")+e])?void 0:l.call(s,...o))?u:de[t];return(null!=(n=ie[t])?n:ae)(d,r.current)?r.current:r.current=d}),[s,t,e,...o]),n=ee((r=>Ie(s,(4==t?d:l)+e,...o,r)),[s,t,e,...o]);return ue(n,u)},Ce=(e,s,t,l=ne,o=ne,...r)=>le((()=>Ie(s,e,...o,t,...r)),[s,e,...o,...l,...r]),be=(e,s,t,l=ne,o=T,r=ne,...u)=>{const n=z(e);return ee((e=>m(n,(l=>m(t(e,l),(t=>o(l["set"+s](...we(u,l,e),t),t)))))),[n,s,...l,...r,...Re(u)])},we=(e,s,t)=>x(e,(e=>f(e)?e(t,s):e)),Re=e=>{return s=e=>!f(e),e.filter(s);var s},ke=(e,s,t=T,l=ne,...o)=>{const r=z(e);return ee((e=>t(null==r?void 0:r["del"+s](...we(o,r,e)))),[r,s,...l,...Re(o)])},ve=(e,s,t)=>{const l=Y(e);return ee((()=>null==l?void 0:l[s](t)),[l,s,t])},ye=e=>pe(I,z(e),1),ge=(e,s)=>pe(b,z(s),1,[e]),he=(e,s,t,l=0,o,r)=>pe(w,z(r),1,[e,s,t,l,o]),me=(e,s,t)=>pe(k,z(t),1,[e,s]),Le=(e,s,t,l)=>pe(R,z(l),3,[e,s,t]),fe=e=>pe(g,z(e),1),Se=(e,s)=>pe(v,z(s),3,[e]),Te=(e,s)=>pe("Metric",J(s),3,[e]),Ve=(e,s)=>pe("SliceIds",K(s),1,[e]),Pe=(e,s,t)=>pe("Slice"+b,K(t),1,[e,s]),xe=(e,s,t)=>pe("RemoteRowId",N(t),3,[e,s]),Oe=(e,s,t)=>pe("Local"+b,N(t),1,[e,s]),qe=(e,s,t)=>pe("Linked"+b,N(t),1,[e,s]),Be=(e,s)=>pe(n+b,X(s),1,[e]),He=(e,s,t,l=0,o,r)=>pe(n+w,X(r),1,[e,s,t,l,o]),Me=(e,s,t)=>pe(n+k,X(t),1,[e,s]),De=(e,s,t,l)=>pe(n+R,X(l),3,[e,s,t]),je=e=>pe("CheckpointIds",Y(e),2),Fe=(e,s)=>pe("Checkpoint",Y(s),3,[e]),Ee=e=>ve(e,"goBackward"),Qe=e=>ve(e,"goForward"),{PureComponent:Ae,Fragment:Ge,createElement:Ue,useCallback:We,useLayoutEffect:ze,useRef:Je,useState:Ke}=s,Ne=(e,...s)=>h(e)?{}:e(...s),Xe=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ye=Object.defineProperty,Ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,es=Object.prototype.hasOwnProperty,ss=Object.prototype.propertyIsEnumerable,ts=(e,s,t)=>s in e?Ye(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,ls=(e,s)=>{for(var t in s||(s={}))es.call(s,t)&&ts(e,t,s[t]);if(_e)for(var t of _e(s))ss.call(s,t)&&ts(e,t,s[t]);return e},os=(e,s)=>Ze(e,$e(s)),rs=(e,s)=>{var t={};for(var l in e)es.call(e,l)&&s.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&_e)for(var l of _e(e))s.indexOf(l)<0&&ss.call(e,l)&&(t[l]=e[l]);return t};const{useCallback:us,useContext:ns,useMemo:ds,useState:is}=s,as=({tableId:e,store:s,rowComponent:t=ws,getRowComponentProps:l,customCellIds:o,separator:r,debugIds:u},n)=>Cs(x(n,(r=>Ue(t,os(ls({},Ne(l,r)),{key:r,tableId:e,rowId:r,customCellIds:o,store:s,debugIds:u})))),r,u,e),cs=({queryId:e,queries:s,resultRowComponent:t=gs,getResultRowComponentProps:l,separator:o,debugIds:r},u)=>Cs(x(u,(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,queryId:e,rowId:o,queries:s,debugIds:r})))),o,r,e),Is=({relationshipId:e,relationships:s,rowComponent:t=ws,getRowComponentProps:l,separator:o,debugIds:r},u,n)=>{const[d,i,a]=Xe(N(s),e),c=u(e,n,d);return Cs(x(c,(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),o,r,n)},ps=e=>({checkpoints:s,checkpointComponent:t=hs,getCheckpointComponentProps:l,separator:o,debugIds:r})=>{const u=Y(s);return Cs(x(e(je(u)),(e=>Ue(t,os(ls({},Ne(l,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),o)},Cs=(e,s,t,l)=>{const o=h(s)||!Array.isArray(e)?e:x(e,((e,t)=>t>0?[s,e]:e));return t?[l,":{",o,"}"]:o},bs=({tableId:e,rowId:s,cellId:t,store:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=Le(e,s,t,o))?u:l),void 0,r,t)},ws=({tableId:e,rowId:s,store:t,cellComponent:l=bs,getCellComponentProps:o,customCellIds:r,separator:u,debugIds:n})=>Cs(x(((e,s,t,l)=>{const o=me(s,t,l);return null!=e?e:o})(r,e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),Rs=e=>as(e,ge(e.tableId,e.store)),ks=({valueId:e,store:s,debugIds:t})=>{var o;return Cs(l+(null!=(o=Se(e,s))?o:l),void 0,t,e)},vs=({indexId:e,sliceId:s,indexes:t,rowComponent:l=ws,getRowComponentProps:o,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(K(t),e),a=Pe(e,s,n);return Cs(x(a,(e=>Ue(l,os(ls({},Ne(o,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},ys=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:r})=>{var u;return Cs(l+(null!=(u=De(e,s,t,o))?u:l),void 0,r,t)},gs=({queryId:e,rowId:s,queries:t,resultCellComponent:l=ys,getResultCellComponentProps:o,separator:r,debugIds:u})=>Cs(x(Me(e,s,t),(r=>Ue(l,os(ls({},Ne(o,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),hs=({checkpoints:e,checkpointId:s,debugIds:t})=>{var o;return Cs(null!=(o=Fe(s,e))?o:l,void 0,t,s)},ms=ps((e=>e[0])),Ls=ps((e=>h(e[1])?[]:[e[1]])),fs=ps((e=>e[2]));e.BackwardCheckpointsView=ms,e.CellView=bs,e.CheckpointView=hs,e.CurrentCheckpointView=Ls,e.ForwardCheckpointsView=fs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=vs,getSliceComponentProps:l,separator:o,debugIds:r})=>Cs(x(Ve(e,s),(o=>Ue(t,os(ls({},Ne(l,o)),{key:o,indexId:e,sliceId:o,indexes:s,debugIds:r})))),o,r,e),e.LinkedRowsView=e=>Is(e,qe,e.firstRowId),e.LocalRowsView=e=>Is(e,Oe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var o;return Cs(null!=(o=Te(e,s))?o:l,void 0,t,e)},e.Provider=({store:e,storesById:s,metrics:t,metricsById:l,indexes:o,indexesById:r,relationships:u,relationshipsById:n,queries:d,queriesById:i,checkpoints:a,checkpointsById:c,children:I})=>{const p=ns(A),[C,b]=is({}),w=us(((e,s)=>b((t=>D(t,e)==s?t:os(ls({},t),{[e]:s})))),[]),R=us((e=>b((s=>ls({},((e,s)=>(delete e[s],e))(s,e))))),[]);return Ue(A.Provider,{value:ds((()=>[null!=e?e:p[0],ls(ls(ls({},p[1]),s),C),null!=t?t:p[2],ls(ls({},p[3]),l),null!=o?o:p[4],ls(ls({},p[5]),r),null!=u?u:p[6],ls(ls({},p[7]),n),null!=d?d:p[8],ls(ls({},p[9]),i),null!=a?a:p[10],ls(ls({},p[11]),c),w,R]),[e,s,C,t,l,o,r,u,n,d,i,a,c,p,w,R])},I)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:l=ws,getRowComponentProps:o,debugIds:r})=>{const[u,n,,d]=Xe(N(t),e),i=xe(e,s,u);return Cs(h(d)||h(i)?null:Ue(l,os(ls({},Ne(o,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=ys,e.ResultRowView=gs,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return cs(u,He(u.queryId,t,l,o,r,u.queries))},e.ResultTableView=e=>cs(e,Be(e.queryId,e.queries)),e.RowView=ws,e.SliceView=vs,e.SortedTableView=e=>{var s=e,{cellId:t,descending:l,offset:o,limit:r}=s,u=rs(s,["cellId","descending","offset","limit"]);return as(u,he(u.tableId,t,l,o,r,u.store))},e.TableView=Rs,e.TablesView=({store:e,tableComponent:s=Rs,getTableComponentProps:t,separator:l,debugIds:o})=>Cs(x(ye(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,tableId:l,store:e,debugIds:o})))),l),e.ValueView=ks,e.ValuesView=({store:e,valueComponent:s=ks,getValueComponentProps:t,separator:l,debugIds:o})=>Cs(x(fe(e),(l=>Ue(s,os(ls({},Ne(t,l)),{key:l,valueId:l,store:e,debugIds:o})))),l),e.useAddRowCallback=(e,s,t=ne,l,o=T,r=ne,u=!0)=>{const n=z(l);return ee((t=>m(n,(l=>m(s(t,l),(s=>o(l.addRow(f(e)?e(t,l):e,s,u),l,s)))))),[n,e,...t,...r,u])},e.useCell=Le,e.useCellIds=me,e.useCellIdsListener=(e,s,t,l,o,r)=>Ce(k,z(r),t,l,[e,s],o),e.useCellListener=(e,s,t,l,o,r,u)=>Ce(R,z(u),l,o,[e,s,t],r),e.useCheckpoint=Fe,e.useCheckpointIds=je,e.useCheckpointIdsListener=(e,s,t)=>Ce("CheckpointIds",Y(t),e,s),e.useCheckpointListener=(e,s,t,l)=>Ce("Checkpoint",Y(l),s,t,[e]),e.useCheckpoints=e=>G(e,10),e.useCheckpointsIds=()=>W(11),e.useCheckpointsOrCheckpointsById=Y,e.useCreateCheckpoints=(e,s,t)=>ce(e,s,t),e.useCreateIndexes=(e,s,t)=>ce(e,s,t),e.useCreateMergeableStore=(e,s=ne)=>te(e,s),e.useCreateMetrics=(e,s,t)=>ce(e,s,t),e.useCreatePersister=(e,s,t=ne,l,o=ne,r,u=ne)=>{const[,n]=re(),[d,i]=re();return se((()=>{const t=e?s(e):void 0;i(t),t&&l&&_(void 0,null,(function*(){yield l(t),n([])}))}),[e,...t,...o]),se((()=>()=>{d&&(d.destroy(),null==r||r(d))}),[d,...u]),d},e.useCreateQueries=(e,s,t)=>ce(e,s,t),e.useCreateRelationships=(e,s,t)=>ce(e,s,t),e.useCreateStore=(e,s=ne)=>te(e,s),e.useCreateSynchronizer=(e,s,t=ne,l,o=ne)=>{const[r,u]=re();return se((()=>{_(void 0,null,(function*(){const t=e?yield s(e):void 0;u(t)}))}),[e,...t]),se((()=>()=>{r&&(r.destroy(),null==l||l(r))}),[r,...o]),r},e.useDelCellCallback=(e,s,t,l,o,r,u)=>ke(o,R,r,u,e,s,t,l),e.useDelRowCallback=(e,s,t,l,o)=>ke(t,p,l,o,e,s),e.useDelTableCallback=(e,s,t,l)=>ke(s,a,t,l,e),e.useDelTablesCallback=(e,s,t)=>ke(e,c,s,t),e.useDelValueCallback=(e,s,t,l)=>ke(s,v,t,l,e),e.useDelValuesCallback=(e,s,t)=>ke(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>Ce("DidFinish"+$,z(t),e,s),e.useGoBackwardCallback=Ee,e.useGoForwardCallback=Qe,e.useGoToCallback=(e,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>m(e(s),(e=>l(t.goTo(e),e)))))),[r,...s,...o])},e.useHasCell=(e,s,t,l)=>pe(R,z(l),4,[e,s,t]),e.useHasCellListener=(e,s,t,l,o,r,u)=>Ce(d+R,z(u),l,o,[e,s,t],r),e.useHasRow=(e,s,t)=>pe(p,z(t),4,[e,s]),e.useHasRowListener=(e,s,t,l,o,r)=>Ce(d+p,z(r),t,l,[e,s],o),e.useHasTable=(e,s)=>pe(a,z(s),4,[e]),e.useHasTableCell=(e,s,t)=>pe(a+R,z(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,l,o,r)=>Ce(d+a+R,z(r),t,l,[e,s],o),e.useHasTableListener=(e,s,t,l,o)=>Ce(d+a,z(o),s,t,[e],l),e.useHasTables=e=>pe(c,z(e),4,[]),e.useHasTablesListener=(e,s,t,l)=>Ce(d+c,z(l),e,s,[],t),e.useHasValue=(e,s)=>pe(v,z(s),4,[e]),e.useHasValueListener=(e,s,t,l,o)=>Ce(d+v,z(o),s,t,[e],l),e.useHasValues=e=>pe(y,z(e),4,[]),e.useHasValuesListener=(e,s,t,l)=>Ce(d+y,z(l),e,s,[],t),e.useIndexIds=e=>pe("IndexIds",K(e),1),e.useIndexes=e=>G(e,4),e.useIndexesIds=()=>W(5),e.useIndexesOrIndexesById=K,e.useLinkedRowIds=qe,e.useLinkedRowIdsListener=(e,s,t,l,o)=>Ce("Linked"+b,N(o),t,l,[e,s]),e.useLocalRowIds=Oe,e.useLocalRowIdsListener=(e,s,t,l,o)=>Ce("Local"+b,N(o),t,l,[e,s]),e.useMetric=Te,e.useMetricIds=e=>pe("MetricIds",J(e),1),e.useMetricListener=(e,s,t,l)=>Ce("Metric",J(l),s,t,[e]),e.useMetrics=e=>G(e,2),e.useMetricsIds=()=>W(3),e.useMetricsOrMetricsById=J,e.useProvideStore=(e,s)=>{const{12:t,13:l}=E(A);Q((()=>(null==t||t(e,s),()=>null==l?void 0:l(e))),[t,e,s,l])},e.useQueries=e=>G(e,8),e.useQueriesIds=()=>W(9),e.useQueriesOrQueriesById=X,e.useQueryIds=e=>pe("QueryIds",X(e),1),e.useRedoInformation=e=>{var s;const t=Y(e),[,,[o]]=je(t);return[!h(o),Qe(t),o,null!=(s=m(o,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l]},e.useRelationshipIds=e=>pe("RelationshipIds",N(e),1),e.useRelationships=e=>G(e,6),e.useRelationshipsIds=()=>W(7),e.useRelationshipsOrRelationshipsById=N,e.useRemoteRowId=xe,e.useRemoteRowIdListener=(e,s,t,l,o)=>Ce("RemoteRowId",N(o),t,l,[e,s]),e.useResultCell=De,e.useResultCellIds=Me,e.useResultCellIdsListener=(e,s,t,l,o)=>Ce(n+k,X(o),t,l,[e,s]),e.useResultCellListener=(e,s,t,l,o,r)=>Ce(n+R,X(r),l,o,[e,s,t]),e.useResultRow=(e,s,t)=>pe(n+p,X(t),0,[e,s]),e.useResultRowCount=(e,s)=>pe(n+C,X(s),5,[e]),e.useResultRowCountListener=(e,s,t,l)=>Ce(n+C,X(l),s,t,[e]),e.useResultRowIds=Be,e.useResultRowIdsListener=(e,s,t,l)=>Ce(n+b,X(l),s,t,[e]),e.useResultRowListener=(e,s,t,l,o)=>Ce(n+p,X(o),t,l,[e,s]),e.useResultSortedRowIds=He,e.useResultSortedRowIdsListener=(e,s,t,l,o,r,u,d)=>Ce(n+w,X(d),r,u,[e,s,t,l,o]),e.useResultTable=(e,s)=>pe(n+a,X(s),0,[e]),e.useResultTableCellIds=(e,s)=>pe(n+a+k,X(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,l)=>Ce(n+a+k,X(l),s,t,[e]),e.useResultTableListener=(e,s,t,l)=>Ce(n+a,X(l),s,t,[e]),e.useRow=(e,s,t)=>pe(p,z(t),0,[e,s]),e.useRowCount=(e,s)=>pe(C,z(s),5,[e]),e.useRowCountListener=(e,s,t,l,o)=>Ce(C,z(o),s,t,[e],l),e.useRowIds=ge,e.useRowIdsListener=(e,s,t,l,o)=>Ce(b,z(o),s,t,[e],l),e.useRowListener=(e,s,t,l,o,r)=>Ce(p,z(r),t,l,[e,s],o),e.useSetCellCallback=(e,s,t,l,o,r,u,n)=>be(r,R,l,o,u,n,e,s,t),e.useSetCheckpointCallback=(e=T,s=ne,t,l=T,o=ne)=>{const r=Y(t);return ee((s=>m(r,(t=>{const o=e(s);l(t.addCheckpoint(o),t,o)}))),[r,...s,...o])},e.useSetPartialRowCallback=(e,s,t,l,o,r,u)=>be(o,"PartialRow",t,l,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,l,o)=>be(t,"PartialValues",e,s,l,o),e.useSetRowCallback=(e,s,t,l,o,r,u)=>be(o,p,t,l,r,u,e,s),e.useSetTableCallback=(e,s,t,l,o,r)=>be(l,a,s,t,o,r,e),e.useSetTablesCallback=(e,s,t,l,o)=>be(t,c,e,s,l,o),e.useSetValueCallback=(e,s,t,l,o,r)=>be(l,v,s,t,o,r,e),e.useSetValuesCallback=(e,s,t,l,o)=>be(t,y,e,s,l,o),e.useSliceIds=Ve,e.useSliceIdsListener=(e,s,t,l)=>Ce("SliceIds",K(l),s,t,[e]),e.useSliceRowIds=Pe,e.useSliceRowIdsListener=(e,s,t,l,o)=>Ce("Slice"+b,K(o),t,l,[e,s]),e.useSortedRowIds=he,e.useSortedRowIdsListener=(e,s,t,l,o,r,u,n,d)=>Ce(w,z(d),r,u,[e,s,t,l,o],n),e.useStartTransactionListener=(e,s,t)=>Ce("Start"+$,z(t),e,s),e.useStore=e=>G(e,0),e.useStoreIds=()=>W(1),e.useStoreOrStoreById=z,e.useTable=(e,s)=>pe(a,z(s),0,[e]),e.useTableCellIds=(e,s)=>pe(a+k,z(s),1,[e]),e.useTableCellIdsListener=(e,s,t,l,o)=>Ce(a+k,z(o),s,t,[e],l),e.useTableIds=ye,e.useTableIdsListener=(e,s,t,l)=>Ce(I,z(l),e,s,ne,t),e.useTableListener=(e,s,t,l,o)=>Ce(a,z(o),s,t,[e],l),e.useTables=e=>pe(c,z(e),0),e.useTablesListener=(e,s,t,l)=>Ce(c,z(l),e,s,ne,t),e.useUndoInformation=e=>{var s;const t=Y(e),[o,r]=je(t);return[(u=o,!(0==S(u))),Ee(t),r,null!=(s=m(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:l];var u},e.useValue=Se,e.useValueIds=fe,e.useValueIdsListener=(e,s,t,l)=>Ce(g,z(l),e,s,ne,t),e.useValueListener=(e,s,t,l,o)=>Ce(v,z(o),s,t,[e],l),e.useValues=e=>pe(y,z(e),0),e.useValuesListener=(e,s,t,l)=>Ce(y,z(l),e,s,ne,t),e.useWillFinishTransactionListener=(e,s,t)=>Ce("WillFinish"+$,z(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|