tinybase 4.3.17 → 4.3.19
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/lib/cjs/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom.cjs +1 -1
- package/lib/cjs/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom.cjs +1 -1
- package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/ui-react-dom.js +80 -84
- package/lib/debug/ui-react.js +9 -5
- package/lib/es6/ui-react-dom-debug.js +1 -1
- package/lib/es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/es6/ui-react-dom.js +1 -1
- package/lib/es6/ui-react-dom.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/types/ui-react.d.ts +24 -2
- package/lib/types/with-schemas/ui-react.d.ts +26 -2
- package/lib/ui-react-dom.js +1 -1
- package/lib/ui-react-dom.js.gz +0 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/ui-react-dom-debug.js +1 -1
- package/lib/umd/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd/ui-react-dom.js +1 -1
- package/lib/umd/ui-react-dom.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom-debug.js +1 -1
- package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom.js +1 -1
- package/lib/umd-es6/ui-react-dom.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +4 -4
- package/readme.md +2 -2
package/lib/umd/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",r=t(o),u="Listener",d="Result",l="Ids",n="Table",i=n+"s",a=n+l,I="Row",c=I+"Count",C=I+l,p="Sorted"+I+l,w="Cell",b=w+l,R="Value",k=R+"s",g=R+l,h=e=>null==e,m=(e,s,t)=>h(e)?t?.():s(e),L=e=>t(e)==r,y=()=>{},S=(e,s)=>e.map(s),V=Object.keys,{createContext:T,useContext:f}=s,x=T([]),v=(e,s)=>{const t=f(x);return h(e)?t[s]:L(e)?((e,s)=>m(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return h(e)||L(e)?t:e},q=e=>V(f(x)[e]??{}),B=e=>P(e,0),M=e=>P(e,2),D=e=>P(e,4),F=e=>P(e,6),O=e=>P(e,8),Q=e=>P(e,10),A=e=>e.toLowerCase();A(u);const E="Transaction";A(E);const{useCallback:G,useEffect:j,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return j((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],r)=>{const[,u]=z(),d=G((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=z(d),n=W(l);return U((()=>n.current=d()),[d]),K(e,s,((...e)=>{n.current=h(r)?d():e[r],u([])}),[],o),n.current},K=(e,s,t,o=[],r=[],...d)=>j((()=>{const o=s?.["add"+e+u]?.(...r,t,...d);return()=>s?.delListener(o)}),[s,...r,...o,...d]),N=(e,s,t,o=[],r=y,u=[],...d)=>{const l=B(e);return G((e=>m(l,(o=>m(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},X=(e,s,t=y,o=[],...r)=>{const u=B(e);return G((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Y=(e,s,t)=>{const o=Q(e);return G((()=>o?.[s](t)),[o,s,t])},Z=e=>J(a,B(e),[],[]),$=(e,s)=>J(C,B(s),[],[e]),_=(e,s,t,o=0,r,u)=>J(p,B(u),[],[e,s,t,o,r],6),ee=(e,s,t)=>J(b,B(t),[],[e,s]),se=(e,s,t,o)=>J(w,B(o),void 0,[e,s,t],4),te=e=>J(g,B(e),[],[]),oe=(e,s)=>J(R,B(s),void 0,[e]),re=(e,s)=>J("Metric",M(s),void 0,[e]),ue=(e,s)=>J("SliceIds",D(s),[],[e]),de=(e,s,t)=>J("Slice"+C,D(t),[],[e,s]),le=(e,s,t)=>J("RemoteRowId",F(t),void 0,[e,s]),ne=(e,s,t)=>J("Local"+C,F(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+C,F(t),[],[e,s]),ae=(e,s)=>J(d+C,O(s),[],[e]),Ie=(e,s,t,o=0,r,u)=>J(d+p,O(u),[],[e,s,t,o,r],6),ce=(e,s,t)=>J(d+b,O(t),[],[e,s]),Ce=(e,s,t,o)=>J(d+w,O(o),void 0,[e,s,t]),pe=e=>J("CheckpointIds",Q(e),[[],void 0,[]]),we=(e,s)=>J("Checkpoint",Q(s),void 0,[e]),be=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ge,createElement:he,useCallback:me,useLayoutEffect:Le,useRef:ye,useState:Se}=s,Ve=(e,...s)=>h(e)?{}:e(...s),Te=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:fe}=s,xe=({tableId:e,store:s,rowComponent:t=De,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(S(l,(u=>he(t,{...Ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ee,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(S(d,(r=>he(t,{...Ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=De,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Te(F(s),e),I=d(e,l,n);return Be(S(I,(e=>he(t,{...Ve(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ge,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Be(S(e(pe(d)),(e=>he(t,{...Ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=h(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Me=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>Be(o+(se(e,s,t,r)??o),void 0,u,t),De=({tableId:e,rowId:s,store:t,cellComponent:o=Me,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(S(((e,s,t,o)=>{const r=ee(s,t,o);return e??r})(u,e,s,t),(u=>he(o,{...Ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Fe=e=>xe(e,$(e.tableId,e.store)),Oe=({valueId:e,store:s,debugIds:t})=>Be(o+(oe(e,s)??o),void 0,t,e),Qe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=De,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(D(t),e),a=de(e,s,l);return Be(S(a,(e=>he(o,{...Ve(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Ae=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>Be(o+(Ce(e,s,t,r)??o),void 0,u,t),Ee=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ae,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(S(ce(e,s,t),(u=>he(o,{...Ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ge=({checkpoints:e,checkpointId:s,debugIds:t})=>Be(we(s,e)??o,void 0,t,s),je=qe((e=>e[0])),Ue=qe((e=>h(e[1])?[]:[e[1]])),We=qe((e=>e[2]));e.BackwardCheckpointsView=je,e.CellView=Me,e.CheckpointView=Ge,e.CurrentCheckpointView=Ue,e.ForwardCheckpointsView=We,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Qe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(S(ue(e,s),(r=>he(t,{...Ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>Pe(e,ie,e.firstRowId),e.LocalRowsView=e=>Pe(e,ne,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Be(re(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:C})=>{const p=s.useContext(x);return he(x.Provider,{value:fe((()=>[e??p[0],{...p[1],...t},o??p[2],{...p[3],...r},u??p[4],{...p[5],...d},l??p[6],{...p[7],...n},i??p[8],{...p[9],...a},I??p[10],{...p[11],...c}]),[e,t,o,r,u,d,l,n,i,a,I,c,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=De,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Te(F(t),e),i=le(e,s,d);return Be(h(n)||h(i)?null:he(o,{...Ve(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Ae,e.ResultRowView=Ee,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,Ie(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ve(e,ae(e.queryId,e.queries)),e.RowView=De,e.SliceView=Qe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>xe(r,_(r.tableId,e,s,t,o,r.store)),e.TableView=Fe,e.TablesView=({store:e,tableComponent:s=Fe,getTableComponentProps:t,separator:o,debugIds:r})=>Be(S(Z(e),(o=>he(s,{...Ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Oe,e.ValuesView=({store:e,valueComponent:s=Oe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(S(te(e),(o=>he(s,{...Ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=[],o,r=y,u=[],d=!0)=>{const l=B(o);return G((t=>m(l,(o=>m(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,r,u)=>K(b,B(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>K(w,B(d),o,r,[e,s,t],u),e.useCheckpoint=we,e.useCheckpointIds=pe,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",Q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",Q(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCheckpointsIds=()=>q(11),e.useCheckpointsOrCheckpointsById=Q,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,r=[])=>{const[,u]=z(),d=U((()=>s(e)),[e,...t]);return j((()=>((async()=>{await(o?.(d)),u(1)})(),()=>{d?.destroy()})),[d,...r]),d},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>X(r,w,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>X(t,I,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,B(t),e,s),e.useGoBackwardCallback=be,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useIndexIds=e=>J("IndexIds",D(e),[]),e.useIndexes=e=>v(e,4),e.useIndexesIds=()=>q(5),e.useIndexesOrIndexesById=D,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,r)=>K("Linked"+C,F(r),t,o,[e,s]),e.useLocalRowIds=ne,e.useLocalRowIdsListener=(e,s,t,o,r)=>K("Local"+C,F(r),t,o,[e,s]),e.useMetric=re,e.useMetricIds=e=>J("MetricIds",M(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",M(o),s,t,[e]),e.useMetrics=e=>v(e,2),e.useMetricsIds=()=>q(3),e.useMetricsOrMetricsById=M,e.useQueries=e=>v(e,8),e.useQueriesIds=()=>q(9),e.useQueriesOrQueriesById=O,e.useQueryIds=e=>J("QueryIds",O(e),[]),e.useRedoInformation=e=>{const s=Q(e),[,,[t]]=pe(s);return[!h(t),Re(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>J("RelationshipIds",F(e),[]),e.useRelationships=e=>v(e,6),e.useRelationshipsIds=()=>q(7),e.useRelationshipsOrRelationshipsById=F,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,r)=>K("RemoteRowId",F(r),t,o,[e,s]),e.useResultCell=Ce,e.useResultCellIds=ce,e.useResultCellIdsListener=(e,s,t,o,r)=>K(d+b,O(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>K(d+w,O(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>J(d+I,O(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(d+c,O(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(d+c,O(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(d+C,O(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>K(d+I,O(r),t,o,[e,s]),e.useResultSortedRowIds=Ie,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,n)=>K(d+p,O(n),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>J(d+n,O(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(d+n+b,O(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(d+n+b,O(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(d+n,O(o),s,t,[e]),e.useRow=(e,s,t)=>J(I,B(t),{},[e,s]),e.useRowCount=(e,s)=>J(c,B(s),[],[e]),e.useRowCountListener=(e,s,t,o,r)=>K(c,B(r),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,r)=>K(C,B(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>K(I,B(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>N(u,w,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>N(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>N(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>N(r,I,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>N(o,n,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>N(t,i,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>N(o,R,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>N(t,k,e,s,o,r),e.useSliceIds=ue,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",D(o),s,t,[e]),e.useSliceRowIds=de,e.useSliceRowIdsListener=(e,s,t,o,r)=>K("Slice"+C,D(r),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>K(p,B(n),u,d,[e,s,t,o,r],l),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,B(t),e,s),e.useStore=e=>v(e,0),e.useStoreIds=()=>q(1),e.useStoreOrStoreById=B,e.useTable=(e,s)=>J(n,B(s),{},[e]),e.useTableCellIds=(e,s)=>J(n+b,B(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>K(n+b,B(r),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,B(o),e,s,[],t),e.useTableListener=(e,s,t,o,r)=>K(n,B(r),s,t,[e],o),e.useTables=e=>J(i,B(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,B(o),e,s,[],t),e.useUndoInformation=e=>{const s=Q(e),[t,r]=pe(s);return[(u=t,!(0==u.length)),be(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(g,B(o),e,s,[],t),e.useValueListener=(e,s,t,o,r)=>K(R,B(r),s,t,[e],o),e.useValues=e=>J(k,B(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,B(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,B(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,o="",r=t(o),u="Listener",d="Result",l="Ids",n="Table",i=n+"s",a=n+l,I="Row",c=I+"Count",C=I+l,p="Sorted"+I+l,w="Cell",b=w+l,R="Value",k=R+"s",g=R+l,h=e=>null==e,m=(e,s,t)=>h(e)?t?.():s(e),L=e=>t(e)==r,y=()=>{},S=(e,s)=>e.map(s),V=Object.keys,{createContext:T,useContext:f}=s,x=T([]),v=(e,s)=>{const t=f(x);return h(e)?t[s]:L(e)?((e,s)=>m(e,(e=>e[s])))(t[s+1]??{},e):e},P=(e,s)=>{const t=v(e,s);return h(e)||L(e)?t:e},q=e=>V(f(x)[e]??{}),B=e=>P(e,0),M=e=>P(e,2),D=e=>P(e,4),F=e=>P(e,6),O=e=>P(e,8),Q=e=>P(e,10),A=e=>e.toLowerCase();A(u);const E="Transaction";A(E);const{useCallback:G,useEffect:j,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return j((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],r)=>{const[,u]=z(),d=G((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[l]=z(d),n=W(l);return U((()=>n.current=d()),[d]),K(e,s,((...e)=>{n.current=h(r)?d():e[r],u([])}),[],o),n.current},K=(e,s,t,o=[],r=[],...d)=>j((()=>{const o=s?.["add"+e+u]?.(...r,t,...d);return()=>s?.delListener(o)}),[s,...r,...o,...d]),N=(e,s,t,o=[],r=y,u=[],...d)=>{const l=B(e);return G((e=>m(l,(o=>m(t(e,o),(e=>r(o["set"+s](...d,e),e)))))),[l,s,...o,...u,...d])},X=(e,s,t=y,o=[],...r)=>{const u=B(e);return G((()=>t(u?.["del"+s](...r))),[u,s,...o,...r])},Y=(e,s,t)=>{const o=Q(e);return G((()=>o?.[s](t)),[o,s,t])},Z=e=>J(a,B(e),[],[]),$=(e,s)=>J(C,B(s),[],[e]),_=(e,s,t,o=0,r,u)=>J(p,B(u),[],[e,s,t,o,r],6),ee=(e,s,t)=>J(b,B(t),[],[e,s]),se=(e,s,t,o)=>J(w,B(o),void 0,[e,s,t],4),te=e=>J(g,B(e),[],[]),oe=(e,s)=>J(R,B(s),void 0,[e]),re=(e,s)=>J("Metric",M(s),void 0,[e]),ue=(e,s)=>J("SliceIds",D(s),[],[e]),de=(e,s,t)=>J("Slice"+C,D(t),[],[e,s]),le=(e,s,t)=>J("RemoteRowId",F(t),void 0,[e,s]),ne=(e,s,t)=>J("Local"+C,F(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+C,F(t),[],[e,s]),ae=(e,s)=>J(d+C,O(s),[],[e]),Ie=(e,s,t,o=0,r,u)=>J(d+p,O(u),[],[e,s,t,o,r],6),ce=(e,s,t)=>J(d+b,O(t),[],[e,s]),Ce=(e,s,t,o)=>J(d+w,O(o),void 0,[e,s,t]),pe=e=>J("CheckpointIds",Q(e),[[],void 0,[]]),we=(e,s)=>J("Checkpoint",Q(s),void 0,[e]),be=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ge,createElement:he,useCallback:me,useLayoutEffect:Le,useRef:ye,useState:Se}=s,Ve=(e,...s)=>h(e)?{}:e(...s),Te=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useMemo:fe}=s,xe=({tableId:e,store:s,rowComponent:t=De,getRowComponentProps:o,customCellIds:r,separator:u,debugIds:d},l)=>Be(S(l,(u=>he(t,{...Ve(o,u),key:u,tableId:e,rowId:u,customCellIds:r,store:s,debugIds:d}))),u,d,e),ve=({queryId:e,queries:s,resultRowComponent:t=Ee,getResultRowComponentProps:o,separator:r,debugIds:u},d)=>Be(S(d,(r=>he(t,{...Ve(o,r),key:r,queryId:e,rowId:r,queries:s,debugIds:u}))),r,u,e),Pe=({relationshipId:e,relationships:s,rowComponent:t=De,getRowComponentProps:o,separator:r,debugIds:u},d,l)=>{const[n,i,a]=Te(F(s),e),I=d(e,l,n);return Be(S(I,(e=>he(t,{...Ve(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:u}))),r,u,l)},qe=e=>({checkpoints:s,checkpointComponent:t=Ge,getCheckpointComponentProps:o,separator:r,debugIds:u})=>{const d=Q(s);return Be(S(e(pe(d)),(e=>he(t,{...Ve(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:u}))),r)},Be=(e,s,t,o)=>{const r=h(s)||!Array.isArray(e)?e:S(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",r,"}"]:r},Me=({tableId:e,rowId:s,cellId:t,store:r,debugIds:u})=>Be(o+(se(e,s,t,r)??o),void 0,u,t),De=({tableId:e,rowId:s,store:t,cellComponent:o=Me,getCellComponentProps:r,customCellIds:u,separator:d,debugIds:l})=>Be(S(((e,s,t,o)=>{const r=ee(s,t,o);return e??r})(u,e,s,t),(u=>he(o,{...Ve(r,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),d,l,s),Fe=e=>xe(e,$(e.tableId,e.store)),Oe=({valueId:e,store:s,debugIds:t})=>Be(o+(oe(e,s)??o),void 0,t,e),Qe=({indexId:e,sliceId:s,indexes:t,rowComponent:o=De,getRowComponentProps:r,separator:u,debugIds:d})=>{const[l,n,i]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(D(t),e),a=de(e,s,l);return Be(S(a,(e=>he(o,{...Ve(r,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),u,d,s)},Ae=({queryId:e,rowId:s,cellId:t,queries:r,debugIds:u})=>Be(o+(Ce(e,s,t,r)??o),void 0,u,t),Ee=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ae,getResultCellComponentProps:r,separator:u,debugIds:d})=>Be(S(ce(e,s,t),(u=>he(o,{...Ve(r,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:d}))),u,d,s),Ge=({checkpoints:e,checkpointId:s,debugIds:t})=>Be(we(s,e)??o,void 0,t,s),je=qe((e=>e[0])),Ue=qe((e=>h(e[1])?[]:[e[1]])),We=qe((e=>e[2]));e.BackwardCheckpointsView=je,e.CellView=Me,e.CheckpointView=Ge,e.CurrentCheckpointView=Ue,e.ForwardCheckpointsView=We,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Qe,getSliceComponentProps:o,separator:r,debugIds:u})=>Be(S(ue(e,s),(r=>he(t,{...Ve(o,r),key:r,indexId:e,sliceId:r,indexes:s,debugIds:u}))),r,u,e),e.LinkedRowsView=e=>Pe(e,ie,e.firstRowId),e.LocalRowsView=e=>Pe(e,ne,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>Be(re(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:r,indexes:u,indexesById:d,relationships:l,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:C})=>{const p=s.useContext(x);return he(x.Provider,{value:fe((()=>[e??p[0],{...p[1],...t},o??p[2],{...p[3],...r},u??p[4],{...p[5],...d},l??p[6],{...p[7],...n},i??p[8],{...p[9],...a},I??p[10],{...p[11],...c}]),[e,t,o,r,u,d,l,n,i,a,I,c,p])},C)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=De,getRowComponentProps:r,debugIds:u})=>{const[d,l,,n]=Te(F(t),e),i=le(e,s,d);return Be(h(n)||h(i)?null:he(o,{...Ve(r,i),key:i,tableId:n,rowId:i,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Ae,e.ResultRowView=Ee,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>ve(r,Ie(r.queryId,e,s,t,o,r.queries)),e.ResultTableView=e=>ve(e,ae(e.queryId,e.queries)),e.RowView=De,e.SliceView=Qe,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...r})=>xe(r,_(r.tableId,e,s,t,o,r.store)),e.TableView=Fe,e.TablesView=({store:e,tableComponent:s=Fe,getTableComponentProps:t,separator:o,debugIds:r})=>Be(S(Z(e),(o=>he(s,{...Ve(t,o),key:o,tableId:o,store:e,debugIds:r}))),o),e.ValueView=Oe,e.ValuesView=({store:e,valueComponent:s=Oe,getValueComponentProps:t,separator:o,debugIds:r})=>Be(S(te(e),(o=>he(s,{...Ve(t,o),key:o,valueId:o,store:e,debugIds:r}))),o),e.useAddRowCallback=(e,s,t=[],o,r=y,u=[],d=!0)=>{const l=B(o);return G((t=>m(l,(o=>m(s(t,o),(s=>r(o.addRow(e,s,d),o,s)))))),[l,e,...t,...u,d])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,r,u)=>K(b,B(u),t,o,[e,s],r),e.useCellListener=(e,s,t,o,r,u,d)=>K(w,B(d),o,r,[e,s,t],u),e.useCheckpoint=we,e.useCheckpointIds=pe,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",Q(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",Q(o),s,t,[e]),e.useCheckpoints=e=>v(e,10),e.useCheckpointsIds=()=>q(11),e.useCheckpointsOrCheckpointsById=Q,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,r=[],u,d=[])=>{const[,l]=z(),n=U((()=>s(e)),[e,...t]);return j((()=>((async()=>{o&&(await o(n),l([]))})(),()=>{n?.destroy(),u?.(n)})),[n,...r,...d]),n},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,r,u,d)=>X(r,w,u,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,r)=>X(t,I,o,r,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,n,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,B(t),e,s),e.useGoBackwardCallback=be,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>m(e(s),(e=>o(t.goTo(e),e)))))),[u,...s,...r])},e.useIndexIds=e=>J("IndexIds",D(e),[]),e.useIndexes=e=>v(e,4),e.useIndexesIds=()=>q(5),e.useIndexesOrIndexesById=D,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,r)=>K("Linked"+C,F(r),t,o,[e,s]),e.useLocalRowIds=ne,e.useLocalRowIdsListener=(e,s,t,o,r)=>K("Local"+C,F(r),t,o,[e,s]),e.useMetric=re,e.useMetricIds=e=>J("MetricIds",M(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",M(o),s,t,[e]),e.useMetrics=e=>v(e,2),e.useMetricsIds=()=>q(3),e.useMetricsOrMetricsById=M,e.useQueries=e=>v(e,8),e.useQueriesIds=()=>q(9),e.useQueriesOrQueriesById=O,e.useQueryIds=e=>J("QueryIds",O(e),[]),e.useRedoInformation=e=>{const s=Q(e),[,,[t]]=pe(s);return[!h(t),Re(s),t,m(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationshipIds=e=>J("RelationshipIds",F(e),[]),e.useRelationships=e=>v(e,6),e.useRelationshipsIds=()=>q(7),e.useRelationshipsOrRelationshipsById=F,e.useRemoteRowId=le,e.useRemoteRowIdListener=(e,s,t,o,r)=>K("RemoteRowId",F(r),t,o,[e,s]),e.useResultCell=Ce,e.useResultCellIds=ce,e.useResultCellIdsListener=(e,s,t,o,r)=>K(d+b,O(r),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,r,u)=>K(d+w,O(u),o,r,[e,s,t]),e.useResultRow=(e,s,t)=>J(d+I,O(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(d+c,O(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(d+c,O(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(d+C,O(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,r)=>K(d+I,O(r),t,o,[e,s]),e.useResultSortedRowIds=Ie,e.useResultSortedRowIdsListener=(e,s,t,o,r,u,l,n)=>K(d+p,O(n),u,l,[e,s,t,o,r]),e.useResultTable=(e,s)=>J(d+n,O(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(d+n+b,O(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(d+n+b,O(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(d+n,O(o),s,t,[e]),e.useRow=(e,s,t)=>J(I,B(t),{},[e,s]),e.useRowCount=(e,s)=>J(c,B(s),[],[e]),e.useRowCountListener=(e,s,t,o,r)=>K(c,B(r),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,r)=>K(C,B(r),s,t,[e],o),e.useRowListener=(e,s,t,o,r,u)=>K(I,B(u),t,o,[e,s],r),e.useSetCellCallback=(e,s,t,o,r,u,d,l)=>N(u,w,o,r,d,l,e,s,t),e.useSetCheckpointCallback=(e=y,s=[],t,o=y,r=[])=>{const u=Q(t);return G((s=>m(u,(t=>{const r=e(s);o(t.addCheckpoint(r),t,r)}))),[u,...s,...r])},e.useSetPartialRowCallback=(e,s,t,o,r,u,d)=>N(r,"PartialRow",t,o,u,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,r)=>N(t,"PartialValues",e,s,o,r),e.useSetRowCallback=(e,s,t,o,r,u,d)=>N(r,I,t,o,u,d,e,s),e.useSetTableCallback=(e,s,t,o,r,u)=>N(o,n,s,t,r,u,e),e.useSetTablesCallback=(e,s,t,o,r)=>N(t,i,e,s,o,r),e.useSetValueCallback=(e,s,t,o,r,u)=>N(o,R,s,t,r,u,e),e.useSetValuesCallback=(e,s,t,o,r)=>N(t,k,e,s,o,r),e.useSliceIds=ue,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",D(o),s,t,[e]),e.useSliceRowIds=de,e.useSliceRowIdsListener=(e,s,t,o,r)=>K("Slice"+C,D(r),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,r,u,d,l,n)=>K(p,B(n),u,d,[e,s,t,o,r],l),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,B(t),e,s),e.useStore=e=>v(e,0),e.useStoreIds=()=>q(1),e.useStoreOrStoreById=B,e.useTable=(e,s)=>J(n,B(s),{},[e]),e.useTableCellIds=(e,s)=>J(n+b,B(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,r)=>K(n+b,B(r),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,B(o),e,s,[],t),e.useTableListener=(e,s,t,o,r)=>K(n,B(r),s,t,[e],o),e.useTables=e=>J(i,B(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,B(o),e,s,[],t),e.useUndoInformation=e=>{const s=Q(e),[t,r]=pe(s);return[(u=t,!(0==u.length)),be(s),r,m(r,(e=>s?.getCheckpoint(e)))??o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(g,B(o),e,s,[],t),e.useValueListener=(e,s,t,o,r)=>K(R,B(r),s,t,[e],o),e.useValues=e=>J(k,B(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,B(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,B(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);
|
package/lib/umd/ui-react.js.gz
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,l;e=this,l=function(e,l,t){"use strict";const n=e=>typeof e,s="",r=n(s),o=n(!0),a=n(0),i=n(n),u="type",d="default",c="Ids",h="Table",m=h+"s",b=h+c,p="Row",g=p+"Count",v=p+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",T="value",S=e=>s+e,x=Math.floor,V=isFinite,R=(e,l)=>e instanceof l,O=e=>null==e,q=(e,l,t)=>O(e)?null==t?void 0:t():l(e),N=e=>e==r||e==o,P=e=>n(e)==i,E=e=>Array.isArray(e),L=(e,l,t)=>e.slice(l,t),M=e=>e.length,{PureComponent:j,Fragment:z,createElement:$,useCallback:A,useLayoutEffect:F,useRef:J,useState:D}=l,B=(e,...l)=>O(e)?{}:e(...l),H=(e,l)=>e.forEach(l),Q=(e,l)=>e.map(l),W=e=>0==M(e),U=(e,...l)=>e.push(...l),G=e=>e.shift(),K=Object,X=K.keys,Y=K.isFrozen,Z=K.freeze,_=e=>R(e,K)&&e.constructor==K,ee=(e=[])=>K.fromEntries(e),le=(e,l)=>!O(((e,l)=>q(e,(e=>e[l])))(e,l)),te=(e,l)=>(delete e[l],e),ne=(e,l)=>Q(K.entries(e),(([e,t])=>l(t,e))),se=e=>_(e)&&0==(e=>M(X(e)))(e),re=e=>JSON.stringify(e,((e,l)=>R(l,Map)?K.fromEntries([...l]):l)),oe=JSON.parse,ae="tinybaseStoreInspector",ie="TinyBase Store Inspector",ue=["left","top","bottom","right","full"],de="state",ce="sort",he="open",me="position",be=he,pe="editable",ge=(...e)=>re(e),ve=(e,l)=>Q(e.sort(),l),fe=(e,l)=>[!!t.useCell(de,e,pe,l),A((t=>{l.setCell(de,e,pe,(e=>!e)),t.preventDefault()}),[l,e])],Ie="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ye='content:url("',we=ye+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ce='</svg>")',ke=ye+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Te=Q([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>we+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+Ce)),Se=we+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,xe=we+`<path d='${Ie}' />`+Ce,Ve=we+`<path d='${Ie}M20 20l60 60' />`+Ce;var Re=Object.defineProperty,Oe=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Ne=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Le=(e,l,t)=>l in e?Re(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Me=(e,l)=>{for(var t in l||(l={}))Pe.call(l,t)&&Le(e,t,l[t]);if(Ne)for(var t of Ne(l))Ee.call(l,t)&&Le(e,t,l[t]);return e},je=(e,l)=>Oe(e,qe(l));const ze="*::-webkit-scrollbar",$e=`#${ae}{\n all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999;\n ${((e,l="")=>e.join(l))(ne(je(Me(je(Me(je(Me({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ze]:"width:0.5rem;height:0.5rem;",[ze+"-track"]:"background:#111",[ze+"-thumb"]:"background:#999;border:1px solid #111",[ze+"-thumb:hover"]:"background:#fff",[ze+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+ke},ee(Q(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),ee(Q(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ke,"header>img:nth-of-type(6)":Se}),ee(Q(Te,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":xe,"details[open]>summary img.done":Ve,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,l)=>e?`& ${l}{${e}}`:"")))}`,Ae=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!0),[],e);return t.useValue(be,e)?null:$("img",{onClick:s,title:ie,"data-position":n})},Fe=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:o})=>{const a=!!t.useCell(de,e,he,o),i=t.useSetCellCallback(de,e,he,(e=>e[k].open),[],o);return $("details",{open:a,onToggle:i},$("summary",null,l,s?$("img",{onClick:s,className:n?"done":"edit"}):null),r)},Je=e=>{const l=n(e);return N(l)||l==a&&V(e)?l:void 0},De=(e,l,t,n,s)=>O(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Be=(e,l,t)=>O(t)?e.delValue(l):e.setValue(l,t),He=(e,l,t,n)=>e==r?l:e==a?t:n;var Qe=Object.defineProperty,We=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ye=(e,l,t)=>l in e?Qe(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ze=(e,l)=>{for(var t in l||(l={}))Ke.call(l,t)&&Ye(e,t,l[t]);if(Ge)for(var t of Ge(l))Xe.call(l,t)&&Ye(e,t,l[t]);return e},_e=(e,l)=>We(e,Ue(l)),el=(e,l)=>{var t={};for(var n in e)Ke.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Ge)for(var n of Ge(e))l.indexOf(n)<0&&Xe.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:ll,useMemo:tl,useState:nl}=l,sl="editable",rl=(e,l)=>Q(t.useTableCellIds(e,l),(l=>e+"."+l)),ol=(e,l,t)=>{const n=ll(e,l);return t?n:void 0},al=(...e)=>tl((()=>e),e),il=(e,l)=>tl((()=>({store:e,tableId:l})),[e,l]),ul=(e,l)=>tl((()=>({queries:e,queryId:l})),[e,l]),dl=(e,l=!1,t,n=0,s,r,o,a)=>{const[[i,u,d],c]=nl([e,l,n]),h=ll((e=>{c(e),null==a||a(e)}),[a]),m=ol((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=ll((e=>h([i,u,e])),[h,i,u]),p=!0===o?kl:o;return[[i,u,d],m,tl((()=>!1===o?null:$(p,{offset:d,limit:s,total:r,onChange:b})),[o,p,d,s,r,b])]},cl=(e,l,t)=>tl((()=>{const s=null!=l?l:e;return ee(ne(E(s)?ee(Q(s,(e=>[e,e]))):s,((e,l)=>{return[l,Ze(Ze({},{label:l,component:t}),(s=e,n(s)==r?{label:e}:e))];var s})))}),[l,t,e]),hl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,o,a,i]})=>$("table",{className:e},i?$("caption",null,i):null,!1===l?null:$("thead",null,$("tr",null,!1===t?null:$(ml,{sort:null!=o?o:[],label:"Id",onClick:a}),ne(n,(({label:e},l)=>$(ml,{key:l,cellId:l,label:e,sort:null!=o?o:[],onClick:a}))))),$("tbody",null,Q(r,(e=>$("tr",{key:e},!1===t?null:$("th",null,e),ne(n,(({component:l,getComponentProps:t},n)=>$("td",{key:n},$(l,_e(Ze(Ze({},B(t,e,n)),s),{rowId:e,cellId:n})))))))))),ml=({cellId:e,sort:[l,t],label:n=(null!=e?e:s),onClick:r})=>$("th",{onClick:ol((()=>null==r?void 0:r(e)),[r,e],r),className:O(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},O(t)||l!=e?null:(t?"↓":"↑")+" ",n),bl=({localRowId:e,params:[n,s,r,o,a,i,u]})=>{const d=t.useRemoteRowId(a,e,i);return $("tr",null,!1===n?null:$(l.Fragment,null,$("th",null,e),$("th",null,d)),ne(s,(({component:l,getComponentProps:t},n)=>{const[s,a]=n.split(".",2),i=s===r?e:s===o?d:null;return O(i)?null:$("td",{key:n},$(l,_e(Ze({},B(t,i,a)),{store:u,tableId:s,rowId:i,cellId:a})))})))},pl=({thing:e,onThingChange:l,className:t,hasSchema:n,showType:s=!0})=>{const[i,u]=nl(),[d,c]=nl(),[h,m]=nl(),[b,p]=nl(),[g,v]=nl();d!==e&&(u(Je(e)),c(e),m(e+""),p(Number(e)||0),v(!!e));const f=ll(((e,t)=>{t(e),c(e),l(e)}),[l]),I=ll((()=>{if(!(null==n?void 0:n())){const e=He(i,a,o,r),t=He(e,h,b,g);u(e),c(t),l(t)}}),[n,l,h,b,g,i]);return $("div",{className:t},s?$("button",{className:i,onClick:I},i):null,He(i,$("input",{key:i,value:h,onChange:ll((e=>f(e[k][T]+"",m)),[f])}),$("input",{key:i,type:"number",value:b,onChange:ll((e=>f(Number(e[k][T]||0),p)),[f])}),$("input",{key:i,type:"checkbox",checked:g,onChange:ll((e=>f(!!e[k].checked,v)),[f])})))},gl=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:o,limit:a,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,b=el(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,g,v]=dl(s,r,d,o,a,t.useRowCount(n,i),c,h);return $(hl,_e(Ze({},b),{params:al(cl(t.useTableCellIds(n,i),m,u?wl:t.CellView),il(i,n),t.useSortedRowIds(n,...p,a,i),p,g,v)}))},vl=({store:e,editable:l=!1,valueComponent:n=(l?Cl:t.ValueView),getValueComponentProps:s,className:r,headerRow:o,idColumn:a})=>$("table",{className:r},!1===o?null:$("thead",null,$("tr",null,!1===a?null:$("th",null,"Id"),$("th",null,y))),$("tbody",null,Q(t.useValueIds(e),(l=>$("tr",{key:l},!1===a?null:$("th",null,l),$("td",null,$(n,_e(Ze({},B(s,l)),{valueId:l,store:e})))))))),fl=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:o,customCells:a}=l,i=el(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(r),n);return $(hl,_e(Ze({},i),{params:al(cl(t.useTableCellIds(c,d),a,o?wl:t.CellView),il(d,c),t.useSliceRowIds(n,s,u))}))},Il=({relationshipId:e,relationships:n,editable:s,customCells:r,className:o,headerRow:a,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(n),e),m=cl([...rl(c,d),...rl(h,d)],r,s?wl:t.CellView),b=al(i,m,c,h,e,u,d);return $("table",{className:o},!1===a?null:$("thead",null,$("tr",null,!1===i?null:$(l.Fragment,null,$("th",null,c,".Id"),$("th",null,h,".Id")),ne(m,(({label:e},l)=>$("th",{key:l},e))))),$("tbody",null,Q(t.useRowIds(c,d),(e=>$(bl,{key:e,localRowId:e,params:b})))))},yl=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:o,limit:a,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=el(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,g]=dl(s,r,u,o,a,t.useResultRowCount(n,i),d,h);return $(hl,_e(Ze({},m),{params:al(cl(t.useResultTableCellIds(n,i),c,t.ResultCellView),ul(i,n),t.useResultSortedRowIds(n,...b,a,i),b,p,g)}))},wl=({tableId:e,rowId:l,cellId:n,store:s,className:r,showType:o})=>{var a;return $(pl,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:sl+f,showType:o,hasSchema:null==(a=t.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},Cl=({valueId:e,store:l,className:n,showType:s})=>{var r;return $(pl,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:sl+y,showType:s,hasSchema:null==(r=t.useStoreOrStoreById(l))?void 0:r.hasValuesSchema})},kl=({onChange:e,total:t,offset:n=0,limit:s=t,singular:r="row",plural:o=r+"s"})=>{(n>t||n<0)&&(n=0,e(0));const a=ol((()=>e(n-s)),[e,n,s],n>0),i=ol((()=>e(n+s)),[e,n,s],n+s<t);return $(l.Fragment,null,t>s&&$(l.Fragment,null,$("button",{className:"previous",disabled:0==n,onClick:a},"←"),$("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?o:r)},Tl=({indexes:e,indexesId:l,indexId:n,s:s})=>$(Fe,{uniqueId:ge("i",l,n),summary:"Index: "+n,s:s},Q(t.useSliceIds(n,e),(t=>$(Sl,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s,key:t})))),Sl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=ge("i",l,t,n),[o,a]=fe(r,s);return $(Fe,{uniqueId:r,summary:"Slice: "+n,editable:o,handleEditable:a,s:s},$(fl,{sliceId:n,indexId:t,indexes:e,editable:o}))},xl=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return O(n)?null:$(Fe,{uniqueId:ge("i",e),summary:"Indexes: "+(null!=e?e:d),s:l},W(s)?"No indexes defined":ve(s,(t=>$(Tl,{indexes:n,indexesId:e,indexId:t,s:l,key:t}))))},Vl=({metrics:e,metricId:l})=>$("tr",null,$("th",null,l),$("td",null,null==e?void 0:e.getTableId(l)),$("td",null,t.useMetric(l,e))),Rl=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return O(n)?null:$(Fe,{uniqueId:ge("m",e),summary:"Metrics: "+(null!=e?e:d),s:l},W(s)?"No metrics defined":$("table",null,$("thead",null,$("th",null,"Metric Id"),$("th",null,"Table Id"),$("th",null,"Metric")),$("tbody",null,Q(s,(e=>$(Vl,{metrics:n,metricId:e,key:e}))))))},Ol=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const o=ge("q",l,n),[a,i,u]=oe(null!=(r=t.useCell(de,o,ce,s))?r:"[]"),d=t.useSetCellCallback(de,o,ce,re,[],s);return $(Fe,{uniqueId:o,summary:"Query: "+n,s:s},$(yl,{queryId:n,queries:e,cellId:a,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ql=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return O(n)?null:$(Fe,{uniqueId:ge("q",e),summary:"Queries: "+(null!=e?e:d),s:l},W(s)?"No queries defined":ve(s,(t=>$(Ol,{queries:n,queriesId:e,queryId:t,s:l,key:t}))))},Nl=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=ge("r",l,t),[r,o]=fe(s,n);return $(Fe,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:o,s:n},$(Il,{relationshipId:t,relationships:e,editable:r}))},Pl=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return O(n)?null:$(Fe,{uniqueId:ge("r",e),summary:"Relationships: "+(null!=e?e:d),s:l},W(s)?"No relationships defined":ve(s,(t=>$(Nl,{relationships:n,relationshipsId:e,relationshipId:t,s:l,key:t}))))},El=({tableId:e,store:l,storeId:n,s:s})=>{var r;const o=ge("t",n,e),[a,i,u]=oe(null!=(r=t.useCell(de,o,ce,s))?r:"[]"),d=t.useSetCellCallback(de,o,ce,re,[],s),[c,m]=fe(o,s);return $(Fe,{uniqueId:o,summary:h+": "+e,editable:c,handleEditable:m,s:s},$(gl,{tableId:e,store:l,cellId:a,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Ll=({store:e,storeId:l,s:n})=>{const s=ge("v",l),[r,o]=fe(s,n);return W(t.useValueIds(e))?null:$(Fe,{uniqueId:s,summary:w,editable:r,handleEditable:o,s:n},$(vl,{store:e,editable:r}))},Ml=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return O(n)?null:$(Fe,{uniqueId:ge("s",e),summary:"Store: "+(null!=e?e:d),s:l},$(Ll,{storeId:e,store:n,s:l}),ve(s,(t=>$(El,{store:n,storeId:e,tableId:t,s:l,key:t}))))},jl=({s:e})=>{const l=J(null),n=J(0),[s,r]=D(!1),{scrollLeft:o,scrollTop:a}=t.useValues(e);F((()=>{const e=l.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=x(o)+e.clientWidth&&e.scrollHeight>=x(a)+e.clientHeight&&e.scrollTo(o,a)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,o,a]);const i=A((l=>{const{scrollLeft:t,scrollTop:s}=l[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),b=t.useIndexesIds(),p=t.useRelationships(),g=t.useRelationshipsIds(),v=t.useQueries(),f=t.useQueriesIds();return O(u)&&W(d)&&O(c)&&W(h)&&O(m)&&W(b)&&O(p)&&W(g)&&O(v)&&W(f)?$("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):$("article",{ref:l,onScroll:i},$(Ml,{s:e}),Q(d,(l=>$(Ml,{storeId:l,s:e,key:l}))),$(Rl,{s:e}),Q(h,(l=>$(Rl,{metricsId:l,s:e,key:l}))),$(xl,{s:e}),Q(b,(l=>$(xl,{indexesId:l,s:e,key:l}))),$(Pl,{s:e}),Q(g,(l=>$(Pl,{relationshipsId:l,s:e,key:l}))),$(ql,{s:e}),Q(f,(l=>$(ql,{queriesId:l,s:e,key:l}))))};class zl extends j{constructor(e){super(e),this.componentDidCatch=(e,l)=>console.error(e,l.componentStack),this.state={e:0}}render(){return this.state.e?$("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}zl.getDerivedStateFromError=()=>({e:1});const $l=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!1),[],e),r=t.useSetValueCallback(me,(e=>Number(e[k].dataset.id)),[],e);return $("header",null,$("img",{title:ie}),$("span",null,ie),Q(ue,((e,l)=>l==n?null:$("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),$("img",{onClick:s,title:"Close"}))},Al=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1;return t.useValue(be,e)?$("main",{"data-position":n},$($l,{s:e}),$(zl,null,$(jl,{s:e}))):null},Fl=e=>l=>{return t=(l,t)=>l+e(t),Ul(l).reduce(t,0);var t},Jl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Dl=Fl(Jl),Bl=Fl(Dl),Hl=Fl(Bl),Ql=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Wl=e=>O(e)||0==Jl(e),Ul=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Gl=e=>e.clear(),Kl=(e,l)=>null==e?void 0:e.forEach(l),Xl=(e,l)=>null==e?void 0:e.delete(l),Yl=e=>new Map(e),Zl=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},_l=(e,l)=>null==e?void 0:e.get(l),et=(e,l)=>Kl(e,((e,t)=>l(t,e))),lt=(e,l,t)=>O(t)?(Xl(e,l),e):null==e?void 0:e.set(l,t),tt=(e,l,t)=>(Ql(e,l)||lt(e,l,t()),_l(e,l)),nt=(e,l,t,n=lt)=>(ne(l,((l,n)=>t(e,n,l))),et(e,(t=>le(l,t)?0:n(e,t))),e),st=(e,l,t)=>{const n={};return Kl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},rt=(e,l,t)=>st(e,(e=>st(e,l,t)),se),ot=(e,l,t)=>st(e,(e=>rt(e,l,t)),se),at=(e,l)=>{const t=Yl();return Kl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},it=e=>at(e,at),ut=e=>at(e,it),dt=(e,l,t,n,s=0)=>q((t?tt:_l)(e,l[s],s>M(l)-2?t:Yl),(r=>{if(s>M(l)-2)return(null==n?void 0:n(r))&<(e,l[s]),r;const o=dt(r,l,t,n,s+1);return Wl(r)&<(e,l[s]),o}));var ct=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{a(t.next(e))}catch(e){s(e)}},o=e=>{try{a(t.throw(e))}catch(e){s(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,o);a((t=t.apply(e,l)).next())}));const ht=Yl(),mt=Yl();var bt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{a(t.next(e))}catch(e){s(e)}},o=e=>{try{a(t.throw(e))}catch(e){s(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,o);a((t=t.apply(e,l)).next())}));const pt="storage",gt=globalThis.window,vt=e=>new Set(E(e)||O(e)?e:[e]),ft=(e,l)=>null==e?void 0:e.add(l),It=/^\d+$/,yt=()=>{const e=[];let l=0;return[t=>{var n;return null!=(n=t?G(e):null)?n:s+l++},l=>{It.test(l)&&M(e)<1e3&&U(e,l)}]},wt=e=>[e,e],Ct=(e,l=Dl)=>l(e[0])+l(e[1]),kt=()=>[Yl(),Yl()],Tt=e=>[...e],St=([e,l])=>e===l,xt=(e,l,t)=>O(e)||!_(e)||se(e)||Y(e)?(null==t||t(),!1):(ne(e,((t,n)=>{l(t,n)||te(e,n)})),!se(e)),Vt=(e,l,t)=>lt(e,l,_l(e,l)==-t?void 0:t),Rt=()=>{let e,l,t=!1,n=!1,r=0;const o=Yl(),i=Yl(),c=Yl(),k=Yl(),T=Yl(),x=Yl(),V=Yl(),R=Yl(),E=Yl(),j=Yl(),z=Yl(),$=Yl(),A=Yl(),F=Yl(),J=vt(),D=Yl(),B=Yl(),W=Yl(),G=Yl(),K=kt(),X=kt(),Y=kt(),_=kt(),ee=kt(),ae=kt(),ie=kt(),ue=kt(),de=kt(),ce=kt(),he=kt(),me=kt(),be=kt(),pe=kt(),ge=kt(),ve=Yl(),fe=kt(),[Ie,ye,we,Ce]=(e=>{let l;const[t,n]=yt(),r=Yl();return[(e,n,o,a=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return lt(r,u,[e,n,o,a,i]),ft(dt(n,null!=o?o:[s],vt),u),u},(e,t,...n)=>H(((e,l=[s])=>{const t=[],n=(e,s)=>s==M(l)?U(t,e):null===l[s]?Kl(e,(e=>n(e,s+1))):H([l[s],null],(l=>n(_l(e,l),s+1)));return n(e,0),t})(e,t),(e=>Kl(e,(e=>_l(r,e)[0](l,...null!=t?t:[],...n))))),e=>q(_l(r,e),(([,l,t])=>(dt(l,null!=t?t:[s],void 0,(l=>(Xl(l,e),Wl(l)?1:0))),lt(r,e),n(e),t))),e=>q(_l(r,e),(([e,,t=[],n,s])=>{const r=(...o)=>{var a,i;const u=M(o);u==M(t)?e(l,...o,...s(o)):O(t[u])?H(null!=(i=null==(a=n[u])?void 0:a.call(n,...o))?i:[],(e=>r(...o,e))):r(...o,t[u])};r()}))]})(),ke=e=>{if(!xt(e,((e,l)=>[u,d].includes(l))))return!1;const l=e[u];return!(!N(l)&&l!=a||(Je(e[d])!=l&&te(e,d),0))},Te=(l,t)=>(!e||Ql(z,t)||nl(t))&&xt(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>xt(n?t:Oe(t,e,l),((n,s)=>q(xe(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),xe=(l,t,n,s)=>e?q(_l(_l(z,l),n),(e=>Je(s)!=e[u]?nl(l,t,n,s,e[d]):s),(()=>nl(l,t,n,s))):O(Je(s))?nl(l,t,n,s):s,Ve=(e,l)=>xt(l?e:qe(e),((l,t)=>q(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?q(_l(A,e),(l=>Je(t)!=l[u]?sl(e,t,l[d]):t),(()=>sl(e,t))):O(Je(t))?sl(e,t):t,Oe=(e,l,t)=>(q(_l($,l),(([n,s])=>{Kl(n,((l,t)=>{le(e,t)||(e[t]=l)})),Kl(s,(n=>{le(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Kl(F,((l,t)=>{le(e,t)||(e[t]=l)})),Kl(J,(l=>{le(e,l)||sl(l)}))),e),Ne=e=>nt(z,e,((e,l,t)=>{const n=Yl(),s=vt();nt(tt(z,l,Yl),t,((e,l,t)=>{lt(e,l,t),q(t[d],(e=>lt(n,l,e)),(()=>ft(s,l)))})),lt($,l,[n,s])}),((e,l)=>{lt(z,l),lt($,l)})),Pe=e=>nt(A,e,((e,l,t)=>{lt(A,l,t),q(t[d],(e=>lt(F,l,e)),(()=>ft(J,l)))}),((e,l)=>{lt(A,l),lt(F,l),Xl(J,l)})),Ee=e=>se(e)?ql():Sl(e),Le=e=>nt(W,e,((e,l,t)=>Me(l,t)),((e,l)=>Ue(l))),Me=(e,l)=>nt(tt(W,e,(()=>(Ye(e,1),lt(D,e,yt()),lt(B,e,Yl()),Yl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ge(e,l,t))),je=(e,l,t,n,s)=>nt(tt(l,t,(()=>(Ze(e,t,1),Yl()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ke(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Ql(t,n)||_e(e,l,n,1);const r=_l(t,n);s!==r&&(el(e,l,n,r,s),lt(t,n,s))},$e=(e,l,t,n,s)=>q(_l(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),Ae=e=>se(e)?El():xl(e),Fe=e=>nt(G,e,((e,l,t)=>He(l,t)),((e,l)=>Xe(l))),He=(e,l)=>{Ql(G,e)||ll(e,1);const t=_l(G,e);l!==t&&(tl(e,t,l),lt(G,e,l))},Qe=(e,l)=>{const[t]=_l(D,e),n=t(l);return Ql(_l(W,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=_l(W,e))?l:Me(e,{})},Ue=e=>Me(e,{}),Ge=(e,l,t)=>{const[,n]=_l(D,e);n(t),je(e,l,t,{},!0)},Ke=(e,l,t,n,s,r)=>{var o;const a=_l(null==(o=_l($,e))?void 0:o[0],s);if(!O(a)&&!r)return ze(e,t,n,s,a);const i=l=>{el(e,t,l,_l(n,l)),_e(e,t,l,-1),lt(n,l)};O(a)?i(s):et(n,i),Wl(n)&&(Ze(e,t,-1),Wl(lt(l,t))&&(Ye(e,-1),lt(W,e),lt(D,e),lt(B,e)))},Xe=e=>{const l=_l(F,e);if(!O(l))return He(e,l);tl(e,_l(G,e)),ll(e,-1),lt(G,e)},Ye=(e,l)=>Vt(o,e,l),Ze=(e,l,t)=>Vt(tt(k,e,Yl),l,t)&<(c,e,tt(c,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=_l(B,e),o=null!=(s=_l(r,t))?s:0;(0==o&&1==n||1==o&&-1==n)&&Vt(tt(i,e,Yl),t,n),lt(r,t,o!=-n?o+n:null),Vt(tt(tt(T,e,Yl),l,Yl),t,n)},el=(e,l,t,n,s)=>tt(tt(tt(x,e,Yl),l,Yl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Vt(V,e,l),tl=(e,l,t)=>tt(R,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(U(tt(tt(tt(E,e,Yl),l,Yl),t,(()=>[])),n),s),sl=(e,l,t)=>(U(tt(j,e,(()=>[])),l),t),rl=(e,l,t)=>q(_l(_l(_l(x,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...wt(wl(e,l,t))])),ol=e=>q(_l(R,e),(([e,l])=>[!0,e,l]),(()=>[!1,...wt(Tl(e))])),al=e=>Wl(E)||Wl(he[e])?0:Kl(e?ut(E):E,((l,t)=>Kl(l,((l,n)=>Kl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Wl(j)||Wl(me[e])?0:Kl(e?at(j):j,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Wl(l))return ye(e,t,(()=>st(l))),1},dl=e=>{const l=Wl(ie[e]),t=Wl(de[e])&&Wl(_[e])&&Wl(ee[e])&&Wl(ae[e])&&l&&Wl(X[e]),n=Wl(ce[e])&&Wl(ue[e])&&Wl(Y[e])&&Wl(K[e]);if(!t||!n){const s=e?[at(o),it(i),at(c),it(k),ut(T),ut(x)]:[o,i,c,k,T,x];if(!t){ul(X[e],s[0]),Kl(s[1],((l,t)=>ul(_[e],l,[t]))),Kl(s[2],((l,t)=>{0!=l&&ye(ee[e],[t],vl(t))}));const t=vt();Kl(s[3],((n,s)=>{ul(ae[e],n,[s])&&!l&&(ye(ie[e],[s,null]),ft(t,s))})),l||Kl(s[5],((l,n)=>{if(!Ql(t,n)){const t=vt();Kl(l,(e=>Kl(e,(([l,n],s)=>n!==l?ft(t,s):Xl(e,s))))),Kl(t,(l=>ye(ie[e],[n,l])))}})),Kl(s[4],((l,t)=>Kl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Kl(s[5],((t,n)=>{let s;Kl(t,((t,r)=>{let o;Kl(t,(([t,a],i)=>{a!==t&&(ye(ce[e],[n,r,i],a,t,rl),l=s=o=1)})),o&&ye(ue[e],[n,r],rl)})),s&&ye(Y[e],[n],rl)})),l&&ye(K[e],void 0,rl)}}},cl=e=>{const l=Wl(pe[e]),t=Wl(ge[e])&&Wl(be[e]);if(!l||!t){const n=e?[at(V),at(R)]:[V,R];if(l||ul(pe[e],n[0]),!t){let l;Kl(n[1],(([t,n],s)=>{n!==t&&(ye(ge[e],[s],n,t,ol),l=1)})),l&&ye(be[e],void 0,ol)}}},hl=(e,...l)=>(jl((()=>e(...Q(l,S)))),Al),ml=()=>[st(x,((e,l)=>-1===_l(o,l)?null:st(e,((e,t)=>-1===_l(_l(k,l),t)?null:st(e,(([,e])=>null!=e?e:null),((e,l)=>St(l)))),se)),se),st(R,(([,e])=>null!=e?e:null),((e,l)=>St(l)))],bl=()=>({cellsTouched:t,valuesTouched:n,changedCells:ot(x,Tt,St),invalidCells:ot(E),changedValues:st(R,Tt,St),invalidValues:st(j),changedTableIds:st(o),changedRowIds:rt(k),changedCellIds:ot(T),changedValueIds:st(V)}),pl=()=>ot(W),gl=()=>Zl(W),vl=e=>Jl(_l(W,S(e))),fl=e=>Zl(_l(W,S(e))),Il=(e,l,t,n=0,s)=>{return Q(L((o=_l(W,S(e)),a=(e,t)=>[O(l)?t:_l(e,S(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},Q([...null!=(i=null==o?void 0:o.entries())?i:[]],(([e,l])=>a(l,e))).sort(r)),n,O(s)?s:n+s),(([,e])=>e));var r,o,a,i},yl=(e,l)=>Zl(_l(_l(W,S(e)),S(l))),wl=(e,l,t)=>_l(_l(_l(W,S(e)),S(l)),S(t)),Cl=()=>st(G),kl=()=>Zl(G),Tl=e=>_l(G,S(e)),Sl=e=>hl((()=>(e=>xt(e,Te,nl))(e)?Le(e):0)),xl=e=>hl((()=>Ve(e)?Fe(e):0)),Vl=e=>{try{Ee(oe(e))}catch(e){}return Al},Rl=l=>hl((()=>{if((e=xt(l,(e=>xt(e,ke))))&&(Ne(l),!Wl(W))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>xt(e,ke))(e)){const t=Cl();Ml(),El(),l=!0,Pe(e),xl(t)}})),ql=()=>hl((()=>Le({}))),Nl=e=>hl((e=>Ql(W,e)?Ue(e):0),e),Pl=(e,l)=>hl(((e,l)=>q(_l(W,e),(t=>Ql(t,l)?Ge(e,t,l):0))),e,l),El=()=>hl((()=>Fe({}))),Ll=()=>hl((()=>{Ne({}),e=!1})),Ml=()=>hl((()=>{Pe({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return $l(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ve,void 0,ml,bl),Al),$l=e=>(r>0&&(r--,0==r&&(t=!Wl(x),n=!Wl(R),r=1,al(1),t&&dl(1),il(1),n&&cl(1),(null==e?void 0:e(ml,bl))&&(Kl(x,((e,l)=>Kl(e,((e,t)=>Kl(e,(([e],n)=>De(Al,l,t,n,e))))))),Kl(R,(([e],l)=>Be(Al,l,e))),t=n=!1),ye(fe[0],void 0,ml,bl),r=-1,al(0),t&&dl(0),il(0),n&&cl(0),ye(fe[1],void 0,ml,bl),r=0,t=n=!1,H([o,i,c,k,T,x,E,V,R,j],Gl))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:gl,getTable:e=>rt(_l(W,S(e))),getTableCellIds:e=>Zl(_l(B,S(e))),getRowCount:vl,getRowIds:fl,getSortedRowIds:Il,getRow:(e,l)=>st(_l(_l(W,S(e)),S(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:kl,getValue:Tl,hasTables:()=>!Wl(W),hasTable:e=>Ql(W,S(e)),hasTableCell:(e,l)=>Ql(_l(B,S(e)),S(l)),hasRow:(e,l)=>Ql(_l(W,S(e)),S(l)),hasCell:(e,l,t)=>Ql(_l(_l(W,S(e)),S(l)),S(t)),hasValues:()=>!Wl(G),hasValue:e=>Ql(G,S(e)),getTablesJson:()=>re(W),getValuesJson:()=>re(G),getJson:()=>re([W,G]),getTablesSchemaJson:()=>re(z),getValuesSchemaJson:()=>re(A),getSchemaJson:()=>re([z,A]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(se(e)?ql:Sl)(e),(se(l)?El:xl)(l)})),setTables:Sl,setTable:(e,l)=>hl((e=>Te(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Se(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Se(e,n,l)&&(e=S(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Se(e,l,t,1)){const n=We(e);ne(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>q(xe(e,l,t,P(n)?n(wl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:xl,setPartialValues:e=>hl((()=>Ve(e,1)?ne(e,((e,l)=>He(l,e))):0)),setValue:(e,l)=>hl((e=>q(Re(e,P(l)?l(Tl(e)):l),(l=>He(e,l)))),e),setTransactionChanges:e=>hl((()=>{ne(e[0],((e,l)=>O(e)?Nl(l):ne(e,((e,t)=>O(e)?Pl(l,t):ne(e,((e,n)=>De(Al,l,t,n,e))))))),ne(e[1],((e,l)=>Be(Al,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{Ae(oe(e))}catch(e){}return Al},setJson:e=>hl((()=>{try{const[l,t]=oe(e);Ee(l),Ae(t)}catch(l){Vl(e)}})),setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Nl,delRow:Pl,delCell:(e,l,t,n)=>hl(((e,l,t)=>q(_l(W,e),(s=>q(_l(s,l),(r=>Ql(r,t)?Ke(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Ql(G,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Kl(W,((l,t)=>e(t,(e=>Kl(l,((l,t)=>e(t,(e=>et(l,e))))))))),forEachTableCell:(e,l)=>et(_l(B,S(e)),l),forEachRow:(e,l)=>Kl(_l(W,S(e)),((e,t)=>l(t,(l=>et(e,l))))),forEachCell:(e,l,t)=>et(_l(_l(W,S(e)),S(l)),t),forEachValue:e=>et(G,e),addSortedRowIdsListener:(e,l,t,n,s,r,o)=>{let a=Il(e,l,t,n,s);return Ie((()=>{const o=Il(e,l,t,n,s);var i,u,d;u=a,M(i=o)===M(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(a=o,r(Al,e,l,t,n,s,a))}),ie[o?1:0],[e,l],[gl])},addStartTransactionListener:e=>Ie(e,ve),addWillFinishTransactionListener:e=>Ie(e,fe[0]),addDidFinishTransactionListener:e=>Ie(e,fe[1]),callListener:e=>(Ce(e),Al),delListener:e=>(we(e),Al),getListenerStats:()=>({tables:Ct(K),tableIds:Ct(X),tableCellIds:Ct(_),table:Ct(Y),rowCount:Ct(ee),rowIds:Ct(ae),sortedRowIds:Ct(ie),row:Ct(ue,Bl),cellIds:Ct(de,Bl),cell:Ct(ce,Hl),invalidCell:Ct(he,Hl),values:Ct(be),valueIds:Ct(pe),value:Ct(ge),invalidValue:Ct(me),transaction:Dl(ve)+Ct(fe)}),createStore:Rt,addListener:Ie,callListeners:ye};return ne({[m]:[0,K],[b]:[0,X],[h]:[1,Y,[gl]],[h+I]:[1,_,[gl]],[g]:[1,ee,[gl]],[v]:[1,ae,[gl]],[p]:[2,ue,[gl,fl]],[I]:[2,de,[gl,fl]],[f]:[3,ce,[gl,fl,yl],e=>wt(wl(...e))],InvalidCell:[3,he],[w]:[0,be],[C]:[0,pe],[y]:[1,ge,[kl],e=>wt(Tl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{Al["add"+s+"Listener"]=(...s)=>Ie(s[e],l[s[e+1]?1:0],e>0?L(s,0,e):void 0,t,n)})),Z(Al)},Ot=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(Rt),s=ue.indexOf(e);return t.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,[o,a]=[],i=[])=>{let u,d,c,h=0,m=0,b=0,p=0;tt(ht,i,(()=>0)),tt(mt,i,(()=>[]));const g=e=>ct(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield v.schedule((()=>ct(void 0,null,(function*(){yield e(),h=0}))))),v})),v={load:(t,n)=>ct(void 0,null,(function*(){return yield g((()=>ct(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>ct(void 0,[...t],(function*(t={},s={}){return v.stopAutoLoad(),yield v.load(t,s),p=1,c=n(((t,n)=>ct(void 0,null,(function*(){if(n){const l=n();yield g((()=>ct(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield g((()=>ct(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),v})),stopAutoLoad:()=>(p&&(s(c),c=void 0,p=0),v),save:l=>ct(void 0,null,(function*(){return 1!=h&&(h=2,b++,yield v.schedule((()=>ct(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}h=0}))))),v})),startAutoSave:()=>ct(void 0,null,(function*(){return yield v.stopAutoSave().save(),u=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();se(t)&&se(n)||v.save((()=>[t,n]))})),v})),stopAutoSave:()=>(q(u,e.delListener),u=void 0,v),schedule:(...e)=>ct(void 0,null,(function*(){return U(_l(mt,i),...e),yield ct(void 0,null,(function*(){if(!_l(ht,i)){for(lt(ht,i,1);!O(d=G(_l(mt,i)));)try{yield d()}catch(e){null==r||r(e)}lt(ht,i,0)}})),v})),getStore:()=>e,destroy:()=>v.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:b})};return o&&(v[o]=()=>a),Z(v)})(e,(()=>bt(void 0,null,(function*(){return oe(t.getItem(l))}))),(e=>bt(void 0,null,(function*(){return t.setItem(l,re(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>oe(n.newValue)))};return gt.addEventListener(pt,n),n}),(e=>gt.removeEventListener(pt,e)),n,["getStorageName",l]))(e,ae,sessionStorage,l);var l}),void 0,(e=>{return t=function*(){yield e.load(void 0,{position:-1==s?1:s,open:!!l}),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),$(z,null,$("aside",{id:ae},$(Ae,{s:n}),$(Al,{s:n})),$("style",null,$e))};var qt=Object.defineProperty,Nt=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,Lt=(e,l,t)=>l in e?qt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;e.EditableCellView=wl,e.EditableValueView=Cl,e.RelationshipInHtmlTable=Il,e.ResultSortedTableInHtmlTable=yl,e.ResultTableInHtmlTable=e=>{var l=e,{queryId:n,queries:s,customCells:r}=l,o=el(l,["queryId","queries","customCells"]);return $(hl,_e(Ze({},o),{params:al(cl(t.useResultTableCellIds(n,s),r,t.ResultCellView),ul(s,n),t.useResultRowIds(n,s))}))},e.SliceInHtmlTable=fl,e.SortedTableInHtmlTable=gl,e.SortedTablePaginator=kl,e.StoreInspector=e=>$(Ot,((e,l)=>{for(var t in l||(l={}))Pt.call(l,t)&&Lt(e,t,l[t]);if(Nt)for(var t of Nt(l))Et.call(l,t)&&Lt(e,t,l[t]);return e})({},e)),e.TableInHtmlTable=e=>{var l=e,{tableId:n,store:s,editable:r,customCells:o}=l,a=el(l,["tableId","store","editable","customCells"]);return $(hl,_e(Ze({},a),{params:al(cl(t.useTableCellIds(n,s),o,r?wl:t.CellView),il(s,n),t.useRowIds(n,s))}))},e.ValuesInHtmlTable=vl},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
|
|
1
|
+
var e,l;e=this,l=function(e,l,t){"use strict";const n=e=>typeof e,s="",r=n(s),o=n(!0),a=n(0),i=n(n),u="type",d="default",c="Ids",h="Table",m=h+"s",b=h+c,p="Row",g=p+"Count",v=p+c,f="Cell",I=f+c,y="Value",w=y+"s",C=y+c,k="currentTarget",T="value",S=e=>s+e,x=Math.floor,V=isFinite,R=(e,l)=>e instanceof l,O=e=>null==e,q=(e,l,t)=>O(e)?null==t?void 0:t():l(e),N=e=>e==r||e==o,P=e=>n(e)==i,E=e=>Array.isArray(e),L=(e,l,t)=>e.slice(l,t),M=e=>e.length,{PureComponent:j,Fragment:z,createElement:$,useCallback:A,useLayoutEffect:F,useRef:J,useState:D}=l,B=(e,...l)=>O(e)?{}:e(...l),H=(e,l)=>e.forEach(l),Q=(e,l)=>e.map(l),W=e=>0==M(e),U=(e,...l)=>e.push(...l),G=e=>e.shift(),K=Object,X=K.keys,Y=K.isFrozen,Z=K.freeze,_=e=>R(e,K)&&e.constructor==K,ee=(e=[])=>K.fromEntries(e),le=(e,l)=>!O(((e,l)=>q(e,(e=>e[l])))(e,l)),te=(e,l)=>(delete e[l],e),ne=(e,l)=>Q(K.entries(e),(([e,t])=>l(t,e))),se=e=>_(e)&&0==(e=>M(X(e)))(e),re=e=>JSON.stringify(e,((e,l)=>R(l,Map)?K.fromEntries([...l]):l)),oe=JSON.parse,ae="tinybaseStoreInspector",ie="TinyBase Store Inspector",ue=["left","top","bottom","right","full"],de="state",ce="sort",he="open",me="position",be=he,pe="editable",ge=(...e)=>re(e),ve=(e,l)=>Q(e.sort(),l),fe=(e,l)=>[!!t.useCell(de,e,pe,l),A((t=>{l.setCell(de,e,pe,(e=>!e)),t.preventDefault()}),[l,e])],Ie="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",ye='content:url("',we=ye+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",Ce='</svg>")',ke=ye+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",Te=Q([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,n])=>we+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${n}' fill='white'/>`+Ce)),Se=we+"<path d='M20 20l60 60M20 80l60-60' />"+Ce,xe=we+`<path d='${Ie}' />`+Ce,Ve=we+`<path d='${Ie}M20 20l60 60' />`+Ce;var Re=Object.defineProperty,Oe=Object.defineProperties,qe=Object.getOwnPropertyDescriptors,Ne=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Le=(e,l,t)=>l in e?Re(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Me=(e,l)=>{for(var t in l||(l={}))Pe.call(l,t)&&Le(e,t,l[t]);if(Ne)for(var t of Ne(l))Ee.call(l,t)&&Le(e,t,l[t]);return e},je=(e,l)=>Oe(e,qe(l));const ze="*::-webkit-scrollbar",$e=((e,l="")=>e.join(l))(ne(je(Me(je(Me(je(Me({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[ze]:"width:0.5rem;height:0.5rem;",[ze+"-track"]:"background:#111",[ze+"-thumb"]:"background:#999;border:1px solid #111",[ze+"-thumb:hover"]:"background:#fff",[ze+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+ke},ee(Q(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),ee(Q(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":ke,"header>img:nth-of-type(6)":Se}),ee(Q(Te,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":xe,"details[open]>summary img.done":Ve,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${ae} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,l)=>e?`#${ae} ${l}{${e}}`:""))),Ae=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!0),[],e);return t.useValue(be,e)?null:$("img",{onClick:s,title:ie,"data-position":n})},Fe=({uniqueId:e,summary:l,editable:n,handleEditable:s,children:r,s:o})=>{const a=!!t.useCell(de,e,he,o),i=t.useSetCellCallback(de,e,he,(e=>e[k].open),[],o);return $("details",{open:a,onToggle:i},$("summary",null,l,s?$("img",{onClick:s,className:n?"done":"edit"}):null),r)},Je=e=>{const l=n(e);return N(l)||l==a&&V(e)?l:void 0},De=(e,l,t,n,s)=>O(s)?e.delCell(l,t,n,!0):e.setCell(l,t,n,s),Be=(e,l,t)=>O(t)?e.delValue(l):e.setValue(l,t),He=(e,l,t,n)=>e==r?l:e==a?t:n;var Qe=Object.defineProperty,We=Object.defineProperties,Ue=Object.getOwnPropertyDescriptors,Ge=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ye=(e,l,t)=>l in e?Qe(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Ze=(e,l)=>{for(var t in l||(l={}))Ke.call(l,t)&&Ye(e,t,l[t]);if(Ge)for(var t of Ge(l))Xe.call(l,t)&&Ye(e,t,l[t]);return e},_e=(e,l)=>We(e,Ue(l)),el=(e,l)=>{var t={};for(var n in e)Ke.call(e,n)&&l.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&Ge)for(var n of Ge(e))l.indexOf(n)<0&&Xe.call(e,n)&&(t[n]=e[n]);return t};const{useCallback:ll,useMemo:tl,useState:nl}=l,sl="editable",rl=(e,l)=>Q(t.useTableCellIds(e,l),(l=>e+"."+l)),ol=(e,l,t)=>{const n=ll(e,l);return t?n:void 0},al=(...e)=>tl((()=>e),e),il=(e,l)=>tl((()=>({store:e,tableId:l})),[e,l]),ul=(e,l)=>tl((()=>({queries:e,queryId:l})),[e,l]),dl=(e,l=!1,t,n=0,s,r,o,a)=>{const[[i,u,d],c]=nl([e,l,n]),h=ll((e=>{c(e),null==a||a(e)}),[a]),m=ol((e=>h([e,e==i&&!u,d])),[h,i,u,d],t),b=ll((e=>h([i,u,e])),[h,i,u]),p=!0===o?kl:o;return[[i,u,d],m,tl((()=>!1===o?null:$(p,{offset:d,limit:s,total:r,onChange:b})),[o,p,d,s,r,b])]},cl=(e,l,t)=>tl((()=>{const s=null!=l?l:e;return ee(ne(E(s)?ee(Q(s,(e=>[e,e]))):s,((e,l)=>{return[l,Ze(Ze({},{label:l,component:t}),(s=e,n(s)==r?{label:e}:e))];var s})))}),[l,t,e]),hl=({className:e,headerRow:l,idColumn:t,params:[n,s,r,o,a,i]})=>$("table",{className:e},i?$("caption",null,i):null,!1===l?null:$("thead",null,$("tr",null,!1===t?null:$(ml,{sort:null!=o?o:[],label:"Id",onClick:a}),ne(n,(({label:e},l)=>$(ml,{key:l,cellId:l,label:e,sort:null!=o?o:[],onClick:a}))))),$("tbody",null,Q(r,(e=>$("tr",{key:e},!1===t?null:$("th",null,e),ne(n,(({component:l,getComponentProps:t},n)=>$("td",{key:n},$(l,_e(Ze(Ze({},B(t,e,n)),s),{rowId:e,cellId:n})))))))))),ml=({cellId:e,sort:[l,t],label:n=(null!=e?e:s),onClick:r})=>$("th",{onClick:ol((()=>null==r?void 0:r(e)),[r,e],r),className:O(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},O(t)||l!=e?null:(t?"↓":"↑")+" ",n),bl=({localRowId:e,params:[n,s,r,o,a,i,u]})=>{const d=t.useRemoteRowId(a,e,i);return $("tr",null,!1===n?null:$(l.Fragment,null,$("th",null,e),$("th",null,d)),ne(s,(({component:l,getComponentProps:t},n)=>{const[s,a]=n.split(".",2),i=s===r?e:s===o?d:null;return O(i)?null:$("td",{key:n},$(l,_e(Ze({},B(t,i,a)),{store:u,tableId:s,rowId:i,cellId:a})))})))},pl=({thing:e,onThingChange:l,className:t,hasSchema:n,showType:s=!0})=>{const[i,u]=nl(),[d,c]=nl(),[h,m]=nl(),[b,p]=nl(),[g,v]=nl();d!==e&&(u(Je(e)),c(e),m(e+""),p(Number(e)||0),v(!!e));const f=ll(((e,t)=>{t(e),c(e),l(e)}),[l]),I=ll((()=>{if(!(null==n?void 0:n())){const e=He(i,a,o,r),t=He(e,h,b,g);u(e),c(t),l(t)}}),[n,l,h,b,g,i]);return $("div",{className:t},s?$("button",{className:i,onClick:I},i):null,He(i,$("input",{key:i,value:h,onChange:ll((e=>f(e[k][T]+"",m)),[f])}),$("input",{key:i,type:"number",value:b,onChange:ll((e=>f(Number(e[k][T]||0),p)),[f])}),$("input",{key:i,type:"checkbox",checked:g,onChange:ll((e=>f(!!e[k].checked,v)),[f])})))},gl=e=>{var l=e,{tableId:n,cellId:s,descending:r,offset:o,limit:a,store:i,editable:u,sortOnClick:d,paginator:c=!1,onChange:h,customCells:m}=l,b=el(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[p,g,v]=dl(s,r,d,o,a,t.useRowCount(n,i),c,h);return $(hl,_e(Ze({},b),{params:al(cl(t.useTableCellIds(n,i),m,u?wl:t.CellView),il(i,n),t.useSortedRowIds(n,...p,a,i),p,g,v)}))},vl=({store:e,editable:l=!1,valueComponent:n=(l?Cl:t.ValueView),getValueComponentProps:s,className:r,headerRow:o,idColumn:a})=>$("table",{className:r},!1===o?null:$("thead",null,$("tr",null,!1===a?null:$("th",null,"Id"),$("th",null,y))),$("tbody",null,Q(t.useValueIds(e),(l=>$("tr",{key:l},!1===a?null:$("th",null,l),$("td",null,$(n,_e(Ze({},B(s,l)),{valueId:l,store:e})))))))),fl=e=>{var l=e,{indexId:n,sliceId:s,indexes:r,editable:o,customCells:a}=l,i=el(l,["indexId","sliceId","indexes","editable","customCells"]);const[u,d,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(r),n);return $(hl,_e(Ze({},i),{params:al(cl(t.useTableCellIds(c,d),a,o?wl:t.CellView),il(d,c),t.useSliceRowIds(n,s,u))}))},Il=({relationshipId:e,relationships:n,editable:s,customCells:r,className:o,headerRow:a,idColumn:i=!0})=>{const[u,d,c,h]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(n),e),m=cl([...rl(c,d),...rl(h,d)],r,s?wl:t.CellView),b=al(i,m,c,h,e,u,d);return $("table",{className:o},!1===a?null:$("thead",null,$("tr",null,!1===i?null:$(l.Fragment,null,$("th",null,c,".Id"),$("th",null,h,".Id")),ne(m,(({label:e},l)=>$("th",{key:l},e))))),$("tbody",null,Q(t.useRowIds(c,d),(e=>$(bl,{key:e,localRowId:e,params:b})))))},yl=e=>{var l=e,{queryId:n,cellId:s,descending:r,offset:o,limit:a,queries:i,sortOnClick:u,paginator:d=!1,customCells:c,onChange:h}=l,m=el(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[b,p,g]=dl(s,r,u,o,a,t.useResultRowCount(n,i),d,h);return $(hl,_e(Ze({},m),{params:al(cl(t.useResultTableCellIds(n,i),c,t.ResultCellView),ul(i,n),t.useResultSortedRowIds(n,...b,a,i),b,p,g)}))},wl=({tableId:e,rowId:l,cellId:n,store:s,className:r,showType:o})=>{var a;return $(pl,{thing:t.useCell(e,l,n,s),onThingChange:t.useSetCellCallback(e,l,n,(e=>e),[],s),className:null!=r?r:sl+f,showType:o,hasSchema:null==(a=t.useStoreOrStoreById(s))?void 0:a.hasTablesSchema})},Cl=({valueId:e,store:l,className:n,showType:s})=>{var r;return $(pl,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=n?n:sl+y,showType:s,hasSchema:null==(r=t.useStoreOrStoreById(l))?void 0:r.hasValuesSchema})},kl=({onChange:e,total:t,offset:n=0,limit:s=t,singular:r="row",plural:o=r+"s"})=>{(n>t||n<0)&&(n=0,e(0));const a=ol((()=>e(n-s)),[e,n,s],n>0),i=ol((()=>e(n+s)),[e,n,s],n+s<t);return $(l.Fragment,null,t>s&&$(l.Fragment,null,$("button",{className:"previous",disabled:0==n,onClick:a},"←"),$("button",{className:"next",disabled:n+s>=t,onClick:i},"→"),n+1," to ",Math.min(t,n+s)," of "),t," ",1!=t?o:r)},Tl=({indexes:e,indexesId:l,indexId:n,s:s})=>$(Fe,{uniqueId:ge("i",l,n),summary:"Index: "+n,s:s},Q(t.useSliceIds(n,e),(t=>$(Sl,{indexes:e,indexesId:l,indexId:n,sliceId:t,s:s,key:t})))),Sl=({indexes:e,indexesId:l,indexId:t,sliceId:n,s:s})=>{const r=ge("i",l,t,n),[o,a]=fe(r,s);return $(Fe,{uniqueId:r,summary:"Slice: "+n,editable:o,handleEditable:a,s:s},$(fl,{sliceId:n,indexId:t,indexes:e,editable:o}))},xl=({indexesId:e,s:l})=>{const n=t.useIndexes(e),s=t.useIndexIds(n);return O(n)?null:$(Fe,{uniqueId:ge("i",e),summary:"Indexes: "+(null!=e?e:d),s:l},W(s)?"No indexes defined":ve(s,(t=>$(Tl,{indexes:n,indexesId:e,indexId:t,s:l,key:t}))))},Vl=({metrics:e,metricId:l})=>$("tr",null,$("th",null,l),$("td",null,null==e?void 0:e.getTableId(l)),$("td",null,t.useMetric(l,e))),Rl=({metricsId:e,s:l})=>{const n=t.useMetrics(e),s=t.useMetricIds(n);return O(n)?null:$(Fe,{uniqueId:ge("m",e),summary:"Metrics: "+(null!=e?e:d),s:l},W(s)?"No metrics defined":$("table",null,$("thead",null,$("th",null,"Metric Id"),$("th",null,"Table Id"),$("th",null,"Metric")),$("tbody",null,Q(s,(e=>$(Vl,{metrics:n,metricId:e,key:e}))))))},Ol=({queries:e,queriesId:l,queryId:n,s:s})=>{var r;const o=ge("q",l,n),[a,i,u]=oe(null!=(r=t.useCell(de,o,ce,s))?r:"[]"),d=t.useSetCellCallback(de,o,ce,re,[],s);return $(Fe,{uniqueId:o,summary:"Query: "+n,s:s},$(yl,{queryId:n,queries:e,cellId:a,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d}))},ql=({queriesId:e,s:l})=>{const n=t.useQueries(e),s=t.useQueryIds(n);return O(n)?null:$(Fe,{uniqueId:ge("q",e),summary:"Queries: "+(null!=e?e:d),s:l},W(s)?"No queries defined":ve(s,(t=>$(Ol,{queries:n,queriesId:e,queryId:t,s:l,key:t}))))},Nl=({relationships:e,relationshipsId:l,relationshipId:t,s:n})=>{const s=ge("r",l,t),[r,o]=fe(s,n);return $(Fe,{uniqueId:s,summary:"Relationship: "+t,editable:r,handleEditable:o,s:n},$(Il,{relationshipId:t,relationships:e,editable:r}))},Pl=({relationshipsId:e,s:l})=>{const n=t.useRelationships(e),s=t.useRelationshipIds(n);return O(n)?null:$(Fe,{uniqueId:ge("r",e),summary:"Relationships: "+(null!=e?e:d),s:l},W(s)?"No relationships defined":ve(s,(t=>$(Nl,{relationships:n,relationshipsId:e,relationshipId:t,s:l,key:t}))))},El=({tableId:e,store:l,storeId:n,s:s})=>{var r;const o=ge("t",n,e),[a,i,u]=oe(null!=(r=t.useCell(de,o,ce,s))?r:"[]"),d=t.useSetCellCallback(de,o,ce,re,[],s),[c,m]=fe(o,s);return $(Fe,{uniqueId:o,summary:h+": "+e,editable:c,handleEditable:m,s:s},$(gl,{tableId:e,store:l,cellId:a,descending:i,offset:u,limit:10,paginator:!0,sortOnClick:!0,onChange:d,editable:c}))},Ll=({store:e,storeId:l,s:n})=>{const s=ge("v",l),[r,o]=fe(s,n);return W(t.useValueIds(e))?null:$(Fe,{uniqueId:s,summary:w,editable:r,handleEditable:o,s:n},$(vl,{store:e,editable:r}))},Ml=({storeId:e,s:l})=>{const n=t.useStore(e),s=t.useTableIds(n);return O(n)?null:$(Fe,{uniqueId:ge("s",e),summary:"Store: "+(null!=e?e:d),s:l},$(Ll,{storeId:e,store:n,s:l}),ve(s,(t=>$(El,{store:n,storeId:e,tableId:t,s:l,key:t}))))},jl=({s:e})=>{const l=J(null),n=J(0),[s,r]=D(!1),{scrollLeft:o,scrollTop:a}=t.useValues(e);F((()=>{const e=l.current;if(e&&!s){const l=new MutationObserver((()=>{e.scrollWidth>=x(o)+e.clientWidth&&e.scrollHeight>=x(a)+e.clientHeight&&e.scrollTo(o,a)}));return l.observe(e,{childList:!0,subtree:!0}),()=>l.disconnect()}}),[s,o,a]);const i=A((l=>{const{scrollLeft:t,scrollTop:s}=l[k];cancelIdleCallback(n.current),n.current=requestIdleCallback((()=>{r(!0),e.setPartialValues({scrollLeft:t,scrollTop:s})}))}),[e]),u=t.useStore(),d=t.useStoreIds(),c=t.useMetrics(),h=t.useMetricsIds(),m=t.useIndexes(),b=t.useIndexesIds(),p=t.useRelationships(),g=t.useRelationshipsIds(),v=t.useQueries(),f=t.useQueriesIds();return O(u)&&W(d)&&O(c)&&W(h)&&O(m)&&W(b)&&O(p)&&W(g)&&O(v)&&W(f)?$("span",{className:"warn"},"There are no Stores or other objects to inspect. Make sure you placed the StoreInspector inside a Provider component."):$("article",{ref:l,onScroll:i},$(Ml,{s:e}),Q(d,(l=>$(Ml,{storeId:l,s:e,key:l}))),$(Rl,{s:e}),Q(h,(l=>$(Rl,{metricsId:l,s:e,key:l}))),$(xl,{s:e}),Q(b,(l=>$(xl,{indexesId:l,s:e,key:l}))),$(Pl,{s:e}),Q(g,(l=>$(Pl,{relationshipsId:l,s:e,key:l}))),$(ql,{s:e}),Q(f,(l=>$(ql,{queriesId:l,s:e,key:l}))))};class zl extends j{constructor(e){super(e),this.componentDidCatch=(e,l)=>console.error(e,l.componentStack),this.state={e:0}}static getDerivedStateFromError(){return{e:1}}render(){return this.state.e?$("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}const $l=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1,s=t.useSetValueCallback(be,(()=>!1),[],e),r=t.useSetValueCallback(me,(e=>Number(e[k].dataset.id)),[],e);return $("header",null,$("img",{title:ie}),$("span",null,ie),Q(ue,((e,l)=>l==n?null:$("img",{onClick:r,"data-id":l,title:"Dock to "+e,key:l}))),$("img",{onClick:s,title:"Close"}))},Al=({s:e})=>{var l;const n=null!=(l=t.useValue(me,e))?l:1;return t.useValue(be,e)?$("main",{"data-position":n},$($l,{s:e}),$(zl,null,$(jl,{s:e}))):null},Fl=e=>l=>{return t=(l,t)=>l+e(t),Ul(l).reduce(t,0);var t},Jl=e=>{var l;return null!=(l=null==e?void 0:e.size)?l:0},Dl=Fl(Jl),Bl=Fl(Dl),Hl=Fl(Bl),Ql=(e,l)=>{var t;return null!=(t=null==e?void 0:e.has(l))&&t},Wl=e=>O(e)||0==Jl(e),Ul=e=>{var l;return[...null!=(l=null==e?void 0:e.values())?l:[]]},Gl=e=>e.clear(),Kl=(e,l)=>null==e?void 0:e.forEach(l),Xl=(e,l)=>null==e?void 0:e.delete(l),Yl=e=>new Map(e),Zl=e=>{var l;return[...null!=(l=null==e?void 0:e.keys())?l:[]]},_l=(e,l)=>null==e?void 0:e.get(l),et=(e,l)=>Kl(e,((e,t)=>l(t,e))),lt=(e,l,t)=>O(t)?(Xl(e,l),e):null==e?void 0:e.set(l,t),tt=(e,l,t)=>(Ql(e,l)||lt(e,l,t()),_l(e,l)),nt=(e,l,t,n=lt)=>(ne(l,((l,n)=>t(e,n,l))),et(e,(t=>le(l,t)?0:n(e,t))),e),st=(e,l,t)=>{const n={};return Kl(e,((e,s)=>{const r=l?l(e,s):e;!(null==t?void 0:t(r,e))&&(n[s]=r)})),n},rt=(e,l,t)=>st(e,(e=>st(e,l,t)),se),ot=(e,l,t)=>st(e,(e=>rt(e,l,t)),se),at=(e,l)=>{const t=Yl();return Kl(e,((e,n)=>{var s;return t.set(n,null!=(s=null==l?void 0:l(e))?s:e)})),t},it=e=>at(e,at),ut=e=>at(e,it),dt=(e,l,t,n,s=0)=>q((t?tt:_l)(e,l[s],s>M(l)-2?t:Yl),(r=>{if(s>M(l)-2)return(null==n?void 0:n(r))&<(e,l[s]),r;const o=dt(r,l,t,n,s+1);return Wl(r)&<(e,l[s]),o}));var ct=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{a(t.next(e))}catch(e){s(e)}},o=e=>{try{a(t.throw(e))}catch(e){s(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,o);a((t=t.apply(e,l)).next())}));const ht=Yl(),mt=Yl();var bt=(e,l,t)=>new Promise(((n,s)=>{var r=e=>{try{a(t.next(e))}catch(e){s(e)}},o=e=>{try{a(t.throw(e))}catch(e){s(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(r,o);a((t=t.apply(e,l)).next())}));const pt="storage",gt=globalThis.window,vt=e=>new Set(E(e)||O(e)?e:[e]),ft=(e,l)=>null==e?void 0:e.add(l),It=/^\d+$/,yt=()=>{const e=[];let l=0;return[t=>{var n;return null!=(n=t?G(e):null)?n:s+l++},l=>{It.test(l)&&M(e)<1e3&&U(e,l)}]},wt=e=>[e,e],Ct=(e,l=Dl)=>l(e[0])+l(e[1]),kt=()=>[Yl(),Yl()],Tt=e=>[...e],St=([e,l])=>e===l,xt=(e,l,t)=>O(e)||!_(e)||se(e)||Y(e)?(null==t||t(),!1):(ne(e,((t,n)=>{l(t,n)||te(e,n)})),!se(e)),Vt=(e,l,t)=>lt(e,l,_l(e,l)==-t?void 0:t),Rt=()=>{let e,l,t=!1,n=!1,r=0;const o=Yl(),i=Yl(),c=Yl(),k=Yl(),T=Yl(),x=Yl(),V=Yl(),R=Yl(),E=Yl(),j=Yl(),z=Yl(),$=Yl(),A=Yl(),F=Yl(),J=vt(),D=Yl(),B=Yl(),W=Yl(),G=Yl(),K=kt(),X=kt(),Y=kt(),_=kt(),ee=kt(),ae=kt(),ie=kt(),ue=kt(),de=kt(),ce=kt(),he=kt(),me=kt(),be=kt(),pe=kt(),ge=kt(),ve=Yl(),fe=kt(),[Ie,ye,we,Ce]=(e=>{let l;const[t,n]=yt(),r=Yl();return[(e,n,o,a=[],i=(()=>[]))=>{null!=l||(l=Al);const u=t(1);return lt(r,u,[e,n,o,a,i]),ft(dt(n,null!=o?o:[s],vt),u),u},(e,t,...n)=>H(((e,l=[s])=>{const t=[],n=(e,s)=>s==M(l)?U(t,e):null===l[s]?Kl(e,(e=>n(e,s+1))):H([l[s],null],(l=>n(_l(e,l),s+1)));return n(e,0),t})(e,t),(e=>Kl(e,(e=>_l(r,e)[0](l,...null!=t?t:[],...n))))),e=>q(_l(r,e),(([,l,t])=>(dt(l,null!=t?t:[s],void 0,(l=>(Xl(l,e),Wl(l)?1:0))),lt(r,e),n(e),t))),e=>q(_l(r,e),(([e,,t=[],n,s])=>{const r=(...o)=>{var a,i;const u=M(o);u==M(t)?e(l,...o,...s(o)):O(t[u])?H(null!=(i=null==(a=n[u])?void 0:a.call(n,...o))?i:[],(e=>r(...o,e))):r(...o,t[u])};r()}))]})(),ke=e=>{if(!xt(e,((e,l)=>[u,d].includes(l))))return!1;const l=e[u];return!(!N(l)&&l!=a||(Je(e[d])!=l&&te(e,d),0))},Te=(l,t)=>(!e||Ql(z,t)||nl(t))&&xt(l,((e,l)=>Se(t,l,e)),(()=>nl(t))),Se=(e,l,t,n)=>xt(n?t:Oe(t,e,l),((n,s)=>q(xe(e,l,s,n),(e=>(t[s]=e,!0)),(()=>!1))),(()=>nl(e,l))),xe=(l,t,n,s)=>e?q(_l(_l(z,l),n),(e=>Je(s)!=e[u]?nl(l,t,n,s,e[d]):s),(()=>nl(l,t,n,s))):O(Je(s))?nl(l,t,n,s):s,Ve=(e,l)=>xt(l?e:qe(e),((l,t)=>q(Re(t,l),(l=>(e[t]=l,!0)),(()=>!1))),(()=>sl())),Re=(e,t)=>l?q(_l(A,e),(l=>Je(t)!=l[u]?sl(e,t,l[d]):t),(()=>sl(e,t))):O(Je(t))?sl(e,t):t,Oe=(e,l,t)=>(q(_l($,l),(([n,s])=>{Kl(n,((l,t)=>{le(e,t)||(e[t]=l)})),Kl(s,(n=>{le(e,n)||nl(l,t,n)}))})),e),qe=e=>(l&&(Kl(F,((l,t)=>{le(e,t)||(e[t]=l)})),Kl(J,(l=>{le(e,l)||sl(l)}))),e),Ne=e=>nt(z,e,((e,l,t)=>{const n=Yl(),s=vt();nt(tt(z,l,Yl),t,((e,l,t)=>{lt(e,l,t),q(t[d],(e=>lt(n,l,e)),(()=>ft(s,l)))})),lt($,l,[n,s])}),((e,l)=>{lt(z,l),lt($,l)})),Pe=e=>nt(A,e,((e,l,t)=>{lt(A,l,t),q(t[d],(e=>lt(F,l,e)),(()=>ft(J,l)))}),((e,l)=>{lt(A,l),lt(F,l),Xl(J,l)})),Ee=e=>se(e)?ql():Sl(e),Le=e=>nt(W,e,((e,l,t)=>Me(l,t)),((e,l)=>Ue(l))),Me=(e,l)=>nt(tt(W,e,(()=>(Ye(e,1),lt(D,e,yt()),lt(B,e,Yl()),Yl()))),l,((l,t,n)=>je(e,l,t,n)),((l,t)=>Ge(e,l,t))),je=(e,l,t,n,s)=>nt(tt(l,t,(()=>(Ze(e,t,1),Yl()))),n,((l,n,s)=>ze(e,t,l,n,s)),((n,r)=>Ke(e,l,t,n,r,s))),ze=(e,l,t,n,s)=>{Ql(t,n)||_e(e,l,n,1);const r=_l(t,n);s!==r&&(el(e,l,n,r,s),lt(t,n,s))},$e=(e,l,t,n,s)=>q(_l(l,t),(l=>ze(e,t,l,n,s)),(()=>je(e,l,t,Oe({[n]:s},e,t)))),Ae=e=>se(e)?El():xl(e),Fe=e=>nt(G,e,((e,l,t)=>He(l,t)),((e,l)=>Xe(l))),He=(e,l)=>{Ql(G,e)||ll(e,1);const t=_l(G,e);l!==t&&(tl(e,t,l),lt(G,e,l))},Qe=(e,l)=>{const[t]=_l(D,e),n=t(l);return Ql(_l(W,e),n)?Qe(e,l):n},We=e=>{var l;return null!=(l=_l(W,e))?l:Me(e,{})},Ue=e=>Me(e,{}),Ge=(e,l,t)=>{const[,n]=_l(D,e);n(t),je(e,l,t,{},!0)},Ke=(e,l,t,n,s,r)=>{var o;const a=_l(null==(o=_l($,e))?void 0:o[0],s);if(!O(a)&&!r)return ze(e,t,n,s,a);const i=l=>{el(e,t,l,_l(n,l)),_e(e,t,l,-1),lt(n,l)};O(a)?i(s):et(n,i),Wl(n)&&(Ze(e,t,-1),Wl(lt(l,t))&&(Ye(e,-1),lt(W,e),lt(D,e),lt(B,e)))},Xe=e=>{const l=_l(F,e);if(!O(l))return He(e,l);tl(e,_l(G,e)),ll(e,-1),lt(G,e)},Ye=(e,l)=>Vt(o,e,l),Ze=(e,l,t)=>Vt(tt(k,e,Yl),l,t)&<(c,e,tt(c,e,(()=>0))+t),_e=(e,l,t,n)=>{var s;const r=_l(B,e),o=null!=(s=_l(r,t))?s:0;(0==o&&1==n||1==o&&-1==n)&&Vt(tt(i,e,Yl),t,n),lt(r,t,o!=-n?o+n:null),Vt(tt(tt(T,e,Yl),l,Yl),t,n)},el=(e,l,t,n,s)=>tt(tt(tt(x,e,Yl),l,Yl),t,(()=>[n,0]))[1]=s,ll=(e,l)=>Vt(V,e,l),tl=(e,l,t)=>tt(R,e,(()=>[l,0]))[1]=t,nl=(e,l,t,n,s)=>(U(tt(tt(tt(E,e,Yl),l,Yl),t,(()=>[])),n),s),sl=(e,l,t)=>(U(tt(j,e,(()=>[])),l),t),rl=(e,l,t)=>q(_l(_l(_l(x,e),l),t),(([e,l])=>[!0,e,l]),(()=>[!1,...wt(wl(e,l,t))])),ol=e=>q(_l(R,e),(([e,l])=>[!0,e,l]),(()=>[!1,...wt(Tl(e))])),al=e=>Wl(E)||Wl(he[e])?0:Kl(e?ut(E):E,((l,t)=>Kl(l,((l,n)=>Kl(l,((l,s)=>ye(he[e],[t,n,s],l))))))),il=e=>Wl(j)||Wl(me[e])?0:Kl(e?at(j):j,((l,t)=>ye(me[e],[t],l))),ul=(e,l,t)=>{if(!Wl(l))return ye(e,t,(()=>st(l))),1},dl=e=>{const l=Wl(ie[e]),t=Wl(de[e])&&Wl(_[e])&&Wl(ee[e])&&Wl(ae[e])&&l&&Wl(X[e]),n=Wl(ce[e])&&Wl(ue[e])&&Wl(Y[e])&&Wl(K[e]);if(!t||!n){const s=e?[at(o),it(i),at(c),it(k),ut(T),ut(x)]:[o,i,c,k,T,x];if(!t){ul(X[e],s[0]),Kl(s[1],((l,t)=>ul(_[e],l,[t]))),Kl(s[2],((l,t)=>{0!=l&&ye(ee[e],[t],vl(t))}));const t=vt();Kl(s[3],((n,s)=>{ul(ae[e],n,[s])&&!l&&(ye(ie[e],[s,null]),ft(t,s))})),l||Kl(s[5],((l,n)=>{if(!Ql(t,n)){const t=vt();Kl(l,(e=>Kl(e,(([l,n],s)=>n!==l?ft(t,s):Xl(e,s))))),Kl(t,(l=>ye(ie[e],[n,l])))}})),Kl(s[4],((l,t)=>Kl(l,((l,n)=>ul(de[e],l,[t,n])))))}if(!n){let l;Kl(s[5],((t,n)=>{let s;Kl(t,((t,r)=>{let o;Kl(t,(([t,a],i)=>{a!==t&&(ye(ce[e],[n,r,i],a,t,rl),l=s=o=1)})),o&&ye(ue[e],[n,r],rl)})),s&&ye(Y[e],[n],rl)})),l&&ye(K[e],void 0,rl)}}},cl=e=>{const l=Wl(pe[e]),t=Wl(ge[e])&&Wl(be[e]);if(!l||!t){const n=e?[at(V),at(R)]:[V,R];if(l||ul(pe[e],n[0]),!t){let l;Kl(n[1],(([t,n],s)=>{n!==t&&(ye(ge[e],[s],n,t,ol),l=1)})),l&&ye(be[e],void 0,ol)}}},hl=(e,...l)=>(jl((()=>e(...Q(l,S)))),Al),ml=()=>[st(x,((e,l)=>-1===_l(o,l)?null:st(e,((e,t)=>-1===_l(_l(k,l),t)?null:st(e,(([,e])=>null!=e?e:null),((e,l)=>St(l)))),se)),se),st(R,(([,e])=>null!=e?e:null),((e,l)=>St(l)))],bl=()=>({cellsTouched:t,valuesTouched:n,changedCells:ot(x,Tt,St),invalidCells:ot(E),changedValues:st(R,Tt,St),invalidValues:st(j),changedTableIds:st(o),changedRowIds:rt(k),changedCellIds:ot(T),changedValueIds:st(V)}),pl=()=>ot(W),gl=()=>Zl(W),vl=e=>Jl(_l(W,S(e))),fl=e=>Zl(_l(W,S(e))),Il=(e,l,t,n=0,s)=>{return Q(L((o=_l(W,S(e)),a=(e,t)=>[O(l)?t:_l(e,S(l)),t],r=([e],[l])=>{return((null!=(n=e)?n:0)<(null!=(s=l)?s:0)?-1:1)*(t?-1:1);var n,s},Q([...null!=(i=null==o?void 0:o.entries())?i:[]],(([e,l])=>a(l,e))).sort(r)),n,O(s)?s:n+s),(([,e])=>e));var r,o,a,i},yl=(e,l)=>Zl(_l(_l(W,S(e)),S(l))),wl=(e,l,t)=>_l(_l(_l(W,S(e)),S(l)),S(t)),Cl=()=>st(G),kl=()=>Zl(G),Tl=e=>_l(G,S(e)),Sl=e=>hl((()=>(e=>xt(e,Te,nl))(e)?Le(e):0)),xl=e=>hl((()=>Ve(e)?Fe(e):0)),Vl=e=>{try{Ee(oe(e))}catch(e){}return Al},Rl=l=>hl((()=>{if((e=xt(l,(e=>xt(e,ke))))&&(Ne(l),!Wl(W))){const e=pl();ql(),Sl(e)}})),Ol=e=>hl((()=>{if(l=(e=>xt(e,ke))(e)){const t=Cl();Ml(),El(),l=!0,Pe(e),xl(t)}})),ql=()=>hl((()=>Le({}))),Nl=e=>hl((e=>Ql(W,e)?Ue(e):0),e),Pl=(e,l)=>hl(((e,l)=>q(_l(W,e),(t=>Ql(t,l)?Ge(e,t,l):0))),e,l),El=()=>hl((()=>Fe({}))),Ll=()=>hl((()=>{Ne({}),e=!1})),Ml=()=>hl((()=>{Pe({}),l=!1})),jl=(e,l)=>{if(-1!=r){zl();const t=e();return $l(l),t}},zl=()=>(-1!=r&&r++,1==r&&ye(ve,void 0,ml,bl),Al),$l=e=>(r>0&&(r--,0==r&&(t=!Wl(x),n=!Wl(R),r=1,al(1),t&&dl(1),il(1),n&&cl(1),(null==e?void 0:e(ml,bl))&&(Kl(x,((e,l)=>Kl(e,((e,t)=>Kl(e,(([e],n)=>De(Al,l,t,n,e))))))),Kl(R,(([e],l)=>Be(Al,l,e))),t=n=!1),ye(fe[0],void 0,ml,bl),r=-1,al(0),t&&dl(0),il(0),n&&cl(0),ye(fe[1],void 0,ml,bl),r=0,t=n=!1,H([o,i,c,k,T,x,E,V,R,j],Gl))),Al),Al={getContent:()=>[pl(),Cl()],getTables:pl,getTableIds:gl,getTable:e=>rt(_l(W,S(e))),getTableCellIds:e=>Zl(_l(B,S(e))),getRowCount:vl,getRowIds:fl,getSortedRowIds:Il,getRow:(e,l)=>st(_l(_l(W,S(e)),S(l))),getCellIds:yl,getCell:wl,getValues:Cl,getValueIds:kl,getValue:Tl,hasTables:()=>!Wl(W),hasTable:e=>Ql(W,S(e)),hasTableCell:(e,l)=>Ql(_l(B,S(e)),S(l)),hasRow:(e,l)=>Ql(_l(W,S(e)),S(l)),hasCell:(e,l,t)=>Ql(_l(_l(W,S(e)),S(l)),S(t)),hasValues:()=>!Wl(G),hasValue:e=>Ql(G,S(e)),getTablesJson:()=>re(W),getValuesJson:()=>re(G),getJson:()=>re([W,G]),getTablesSchemaJson:()=>re(z),getValuesSchemaJson:()=>re(A),getSchemaJson:()=>re([z,A]),hasTablesSchema:()=>e,hasValuesSchema:()=>l,setContent:([e,l])=>hl((()=>{(se(e)?ql:Sl)(e),(se(l)?El:xl)(l)})),setTables:Sl,setTable:(e,l)=>hl((e=>Te(l,e)?Me(e,l):0),e),setRow:(e,l,t)=>hl(((e,l)=>Se(e,l,t)?je(e,We(e),l,t):0),e,l),addRow:(e,l,t=!0)=>jl((()=>{let n;return Se(e,n,l)&&(e=S(e),je(e,We(e),n=Qe(e,t?1:0),l)),n})),setPartialRow:(e,l,t)=>hl(((e,l)=>{if(Se(e,l,t,1)){const n=We(e);ne(t,((t,s)=>$e(e,n,l,s,t)))}}),e,l),setCell:(e,l,t,n)=>hl(((e,l,t)=>q(xe(e,l,t,P(n)?n(wl(e,l,t)):n),(n=>$e(e,We(e),l,t,n)))),e,l,t),setValues:xl,setPartialValues:e=>hl((()=>Ve(e,1)?ne(e,((e,l)=>He(l,e))):0)),setValue:(e,l)=>hl((e=>q(Re(e,P(l)?l(Tl(e)):l),(l=>He(e,l)))),e),setTransactionChanges:e=>hl((()=>{ne(e[0],((e,l)=>O(e)?Nl(l):ne(e,((e,t)=>O(e)?Pl(l,t):ne(e,((e,n)=>De(Al,l,t,n,e))))))),ne(e[1],((e,l)=>Be(Al,l,e)))})),setTablesJson:Vl,setValuesJson:e=>{try{Ae(oe(e))}catch(e){}return Al},setJson:e=>hl((()=>{try{const[l,t]=oe(e);Ee(l),Ae(t)}catch(l){Vl(e)}})),setTablesSchema:Rl,setValuesSchema:Ol,setSchema:(e,l)=>hl((()=>{Rl(e),Ol(l)})),delTables:ql,delTable:Nl,delRow:Pl,delCell:(e,l,t,n)=>hl(((e,l,t)=>q(_l(W,e),(s=>q(_l(s,l),(r=>Ql(r,t)?Ke(e,s,l,r,t,n):0))))),e,l,t),delValues:El,delValue:e=>hl((e=>Ql(G,e)?Xe(e):0),e),delTablesSchema:Ll,delValuesSchema:Ml,delSchema:()=>hl((()=>{Ll(),Ml()})),transaction:jl,startTransaction:zl,finishTransaction:$l,forEachTable:e=>Kl(W,((l,t)=>e(t,(e=>Kl(l,((l,t)=>e(t,(e=>et(l,e))))))))),forEachTableCell:(e,l)=>et(_l(B,S(e)),l),forEachRow:(e,l)=>Kl(_l(W,S(e)),((e,t)=>l(t,(l=>et(e,l))))),forEachCell:(e,l,t)=>et(_l(_l(W,S(e)),S(l)),t),forEachValue:e=>et(G,e),addSortedRowIdsListener:(e,l,t,n,s,r,o)=>{let a=Il(e,l,t,n,s);return Ie((()=>{const o=Il(e,l,t,n,s);var i,u,d;u=a,M(i=o)===M(u)&&(d=(e,l)=>u[l]===e,i.every(d))||(a=o,r(Al,e,l,t,n,s,a))}),ie[o?1:0],[e,l],[gl])},addStartTransactionListener:e=>Ie(e,ve),addWillFinishTransactionListener:e=>Ie(e,fe[0]),addDidFinishTransactionListener:e=>Ie(e,fe[1]),callListener:e=>(Ce(e),Al),delListener:e=>(we(e),Al),getListenerStats:()=>({tables:Ct(K),tableIds:Ct(X),tableCellIds:Ct(_),table:Ct(Y),rowCount:Ct(ee),rowIds:Ct(ae),sortedRowIds:Ct(ie),row:Ct(ue,Bl),cellIds:Ct(de,Bl),cell:Ct(ce,Hl),invalidCell:Ct(he,Hl),values:Ct(be),valueIds:Ct(pe),value:Ct(ge),invalidValue:Ct(me),transaction:Dl(ve)+Ct(fe)}),createStore:Rt,addListener:Ie,callListeners:ye};return ne({[m]:[0,K],[b]:[0,X],[h]:[1,Y,[gl]],[h+I]:[1,_,[gl]],[g]:[1,ee,[gl]],[v]:[1,ae,[gl]],[p]:[2,ue,[gl,fl]],[I]:[2,de,[gl,fl]],[f]:[3,ce,[gl,fl,yl],e=>wt(wl(...e))],InvalidCell:[3,he],[w]:[0,be],[C]:[0,pe],[y]:[1,ge,[kl],e=>wt(Tl(e[0]))],InvalidValue:[1,me]},(([e,l,t,n],s)=>{Al["add"+s+"Listener"]=(...s)=>Ie(s[e],l[s[e+1]?1:0],e>0?L(s,0,e):void 0,t,n)})),Z(Al)},Ot=({position:e="right",open:l=!1})=>{const n=t.useCreateStore(Rt),s=ue.indexOf(e);return t.useCreatePersister(n,(e=>{return((e,l,t,n)=>((e,l,t,n,s,r,[o,a]=[],i=[])=>{let u,d,c,h=0,m=0,b=0,p=0;tt(ht,i,(()=>0)),tt(mt,i,(()=>[]));const g=e=>ct(void 0,null,(function*(){return 2!=h&&(h=1,m++,yield v.schedule((()=>ct(void 0,null,(function*(){yield e(),h=0}))))),v})),v={load:(t,n)=>ct(void 0,null,(function*(){return yield g((()=>ct(void 0,null,(function*(){try{e.setContent(yield l())}catch(l){e.setContent([t,n])}}))))})),startAutoLoad:(...t)=>ct(void 0,[...t],(function*(t={},s={}){return v.stopAutoLoad(),yield v.load(t,s),p=1,c=n(((t,n)=>ct(void 0,null,(function*(){if(n){const l=n();yield g((()=>ct(void 0,null,(function*(){return e.setTransactionChanges(l)}))))}else yield g((()=>ct(void 0,null,(function*(){var n;try{e.setContent(null!=(n=null==t?void 0:t())?n:yield l())}catch(e){null==r||r(e)}}))))})))),v})),stopAutoLoad:()=>(p&&(s(c),c=void 0,p=0),v),save:l=>ct(void 0,null,(function*(){return 1!=h&&(h=2,b++,yield v.schedule((()=>ct(void 0,null,(function*(){try{yield t(e.getContent,l)}catch(e){null==r||r(e)}h=0}))))),v})),startAutoSave:()=>ct(void 0,null,(function*(){return yield v.stopAutoSave().save(),u=e.addDidFinishTransactionListener(((e,l)=>{const[t,n]=l();se(t)&&se(n)||v.save((()=>[t,n]))})),v})),stopAutoSave:()=>(q(u,e.delListener),u=void 0,v),schedule:(...e)=>ct(void 0,null,(function*(){return U(_l(mt,i),...e),yield ct(void 0,null,(function*(){if(!_l(ht,i)){for(lt(ht,i,1);!O(d=G(_l(mt,i)));)try{yield d()}catch(e){null==r||r(e)}lt(ht,i,0)}})),v})),getStore:()=>e,destroy:()=>v.stopAutoLoad().stopAutoSave(),getStats:()=>({loads:m,saves:b})};return o&&(v[o]=()=>a),Z(v)})(e,(()=>bt(void 0,null,(function*(){return oe(t.getItem(l))}))),(e=>bt(void 0,null,(function*(){return t.setItem(l,re(e()))}))),(e=>{const n=n=>{n.storageArea===t&&n.key===l&&e((()=>oe(n.newValue)))};return gt.addEventListener(pt,n),n}),(e=>gt.removeEventListener(pt,e)),n,["getStorageName",l]))(e,ae,sessionStorage,l);var l}),void 0,(e=>{return t=function*(){yield e.load(void 0,{position:-1==s?1:s,open:!!l}),yield e.startAutoSave()},new Promise(((e,l)=>{var n=e=>{try{r(t.next(e))}catch(e){l(e)}},s=e=>{try{r(t.throw(e))}catch(e){l(e)}},r=l=>l.done?e(l.value):Promise.resolve(l.value).then(n,s);r((t=t.apply(void 0,null)).next())}));var t})),$(z,null,$("aside",{id:ae},$(Ae,{s:n}),$(Al,{s:n})),$("style",null,$e))};var qt=Object.defineProperty,Nt=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,Lt=(e,l,t)=>l in e?qt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t;e.EditableCellView=wl,e.EditableValueView=Cl,e.RelationshipInHtmlTable=Il,e.ResultSortedTableInHtmlTable=yl,e.ResultTableInHtmlTable=e=>{var l=e,{queryId:n,queries:s,customCells:r}=l,o=el(l,["queryId","queries","customCells"]);return $(hl,_e(Ze({},o),{params:al(cl(t.useResultTableCellIds(n,s),r,t.ResultCellView),ul(s,n),t.useResultRowIds(n,s))}))},e.SliceInHtmlTable=fl,e.SortedTableInHtmlTable=gl,e.SortedTablePaginator=kl,e.StoreInspector=e=>$(Ot,((e,l)=>{for(var t in l||(l={}))Pt.call(l,t)&&Lt(e,t,l[t]);if(Nt)for(var t of Nt(l))Et.call(l,t)&&Lt(e,t,l[t]);return e})({},e)),e.TableInHtmlTable=e=>{var l=e,{tableId:n,store:s,editable:r,customCells:o}=l,a=el(l,["tableId","store","editable","customCells"]);return $(hl,_e(Ze({},a),{params:al(cl(t.useTableCellIds(n,s),o,r?wl:t.CellView),il(s,n),t.useRowIds(n,s))}))},e.ValuesInHtmlTable=vl},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDomDebug={},e.React,e.TinyBaseUiReact);
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,l){"use strict";const r=e=>typeof e,o=r(""),a=r(!0),n=r(0),s="Value",i="currentTarget",d="value",u=isFinite,c=e=>null==e,{PureComponent:m,Fragment:h,createElement:b,useCallback:p,useLayoutEffect:g,useRef:f,useState:w}=t,y=(e,...t)=>c(e)?{}:e(...t),v=(e,t)=>e.map(t),I=Object,C=(e=[])=>I.fromEntries(e),k=(e,t)=>v(I.entries(e),(([e,l])=>t(l,e))),x="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",T='content:url("',R=T+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",O='</svg>")',S=T+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",N=v([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,t,l,r])=>R+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${t}' width='${l}' height='${r}' fill='white'/>`+O)),V=R+"<path d='M20 20l60 60M20 80l60-60' />"+O,j=R+`<path d='${x}' />`+O,P=R+`<path d='${x}M20 20l60 60' />`+O;var z=Object.defineProperty,q=Object.defineProperties,M=Object.getOwnPropertyDescriptors,$=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,F=(e,t,l)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,H=(e,t)=>{for(var l in t||(t={}))B.call(t,l)&&F(e,l,t[l]);if($)for(var l of $(t))E.call(t,l)&&F(e,l,t[l]);return e},D=(e,t)=>q(e,M(t));const A="*::-webkit-scrollbar";((e,t="")=>{e.join(t)})(k(D(H(D(H(D(H({"*":"all:revert","*::before":"all:revert","*::after":"all:revert",[A]:"width:0.5rem;height:0.5rem;",[A+"-track"]:"background:#111",[A+"-thumb"]:"background:#999;border:1px solid #111",[A+"-thumb:hover"]:"background:#fff",[A+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+S},C(v(["bottom:0;left:0","top:0;right:0"],((e,t)=>[`>img[data-position='${t}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),C(v(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,t)=>[`main[data-position='${t}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":S,"header>img:nth-of-type(6)":V}),C(v(N,((e,t)=>[`header>img[data-id='${t}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":j,"details[open]>summary img.done":P,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem","th,td":"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,t)=>e?`& ${t}{${e}}`:"")));const L=(e,t,l,r)=>e==o?t:e==n?l:r;var U=Object.defineProperty,G=Object.defineProperties,J=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,X=(e,t,l)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[t]=l,Y=(e,t)=>{for(var l in t||(t={}))Q.call(t,l)&&X(e,l,t[l]);if(K)for(var l of K(t))W.call(t,l)&&X(e,l,t[l]);return e},Z=(e,t)=>G(e,J(t)),_=(e,t)=>{var l={};for(var r in e)Q.call(e,r)&&t.indexOf(r)<0&&(l[r]=e[r]);if(null!=e&&K)for(var r of K(e))t.indexOf(r)<0&&W.call(e,r)&&(l[r]=e[r]);return l};const{useCallback:ee,useMemo:te,useState:le}=t,re="editable",oe=(e,t)=>v(l.useTableCellIds(e,t),(t=>e+"."+t)),ae=(e,t,l)=>{const r=ee(e,t);return l?r:void 0},ne=(...e)=>te((()=>e),e),se=(e,t)=>te((()=>({store:e,tableId:t})),[e,t]),ie=(e,t)=>te((()=>({queries:e,queryId:t})),[e,t]),de=(e,t=!1,l,r=0,o,a,n,s)=>{const[[i,d,u],c]=le([e,t,r]),m=ee((e=>{c(e),null==s||s(e)}),[s]),h=ae((e=>m([e,e==i&&!d,u])),[m,i,d,u],l),p=ee((e=>m([i,d,e])),[m,i,d]),g=!0===n?fe:n;return[[i,d,u],h,te((()=>!1===n?null:b(g,{offset:u,limit:o,total:a,onChange:p})),[n,g,u,o,a,p])]},ue=(e,t,l)=>te((()=>{const a=null!=t?t:e;return C(k(Array.isArray(a)?C(v(a,(e=>[e,e]))):a,((e,t)=>{return[t,Y(Y({},{label:t,component:l}),(a=e,r(a)==o?{label:e}:e))];var a})))}),[t,l,e]),ce=({className:e,headerRow:t,idColumn:l,params:[r,o,a,n,s,i]})=>b("table",{className:e},i?b("caption",null,i):null,!1===t?null:b("thead",null,b("tr",null,!1===l?null:b(me,{sort:null!=n?n:[],label:"Id",onClick:s}),k(r,(({label:e},t)=>b(me,{key:t,cellId:t,label:e,sort:null!=n?n:[],onClick:s}))))),b("tbody",null,v(a,(e=>b("tr",{key:e},!1===l?null:b("th",null,e),k(r,(({component:t,getComponentProps:l},r)=>b("td",{key:r},b(t,Z(Y(Y({},y(l,e,r)),o),{rowId:e,cellId:r})))))))))),me=({cellId:e,sort:[t,l],label:r=(null!=e?e:""),onClick:o})=>b("th",{onClick:ae((()=>null==o?void 0:o(e)),[o,e],o),className:c(l)||t!=e?void 0:`sorted ${l?"de":"a"}scending`},c(l)||t!=e?null:(l?"↓":"↑")+" ",r),he=({localRowId:e,params:[r,o,a,n,s,i,d]})=>{const u=l.useRemoteRowId(s,e,i);return b("tr",null,!1===r?null:b(t.Fragment,null,b("th",null,e),b("th",null,u)),k(o,(({component:t,getComponentProps:l},r)=>{const[o,s]=r.split(".",2),i=o===a?e:o===n?u:null;return c(i)?null:b("td",{key:r},b(t,Z(Y({},y(l,i,s)),{store:d,tableId:o,rowId:i,cellId:s})))})))},be=({thing:e,onThingChange:t,className:l,hasSchema:s,showType:c=!0})=>{const[m,h]=le(),[p,g]=le(),[f,w]=le(),[y,v]=le(),[I,C]=le();p!==e&&(h((e=>{const t=r(e);return(e=>e==o||e==a)(t)||t==n&&u(e)?t:void 0})(e)),g(e),w(e+""),v(Number(e)||0),C(!!e));const k=ee(((e,l)=>{l(e),g(e),t(e)}),[t]),x=ee((()=>{if(!(null==s?void 0:s())){const e=L(m,n,a,o),l=L(e,f,y,I);h(e),g(l),t(l)}}),[s,t,f,y,I,m]);return b("div",{className:l},c?b("button",{className:m,onClick:x},m):null,L(m,b("input",{key:m,value:f,onChange:ee((e=>k(e[i][d]+"",w)),[k])}),b("input",{key:m,type:"number",value:y,onChange:ee((e=>k(Number(e[i][d]||0),v)),[k])}),b("input",{key:m,type:"checkbox",checked:I,onChange:ee((e=>k(!!e[i].checked,C)),[k])})))},pe=({tableId:e,rowId:t,cellId:r,store:o,className:a,showType:n})=>{var s;return b(be,{thing:l.useCell(e,t,r,o),onThingChange:l.useSetCellCallback(e,t,r,(e=>e),[],o),className:null!=a?a:re+"Cell",showType:n,hasSchema:null==(s=l.useStoreOrStoreById(o))?void 0:s.hasTablesSchema})},ge=({valueId:e,store:t,className:r,showType:o})=>{var a;return b(be,{thing:l.useValue(e,t),onThingChange:l.useSetValueCallback(e,(e=>e),[],t),className:null!=r?r:re+s,showType:o,hasSchema:null==(a=l.useStoreOrStoreById(t))?void 0:a.hasValuesSchema})},fe=({onChange:e,total:l,offset:r=0,limit:o=l,singular:a="row",plural:n=a+"s"})=>{(r>l||r<0)&&(r=0,e(0));const s=ae((()=>e(r-o)),[e,r,o],r>0),i=ae((()=>e(r+o)),[e,r,o],r+o<l);return b(t.Fragment,null,l>o&&b(t.Fragment,null,b("button",{className:"previous",disabled:0==r,onClick:s},"←"),b("button",{className:"next",disabled:r+o>=l,onClick:i},"→"),r+1," to ",Math.min(l,r+o)," of "),l," ",1!=l?n:a)};(class extends m{constructor(e){super(e),this.componentDidCatch=(e,t)=>console.error(e,t.componentStack),this.state={e:0}}render(){return this.state.e?b("span",{className:"warn"},"Inspector error: please see console for details."):this.props.children}}).getDerivedStateFromError=()=>({e:1});const we=e=>new Map(e);we(),we(),e.EditableCellView=pe,e.EditableValueView=ge,e.RelationshipInHtmlTable=({relationshipId:e,relationships:r,editable:o,customCells:a,className:n,headerRow:s,idColumn:i=!0})=>{const[d,u,c,m]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(t),null==e?void 0:e.getRemoteTableId(t)])(l.useRelationshipsOrRelationshipsById(r),e),h=ue([...oe(c,u),...oe(m,u)],a,o?pe:l.CellView),p=ne(i,h,c,m,e,d,u);return b("table",{className:n},!1===s?null:b("thead",null,b("tr",null,!1===i?null:b(t.Fragment,null,b("th",null,c,".Id"),b("th",null,m,".Id")),k(h,(({label:e},t)=>b("th",{key:t},e))))),b("tbody",null,v(l.useRowIds(c,u),(e=>b(he,{key:e,localRowId:e,params:p})))))},e.ResultSortedTableInHtmlTable=e=>{var t=e,{queryId:r,cellId:o,descending:a,offset:n,limit:s,queries:i,sortOnClick:d,paginator:u=!1,customCells:c,onChange:m}=t,h=_(t,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,g,f]=de(o,a,d,n,s,l.useResultRowCount(r,i),u,m);return b(ce,Z(Y({},h),{params:ne(ue(l.useResultTableCellIds(r,i),c,l.ResultCellView),ie(i,r),l.useResultSortedRowIds(r,...p,s,i),p,g,f)}))},e.ResultTableInHtmlTable=e=>{var t=e,{queryId:r,queries:o,customCells:a}=t,n=_(t,["queryId","queries","customCells"]);return b(ce,Z(Y({},n),{params:ne(ue(l.useResultTableCellIds(r,o),a,l.ResultCellView),ie(o,r),l.useResultRowIds(r,o))}))},e.SliceInHtmlTable=e=>{var t=e,{indexId:r,sliceId:o,indexes:a,editable:n,customCells:s}=t,i=_(t,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,c]=((e,t)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(t)])(l.useIndexesOrIndexesById(a),r);return b(ce,Z(Y({},i),{params:ne(ue(l.useTableCellIds(c,u),s,n?pe:l.CellView),se(u,c),l.useSliceRowIds(r,o,d))}))},e.SortedTableInHtmlTable=e=>{var t=e,{tableId:r,cellId:o,descending:a,offset:n,limit:s,store:i,editable:d,sortOnClick:u,paginator:c=!1,onChange:m,customCells:h}=t,p=_(t,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,w]=de(o,a,u,n,s,l.useRowCount(r,i),c,m);return b(ce,Z(Y({},p),{params:ne(ue(l.useTableCellIds(r,i),h,d?pe:l.CellView),se(i,r),l.useSortedRowIds(r,...g,s,i),g,f,w)}))},e.SortedTablePaginator=fe,e.StoreInspector=e=>null,e.TableInHtmlTable=e=>{var t=e,{tableId:r,store:o,editable:a,customCells:n}=t,s=_(t,["tableId","store","editable","customCells"]);return b(ce,Z(Y({},s),{params:ne(ue(l.useTableCellIds(r,o),n,a?pe:l.CellView),se(o,r),l.useRowIds(r,o))}))},e.ValuesInHtmlTable=({store:e,editable:t=!1,valueComponent:r=(t?ge:l.ValueView),getValueComponentProps:o,className:a,headerRow:n,idColumn:i})=>b("table",{className:a},!1===n?null:b("thead",null,b("tr",null,!1===i?null:b("th",null,"Id"),b("th",null,s))),b("tbody",null,v(l.useValueIds(e),(t=>b("tr",{key:t},!1===i?null:b("th",null,t),b("td",null,b(r,Z(Y({},y(o,t)),{valueId:t,store:e}))))))))},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDom={},e.React,e.TinyBaseUiReact);
|
|
1
|
+
var e,l;e=this,l=function(e,l,t){"use strict";const a=e=>typeof e,n=a(""),o=a(!0),r=a(0),i="Value",s="currentTarget",d="value",u=isFinite,c=e=>null==e,{PureComponent:m,Fragment:h,createElement:b,useCallback:p,useLayoutEffect:g,useRef:f,useState:w}=l,y=(e,...l)=>c(e)?{}:e(...l),v=(e,l)=>e.map(l),I=Object,C=(e=[])=>I.fromEntries(e),k=(e,l)=>v(I.entries(e),(([e,t])=>l(t,e))),x="tinybaseStoreInspector",T="M20 80l5-15l40-40l10 10l-40 40l-15 5m5-15l10 10",R='content:url("',O=R+"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' stroke-width='4' stroke='white' fill='none'>",S='</svg>")',N=R+"data:image/svg+xml,%3csvg viewBox='0 0 680 680' xmlns='http://www.w3.org/2000/svg' style='width:680px%3bheight:680px'%3e %3cpath stroke='white' stroke-width='80' fill='none' d='M340 617a84 241 90 11.01 0zM131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124zm-12-127a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e %3cpath fill='%23d81b60' d='M131 475a94 254 70 10428-124 114 286 70 01-428 124zm0-140a94 254 70 10428-124 114 286 70 01-428 124z' /%3e %3cpath d='M249 619a94 240 90 00308-128 114 289 70 01-308 128zM119 208a94 254 70 00306 38 90 260 90 01-306-38zm221 3a74 241 90 11.01 0z' /%3e%3c/svg%3e\")",V=v([[20,20,20,60],[20,20,60,20],[20,60,60,20],[60,20,20,60],[30,30,40,40]],(([e,l,t,a])=>O+`<rect x='20' y='20' width='60' height='60' fill='grey'/><rect x='${e}' y='${l}' width='${t}' height='${a}' fill='white'/>`+S)),j=O+"<path d='M20 20l60 60M20 80l60-60' />"+S,z=O+`<path d='${T}' />`+S,P=O+`<path d='${T}M20 20l60 60' />`+S;var $=Object.defineProperty,q=Object.defineProperties,M=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,F=(e,l,t)=>l in e?$(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,D=(e,l)=>{for(var t in l||(l={}))E.call(l,t)&&F(e,t,l[t]);if(B)for(var t of B(l))H.call(l,t)&&F(e,t,l[t]);return e},A=(e,l)=>q(e,M(l));const L="*::-webkit-scrollbar";((e,l="")=>{e.join(l)})(k(A(D(A(D(A(D({"":"all:initial;font-family:sans-serif;font-size:0.75rem;position:fixed;z-index:999999","*":"all:revert","*::before":"all:revert","*::after":"all:revert",[L]:"width:0.5rem;height:0.5rem;",[L+"-track"]:"background:#111",[L+"-thumb"]:"background:#999;border:1px solid #111",[L+"-thumb:hover"]:"background:#fff",[L+"-corner"]:"background:#111",img:"width:1rem;height:1rem;background:#111;border:0;vertical-align:text-bottom",">img":"padding:0.25rem;bottom:0;right:0;position:fixed;"+N},C(v(["bottom:0;left:0","top:0;right:0"],((e,l)=>[`>img[data-position='${l}']`,e])))),{main:"display:flex;flex-direction:column;background:#111d;color:#fff;position:fixed;"}),C(v(["bottom:0;left:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:30vh","bottom:0;left:0;width:100vw;height:30vh","top:0;right:0;width:35vw;height:100vh","top:0;right:0;width:100vw;height:100vh"],((e,l)=>[`main[data-position='${l}']`,e])))),{header:"display:flex;padding:0.25rem;background:#000;align-items:center","header>img:nth-of-type(1)":N,"header>img:nth-of-type(6)":j}),C(v(V,((e,l)=>[`header>img[data-id='${l}']`,e])))),{"header>span":"flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-left:0.25rem",article:"padding:0.25rem 0.25rem 0.25rem 0.5rem;overflow:auto;flex:1",details:"margin-left:0.75rem;width:fit-content;","details img":"display:none","details[open]>summary img":"display:unset;background:none;margin-left:0.25rem","details[open]>summary img.edit":z,"details[open]>summary img.done":P,summary:"margin-left:-0.75rem;line-height:1.25rem;user-select:none;width:fit-content",table:"border-collapse:collapse;table-layout:fixed;margin-bottom:0.5rem","table input":"background:#111;color:unset;padding:0 0.25rem;border:0;font-size:unset;vertical-align:top;margin:0",'table input[type="number"]':"width:4rem","table tbody button":"font-size:0;background:#fff;border-radius:50%;margin:0 0.125rem 0 0;width:0.85rem;color:#111","table button:first-letter":"font-size:0.75rem",thead:"background:#222","th:nth-of-type(1)":"min-width:2rem;","th.sorted":"background:#000","table caption":"text-align:left;white-space:nowrap;line-height:1.25rem",button:"width:1.5rem;border:none;background:none;color:#fff;padding:0","button[disabled]":"color:#777","button.next":"margin-right:0.5rem",[`th,#${x} td`]:"overflow:hidden;text-overflow:ellipsis;padding:0.25rem 0.5rem;max-width:12rem;white-space:nowrap;border-width:1px 0;border-style:solid;border-color:#777;text-align:left","span.warn":"margin:0.25rem;color:#d81b60"}),((e,l)=>e?`#${x} ${l}{${e}}`:"")));const U=(e,l,t,a)=>e==n?l:e==r?t:a;var G=Object.defineProperty,J=Object.defineProperties,K=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,Y=(e,l,t)=>l in e?G(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,Z=(e,l)=>{for(var t in l||(l={}))W.call(l,t)&&Y(e,t,l[t]);if(Q)for(var t of Q(l))X.call(l,t)&&Y(e,t,l[t]);return e},_=(e,l)=>J(e,K(l)),ee=(e,l)=>{var t={};for(var a in e)W.call(e,a)&&l.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&Q)for(var a of Q(e))l.indexOf(a)<0&&X.call(e,a)&&(t[a]=e[a]);return t};const{useCallback:le,useMemo:te,useState:ae}=l,ne="editable",oe=(e,l)=>v(t.useTableCellIds(e,l),(l=>e+"."+l)),re=(e,l,t)=>{const a=le(e,l);return t?a:void 0},ie=(...e)=>te((()=>e),e),se=(e,l)=>te((()=>({store:e,tableId:l})),[e,l]),de=(e,l)=>te((()=>({queries:e,queryId:l})),[e,l]),ue=(e,l=!1,t,a=0,n,o,r,i)=>{const[[s,d,u],c]=ae([e,l,a]),m=le((e=>{c(e),null==i||i(e)}),[i]),h=re((e=>m([e,e==s&&!d,u])),[m,s,d,u],t),p=le((e=>m([s,d,e])),[m,s,d]),g=!0===r?we:r;return[[s,d,u],h,te((()=>!1===r?null:b(g,{offset:u,limit:n,total:o,onChange:p})),[r,g,u,n,o,p])]},ce=(e,l,t)=>te((()=>{const o=null!=l?l:e;return C(k(Array.isArray(o)?C(v(o,(e=>[e,e]))):o,((e,l)=>{return[l,Z(Z({},{label:l,component:t}),(o=e,a(o)==n?{label:e}:e))];var o})))}),[l,t,e]),me=({className:e,headerRow:l,idColumn:t,params:[a,n,o,r,i,s]})=>b("table",{className:e},s?b("caption",null,s):null,!1===l?null:b("thead",null,b("tr",null,!1===t?null:b(he,{sort:null!=r?r:[],label:"Id",onClick:i}),k(a,(({label:e},l)=>b(he,{key:l,cellId:l,label:e,sort:null!=r?r:[],onClick:i}))))),b("tbody",null,v(o,(e=>b("tr",{key:e},!1===t?null:b("th",null,e),k(a,(({component:l,getComponentProps:t},a)=>b("td",{key:a},b(l,_(Z(Z({},y(t,e,a)),n),{rowId:e,cellId:a})))))))))),he=({cellId:e,sort:[l,t],label:a=(null!=e?e:""),onClick:n})=>b("th",{onClick:re((()=>null==n?void 0:n(e)),[n,e],n),className:c(t)||l!=e?void 0:`sorted ${t?"de":"a"}scending`},c(t)||l!=e?null:(t?"↓":"↑")+" ",a),be=({localRowId:e,params:[a,n,o,r,i,s,d]})=>{const u=t.useRemoteRowId(i,e,s);return b("tr",null,!1===a?null:b(l.Fragment,null,b("th",null,e),b("th",null,u)),k(n,(({component:l,getComponentProps:t},a)=>{const[n,i]=a.split(".",2),s=n===o?e:n===r?u:null;return c(s)?null:b("td",{key:a},b(l,_(Z({},y(t,s,i)),{store:d,tableId:n,rowId:s,cellId:i})))})))},pe=({thing:e,onThingChange:l,className:t,hasSchema:i,showType:c=!0})=>{const[m,h]=ae(),[p,g]=ae(),[f,w]=ae(),[y,v]=ae(),[I,C]=ae();p!==e&&(h((e=>{const l=a(e);return(e=>e==n||e==o)(l)||l==r&&u(e)?l:void 0})(e)),g(e),w(e+""),v(Number(e)||0),C(!!e));const k=le(((e,t)=>{t(e),g(e),l(e)}),[l]),x=le((()=>{if(!(null==i?void 0:i())){const e=U(m,r,o,n),t=U(e,f,y,I);h(e),g(t),l(t)}}),[i,l,f,y,I,m]);return b("div",{className:t},c?b("button",{className:m,onClick:x},m):null,U(m,b("input",{key:m,value:f,onChange:le((e=>k(e[s][d]+"",w)),[k])}),b("input",{key:m,type:"number",value:y,onChange:le((e=>k(Number(e[s][d]||0),v)),[k])}),b("input",{key:m,type:"checkbox",checked:I,onChange:le((e=>k(!!e[s].checked,C)),[k])})))},ge=({tableId:e,rowId:l,cellId:a,store:n,className:o,showType:r})=>{var i;return b(pe,{thing:t.useCell(e,l,a,n),onThingChange:t.useSetCellCallback(e,l,a,(e=>e),[],n),className:null!=o?o:ne+"Cell",showType:r,hasSchema:null==(i=t.useStoreOrStoreById(n))?void 0:i.hasTablesSchema})},fe=({valueId:e,store:l,className:a,showType:n})=>{var o;return b(pe,{thing:t.useValue(e,l),onThingChange:t.useSetValueCallback(e,(e=>e),[],l),className:null!=a?a:ne+i,showType:n,hasSchema:null==(o=t.useStoreOrStoreById(l))?void 0:o.hasValuesSchema})},we=({onChange:e,total:t,offset:a=0,limit:n=t,singular:o="row",plural:r=o+"s"})=>{(a>t||a<0)&&(a=0,e(0));const i=re((()=>e(a-n)),[e,a,n],a>0),s=re((()=>e(a+n)),[e,a,n],a+n<t);return b(l.Fragment,null,t>n&&b(l.Fragment,null,b("button",{className:"previous",disabled:0==a,onClick:i},"←"),b("button",{className:"next",disabled:a+n>=t,onClick:s},"→"),a+1," to ",Math.min(t,a+n)," of "),t," ",1!=t?r:o)},ye=e=>new Map(e);ye(),ye(),e.EditableCellView=ge,e.EditableValueView=fe,e.RelationshipInHtmlTable=({relationshipId:e,relationships:a,editable:n,customCells:o,className:r,headerRow:i,idColumn:s=!0})=>{const[d,u,c,m]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(l),null==e?void 0:e.getRemoteTableId(l)])(t.useRelationshipsOrRelationshipsById(a),e),h=ce([...oe(c,u),...oe(m,u)],o,n?ge:t.CellView),p=ie(s,h,c,m,e,d,u);return b("table",{className:r},!1===i?null:b("thead",null,b("tr",null,!1===s?null:b(l.Fragment,null,b("th",null,c,".Id"),b("th",null,m,".Id")),k(h,(({label:e},l)=>b("th",{key:l},e))))),b("tbody",null,v(t.useRowIds(c,u),(e=>b(be,{key:e,localRowId:e,params:p})))))},e.ResultSortedTableInHtmlTable=e=>{var l=e,{queryId:a,cellId:n,descending:o,offset:r,limit:i,queries:s,sortOnClick:d,paginator:u=!1,customCells:c,onChange:m}=l,h=ee(l,["queryId","cellId","descending","offset","limit","queries","sortOnClick","paginator","customCells","onChange"]);const[p,g,f]=ue(n,o,d,r,i,t.useResultRowCount(a,s),u,m);return b(me,_(Z({},h),{params:ie(ce(t.useResultTableCellIds(a,s),c,t.ResultCellView),de(s,a),t.useResultSortedRowIds(a,...p,i,s),p,g,f)}))},e.ResultTableInHtmlTable=e=>{var l=e,{queryId:a,queries:n,customCells:o}=l,r=ee(l,["queryId","queries","customCells"]);return b(me,_(Z({},r),{params:ie(ce(t.useResultTableCellIds(a,n),o,t.ResultCellView),de(n,a),t.useResultRowIds(a,n))}))},e.SliceInHtmlTable=e=>{var l=e,{indexId:a,sliceId:n,indexes:o,editable:r,customCells:i}=l,s=ee(l,["indexId","sliceId","indexes","editable","customCells"]);const[d,u,c]=((e,l)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(l)])(t.useIndexesOrIndexesById(o),a);return b(me,_(Z({},s),{params:ie(ce(t.useTableCellIds(c,u),i,r?ge:t.CellView),se(u,c),t.useSliceRowIds(a,n,d))}))},e.SortedTableInHtmlTable=e=>{var l=e,{tableId:a,cellId:n,descending:o,offset:r,limit:i,store:s,editable:d,sortOnClick:u,paginator:c=!1,onChange:m,customCells:h}=l,p=ee(l,["tableId","cellId","descending","offset","limit","store","editable","sortOnClick","paginator","onChange","customCells"]);const[g,f,w]=ue(n,o,u,r,i,t.useRowCount(a,s),c,m);return b(me,_(Z({},p),{params:ie(ce(t.useTableCellIds(a,s),h,d?ge:t.CellView),se(s,a),t.useSortedRowIds(a,...g,i,s),g,f,w)}))},e.SortedTablePaginator=we,e.StoreInspector=e=>null,e.TableInHtmlTable=e=>{var l=e,{tableId:a,store:n,editable:o,customCells:r}=l,i=ee(l,["tableId","store","editable","customCells"]);return b(me,_(Z({},i),{params:ie(ce(t.useTableCellIds(a,n),r,o?ge:t.CellView),se(n,a),t.useRowIds(a,n))}))},e.ValuesInHtmlTable=({store:e,editable:l=!1,valueComponent:a=(l?fe:t.ValueView),getValueComponentProps:n,className:o,headerRow:r,idColumn:s})=>b("table",{className:o},!1===r?null:b("thead",null,b("tr",null,!1===s?null:b("th",null,"Id"),b("th",null,i))),b("tbody",null,v(t.useValueIds(e),(l=>b("tr",{key:l},!1===s?null:b("th",null,l),b("td",null,b(a,_(Z({},y(n,l)),{valueId:l,store:e}))))))))},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("react"),require("./ui-react")):"function"==typeof define&&define.amd?define(["exports","react","./ui-react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDom={},e.React,e.TinyBaseUiReact);
|
|
Binary file
|
package/lib/umd-es6/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Listener",u="Result",n="Ids",d="Table",i=d+"s",a=d+n,c="Row",I=c+"Count",p=c+n,C="Sorted"+c+n,b="Cell",w=b+n,R="Value",k=R+"s",v=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},L=(e,s)=>e.map(s),f=Object.keys,{createContext:S,useContext:V}=s,T=S([]),x=(e,s)=>{var t;const o=V(T);return g(e)?o[s]:y(e)?((e,s)=>h(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},P=(e,s)=>{const t=x(e,s);return g(e)||y(e)?t:e},O=e=>{var s;return f(null!=(s=V(T)[e])?s:{})},q=e=>P(e,0),B=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),j=e=>P(e,8),F=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],l)=>{const[,r]=z(),u=A((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=z(u),d=W(n);return U((()=>d.current=u()),[u]),K(e,s,((...e)=>{d.current=g(l)?u():e[l],r([])}),[],o),d.current},K=(e,s,t,o=[],l=[],...u)=>G((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),N=(e,s,t,o=[],l=m,r=[],...u)=>{const n=q(e);return A((e=>h(n,(o=>h(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},X=(e,s,t=m,o=[],...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Y=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},Z=e=>J(a,q(e),[],[]),$=(e,s)=>J(p,q(s),[],[e]),_=(e,s,t,o=0,l,r)=>J(C,q(r),[],[e,s,t,o,l],6),ee=(e,s,t)=>J(w,q(t),[],[e,s]),se=(e,s,t,o)=>J(b,q(o),void 0,[e,s,t],4),te=e=>J(v,q(e),[],[]),oe=(e,s)=>J(R,q(s),void 0,[e]),le=(e,s)=>J("Metric",B(s),void 0,[e]),re=(e,s)=>J("SliceIds",M(s),[],[e]),ue=(e,s,t)=>J("Slice"+p,M(t),[],[e,s]),ne=(e,s,t)=>J("RemoteRowId",D(t),void 0,[e,s]),de=(e,s,t)=>J("Local"+p,D(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+p,D(t),[],[e,s]),ae=(e,s)=>J(u+p,j(s),[],[e]),ce=(e,s,t,o=0,l,r)=>J(u+C,j(r),[],[e,s,t,o,l],6),Ie=(e,s,t)=>J(u+w,j(t),[],[e,s]),pe=(e,s,t,o)=>J(u+b,j(o),void 0,[e,s,t]),Ce=e=>J("CheckpointIds",F(e),[[],void 0,[]]),be=(e,s)=>J("Checkpoint",F(s),void 0,[e]),we=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ve,createElement:ge,useCallback:he,useLayoutEffect:ye,useRef:me,useState:Le}=s,fe=(e,...s)=>g(e)?{}:e(...s),Se=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ve=Object.defineProperty,Te=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Be=(e,s,t)=>s in e?Ve(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Me=(e,s)=>{for(var t in s||(s={}))Oe.call(s,t)&&Be(e,t,s[t]);if(Pe)for(var t of Pe(s))qe.call(s,t)&&Be(e,t,s[t]);return e},De=(e,s)=>Te(e,xe(s)),je=(e,s)=>{var t={};for(var o in e)Oe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Pe)for(var o of Pe(e))s.indexOf(o)<0&&qe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=s,Qe=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ue(L(n,(r=>ge(t,De(Me({},fe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Ee=({queryId:e,queries:s,resultRowComponent:t=Xe,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ue(L(u,(l=>ge(t,De(Me({},fe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ae=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Se(D(s),e),c=u(e,n,d);return Ue(L(c,(e=>ge(t,De(Me({},fe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ge=e=>({checkpoints:s,checkpointComponent:t=Ye,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Ue(L(e(Ce(u)),(e=>ge(t,De(Me({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ue=(e,s,t,o)=>{const l=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},We=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=se(e,s,t,l))?u:o),void 0,r,t)},ze=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ue(L(((e,s,t,o)=>{const l=ee(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),He=e=>Qe(e,$(e.tableId,e.store)),Je=({valueId:e,store:s,debugIds:t})=>{var l;return Ue(o+(null!=(l=oe(e,s))?l:o),void 0,t,e)},Ke=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(M(t),e),a=ue(e,s,n);return Ue(L(a,(e=>ge(o,De(Me({},fe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ne=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=pe(e,s,t,l))?u:o),void 0,r,t)},Xe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ne,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ue(L(Ie(e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ye=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ue(null!=(l=be(s,e))?l:o,void 0,t,s)},Ze=Ge((e=>e[0])),$e=Ge((e=>g(e[1])?[]:[e[1]])),_e=Ge((e=>e[2]));e.BackwardCheckpointsView=Ze,e.CellView=We,e.CheckpointView=Ye,e.CurrentCheckpointView=$e,e.ForwardCheckpointsView=_e,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ke,getSliceComponentProps:o,separator:l,debugIds:r})=>Ue(L(re(e,s),(l=>ge(t,De(Me({},fe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ae(e,ie,e.firstRowId),e.LocalRowsView=e=>Ae(e,de,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ue(null!=(l=le(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(T);return ge(T.Provider,{value:Fe((()=>[null!=e?e:C[0],Me(Me({},C[1]),t),null!=o?o:C[2],Me(Me({},C[3]),l),null!=r?r:C[4],Me(Me({},C[5]),u),null!=n?n:C[6],Me(Me({},C[7]),d),null!=i?i:C[8],Me(Me({},C[9]),a),null!=c?c:C[10],Me(Me({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Se(D(t),e),i=ne(e,s,u);return Ue(g(d)||g(i)?null:ge(o,De(Me({},fe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ne,e.ResultRowView=Xe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Ee(u,ce(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Ee(e,ae(e.queryId,e.queries)),e.RowView=ze,e.SliceView=Ke,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Qe(u,_(u.tableId,t,o,l,r,u.store))},e.TableView=He,e.TablesView=({store:e,tableComponent:s=He,getTableComponentProps:t,separator:o,debugIds:l})=>Ue(L(Z(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Je,e.ValuesView=({store:e,valueComponent:s=Je,getValueComponentProps:t,separator:o,debugIds:l})=>Ue(L(te(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=q(o);return A((t=>h(n,(o=>h(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,l,r)=>K(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>K(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=be,e.useCheckpointIds=Ce,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=z(),u=U((()=>s(e)),[e,...t]);return G((()=>{var e;return e=function*(){yield null==o?void 0:o(u),r(1)},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{null==u||u.destroy()}}),[u,...l]),u},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>X(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>X(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=we,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>J("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,l)=>K("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=de,e.useLocalRowIdsListener=(e,s,t,o,l)=>K("Local"+p,D(l),t,o,[e,s]),e.useMetric=le,e.useMetricIds=e=>J("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>O(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>O(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>J("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=Ce(t);return[!g(l),Re(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>J("RelationshipIds",D(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ne,e.useRemoteRowIdListener=(e,s,t,o,l)=>K("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=pe,e.useResultCellIds=Ie,e.useResultCellIdsListener=(e,s,t,o,l)=>K(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>K(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>J(u+c,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(u+I,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(u+I,j(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>K(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=ce,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>K(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>J(u+d,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(u+d+w,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>J(c,q(t),{},[e,s]),e.useRowCount=(e,s)=>J(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>K(I,q(l),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,l)=>K(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>K(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>N(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>N(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>N(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>N(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>N(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>N(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>N(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>N(t,k,e,s,o,l),e.useSliceIds=re,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ue,e.useSliceRowIdsListener=(e,s,t,o,l)=>K("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>K(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>J(d,q(s),{},[e]),e.useTableCellIds=(e,s)=>J(d+w,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>K(d+w,q(l),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>K(d,q(l),s,t,[e],o),e.useTables=e=>J(i,q(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,q(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=Ce(t);return[(u=l,!(0==u.length)),we(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(v,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>K(R,q(l),s,t,[e],o),e.useValues=e=>J(k,q(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,q(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,q(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,o="",l=t(o),r="Listener",u="Result",n="Ids",d="Table",i=d+"s",a=d+n,c="Row",I=c+"Count",p=c+n,C="Sorted"+c+n,b="Cell",w=b+n,R="Value",k=R+"s",v=R+n,g=e=>null==e,h=(e,s,t)=>g(e)?null==t?void 0:t():s(e),y=e=>t(e)==l,m=()=>{},L=(e,s)=>e.map(s),f=Object.keys,{createContext:S,useContext:V}=s,T=S([]),x=(e,s)=>{var t;const o=V(T);return g(e)?o[s]:y(e)?((e,s)=>h(e,(e=>e[s])))(null!=(t=o[s+1])?t:{},e):e},P=(e,s)=>{const t=x(e,s);return g(e)||y(e)?t:e},O=e=>{var s;return f(null!=(s=V(T)[e])?s:{})},q=e=>P(e,0),B=e=>P(e,2),M=e=>P(e,4),D=e=>P(e,6),j=e=>P(e,8),F=e=>P(e,10),Q=e=>e.toLowerCase();Q(r);const E="Transaction";Q(E);const{useCallback:A,useEffect:G,useMemo:U,useRef:W,useState:z}=s,H=(e,s,t=[])=>{const o=U((()=>s(e)),[e,...t]);return G((()=>()=>o.destroy()),[o]),o},J=(e,s,t,o=[],l)=>{const[,r]=z(),u=A((()=>{var l,r;return null!=(r=null==(l=null==s?void 0:s["get"+e])?void 0:l.call(s,...o))?r:t}),[s,...o]),[n]=z(u),d=W(n);return U((()=>d.current=u()),[u]),K(e,s,((...e)=>{d.current=g(l)?u():e[l],r([])}),[],o),d.current},K=(e,s,t,o=[],l=[],...u)=>G((()=>{var o;const n=null==(o=null==s?void 0:s["add"+e+r])?void 0:o.call(s,...l,t,...u);return()=>null==s?void 0:s.delListener(n)}),[s,...l,...o,...u]),N=(e,s,t,o=[],l=m,r=[],...u)=>{const n=q(e);return A((e=>h(n,(o=>h(t(e,o),(e=>l(o["set"+s](...u,e),e)))))),[n,s,...o,...r,...u])},X=(e,s,t=m,o=[],...l)=>{const r=q(e);return A((()=>t(null==r?void 0:r["del"+s](...l))),[r,s,...o,...l])},Y=(e,s,t)=>{const o=F(e);return A((()=>null==o?void 0:o[s](t)),[o,s,t])},Z=e=>J(a,q(e),[],[]),$=(e,s)=>J(p,q(s),[],[e]),_=(e,s,t,o=0,l,r)=>J(C,q(r),[],[e,s,t,o,l],6),ee=(e,s,t)=>J(w,q(t),[],[e,s]),se=(e,s,t,o)=>J(b,q(o),void 0,[e,s,t],4),te=e=>J(v,q(e),[],[]),oe=(e,s)=>J(R,q(s),void 0,[e]),le=(e,s)=>J("Metric",B(s),void 0,[e]),re=(e,s)=>J("SliceIds",M(s),[],[e]),ue=(e,s,t)=>J("Slice"+p,M(t),[],[e,s]),ne=(e,s,t)=>J("RemoteRowId",D(t),void 0,[e,s]),de=(e,s,t)=>J("Local"+p,D(t),[],[e,s]),ie=(e,s,t)=>J("Linked"+p,D(t),[],[e,s]),ae=(e,s)=>J(u+p,j(s),[],[e]),ce=(e,s,t,o=0,l,r)=>J(u+C,j(r),[],[e,s,t,o,l],6),Ie=(e,s,t)=>J(u+w,j(t),[],[e,s]),pe=(e,s,t,o)=>J(u+b,j(o),void 0,[e,s,t]),Ce=e=>J("CheckpointIds",F(e),[[],void 0,[]]),be=(e,s)=>J("Checkpoint",F(s),void 0,[e]),we=e=>Y(e,"goBackward"),Re=e=>Y(e,"goForward"),{PureComponent:ke,Fragment:ve,createElement:ge,useCallback:he,useLayoutEffect:ye,useRef:me,useState:Le}=s,fe=(e,...s)=>g(e)?{}:e(...s),Se=(e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getLocalTableId(s),null==e?void 0:e.getRemoteTableId(s)];var Ve=Object.defineProperty,Te=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,Be=(e,s,t)=>s in e?Ve(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,Me=(e,s)=>{for(var t in s||(s={}))Oe.call(s,t)&&Be(e,t,s[t]);if(Pe)for(var t of Pe(s))qe.call(s,t)&&Be(e,t,s[t]);return e},De=(e,s)=>Te(e,xe(s)),je=(e,s)=>{var t={};for(var o in e)Oe.call(e,o)&&s.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&Pe)for(var o of Pe(e))s.indexOf(o)<0&&qe.call(e,o)&&(t[o]=e[o]);return t};const{useMemo:Fe}=s,Qe=({tableId:e,store:s,rowComponent:t=ze,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:u},n)=>Ue(L(n,(r=>ge(t,De(Me({},fe(o,r)),{key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:u})))),r,u,e),Ee=({queryId:e,queries:s,resultRowComponent:t=Xe,getResultRowComponentProps:o,separator:l,debugIds:r},u)=>Ue(L(u,(l=>ge(t,De(Me({},fe(o,l)),{key:l,queryId:e,rowId:l,queries:s,debugIds:r})))),l,r,e),Ae=({relationshipId:e,relationships:s,rowComponent:t=ze,getRowComponentProps:o,separator:l,debugIds:r},u,n)=>{const[d,i,a]=Se(D(s),e),c=u(e,n,d);return Ue(L(c,(e=>ge(t,De(Me({},fe(o,e)),{key:e,tableId:a,rowId:e,store:i,debugIds:r})))),l,r,n)},Ge=e=>({checkpoints:s,checkpointComponent:t=Ye,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const u=F(s);return Ue(L(e(Ce(u)),(e=>ge(t,De(Me({},fe(o,e)),{key:e,checkpoints:u,checkpointId:e,debugIds:r})))),l)},Ue=(e,s,t,o)=>{const l=g(s)||!Array.isArray(e)?e:L(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},We=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=se(e,s,t,l))?u:o),void 0,r,t)},ze=({tableId:e,rowId:s,store:t,cellComponent:o=We,getCellComponentProps:l,customCellIds:r,separator:u,debugIds:n})=>Ue(L(((e,s,t,o)=>{const l=ee(s,t,o);return null!=e?e:l})(r,e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:n})))),u,n,s),He=e=>Qe(e,$(e.tableId,e.store)),Je=({valueId:e,store:s,debugIds:t})=>{var l;return Ue(o+(null!=(l=oe(e,s))?l:o),void 0,t,e)},Ke=({indexId:e,sliceId:s,indexes:t,rowComponent:o=ze,getRowComponentProps:l,separator:r,debugIds:u})=>{const[n,d,i]=((e,s)=>[e,null==e?void 0:e.getStore(),null==e?void 0:e.getTableId(s)])(M(t),e),a=ue(e,s,n);return Ue(L(a,(e=>ge(o,De(Me({},fe(l,e)),{key:e,tableId:i,rowId:e,store:d,debugIds:u})))),r,u,s)},Ne=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>{var u;return Ue(o+(null!=(u=pe(e,s,t,l))?u:o),void 0,r,t)},Xe=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Ne,getResultCellComponentProps:l,separator:r,debugIds:u})=>Ue(L(Ie(e,s,t),(r=>ge(o,De(Me({},fe(l,r)),{key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:u})))),r,u,s),Ye=({checkpoints:e,checkpointId:s,debugIds:t})=>{var l;return Ue(null!=(l=be(s,e))?l:o,void 0,t,s)},Ze=Ge((e=>e[0])),$e=Ge((e=>g(e[1])?[]:[e[1]])),_e=Ge((e=>e[2]));e.BackwardCheckpointsView=Ze,e.CellView=We,e.CheckpointView=Ye,e.CurrentCheckpointView=$e,e.ForwardCheckpointsView=_e,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=Ke,getSliceComponentProps:o,separator:l,debugIds:r})=>Ue(L(re(e,s),(l=>ge(t,De(Me({},fe(o,l)),{key:l,indexId:e,sliceId:l,indexes:s,debugIds:r})))),l,r,e),e.LinkedRowsView=e=>Ae(e,ie,e.firstRowId),e.LocalRowsView=e=>Ae(e,de,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>{var l;return Ue(null!=(l=le(e,s))?l:o,void 0,t,e)},e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:u,relationships:n,relationshipsById:d,queries:i,queriesById:a,checkpoints:c,checkpointsById:I,children:p})=>{const C=s.useContext(T);return ge(T.Provider,{value:Fe((()=>[null!=e?e:C[0],Me(Me({},C[1]),t),null!=o?o:C[2],Me(Me({},C[3]),l),null!=r?r:C[4],Me(Me({},C[5]),u),null!=n?n:C[6],Me(Me({},C[7]),d),null!=i?i:C[8],Me(Me({},C[9]),a),null!=c?c:C[10],Me(Me({},C[11]),I)]),[e,t,o,l,r,u,n,d,i,a,c,I,C])},p)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=ze,getRowComponentProps:l,debugIds:r})=>{const[u,n,,d]=Se(D(t),e),i=ne(e,s,u);return Ue(g(d)||g(i)?null:ge(o,De(Me({},fe(l,i)),{key:i,tableId:d,rowId:i,store:n,debugIds:r})),void 0,r,s)},e.ResultCellView=Ne,e.ResultRowView=Xe,e.ResultSortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Ee(u,ce(u.queryId,t,o,l,r,u.queries))},e.ResultTableView=e=>Ee(e,ae(e.queryId,e.queries)),e.RowView=ze,e.SliceView=Ke,e.SortedTableView=e=>{var s=e,{cellId:t,descending:o,offset:l,limit:r}=s,u=je(s,["cellId","descending","offset","limit"]);return Qe(u,_(u.tableId,t,o,l,r,u.store))},e.TableView=He,e.TablesView=({store:e,tableComponent:s=He,getTableComponentProps:t,separator:o,debugIds:l})=>Ue(L(Z(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,tableId:o,store:e,debugIds:l})))),o),e.ValueView=Je,e.ValuesView=({store:e,valueComponent:s=Je,getValueComponentProps:t,separator:o,debugIds:l})=>Ue(L(te(e),(o=>ge(s,De(Me({},fe(t,o)),{key:o,valueId:o,store:e,debugIds:l})))),o),e.useAddRowCallback=(e,s,t=[],o,l=m,r=[],u=!0)=>{const n=q(o);return A((t=>h(n,(o=>h(s(t,o),(s=>l(o.addRow(e,s,u),o,s)))))),[n,e,...t,...r,u])},e.useCell=se,e.useCellIds=ee,e.useCellIdsListener=(e,s,t,o,l,r)=>K(w,q(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,u)=>K(b,q(u),o,l,[e,s,t],r),e.useCheckpoint=be,e.useCheckpointIds=Ce,e.useCheckpointIdsListener=(e,s,t)=>K("CheckpointIds",F(t),e,s),e.useCheckpointListener=(e,s,t,o)=>K("Checkpoint",F(o),s,t,[e]),e.useCheckpoints=e=>x(e,10),e.useCheckpointsIds=()=>O(11),e.useCheckpointsOrCheckpointsById=F,e.useCreateCheckpoints=(e,s,t)=>H(e,s,t),e.useCreateIndexes=(e,s,t)=>H(e,s,t),e.useCreateMetrics=(e,s,t)=>H(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[],r,u=[])=>{const[,n]=z(),d=U((()=>s(e)),[e,...t]);return G((()=>{var e;return e=function*(){o&&(yield o(d),n([]))},new Promise(((s,t)=>{var o=s=>{try{r(e.next(s))}catch(e){t(e)}},l=s=>{try{r(e.throw(s))}catch(e){t(e)}},r=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,l);r((e=e.apply(void 0,null)).next())})),()=>{null==d||d.destroy(),null==r||r(d)}}),[d,...l,...u]),d},e.useCreateQueries=(e,s,t)=>H(e,s,t),e.useCreateRelationships=(e,s,t)=>H(e,s,t),e.useCreateStore=(e,s=[])=>U(e,s),e.useDelCellCallback=(e,s,t,o,l,r,u)=>X(l,b,r,u,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>X(t,c,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>X(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>X(e,i,s,t),e.useDelValueCallback=(e,s,t,o)=>X(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>X(e,k,s,t),e.useDidFinishTransactionListener=(e,s,t)=>K("DidFinish"+E,q(t),e,s),e.useGoBackwardCallback=we,e.useGoForwardCallback=Re,e.useGoToCallback=(e,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>h(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexIds=e=>J("IndexIds",M(e),[]),e.useIndexes=e=>x(e,4),e.useIndexesIds=()=>O(5),e.useIndexesOrIndexesById=M,e.useLinkedRowIds=ie,e.useLinkedRowIdsListener=(e,s,t,o,l)=>K("Linked"+p,D(l),t,o,[e,s]),e.useLocalRowIds=de,e.useLocalRowIdsListener=(e,s,t,o,l)=>K("Local"+p,D(l),t,o,[e,s]),e.useMetric=le,e.useMetricIds=e=>J("MetricIds",B(e),[]),e.useMetricListener=(e,s,t,o)=>K("Metric",B(o),s,t,[e]),e.useMetrics=e=>x(e,2),e.useMetricsIds=()=>O(3),e.useMetricsOrMetricsById=B,e.useQueries=e=>x(e,8),e.useQueriesIds=()=>O(9),e.useQueriesOrQueriesById=j,e.useQueryIds=e=>J("QueryIds",j(e),[]),e.useRedoInformation=e=>{var s;const t=F(e),[,,[l]]=Ce(t);return[!g(l),Re(t),l,null!=(s=h(l,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o]},e.useRelationshipIds=e=>J("RelationshipIds",D(e),[]),e.useRelationships=e=>x(e,6),e.useRelationshipsIds=()=>O(7),e.useRelationshipsOrRelationshipsById=D,e.useRemoteRowId=ne,e.useRemoteRowIdListener=(e,s,t,o,l)=>K("RemoteRowId",D(l),t,o,[e,s]),e.useResultCell=pe,e.useResultCellIds=Ie,e.useResultCellIdsListener=(e,s,t,o,l)=>K(u+w,j(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>K(u+b,j(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>J(u+c,j(t),{},[e,s]),e.useResultRowCount=(e,s)=>J(u+I,j(s),[],[e]),e.useResultRowCountListener=(e,s,t,o)=>K(u+I,j(o),s,t,[e]),e.useResultRowIds=ae,e.useResultRowIdsListener=(e,s,t,o)=>K(u+p,j(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>K(u+c,j(l),t,o,[e,s]),e.useResultSortedRowIds=ce,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,n,d)=>K(u+C,j(d),r,n,[e,s,t,o,l]),e.useResultTable=(e,s)=>J(u+d,j(s),{},[e]),e.useResultTableCellIds=(e,s)=>J(u+d+w,j(s),[],[e]),e.useResultTableCellIdsListener=(e,s,t,o)=>K(u+d+w,j(o),s,t,[e]),e.useResultTableListener=(e,s,t,o)=>K(u+d,j(o),s,t,[e]),e.useRow=(e,s,t)=>J(c,q(t),{},[e,s]),e.useRowCount=(e,s)=>J(I,q(s),[],[e]),e.useRowCountListener=(e,s,t,o,l)=>K(I,q(l),s,t,[e],o),e.useRowIds=$,e.useRowIdsListener=(e,s,t,o,l)=>K(p,q(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>K(c,q(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,u,n)=>N(r,b,o,l,u,n,e,s,t),e.useSetCheckpointCallback=(e=m,s=[],t,o=m,l=[])=>{const r=F(t);return A((s=>h(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,u)=>N(l,"PartialRow",t,o,r,u,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>N(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,u)=>N(l,c,t,o,r,u,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>N(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>N(t,i,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>N(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>N(t,k,e,s,o,l),e.useSliceIds=re,e.useSliceIdsListener=(e,s,t,o)=>K("SliceIds",M(o),s,t,[e]),e.useSliceRowIds=ue,e.useSliceRowIdsListener=(e,s,t,o,l)=>K("Slice"+p,M(l),t,o,[e,s]),e.useSortedRowIds=_,e.useSortedRowIdsListener=(e,s,t,o,l,r,u,n,d)=>K(C,q(d),r,u,[e,s,t,o,l],n),e.useStartTransactionListener=(e,s,t)=>K("Start"+E,q(t),e,s),e.useStore=e=>x(e,0),e.useStoreIds=()=>O(1),e.useStoreOrStoreById=q,e.useTable=(e,s)=>J(d,q(s),{},[e]),e.useTableCellIds=(e,s)=>J(d+w,q(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>K(d+w,q(l),s,t,[e],o),e.useTableIds=Z,e.useTableIdsListener=(e,s,t,o)=>K(a,q(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>K(d,q(l),s,t,[e],o),e.useTables=e=>J(i,q(e),{}),e.useTablesListener=(e,s,t,o)=>K(i,q(o),e,s,[],t),e.useUndoInformation=e=>{var s;const t=F(e),[l,r]=Ce(t);return[(u=l,!(0==u.length)),we(t),r,null!=(s=h(r,(e=>null==t?void 0:t.getCheckpoint(e))))?s:o];var u},e.useValue=oe,e.useValueIds=te,e.useValueIdsListener=(e,s,t,o)=>K(v,q(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>K(R,q(l),s,t,[e],o),e.useValues=e=>J(k,q(e),{}),e.useValuesListener=(e,s,t,o)=>K(k,q(o),e,s,[],t),e.useWillFinishTransactionListener=(e,s,t)=>K("WillFinish"+E,q(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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.19",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"@types/less": "^3.0.5",
|
|
231
231
|
"@types/node": "^20.8.7",
|
|
232
232
|
"@types/puppeteer": "^5.4.7",
|
|
233
|
-
"@types/react": "^18.2.
|
|
233
|
+
"@types/react": "^18.2.31",
|
|
234
234
|
"@types/react-dom": "^18.2.14",
|
|
235
235
|
"@types/react-test-renderer": "^18.0.5",
|
|
236
236
|
"@types/tmp": "^0.2.5",
|
|
@@ -248,9 +248,9 @@
|
|
|
248
248
|
"country-flag-emoji-json": "^2.0.0",
|
|
249
249
|
"cspell": "^7.3.8",
|
|
250
250
|
"esbuild": "^0.19.5",
|
|
251
|
-
"eslint": "^8.
|
|
251
|
+
"eslint": "^8.52.0",
|
|
252
252
|
"eslint-config-prettier": "^9.0.0",
|
|
253
|
-
"eslint-plugin-jest": "^27.4.
|
|
253
|
+
"eslint-plugin-jest": "^27.4.3",
|
|
254
254
|
"eslint-plugin-jsdoc": "^46.8.2",
|
|
255
255
|
"eslint-plugin-react": "7.33.2",
|
|
256
256
|
"eslint-plugin-react-hooks": "^4.6.0",
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-3"><em>NEW!</em> v4.3 release</a> <span id="one-with">"The One With PartyKit"</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><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app's data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions & ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">4.8kB - 9.2kB</a>, zero dependencies. <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>!</li></ul><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/sqlite.svg"> SQLite</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/4.3.
|
|
1
|
+
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p id="copy">Build blisteringly fast web apps that work both online and offline. Manage your state locally, synchronize it to the cloud when you need to, or even make it collaborative. But, most importantly... have fun building stuff again!</p></section><p><a href="https://tinybase.org/guides/releases/#v4-3"><em>NEW!</em> v4.3 release</a> <span id="one-with">"The One With PartyKit"</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><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model your app's data structures.</li><li><a href="#register-granular-listeners">Flexibly reactive</a> to reconciled updates, so you only spend rendering cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively - and without SQL.</li><li>Built-in <a href="#create-indexes-for-fast-lookups">indexing</a>, <a href="#define-metrics-and-aggregations">metric aggregation</a>, <a href="#model-table-relationships">tabular relationships</a> - and even an <a href="#set-checkpoints-for-an-undo-stack">undo stack</a> for your app state.</li><li>Create <a href="#type-definitions-orm-like-apis">type definitions & ORM-like APIs</a>, from schema or inference. <a href="#an-inspector-for-your-data">Inspect your data</a> (<em>new!</em>) directly in the browser.</li><li>Easily <a href="#persist-to-storage-sqlite-crdts">sync your data</a> to browser <a href="https://tinybase.org/api/persister-browser">storage</a>, <a href="https://tinybase.org/api/persister-indexed-db/">IndexedDB</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/database-persistence/">SQLite</a>, <a href="https://tinybase.org/guides/schemas-and-persistence/synchronizing-data/">CRDTs</a>, and (<em>new!</em>) <a href="https://tinybase.org/api/persister-partykit-client/">PartyKit</a>.</li><li>Optional <a href="#call-hooks-to-bind-to-data">bindings to React</a> and (<em>new!</em>) <a href="#pre-built-reactive-components">pre-built components</a> that let you easily build fully reactive user interfaces.</li><li>Tiny by name, tiny by nature: <a href="#did-we-say-tiny">4.8kB - 9.2kB</a>, zero dependencies. <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>!</li></ul><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/sqlite.svg"> SQLite</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/4.3.19" 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
|
const store = createStore()
|
|
@@ -247,4 +247,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
247
247
|
};
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
<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>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.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 width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.8kB</td><td>11.4kB</td><td>48.6kB</td><td>220.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.0kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.1kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>127.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.4kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.5kB</td><td>5.2kB</td><td>43.5kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>9.2kB</td><td>22.6kB</td><td>97.6kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,
|
|
250
|
+
<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>4.8kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>9.2kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.9kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.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 width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.8kB</td><td>11.4kB</td><td>48.6kB</td><td>220.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>15.2kB</td><td>30.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.8kB</td><td>17.0kB</td><td>35.6kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.9kB</td><td>3.7kB</td><td>17.1kB</td><td>44.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.8kB</td><td>5.7kB</td><td>25.6kB</td><td>127.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.4kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.8kB</td><td>1.5kB</td><td>5.2kB</td><td>43.5kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>9.2kB</td><td>22.6kB</td><td>97.6kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,884</td><td>1,884</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>2,039</td><td>2,039</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>812</td><td>812</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>695</td><td>695</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,402</td></tr><tr><th class="right">Assertions</th><td colspan="3">15,316</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/expo" target="_blank"><img title="expo" src="https://github.com/expo.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/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/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/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/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/nikitavoloboev" target="_blank"><img title="nikitavoloboev" src="https://github.com/nikitavoloboev.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></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>
|