tinybase 4.1.0-beta.0 → 4.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react-dom.cjs +1 -0
- 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/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react-dom.cjs +1 -0
- 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/tools.js +25 -4
- package/lib/debug/ui-react-dom.js +205 -0
- package/lib/debug/ui-react.js +21 -13
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react-dom.js +1 -0
- 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/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/ui-react-dom.d.ts +544 -0
- package/lib/types/ui-react.d.ts +59 -18
- package/lib/types/with-schemas/internal/ui-react.d.ts +15 -0
- package/lib/types/with-schemas/ui-react-dom.d.ts +590 -0
- package/lib/types/with-schemas/ui-react.d.ts +44 -18
- package/lib/ui-react-dom.js +1 -0
- 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/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react-dom.js +1 -0
- 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/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react-dom.js +1 -0
- 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 +32 -28
- package/readme.md +41 -24
|
@@ -9031,8 +9031,10 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9031
9031
|
* You can create your own RowView-like component to customize the way that a
|
|
9032
9032
|
* Row is rendered: see the TableView component for more details.
|
|
9033
9033
|
*
|
|
9034
|
-
*
|
|
9035
|
-
*
|
|
9034
|
+
* Since v4.1.0, you can use the `customCellIds` prop if you want to render a
|
|
9035
|
+
* prescribed set of the Row's Cells in a given order. Otherwise, this component
|
|
9036
|
+
* uses the useCellIds hook under the covers, which means that any changes to
|
|
9037
|
+
* the structure of the Row will cause a re-render.
|
|
9036
9038
|
* @param props The props for this component.
|
|
9037
9039
|
* @returns A rendering of the Row, or nothing, if not present.
|
|
9038
9040
|
* @example
|
|
@@ -9059,8 +9061,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9059
9061
|
* ```
|
|
9060
9062
|
* @example
|
|
9061
9063
|
* This example creates a Provider context into which a default Store is
|
|
9062
|
-
* provided. The RowView component within it then renders the Row
|
|
9063
|
-
* readability).
|
|
9064
|
+
* provided. The RowView component within it then renders the Row for a custom
|
|
9065
|
+
* set of Cell Ids (and rendered with Ids for readability).
|
|
9064
9066
|
*
|
|
9065
9067
|
* ```jsx
|
|
9066
9068
|
* const App = ({store}) => (
|
|
@@ -9068,20 +9070,27 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9068
9070
|
* <Pane />
|
|
9069
9071
|
* </Provider>
|
|
9070
9072
|
* );
|
|
9073
|
+
* const customCellIds = ['color', 'species'];
|
|
9071
9074
|
* const Pane = () => (
|
|
9072
9075
|
* <div>
|
|
9073
|
-
* <RowView
|
|
9076
|
+
* <RowView
|
|
9077
|
+
* tableId="pets"
|
|
9078
|
+
* rowId="fido"
|
|
9079
|
+
* customCellIds={customCellIds}
|
|
9080
|
+
* debugIds={true}
|
|
9081
|
+
* />
|
|
9074
9082
|
* </div>
|
|
9075
9083
|
* );
|
|
9076
9084
|
*
|
|
9077
9085
|
* const store = createStore().setRow('pets', 'fido', {
|
|
9078
9086
|
* species: 'dog',
|
|
9079
9087
|
* color: 'walnut',
|
|
9088
|
+
* legs: 4,
|
|
9080
9089
|
* });
|
|
9081
9090
|
* const app = document.createElement('div');
|
|
9082
9091
|
* ReactDOMClient.createRoot(app).render(<App store={store} />); // !act
|
|
9083
9092
|
* console.log(app.innerHTML);
|
|
9084
|
-
* // -> '<div>fido:{
|
|
9093
|
+
* // -> '<div>fido:{color:{walnut}species:{dog}}</div>'
|
|
9085
9094
|
* ```
|
|
9086
9095
|
* @example
|
|
9087
9096
|
* This example creates a Provider context into which a default Store is
|
|
@@ -9153,6 +9162,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9153
9162
|
* This component uses the useSortedRowIds hook under the covers, which means
|
|
9154
9163
|
* that any changes to the structure or sorting of the Table will cause a
|
|
9155
9164
|
* re-render.
|
|
9165
|
+
*
|
|
9166
|
+
* Since v4.1.0, you can use the `customCellIds` prop if you want to render a
|
|
9167
|
+
* prescribed set of the Table's Cells in a given order for each Row.
|
|
9156
9168
|
* @param props The props for this component.
|
|
9157
9169
|
* @returns A rendering of the Table, or nothing, if not present.
|
|
9158
9170
|
* @example
|
|
@@ -9189,8 +9201,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9189
9201
|
* ```
|
|
9190
9202
|
* @example
|
|
9191
9203
|
* This example creates a Provider context into which a default Store is
|
|
9192
|
-
* provided. The SortedTableView component within it then renders the Table
|
|
9193
|
-
* (with Ids for readability).
|
|
9204
|
+
* provided. The SortedTableView component within it then renders the Table for
|
|
9205
|
+
* a custom set of Cell Ids (and rendered with Ids for readability).
|
|
9194
9206
|
*
|
|
9195
9207
|
* ```jsx
|
|
9196
9208
|
* const App = ({store}) => (
|
|
@@ -9198,16 +9210,22 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9198
9210
|
* <Pane />
|
|
9199
9211
|
* </Provider>
|
|
9200
9212
|
* );
|
|
9213
|
+
* const customCellIds = ['species'];
|
|
9201
9214
|
* const Pane = () => (
|
|
9202
9215
|
* <div>
|
|
9203
|
-
* <SortedTableView
|
|
9216
|
+
* <SortedTableView
|
|
9217
|
+
* tableId="pets"
|
|
9218
|
+
* cellId="species"
|
|
9219
|
+
* customCellIds={customCellIds}
|
|
9220
|
+
* debugIds={true}
|
|
9221
|
+
* />
|
|
9204
9222
|
* </div>
|
|
9205
9223
|
* );
|
|
9206
9224
|
*
|
|
9207
9225
|
* const store = createStore().setTables({
|
|
9208
9226
|
* pets: {
|
|
9209
|
-
* fido: {species: 'dog'},
|
|
9210
|
-
* felix: {species: 'cat'},
|
|
9227
|
+
* fido: {color: 'black', species: 'dog'},
|
|
9228
|
+
* felix: {color: 'brown', species: 'cat'},
|
|
9211
9229
|
* },
|
|
9212
9230
|
* });
|
|
9213
9231
|
* const app = document.createElement('div');
|
|
@@ -9286,6 +9304,9 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9286
9304
|
*
|
|
9287
9305
|
* This component uses the useRowIds hook under the covers, which means that any
|
|
9288
9306
|
* changes to the structure of the Table will cause a re-render.
|
|
9307
|
+
*
|
|
9308
|
+
* Since v4.1.0, you can use the `customCellIds` prop if you want to render a
|
|
9309
|
+
* prescribed set of the Table's Cells in a given order for each Row.
|
|
9289
9310
|
* @param props The props for this component.
|
|
9290
9311
|
* @returns A rendering of the Table, or nothing, if not present.
|
|
9291
9312
|
* @example
|
|
@@ -9312,8 +9333,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9312
9333
|
* ```
|
|
9313
9334
|
* @example
|
|
9314
9335
|
* This example creates a Provider context into which a default Store is
|
|
9315
|
-
* provided. The TableView component within it then renders the Table
|
|
9316
|
-
* for readability).
|
|
9336
|
+
* provided. The TableView component within it then renders the Table for a
|
|
9337
|
+
* custom set of Cell Ids (and rendered with Ids for readability).
|
|
9317
9338
|
*
|
|
9318
9339
|
* ```jsx
|
|
9319
9340
|
* const App = ({store}) => (
|
|
@@ -9321,15 +9342,20 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9321
9342
|
* <Pane />
|
|
9322
9343
|
* </Provider>
|
|
9323
9344
|
* );
|
|
9345
|
+
* const customCellIds = ['species'];
|
|
9324
9346
|
* const Pane = () => (
|
|
9325
9347
|
* <div>
|
|
9326
|
-
* <TableView
|
|
9348
|
+
* <TableView
|
|
9349
|
+
* tableId="pets"
|
|
9350
|
+
* customCellIds={customCellIds}
|
|
9351
|
+
* debugIds={true}
|
|
9352
|
+
* />
|
|
9327
9353
|
* </div>
|
|
9328
9354
|
* );
|
|
9329
9355
|
*
|
|
9330
9356
|
* const store = createStore().setTable('pets', {
|
|
9331
|
-
* fido: {species: 'dog'},
|
|
9332
|
-
* felix: {species: 'cat'},
|
|
9357
|
+
* fido: {color: 'black', species: 'dog'},
|
|
9358
|
+
* felix: {color: 'brown', species: 'cat'},
|
|
9333
9359
|
* });
|
|
9334
9360
|
* const app = document.createElement('div');
|
|
9335
9361
|
* ReactDOMClient.createRoot(app).render(<App store={store} />); // !act
|
|
@@ -9607,8 +9633,8 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9607
9633
|
* also pass additional props to your custom component with the
|
|
9608
9634
|
* `getValueComponentProps` callback prop.
|
|
9609
9635
|
*
|
|
9610
|
-
* This component uses the
|
|
9611
|
-
* any changes to the
|
|
9636
|
+
* This component uses the useValueIds hook under the covers, which means that
|
|
9637
|
+
* any changes to the Values in the Store will cause a re-render.
|
|
9612
9638
|
*
|
|
9613
9639
|
* This component uses the useValueIds hook under the covers, which means that
|
|
9614
9640
|
* any changes to the Store's Values will cause a re-render.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useRowIds as l,useSortedRowIds as e,useValueIds as t,ValueView as o,useTableCellIds as n,CellView as r}from"./ui-react";import s from"react";const a=(l,e)=>l.map(e),d=l=>null==l,{createContext:u,useContext:c}=s;u([]);const i=(l,...e)=>d(l)?{}:l(...e),{createElement:m,useCallback:C,useState:I}=s,b=(l,e,t)=>{const o=C(l,e);return t?o:void 0},k=(l,e)=>d(l)||l[0]!=e?void 0:`sorted ${l[1]?"de":"a"}scending`,h=({cellId:l,sorting:e,label:t=l??"",onClick:o})=>m("th",{onClick:b((()=>o?.(l)),[o,l],!d(o)),className:k(e,l)},t),p=({tableId:l,rowIds:e,store:t,cellComponent:o=r,getCellComponentProps:s,className:d,headerRow:u,idColumn:c,customCellIds:C,sorting:I,onHeaderThClick:b})=>{const k=n(l,t),p=C??k;return m("table",{className:d},!1===u?null:m("thead",null,m("tr",null,!1===c?null:m(h,{sorting:I,label:"Id",onClick:b}),a(p,(l=>m(h,{key:l,cellId:l,sorting:I,onClick:b}))))),m("tbody",null,a(e,(e=>m("tr",{key:e},!1===c?null:m("th",null,e),a(p,(n=>m("td",{key:n},m(o,{...i(s,e,n),tableId:l,rowId:e,cellId:n,store:t})))))))))},g=({tableId:e,store:t,...o})=>m(p,{...o,tableId:e,store:t,rowIds:l(e,t)}),w=({tableId:l,cellId:t,descending:o,offset:n,limit:r,store:s,sortOnClick:a,...d})=>{const[u,c]=I([t,!!o]),i=b((l=>c([l,l==u[0]&&!u[1]])),[u],a);return m(p,{...d,tableId:l,store:s,rowIds:e(l,...u,n,r,s),sorting:u,onHeaderThClick:i})},y=({store:l,valueComponent:e=o,getValueComponentProps:n,className:r,headerRow:s,idColumn:d})=>m("table",{className:r},!1===s?null:m("thead",null,m("tr",null,!1===d?null:m("th",null,"Id"),m("th",null,"Value"))),m("tbody",null,a(t(l),(t=>m("tr",{key:t},!1===d?null:m("th",null,t),m("td",null,m(e,{...i(n,t),valueId:t,store:l})))))));export{w as SortedTableInHtmlTable,g as TableInHtmlTable,y as ValuesInHtmlTable};
|
|
Binary file
|
package/lib/ui-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as o}from"react";const t=e=>typeof e,s="",d=t(s),r="Ids",n="Table",l=n+"s",I=n+r,u="Row",i=u+r,c="Sorted"+u+r,a="Cell",p=a+r,g="Value",b=g+"s",w=g+r,R=(e,o)=>e.map(o),C=e=>null==e,m=(e,o,t)=>C(e)?t?.():o(e),k=e=>t(e)==d,y=()=>{},{createContext:h,useContext:v}=e,q=h([]),P=(e,o)=>{const t=v(q);return C(e)?t[o]:k(e)?((e,o)=>m(e,(e=>e[o])))(t[o+1],e):e},x=(e,o)=>{const t=P(e,o);return C(e)||k(e)?t:e},S=e=>P(e,0),f=e=>P(e,2),T=e=>P(e,4),B=e=>P(e,6),L=e=>P(e,8),M=e=>P(e,10),V=e=>x(e,0),A=e=>x(e,2),E=e=>x(e,4),F=e=>x(e,6),j=e=>x(e,8),z=e=>x(e,10),{useCallback:D,useEffect:G,useMemo:H,useRef:J,useState:K}=e,N=(e,o,t=[])=>{const s=H((()=>o(e)),[e,...t]);return G((()=>()=>s.destroy()),[s]),s},O=(e,o,t,s=[],d)=>{const[,r]=K(),n=D((()=>o?.["get"+e]?.(...s)??t),[o,...s]),[l]=K(n),I=J(l);return H((()=>I.current=n()),[n]),Q(e,o,((...e)=>{I.current=C(d)?n():e[d],r([])}),[],s),I.current},Q=(e,o,t,s=[],d=[],...r)=>G((()=>{const s=o?.["add"+e+"Listener"]?.(...d,t,...r);return()=>o?.delListener(s)}),[o,...d,...s,...r]),U=(e,o,t,s=[],d=y,r=[],...n)=>{const l=V(e);return D((e=>m(l,(s=>m(t(e,s),(e=>d(s["set"+o](...n,e),e)))))),[l,o,...s,...r,...n])},W=(e,o,t=y,s=[],...d)=>{const r=V(e);return D((()=>t(r?.["del"+o](...d))),[r,o,...s,...d])},X=(e,o,t)=>{const s=z(e);return D((()=>s?.[o](t)),[s,o,t])},Y=(e,o=[])=>H(e,o),Z=e=>O(l,V(e),{}),$=e=>O(I,V(e),[],[]),_=(e,o)=>O(n,V(o),{},[e]),ee=(e,o)=>O(n+p,V(o),[],[e]),oe=(e,o)=>O(i,V(o),[],[e]),te=(e,o,t,s=0,d,r)=>O(c,V(r),[],[e,o,t,s,d],6),se=(e,o,t)=>O(u,V(t),{},[e,o]),de=(e,o,t)=>O(p,V(t),[],[e,o]),re=(e,o,t,s)=>O(a,V(s),void 0,[e,o,t],4),ne=e=>O(b,V(e),{}),le=e=>O(w,V(e),[],[]),Ie=(e,o)=>O(g,V(o),void 0,[e]),ue=(e,o,t,s,d)=>U(t,l,e,o,s,d),ie=(e,o,t,s,d,r)=>U(s,n,o,t,d,r,e),ce=(e,o,t,s,d,r,n)=>U(d,u,t,s,r,n,e,o),ae=(e,o,t=[],s,d=y,r=[],n=!0)=>{const l=V(s);return D((t=>m(l,(s=>m(o(t,s),(o=>d(s.addRow(e,o,n),s,o)))))),[l,e,...t,...r,n])},pe=(e,o,t,s,d,r,n)=>U(d,"PartialRow",t,s,r,n,e,o),ge=(e,o,t,s,d,r,n,l)=>U(r,a,s,d,n,l,e,o,t),be=(e,o,t,s,d)=>U(t,b,e,o,s,d),we=(e,o,t,s,d)=>U(t,"PartialValues",e,o,s,d),Re=(e,o,t,s,d,r)=>U(s,g,o,t,d,r,e),Ce=(e,o,t)=>W(e,l,o,t),me=(e,o,t,s)=>W(o,n,t,s,e),ke=(e,o,t,s,d)=>W(t,u,s,d,e,o),ye=(e,o,t,s,d,r,n)=>W(d,a,r,n,e,o,t,s),he=(e,o,t)=>W(e,b,o,t),ve=(e,o,t,s)=>W(o,g,t,s,e),qe=(e,o,t,s)=>Q(l,V(s),e,o,[],t),Pe=(e,o,t,s)=>Q(I,V(s),e,o,[],t),xe=(e,o,t,s,d)=>Q(n,V(d),o,t,[e],s),Se=(e,o,t,s,d)=>Q(n+p,V(d),o,t,[e],s),fe=(e,o,t,s,d)=>Q(i,V(d),o,t,[e],s),Te=(e,o,t,s,d,r,n,l,I)=>Q(c,V(I),r,n,[e,o,t,s,d],l),Be=(e,o,t,s,d,r)=>Q(u,V(r),t,s,[e,o],d),Le=(e,o,t,s,d,r)=>Q(p,V(r),t,s,[e,o],d),Me=(e,o,t,s,d,r,n)=>Q(a,V(n),s,d,[e,o,t],r),Ve=(e,o,t,s)=>Q(b,V(s),e,o,[],t),Ae=(e,o,t,s)=>Q(w,V(s),e,o,[],t),Ee=(e,o,t,s,d)=>Q(g,V(d),o,t,[e],s),Fe=(e,o,t)=>N(e,o,t),je=(e,o)=>O("Metric",A(o),void 0,[e]),ze=(e,o,t,s)=>Q("Metric",A(s),o,t,[e]),De=(e,o,t)=>N(e,o,t),Ge=(e,o)=>O("SliceIds",E(o),[],[e]),He=(e,o,t)=>O("SliceRowIds",E(t),[],[e,o]),Je=(e,o,t,s)=>Q("SliceIds",E(s),o,t,[e]),Ke=(e,o,t,s,d)=>Q("SliceRowIds",E(d),t,s,[e,o]),Ne=(e,o,t)=>N(e,o,t),Oe=(e,o,t)=>O("RemoteRowId",F(t),void 0,[e,o]),Qe=(e,o,t)=>O("LocalRowIds",F(t),[],[e,o]),Ue=(e,o,t)=>O("LinkedRowIds",F(t),[],[e,o]),We=(e,o,t,s,d)=>Q("RemoteRowId",F(d),t,s,[e,o]),Xe=(e,o,t,s,d)=>Q("LocalRowIds",F(d),t,s,[e,o]),Ye=(e,o,t,s,d)=>Q("LinkedRowIds",F(d),t,s,[e,o]),Ze=(e,o,t)=>N(e,o,t),$e=(e,o)=>O("ResultTable",j(o),{},[e]),_e=(e,o)=>O("ResultRowIds",j(o),[],[e]),eo=(e,o,t,s=0,d,r)=>O("ResultSortedRowIds",j(r),[],[e,o,t,s,d],6),oo=(e,o,t)=>O("ResultRow",j(t),{},[e,o]),to=(e,o,t)=>O("ResultCellIds",j(t),[],[e,o]),so=(e,o,t,s)=>O("ResultCell",j(s),void 0,[e,o,t]),ro=(e,o,t,s)=>Q("ResultTable",j(s),o,t,[e]),no=(e,o,t,s)=>Q("ResultRowIds",j(s),o,t,[e]),lo=(e,o,t,s,d,r,n,l)=>Q("ResultSortedRowIds",j(l),r,n,[e,o,t,s,d]),Io=(e,o,t,s,d)=>Q("ResultRow",j(d),t,s,[e,o]),uo=(e,o,t,s,d)=>Q("ResultCellIds",j(d),t,s,[e,o]),io=(e,o,t,s,d,r)=>Q("ResultCell",j(r),s,d,[e,o,t]),co=(e,o,t)=>N(e,o,t),ao=e=>O("CheckpointIds",z(e),[[],void 0,[]]),po=(e,o)=>O("Checkpoint",z(o),void 0,[e]),go=(e=y,o=[],t,s=y,d=[])=>{const r=z(t);return D((o=>m(r,(t=>{const d=e(o);s(t.addCheckpoint(d),t,d)}))),[r,...o,...d])},bo=e=>X(e,"goBackward"),wo=e=>X(e,"goForward"),Ro=(e,o=[],t,s=y,d=[])=>{const r=z(t);return D((o=>m(r,(t=>m(e(o),(e=>s(t.goTo(e),e)))))),[r,...o,...d])},Co=e=>{const o=z(e),[t,d]=ao(o);return[(r=t,!(0==(e=>e.length)(r))),bo(o),d,m(d,(e=>o?.getCheckpoint(e)))??s];var r},mo=e=>{const o=z(e),[,,[t]]=ao(o);return[!C(t),wo(o),t,m(t,(e=>o?.getCheckpoint(e)))??s]},ko=(e,o,t)=>Q("CheckpointIds",z(t),e,o),yo=(e,o,t,s)=>Q("Checkpoint",z(s),o,t,[e]),ho=(e,o,t=[],s,d=[])=>{const[,r]=K(),n=H((()=>o(e)),[e,...t]);return G((()=>((async()=>{await(s?.(n)),r(1)})(),()=>{n.destroy()})),[n,...d]),n},{createElement:vo,useMemo:qo}=e,Po=({tableId:e,store:o,rowComponent:t=Ao,getRowComponentProps:s,separator:d,debugIds:r},n)=>Mo(R(n,(d=>vo(t,{...Bo(s,d),key:d,tableId:e,rowId:d,store:o,debugIds:r}))),d,r,e),xo=({queryId:e,queries:o,resultRowComponent:t=Uo,getResultRowComponentProps:s,separator:d,debugIds:r},n)=>Mo(R(n,(d=>vo(t,{...Bo(s,d),key:d,queryId:e,rowId:d,queries:o,debugIds:r}))),d,r,e),So=e=>{const o=F(e);return[o,o?.getStore()]},fo=({relationshipId:e,relationships:o,rowComponent:t=Ao,getRowComponentProps:s,separator:d,debugIds:r},n,l)=>{const[I,u]=So(o),i=I?.getLocalTableId(e),c=n(e,l,I);return Mo(R(c,(e=>vo(t,{...Bo(s,e),key:e,tableId:i,rowId:e,store:u,debugIds:r}))),d,r,l)},To=e=>({checkpoints:o,checkpointComponent:t=Yo,getCheckpointComponentProps:s,separator:d,debugIds:r})=>{const n=z(o);return Mo(R(e(ao(n)),(e=>vo(t,{...Bo(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:r}))),d)},Bo=(e,o)=>C(e)?{}:e(o),Lo=({store:e,storesById:t,metrics:s,metricsById:d,indexes:r,indexesById:n,relationships:l,relationshipsById:I,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:p})=>{const g=o(q);return vo(q.Provider,{value:qo((()=>[e??g[0],{...g[1],...t},s??g[2],{...g[3],...d},r??g[4],{...g[5],...n},l??g[6],{...g[7],...I},u??g[8],{...g[9],...i},c??g[10],{...g[11],...a}]),[e,t,s,d,r,n,l,I,u,i,c,a,g])},p)},Mo=(e,o,t,s)=>{const d=C(o)||!Array.isArray(e)?e:R(e,((e,t)=>t>0?[o,e]:e));return t?[s,":{",d,"}"]:d},Vo=({tableId:e,rowId:o,cellId:t,store:d,debugIds:r})=>Mo(s+(re(e,o,t,d)??s),void 0,r,t),Ao=({tableId:e,rowId:o,store:t,cellComponent:s=Vo,getCellComponentProps:d,separator:r,debugIds:n})=>Mo(R(de(e,o,t),(r=>vo(s,{...Bo(d,r),key:r,tableId:e,rowId:o,cellId:r,store:t,debugIds:n}))),r,n,o),Eo=e=>Po(e,oe(e.tableId,e.store)),Fo=({cellId:e,descending:o,offset:t,limit:s,...d})=>Po(d,te(d.tableId,e,o,t,s,d.store)),jo=({store:e,tableComponent:o=Eo,getTableComponentProps:t,separator:s,debugIds:d})=>Mo(R($(e),(s=>vo(o,{...Bo(t,s),key:s,tableId:s,store:e,debugIds:d}))),s),zo=({valueId:e,store:o,debugIds:t})=>Mo(s+(Ie(e,o)??s),void 0,t,e),Do=({store:e,valueComponent:o=zo,getValueComponentProps:t,separator:s,debugIds:d})=>Mo(R(le(e),(s=>vo(o,{...Bo(t,s),key:s,valueId:s,store:e,debugIds:d}))),s),Go=({metricId:e,metrics:o,debugIds:t})=>Mo(je(e,o)??s,void 0,t,e),Ho=({indexId:e,sliceId:o,indexes:t,rowComponent:s=Ao,getRowComponentProps:d,separator:r,debugIds:n})=>{const l=E(t),I=l?.getStore(),u=l?.getTableId(e),i=He(e,o,l);return Mo(R(i,(e=>vo(s,{...Bo(d,e),key:e,tableId:u,rowId:e,store:I,debugIds:n}))),r,n,o)},Jo=({indexId:e,indexes:o,sliceComponent:t=Ho,getSliceComponentProps:s,separator:d,debugIds:r})=>Mo(R(Ge(e,o),(d=>vo(t,{...Bo(s,d),key:d,indexId:e,sliceId:d,indexes:o,debugIds:r}))),d,r,e),Ko=({relationshipId:e,localRowId:o,relationships:t,rowComponent:s=Ao,getRowComponentProps:d,debugIds:r})=>{const[n,l]=So(t),I=n?.getRemoteTableId(e),u=Oe(e,o,n);return Mo(C(I)||C(u)?null:vo(s,{...Bo(d,u),key:u,tableId:I,rowId:u,store:l,debugIds:r}),void 0,r,o)},No=e=>fo(e,Qe,e.remoteRowId),Oo=e=>fo(e,Ue,e.firstRowId),Qo=({queryId:e,rowId:o,cellId:t,queries:d,debugIds:r})=>Mo(s+(so(e,o,t,d)??s),void 0,r,t),Uo=({queryId:e,rowId:o,queries:t,resultCellComponent:s=Qo,getResultCellComponentProps:d,separator:r,debugIds:n})=>Mo(R(to(e,o,t),(r=>vo(s,{...Bo(d,r),key:r,queryId:e,rowId:o,cellId:r,queries:t,debugIds:n}))),r,n,o),Wo=e=>xo(e,_e(e.queryId,e.queries)),Xo=({cellId:e,descending:o,offset:t,limit:s,...d})=>xo(d,eo(d.queryId,e,o,t,s,d.queries)),Yo=({checkpoints:e,checkpointId:o,debugIds:t})=>Mo(po(o,e)??s,void 0,t,o),Zo=To((e=>e[0])),$o=To((e=>C(e[1])?[]:[e[1]])),_o=To((e=>e[2]));export{Zo as BackwardCheckpointsView,Vo as CellView,Yo as CheckpointView,$o as CurrentCheckpointView,_o as ForwardCheckpointsView,Jo as IndexView,Oo as LinkedRowsView,No as LocalRowsView,Go as MetricView,Lo as Provider,Ko as RemoteRowView,Qo as ResultCellView,Uo as ResultRowView,Xo as ResultSortedTableView,Wo as ResultTableView,Ao as RowView,Ho as SliceView,Fo as SortedTableView,Eo as TableView,jo as TablesView,zo as ValueView,Do as ValuesView,Po as tableView,ae as useAddRowCallback,re as useCell,de as useCellIds,Le as useCellIdsListener,Me as useCellListener,po as useCheckpoint,ao as useCheckpointIds,ko as useCheckpointIdsListener,yo as useCheckpointListener,M as useCheckpoints,co as useCreateCheckpoints,De as useCreateIndexes,Fe as useCreateMetrics,ho as useCreatePersister,Ze as useCreateQueries,Ne as useCreateRelationships,Y as useCreateStore,ye as useDelCellCallback,ke as useDelRowCallback,me as useDelTableCallback,Ce as useDelTablesCallback,ve as useDelValueCallback,he as useDelValuesCallback,bo as useGoBackwardCallback,wo as useGoForwardCallback,Ro as useGoToCallback,T as useIndexes,Ue as useLinkedRowIds,Ye as useLinkedRowIdsListener,Qe as useLocalRowIds,Xe as useLocalRowIdsListener,je as useMetric,ze as useMetricListener,f as useMetrics,L as useQueries,mo as useRedoInformation,B as useRelationships,Oe as useRemoteRowId,We as useRemoteRowIdListener,so as useResultCell,to as useResultCellIds,uo as useResultCellIdsListener,io as useResultCellListener,oo as useResultRow,_e as useResultRowIds,no as useResultRowIdsListener,Io as useResultRowListener,eo as useResultSortedRowIds,lo as useResultSortedRowIdsListener,$e as useResultTable,ro as useResultTableListener,se as useRow,oe as useRowIds,fe as useRowIdsListener,Be as useRowListener,ge as useSetCellCallback,go as useSetCheckpointCallback,pe as useSetPartialRowCallback,we as useSetPartialValuesCallback,ce as useSetRowCallback,ie as useSetTableCallback,ue as useSetTablesCallback,Re as useSetValueCallback,be as useSetValuesCallback,Ge as useSliceIds,Je as useSliceIdsListener,He as useSliceRowIds,Ke as useSliceRowIdsListener,te as useSortedRowIds,Te as useSortedRowIdsListener,S as useStore,_ as useTable,ee as useTableCellIds,Se as useTableCellIdsListener,$ as useTableIds,Pe as useTableIdsListener,xe as useTableListener,Z as useTables,qe as useTablesListener,Co as useUndoInformation,Ie as useValue,le as useValueIds,Ae as useValueIdsListener,Ee as useValueListener,ne as useValues,Ve as useValuesListener};
|
|
1
|
+
import e,{useContext as o}from"react";const t=e=>typeof e,s="",d=t(s),r="Ids",n="Table",l=n+"s",I=n+r,u="Row",i=u+r,c="Sorted"+u+r,a="Cell",p=a+r,g="Value",b=g+"s",C=g+r,w=(e,o)=>e.map(o),R=e=>null==e,m=(e,o,t)=>R(e)?t?.():o(e),k=e=>t(e)==d,y=()=>{},{createContext:h,useContext:v}=e,q=h([]),P=(e,o)=>{const t=v(q);return R(e)?t[o]:k(e)?((e,o)=>m(e,(e=>e[o])))(t[o+1],e):e},x=(e,o)=>{const t=P(e,o);return R(e)||k(e)?t:e},S=(e,...o)=>R(e)?{}:e(...o),f=e=>P(e,0),T=e=>P(e,2),B=e=>P(e,4),L=e=>P(e,6),M=e=>P(e,8),V=e=>P(e,10),A=e=>x(e,0),E=e=>x(e,2),F=e=>x(e,4),j=e=>x(e,6),z=e=>x(e,8),D=e=>x(e,10),{useCallback:G,useEffect:H,useMemo:J,useRef:K,useState:N}=e,O=(e,o,t=[])=>{const s=J((()=>o(e)),[e,...t]);return H((()=>()=>s.destroy()),[s]),s},Q=(e,o,t,s=[],d)=>{const[,r]=N(),n=G((()=>o?.["get"+e]?.(...s)??t),[o,...s]),[l]=N(n),I=K(l);return J((()=>I.current=n()),[n]),U(e,o,((...e)=>{I.current=R(d)?n():e[d],r([])}),[],s),I.current},U=(e,o,t,s=[],d=[],...r)=>H((()=>{const s=o?.["add"+e+"Listener"]?.(...d,t,...r);return()=>o?.delListener(s)}),[o,...d,...s,...r]),W=(e,o,t,s=[],d=y,r=[],...n)=>{const l=A(e);return G((e=>m(l,(s=>m(t(e,s),(e=>d(s["set"+o](...n,e),e)))))),[l,o,...s,...r,...n])},X=(e,o,t=y,s=[],...d)=>{const r=A(e);return G((()=>t(r?.["del"+o](...d))),[r,o,...s,...d])},Y=(e,o,t)=>{const s=D(e);return G((()=>s?.[o](t)),[s,o,t])},Z=(e,o=[])=>J(e,o),$=e=>Q(l,A(e),{}),_=e=>Q(I,A(e),[],[]),ee=(e,o)=>Q(n,A(o),{},[e]),oe=(e,o)=>Q(n+p,A(o),[],[e]),te=(e,o)=>Q(i,A(o),[],[e]),se=(e,o,t,s=0,d,r)=>Q(c,A(r),[],[e,o,t,s,d],6),de=(e,o,t)=>Q(u,A(t),{},[e,o]),re=(e,o,t)=>Q(p,A(t),[],[e,o]),ne=(e,o,t,s)=>Q(a,A(s),void 0,[e,o,t],4),le=e=>Q(b,A(e),{}),Ie=e=>Q(C,A(e),[],[]),ue=(e,o)=>Q(g,A(o),void 0,[e]),ie=(e,o,t,s,d)=>W(t,l,e,o,s,d),ce=(e,o,t,s,d,r)=>W(s,n,o,t,d,r,e),ae=(e,o,t,s,d,r,n)=>W(d,u,t,s,r,n,e,o),pe=(e,o,t=[],s,d=y,r=[],n=!0)=>{const l=A(s);return G((t=>m(l,(s=>m(o(t,s),(o=>d(s.addRow(e,o,n),s,o)))))),[l,e,...t,...r,n])},ge=(e,o,t,s,d,r,n)=>W(d,"PartialRow",t,s,r,n,e,o),be=(e,o,t,s,d,r,n,l)=>W(r,a,s,d,n,l,e,o,t),Ce=(e,o,t,s,d)=>W(t,b,e,o,s,d),we=(e,o,t,s,d)=>W(t,"PartialValues",e,o,s,d),Re=(e,o,t,s,d,r)=>W(s,g,o,t,d,r,e),me=(e,o,t)=>X(e,l,o,t),ke=(e,o,t,s)=>X(o,n,t,s,e),ye=(e,o,t,s,d)=>X(t,u,s,d,e,o),he=(e,o,t,s,d,r,n)=>X(d,a,r,n,e,o,t,s),ve=(e,o,t)=>X(e,b,o,t),qe=(e,o,t,s)=>X(o,g,t,s,e),Pe=(e,o,t,s)=>U(l,A(s),e,o,[],t),xe=(e,o,t,s)=>U(I,A(s),e,o,[],t),Se=(e,o,t,s,d)=>U(n,A(d),o,t,[e],s),fe=(e,o,t,s,d)=>U(n+p,A(d),o,t,[e],s),Te=(e,o,t,s,d)=>U(i,A(d),o,t,[e],s),Be=(e,o,t,s,d,r,n,l,I)=>U(c,A(I),r,n,[e,o,t,s,d],l),Le=(e,o,t,s,d,r)=>U(u,A(r),t,s,[e,o],d),Me=(e,o,t,s,d,r)=>U(p,A(r),t,s,[e,o],d),Ve=(e,o,t,s,d,r,n)=>U(a,A(n),s,d,[e,o,t],r),Ae=(e,o,t,s)=>U(b,A(s),e,o,[],t),Ee=(e,o,t,s)=>U(C,A(s),e,o,[],t),Fe=(e,o,t,s,d)=>U(g,A(d),o,t,[e],s),je=(e,o,t)=>O(e,o,t),ze=(e,o)=>Q("Metric",E(o),void 0,[e]),De=(e,o,t,s)=>U("Metric",E(s),o,t,[e]),Ge=(e,o,t)=>O(e,o,t),He=(e,o)=>Q("SliceIds",F(o),[],[e]),Je=(e,o,t)=>Q("SliceRowIds",F(t),[],[e,o]),Ke=(e,o,t,s)=>U("SliceIds",F(s),o,t,[e]),Ne=(e,o,t,s,d)=>U("SliceRowIds",F(d),t,s,[e,o]),Oe=(e,o,t)=>O(e,o,t),Qe=(e,o,t)=>Q("RemoteRowId",j(t),void 0,[e,o]),Ue=(e,o,t)=>Q("LocalRowIds",j(t),[],[e,o]),We=(e,o,t)=>Q("LinkedRowIds",j(t),[],[e,o]),Xe=(e,o,t,s,d)=>U("RemoteRowId",j(d),t,s,[e,o]),Ye=(e,o,t,s,d)=>U("LocalRowIds",j(d),t,s,[e,o]),Ze=(e,o,t,s,d)=>U("LinkedRowIds",j(d),t,s,[e,o]),$e=(e,o,t)=>O(e,o,t),_e=(e,o)=>Q("ResultTable",z(o),{},[e]),eo=(e,o)=>Q("ResultRowIds",z(o),[],[e]),oo=(e,o,t,s=0,d,r)=>Q("ResultSortedRowIds",z(r),[],[e,o,t,s,d],6),to=(e,o,t)=>Q("ResultRow",z(t),{},[e,o]),so=(e,o,t)=>Q("ResultCellIds",z(t),[],[e,o]),ro=(e,o,t,s)=>Q("ResultCell",z(s),void 0,[e,o,t]),no=(e,o,t,s)=>U("ResultTable",z(s),o,t,[e]),lo=(e,o,t,s)=>U("ResultRowIds",z(s),o,t,[e]),Io=(e,o,t,s,d,r,n,l)=>U("ResultSortedRowIds",z(l),r,n,[e,o,t,s,d]),uo=(e,o,t,s,d)=>U("ResultRow",z(d),t,s,[e,o]),io=(e,o,t,s,d)=>U("ResultCellIds",z(d),t,s,[e,o]),co=(e,o,t,s,d,r)=>U("ResultCell",z(r),s,d,[e,o,t]),ao=(e,o,t)=>O(e,o,t),po=e=>Q("CheckpointIds",D(e),[[],void 0,[]]),go=(e,o)=>Q("Checkpoint",D(o),void 0,[e]),bo=(e=y,o=[],t,s=y,d=[])=>{const r=D(t);return G((o=>m(r,(t=>{const d=e(o);s(t.addCheckpoint(d),t,d)}))),[r,...o,...d])},Co=e=>Y(e,"goBackward"),wo=e=>Y(e,"goForward"),Ro=(e,o=[],t,s=y,d=[])=>{const r=D(t);return G((o=>m(r,(t=>m(e(o),(e=>s(t.goTo(e),e)))))),[r,...o,...d])},mo=e=>{const o=D(e),[t,d]=po(o);return[(r=t,!(0==(e=>e.length)(r))),Co(o),d,m(d,(e=>o?.getCheckpoint(e)))??s];var r},ko=e=>{const o=D(e),[,,[t]]=po(o);return[!R(t),wo(o),t,m(t,(e=>o?.getCheckpoint(e)))??s]},yo=(e,o,t)=>U("CheckpointIds",D(t),e,o),ho=(e,o,t,s)=>U("Checkpoint",D(s),o,t,[e]),vo=(e,o,t=[],s,d=[])=>{const[,r]=N(),n=J((()=>o(e)),[e,...t]);return H((()=>((async()=>{await(s?.(n)),r(1)})(),()=>{n.destroy()})),[n,...d]),n},{createElement:qo,useMemo:Po}=e,xo=({tableId:e,store:o,rowComponent:t=Ao,getRowComponentProps:s,customCellIds:d,separator:r,debugIds:n},l)=>Mo(w(l,(r=>qo(t,{...S(s,r),key:r,tableId:e,rowId:r,customCellIds:d,store:o,debugIds:n}))),r,n,e),So=({queryId:e,queries:o,resultRowComponent:t=Uo,getResultRowComponentProps:s,separator:d,debugIds:r},n)=>Mo(w(n,(d=>qo(t,{...S(s,d),key:d,queryId:e,rowId:d,queries:o,debugIds:r}))),d,r,e),fo=e=>{const o=j(e);return[o,o?.getStore()]},To=({relationshipId:e,relationships:o,rowComponent:t=Ao,getRowComponentProps:s,separator:d,debugIds:r},n,l)=>{const[I,u]=fo(o),i=I?.getLocalTableId(e),c=n(e,l,I);return Mo(w(c,(e=>qo(t,{...S(s,e),key:e,tableId:i,rowId:e,store:u,debugIds:r}))),d,r,l)},Bo=e=>({checkpoints:o,checkpointComponent:t=Yo,getCheckpointComponentProps:s,separator:d,debugIds:r})=>{const n=D(o);return Mo(w(e(po(n)),(e=>qo(t,{...S(s,e),key:e,checkpoints:n,checkpointId:e,debugIds:r}))),d)},Lo=({store:e,storesById:t,metrics:s,metricsById:d,indexes:r,indexesById:n,relationships:l,relationshipsById:I,queries:u,queriesById:i,checkpoints:c,checkpointsById:a,children:p})=>{const g=o(q);return qo(q.Provider,{value:Po((()=>[e??g[0],{...g[1],...t},s??g[2],{...g[3],...d},r??g[4],{...g[5],...n},l??g[6],{...g[7],...I},u??g[8],{...g[9],...i},c??g[10],{...g[11],...a}]),[e,t,s,d,r,n,l,I,u,i,c,a,g])},p)},Mo=(e,o,t,s)=>{const d=R(o)||!Array.isArray(e)?e:w(e,((e,t)=>t>0?[o,e]:e));return t?[s,":{",d,"}"]:d},Vo=({tableId:e,rowId:o,cellId:t,store:d,debugIds:r})=>Mo(s+(ne(e,o,t,d)??s),void 0,r,t),Ao=({tableId:e,rowId:o,store:t,cellComponent:s=Vo,getCellComponentProps:d,customCellIds:r,separator:n,debugIds:l})=>Mo(w(((e,o,t,s)=>{const d=re(o,t,s);return e??d})(r,e,o,t),(r=>qo(s,{...S(d,r),key:r,tableId:e,rowId:o,cellId:r,store:t,debugIds:l}))),n,l,o),Eo=e=>xo(e,te(e.tableId,e.store)),Fo=({cellId:e,descending:o,offset:t,limit:s,...d})=>xo(d,se(d.tableId,e,o,t,s,d.store)),jo=({store:e,tableComponent:o=Eo,getTableComponentProps:t,separator:s,debugIds:d})=>Mo(w(_(e),(s=>qo(o,{...S(t,s),key:s,tableId:s,store:e,debugIds:d}))),s),zo=({valueId:e,store:o,debugIds:t})=>Mo(s+(ue(e,o)??s),void 0,t,e),Do=({store:e,valueComponent:o=zo,getValueComponentProps:t,separator:s,debugIds:d})=>Mo(w(Ie(e),(s=>qo(o,{...S(t,s),key:s,valueId:s,store:e,debugIds:d}))),s),Go=({metricId:e,metrics:o,debugIds:t})=>Mo(ze(e,o)??s,void 0,t,e),Ho=({indexId:e,sliceId:o,indexes:t,rowComponent:s=Ao,getRowComponentProps:d,separator:r,debugIds:n})=>{const l=F(t),I=l?.getStore(),u=l?.getTableId(e),i=Je(e,o,l);return Mo(w(i,(e=>qo(s,{...S(d,e),key:e,tableId:u,rowId:e,store:I,debugIds:n}))),r,n,o)},Jo=({indexId:e,indexes:o,sliceComponent:t=Ho,getSliceComponentProps:s,separator:d,debugIds:r})=>Mo(w(He(e,o),(d=>qo(t,{...S(s,d),key:d,indexId:e,sliceId:d,indexes:o,debugIds:r}))),d,r,e),Ko=({relationshipId:e,localRowId:o,relationships:t,rowComponent:s=Ao,getRowComponentProps:d,debugIds:r})=>{const[n,l]=fo(t),I=n?.getRemoteTableId(e),u=Qe(e,o,n);return Mo(R(I)||R(u)?null:qo(s,{...S(d,u),key:u,tableId:I,rowId:u,store:l,debugIds:r}),void 0,r,o)},No=e=>To(e,Ue,e.remoteRowId),Oo=e=>To(e,We,e.firstRowId),Qo=({queryId:e,rowId:o,cellId:t,queries:d,debugIds:r})=>Mo(s+(ro(e,o,t,d)??s),void 0,r,t),Uo=({queryId:e,rowId:o,queries:t,resultCellComponent:s=Qo,getResultCellComponentProps:d,separator:r,debugIds:n})=>Mo(w(so(e,o,t),(r=>qo(s,{...S(d,r),key:r,queryId:e,rowId:o,cellId:r,queries:t,debugIds:n}))),r,n,o),Wo=e=>So(e,eo(e.queryId,e.queries)),Xo=({cellId:e,descending:o,offset:t,limit:s,...d})=>So(d,oo(d.queryId,e,o,t,s,d.queries)),Yo=({checkpoints:e,checkpointId:o,debugIds:t})=>Mo(go(o,e)??s,void 0,t,o),Zo=Bo((e=>e[0])),$o=Bo((e=>R(e[1])?[]:[e[1]])),_o=Bo((e=>e[2]));export{Zo as BackwardCheckpointsView,Vo as CellView,Yo as CheckpointView,$o as CurrentCheckpointView,_o as ForwardCheckpointsView,Jo as IndexView,Oo as LinkedRowsView,No as LocalRowsView,Go as MetricView,Lo as Provider,Ko as RemoteRowView,Qo as ResultCellView,Uo as ResultRowView,Xo as ResultSortedTableView,Wo as ResultTableView,Ao as RowView,Ho as SliceView,Fo as SortedTableView,Eo as TableView,jo as TablesView,zo as ValueView,Do as ValuesView,pe as useAddRowCallback,ne as useCell,re as useCellIds,Me as useCellIdsListener,Ve as useCellListener,go as useCheckpoint,po as useCheckpointIds,yo as useCheckpointIdsListener,ho as useCheckpointListener,V as useCheckpoints,ao as useCreateCheckpoints,Ge as useCreateIndexes,je as useCreateMetrics,vo as useCreatePersister,$e as useCreateQueries,Oe as useCreateRelationships,Z as useCreateStore,he as useDelCellCallback,ye as useDelRowCallback,ke as useDelTableCallback,me as useDelTablesCallback,qe as useDelValueCallback,ve as useDelValuesCallback,Co as useGoBackwardCallback,wo as useGoForwardCallback,Ro as useGoToCallback,B as useIndexes,We as useLinkedRowIds,Ze as useLinkedRowIdsListener,Ue as useLocalRowIds,Ye as useLocalRowIdsListener,ze as useMetric,De as useMetricListener,T as useMetrics,M as useQueries,ko as useRedoInformation,L as useRelationships,Qe as useRemoteRowId,Xe as useRemoteRowIdListener,ro as useResultCell,so as useResultCellIds,io as useResultCellIdsListener,co as useResultCellListener,to as useResultRow,eo as useResultRowIds,lo as useResultRowIdsListener,uo as useResultRowListener,oo as useResultSortedRowIds,Io as useResultSortedRowIdsListener,_e as useResultTable,no as useResultTableListener,de as useRow,te as useRowIds,Te as useRowIdsListener,Le as useRowListener,be as useSetCellCallback,bo as useSetCheckpointCallback,ge as useSetPartialRowCallback,we as useSetPartialValuesCallback,ae as useSetRowCallback,ce as useSetTableCallback,ie as useSetTablesCallback,Re as useSetValueCallback,Ce as useSetValuesCallback,He as useSliceIds,Ke as useSliceIdsListener,Je as useSliceRowIds,Ne as useSliceRowIdsListener,se as useSortedRowIds,Be as useSortedRowIdsListener,f as useStore,ee as useTable,oe as useTableCellIds,fe as useTableCellIdsListener,_ as useTableIds,xe as useTableIdsListener,Se as useTableListener,$ as useTables,Pe as useTablesListener,mo as useUndoInformation,ue as useValue,Ie as useValueIds,Ee as useValueIdsListener,Fe as useValueListener,le as useValues,Ae as useValuesListener};
|
package/lib/ui-react.js.gz
CHANGED
|
Binary file
|
package/lib/umd/tools.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="tinybase",a="",n=",",o=t(a),d=t(!0),r=t(0),s="type",I="default",c="Listener",$="get",i="add",u="Ids",p="Table",b=p+"s",C=p+u,h="Row",g=h+u,m="Sorted"+h+u,f="Cell",w=f+u,y="Value",T=y+"s",v=y+u,V=(e,t)=>e.every(t),x=(e,t)=>e.sort(t),R=(e,t)=>e.forEach(t),k=(e,t=a)=>e.join(t),S=(e,t)=>e.map(t),A=e=>e.length,P=(e,t)=>e.filter(t),E=(e,...t)=>e.push(...t),D=e=>e.pop(),O=(e,...t)=>e.unshift(...t),N=e=>e.shift(),L=JSON.parse,G=isFinite,j=(e,t)=>e instanceof t,M=e=>null==e,J=e=>e==o||e==d,z=e=>t(e)==o,W=e=>Array.isArray(e),B=e=>{const l=t(e);return J(l)||l==r&&G(e)?l:void 0},F=Object,U=F.keys,_=F.freeze,Z=e=>j(e,F)&&e.constructor==F,H=(e,t)=>S(F.entries(e),(([e,l])=>t(l,e))),Q=e=>A(U(e)),q=e=>Z(e)&&0==Q(e),K=(e,t)=>e?.has(t)??!1,X=e=>[...e?.values()??[]],Y=(e,t)=>e?.forEach(t),ee=(e,t)=>e?.delete(t),te=e=>new Map(e),le=(e,t)=>e?.get(t),ae=(e,t)=>Y(e,((e,l)=>t(l,e))),ne=(e,t)=>S([...e?.entries()??[]],(([e,l])=>t(l,e))),oe=(e,t,l)=>M(l)?(ee(e,t),e):e?.set(t,l),de=(e,t,l)=>(K(e,t)||oe(e,t,l()),le(e,t)),re=e=>e.toUpperCase(),se=e=>e.toLowerCase(),Ie="a ",ce="A function for",$e=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",ue="Del",pe="Deps",be=pe+"?: React.DependencyList",Ce="doRollback?: DoRollback",he="actions: () => Return, "+Ce,ge="export",me="Id",fe="Invalid",we="Json",ye=se(c),Te="?: ",ve=" | undefined",Ve="NonNullable",xe="Partial",Re="Props",ke="Provider",Se=`Registers a ${ye} that will be called`,Ae="Represents",Pe="rowId: "+me,Ee="Schema",De="Set",Oe=", descending?: boolean, offset?: number, limit?: number",Ne="[]",Le="the Store",Ge="Transaction",je=Ge+"Changes",Me=se(Ge),Je="Execute a "+Me+" to make multiple mutations",ze="Explicitly starts a "+Me,We="Explicitly finishes a "+Me,Be="the end of the "+Me,Fe="void",Ue=" => "+Fe,_e="WhenSet",Ze=" when setting it",He=Ie+"string serialization of",Qe=" ",qe="Gets a callback that can ",Ke="the ",Xe=" the schema for",Ye=(e=0,t=0)=>`the ${ht[e]}content of`+(t?Qe+Le:a),et=(e=0,t,l=0)=>pt[t]+Qe+Ye(e,1)+(l?" when setting it":a),tt=(e,t=0)=>Ae+` a Row when ${t?"s":"g"}etting ${Ye()} the '${e}' `+p,lt=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,at=(e,t)=>`Calls a function for each ${e} in `+t,nt=e=>"The props passed to a component that renders "+e,ot=e=>"A function that takes "+e,dt=(e,t=0)=>ce+" listening to changes to "+Ct[e]+" in "+Ct[t],rt=(e,t,l=0)=>Se+" whenever "+Ct[e]+" in "+Ct[t]+" change"+(l?a:"s"),st=e=>`the '${e}' `+p,It=e=>"the specified Row in "+st(e),ct=(e,t=0)=>pt[t]+` ${Ye()} `+st(e),$t=(e,t=0)=>pt[t]+` ${Ye()} `+It(e),it=(e,t,l=0)=>pt[l]+` the '${t}' Cell for `+It(e),ut=(e,t=0)=>pt[t]+` the '${e}' Value`,pt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ae,"Gets "+He,"Sets "+He,Se+" whenever",qe+"set",qe+"add",qe+"set part of",qe+"delete","Renders","Gets "+He+Xe,"Sets"+Xe,"Deletes"+Xe],bt=[$,"has","set","del","set","forEach",i,a],Ct=[Le,b,Ke+p+Qe+u,Ie+p,Ke+h+Qe+u,Ie+h,Ke+f+Qe+u,Ie+f,"invalid Cell changes",T,Ke+y+Qe+u,Ie+y,"invalid Value changes",Ke+"sorted "+h+Qe+u,Ke+f+Qe+u+" anywhere"],ht=[a,"tabular ","keyed value "],gt=e=>new Set(W(e)||M(e)?e:[e]),mt=(e,t)=>e?.add(t),ft=/[^A-Za-z]+/,wt=/[^A-Za-z0-9]+/,yt=/^( *)\/\*\* *(.*?) *\*\/$/gm,Tt=(e,t,l)=>e.substring(t,l),vt=e=>e.includes(n),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return K(e,n)?Vt(e,t,l,a+1):(oe(e,n,l),n)},xt=e=>e.replace(yt,((e,t,l)=>{const a=77-Rt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.length,kt=e=>e.flat(1e3),St=(e,t=0)=>k(S(e.split(wt),((e,l)=>(l>0||t?re:se)(Tt(e,0,1))+Tt(e,1)))),At=e=>re(k((e&&!ft.test(e[0])?e:" "+e).split(wt),"_")),Pt=e=>`/** ${e}. */`,Et=(...e)=>k(P(e,(e=>e)),", "),Dt=(...e)=>"{"+k(e,"; ")+"}",Ot=(...e)=>Dt(...S(e,(e=>"readonly "+e))),Nt=()=>{const e=[te(),te(),te(),te()],t=te(),l=te(),n=e=>{const t=e.indexOf(" as ");return-1!=t?e.substring(t+4):e};return[(...e)=>k(kt(e),"\n"),(t,l,...a)=>R(a,(a=>R([0,1],(n=>(t??n)==n?mt(de(e[n],l,gt),a):0)))),(e,l,n,o=a,d=1)=>Vt(t,e,[l,n,o,d]),(e,t,a)=>Vt(l,e,W(a)?[`(${t}) => {`,a,"}"]:[`(${t}) => ${a}`]),(e,t)=>le(l,e)===t?e:Vt(l,e,t),(t=0)=>S([...x(ne(e[t],((e,t)=>`import {${k(x(X(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ne(t,(([e,t,l,n],o)=>[Pt(t),`${n?ge+" ":a}type ${o}${l} = ${e};`,a])),()=>ne(l,((e,t)=>(e=W(e)?e:[e],E(e,D(e)+";"),[`const ${t} = ${N(e)}`,e,a])))]},Lt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Gt=(e,t,l)=>[t=>H(e,((e,a)=>t(a,St(a,1),l(At(a),`'${a}'`)))),(t,a)=>H(e[t],((e,t)=>a(t,e[s],e[I],l(At(t),`'${t}'`),St(t,1)))),e=>H(t,((t,a)=>e(a,t[s],t[I],l(At(a),`'${a}'`),St(a,1))))],jt=(e,t,l,n)=>[(n,o)=>{const d=n+": "+o,r=e(b,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...l(e,((e,t,l)=>`'${e}'${M(l)?"?":a}: ${t}`)))+"}"))),et(1,5)),s=e(b+_e,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...l(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),et(1,5,1)),I=e(p+me,"keyof "+r,"A "+p+" Id in "+Le),$=`<TId extends ${I}>`,i=e(p,Ve+`<${r}[TId]>`,"A "+p+" in "+Le,$),u=e(p+_e,Ve+`<${s}[TId]>`,"A "+p+" in "+Le+Ze,$),y=e(h,i+"<TId>[Id]","A "+h+" in a "+p,$),T=e(h+_e,u+"<TId>[Id]","A "+h+" in a "+p+Ze,$),v=e(f+me,`Extract<keyof ${y}<TId>, Id>`,"A "+f+" Id in a "+h,$),V=e(f,Ve+`<${r}[TId]>[Id][CId]`,"A "+f+" in a "+h,`<TId extends ${I}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,f+" Ids and types in a "+h,`<TId extends ${I}, CId = ${v}<TId>>`,0),R=e(f+ie,`(...[cellId, cell]: ${x}<TId>)`+Ue,ot(Ie+f+" Id, and "+f),$),k=e(h+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ue+") "+Ue,ot(Ie+h+" Id, and a "+f+" iterator"),$),S=e(p+f+ie,`(cellId: ${v}<TId>, count: number) `+Ue,ot(Ie+f+" Id, and count of how many times it appears"),$),A=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Ue}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),P=e(p+ie,`(...[tableId, forEachRow]: ${A})`+Ue,ot(Ie+p+" Id, and a "+h+" iterator"),a),E=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${E}) => CellChange`,ce+" returning information about any Cell's changes during a "+Me),O=e(b+c,`(${d}, getCellChange: ${D}${ve})`+Ue,dt(1)),N=e(C+c,`(${d})`+Ue,dt(2)),L=e(p+c,`(${d}, tableId: ${I}, getCellChange: ${D}${ve})`+Ue,dt(3)),G=e(p+w+c,`(${d}, tableId: ${I})`+Ue,dt(14,3)),j=e(g+c,`(${d}, tableId: ${I})`+Ue,dt(4,3)),J=e(m+c,"("+Et(d,"tableId: "+I,"cellId: Id"+ve,"descending: boolean","offset: number","limit: number"+ve,"sortedRowIds: Ids")+")"+Ue,dt(13,3)),z=e(h+c,"("+Et(""+d,"tableId: "+I,Pe,`getCellChange: ${D}${ve}`)+")"+Ue,dt(5,3)),W=e(w+c,"("+Et(""+d,"tableId: "+I,Pe)+")"+Ue,dt(6,5)),B=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Pe}, cellId: CId, newCell: ${V}<TId, CId> ${ve}, oldCell: ${V}<TId, CId> ${ve}, getCellChange: ${D} ${ve}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${v}<TId>>`,0),F=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+B+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[r,s,I,i,u,y,T,v,V,R,k,S,P,O,N,L,G,j,J,z,W,e(f+c,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${F})`+Ue,dt(7,5)),e(fe+f+c,`(${d}, tableId: Id, ${Pe}, cellId: Id, invalidCells: any[])`+Ue,dt(8))]},(t,l)=>{const o=t+": "+l,d=e(T,Dt(...n(((e,t,l)=>`'${e}'${M(l)?"?":a}: ${t}`))),et(2,5)),r=e(T+_e,Dt(...n(((e,t)=>`'${e}'?: ${t}`))),et(2,5,1)),s=e(y+me,"keyof "+d,"A "+y+" Id in "+Le),I=e(y,Ve+`<${d}[VId]>`,"A "+y+" Id in "+Le,`<VId extends ${s}>`),$=e("ValueIdValueArray",`VId extends ${s} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+Le,`<VId = ${s}>`,0),i=e(y+ie,`(...[valueId, value]: ${$})`+Ue,ot(Ie+y+" Id, and "+y)),u=e("GetValueChange",`(valueId: ${s}) => ValueChange`,ce+" returning information about any Value's changes during a "+Me),p=e(T+c,`(${o}, getValueChange: ${u}${ve})`+Ue,dt(9)),b=e(v+c,`(${o})`+Ue,dt(10)),C=e("ValueListenerArgsArray",`VId extends ${s} ? [${o}, valueId: VId, newValue: ${I}<VId> ${ve}, oldValue: ${I}<VId> ${ve}, getValueChange: ${u} ${ve}] : never`,"Value args for ValueListener",`<VId = ${s}>`,0);return[d,r,s,I,i,p,b,e(y+c,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+Ue,dt(11)),e(fe+y+c,`(${o}, valueId: Id, invalidValues: any[])`+Ue,dt(12))]},(t,l)=>e(Ge+c,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Ue,ce+" listening to the completion of a "+Me)],Mt=(e,t=a,l=a)=>`store.${e}(${t})`+(l?" as "+l:a),Jt=(e,t=a)=>`fluent(() => ${Mt(e,t)})`,zt=(e,t=a,l=a)=>`store.${e}(${t?t+", ":a}proxy(listener)${l?", "+l:a})`,Wt=(e,t,n)=>{const[o,r,$,V,x,S,A,P]=Nt(),[D,N,L]=Gt(e,t,x),[G,j,J]=jt($,D,N,L),W=te(),B=(e=0)=>ne(W,(([t,l,n,o,d],r)=>{const s=e?[r+`: ${d}(${t}): ${l} => ${n},`]:[r+d+`(${t}): ${l};`];return e||O(s,Pt(o)),E(s,a),s})),F=(e,t,l,n,o,d=a)=>Vt(W,e,[t,l,n,o,d]),U=(e,t,l,n,o,d=a,r=a,s=a)=>F(bt[e]+t+(4==e?xe:a)+l,d,n,(n==H?Jt:Mt)(bt[e]+(4==e?xe:a)+l,r,e?void 0:n),o,s),_=(e,t,l,n=a,o=a,d=1,r=a)=>F(i+e+c,(n?n+", ":a)+ye+": "+t+(d?", mutator?: boolean":a),me,zt(i+e+c,o,d?"mutator":a),l,r),Z=`./${St(n)}.d`,H=St(n,1),Q=St(H),K=[],Y=te();let ee=[],de=[];if(r(1,Z,H,`create${H} as create${H}Decl`),q(e))r(null,l,b);else{r(0,l,"CellChange"),r(null,l,u);const[e,t,n,o,c,i,y,T,v,V,S,A,P,O,L,j,J,W,B,F,q,ae,ne]=G(Q,H),de=te();D(((e,t)=>{const l=`<'${e}'>`,a=[$(t+p,o+l,Ae+` the '${e}' `+p),$(t+p+_e,c+l,Ae+` the '${e}' `+p+Ze),$(t+h,i+l,tt(e)),$(t+h+_e,y+l,tt(e,1)),$(t+f+me,T+l,`A Cell Id for the '${e}' `+p),$(t+f+ie,V+l,ot(`a Cell Id and value from a Row in the '${e}' `+p)),$(t+h+ie,S+l,ot(`a Row Id from the '${e}' Table, and a Cell iterator`)),$(t+p+f+ie,A+l,ot(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];oe(de,e,a),r(1,Z,...a)})),r(1,Z,e,t,n,T,P,O,L,j,J,W,B,F,q,ae,ne),ee=[e,t,n,T,O,L,j,J,W,B,F,q,ae,de],R([[e],[d],[H,"tables: "+t,"tables"],[H]],(([e,t,l],n)=>U(n,a,b,e,et(1,n),t,l))),U(0,a,C,n+Ne,lt(p,Le)),U(5,a,p,Fe,at(p,Le),"tableCallback: "+P,"tableCallback as any"),D(((e,t,l)=>{const[n,o,r,s,I,c,$,i]=le(de,e);R([[n],[d],[H,"table: "+o,", table"],[H]],(([n,o,d=a],r)=>U(r,t,p,n,ct(e,r),o,l+d))),U(0,t,p+w,u,lt(f,"the whole of "+st(e)),a,l),U(5,t,p+f,Fe,at(p+f,"the whole of "+st(e)),"tableCellCallback: "+i,l+", tableCellCallback as any"),U(0,t,g,u,lt(h,st(e)),a,l),U(0,t,m,u,lt(h,st(e),1),"cellId?: "+I+Oe,l+", cellId, descending, offset, limit"),U(5,t,h,Fe,at(h,st(e)),"rowCallback: "+$,l+", rowCallback as any"),R([[r],[d],[H,", row: "+s,", row"],[H],[H,", partialRow: "+s,", partialRow"]],(([n,o=a,d=a],r)=>U(r,t,h,n,$t(e,r),Pe+o,l+", rowId"+d))),U(6,t,h,me+ve,"Add a new Row to "+st(e),"row: "+s+", reuseIds?: boolean",l+", row, reuseIds"),U(0,t,w,I+Ne,lt(f,It(e)),Pe,l+", rowId"),U(5,t,f,Fe,at(f,It(e)),Pe+", cellCallback: "+c,l+", rowId, cellCallback as any"),N(e,((n,o,r,s,I)=>{const c="Map"+St(o,1);oe(Y,o,c);const $=o+(M(r)?ve:a);R([[$],[d],[H,`, cell: ${o} | `+c,", cell as any"],[H]],(([o,d=a,r=a],c)=>U(c,t+I,f,o,it(e,n,c),Pe+d,l+", rowId, "+s+r))),U(1,t+I,p+f,d,pt[1]+` the '${n}' Cell anywhere in `+st(e),a,l+", "+s)}))})),U(0,a,b+we,we,et(1,6)),U(2,a,b+we,H,et(1,7),"tablesJson: "+we,"tables"+we),_(b,O,et(1,8)+" changes"),_(C,L,rt(2,0,1)),_(p,j,rt(3,0),`tableId: ${n} | null`,"tableId"),_(p+w,J,rt(14,3,1),`tableId: ${n} | null`,"tableId"),_(g,W,rt(4,3,1),`tableId: ${n} | null`,"tableId"),_(m,B,rt(13,3,1),Et("tableId: TId",`cellId: ${T}<TId>`+ve,"descending: boolean","offset: number","limit: number"+ve),Et("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(h,F,rt(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(w,q,rt(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,ae,rt(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${k(D((e=>le(de,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),_(fe+f,ne,Se+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),r(1,Z,...X(Y)),E(K,".set"+b+Ee+"({",kt(D(((e,t,l)=>[`[${l}]: {`,...N(e,((e,t,l,n)=>`[${n}]: {[${x(At(s),`'${s}'`)}]: ${x(At(t),`'${t}'`)}${M(l)?a:`, [${x(At(I),`'${I}'`)}]: `+(z(l)?x(At(l),`'${l}'`):l)}},`)),"},"]))),"})")}if(q(t))r(null,l,T);else{const[e,t,n,o,c,$,i,u,p]=j(Q,H);r(1,Z,e,t,n,c,$,i,u,p),de=[e,t,n,$,i,u],R([[e],[d],[H,"values: "+t,"values"],[H],[H,"partialValues: "+t,"partialValues"]],(([e,t,l],n)=>U(n,a,T,e,et(2,n),t,l))),U(0,a,v,n+Ne,lt(y,Le)),U(5,a,y,"void",at(y,Le),"valueCallback: "+c,"valueCallback as any"),L(((e,t,l,n,o)=>{const r="Map"+St(t,1);oe(Y,t,r),R([[t],[d],[H,`value: ${t} | `+r,", value as any"],[H]],(([t,l,d=a],r)=>U(r,o,y,t,ut(e,r),l,n+d)))})),U(0,a,T+we,we,et(2,6)),U(2,a,T+we,H,et(2,7),"valuesJson: "+we,"values"+we),_(T,$,et(2,8)+" changes"),_(v,i,rt(10,0,1)),_(y,u,rt(11,0),`valueId: ${n} | null`,"valueId"),_(fe+y,p,Se+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),r(1,Z,...X(Y)),r(0,l,"ValueChange"),E(K,".set"+T+Ee+"({",L(((e,t,l,n)=>[`[${n}]: {[${x(At(s),`'${s}'`)}]: ${x(At(t),`'${t}'`)}${M(l)?a:`, [${x(At(I),`'${I}'`)}]: `+(z(l)?x(At(l),`'${l}'`):l)}},`])),"})")}U(0,a,"Content",`[${b}, ${T}]`,et(0,0)),U(2,a,"Content",H,et(0,2),`[tables, values]: [${b}, ${T}]`,"[tables, values]"),U(2,a,je,H,`Applies a set of ${je} to the Store`,"transactionChanges: "+je,"transactionChanges"),ae(Y,((e,t)=>$(t,`(cell: ${e}${ve}) => `+e,`Takes a ${e} Cell value and returns another`))),r(null,l,"DoRollback",me,"IdOrNull",we,"Store",je),r(0,l,"Get"+je,"GetTransactionLog"),U(0,a,we,we,et(0,6)),U(2,a,we,H,et(0,7),"tablesAndValuesJson: "+we,"tablesAndValuesJson"),U(7,a,Me,"Return",Je,he,"actions, doRollback","<Return>"),U(7,a,"start"+Ge,H,ze),U(7,a,"finish"+Ge,H,We,Ce,"doRollback");const re=J(Q,H);return _("Start"+Ge,re,Se+" just before the start of the "+Me,a,a,0),_("WillFinish"+Ge,re,Se+" just before "+Be,a,a,0),_("DidFinish"+Ge,re,Se+" just after "+Be,a,a,0),U(7,a,"call"+c,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,c,H,"Remove a listener that was previously added to "+Le,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",pt[0]+" the underlying Store object"),r(1,l,"createStore"),r(1,Z,H,`create${H} as create${H}Decl`,re),x("store",["createStore()",...K]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...B(1),"}"]),[o(...S(0),...A(),ge+" interface "+H+" {",...B(0),"}",a,Pt(`Creates a ${H} object`),ge+" function create"+H+"(): "+H+";"),o(...S(1),ge+" const create"+H+": typeof create"+H+"Decl = () => {",...P(),`return Object.freeze(${Q});`,"};"),ee,de]},Bt=e=>$+e,Ft=e=>Et(Bt(e),Bt(e)+pe),Ut="debugIds?: boolean",_t="debugIds={debugIds}",Zt="then"+be,Ht="Parameter",Qt=": (parameter: "+Ht+", store: Store) => ",qt="const contextValue = useContext(Context);",Kt=", based on a parameter",Xt=": ",Yt="<"+Ht+",>",el=Ht+"ized"+ie+"<"+Ht+">",tl="rowId",ll="rowId={rowId}",al=", separator, debugIds",nl="separator?: ReactElement | string",ol="then?: (store: Store",dl=Et(ol+")"+Ue,Zt),rl="then, then"+pe,sl=tl+Xt+me,Il="View",cl=(e,...t)=>Et(...t,ye+": "+e,ye+be,"mutator?: boolean"),$l=(...e)=>Et(...e,ye,ye+pe,"mutator"),il=(e,t,n,o,d)=>{const[r,s,I,$,i,V,x,R]=Nt(),[S,A,P]=Gt(e,t,i),D=`./${St(n)}.d`,N=`./${St(n)}-ui-react.d`,L="tinybase/ui-react",G=St(n,1),j=St(G),J=G+"Or"+G+me,z=j+"Or"+G+me,W=j+`={${j}}`,B=te(),F=(e,t,l,n,o,d=a)=>(s(1,N,e+" as "+e+"Decl"),Vt(B,e,[t,l,n,o,d])),U=(e,t,l,n,o,d=a)=>F("use"+e,t,l,n,o,d),_=(e,t,l,n,o=a,d=a,r=a,I=a,c=a)=>(s(1,L,`use${t} as use${t}Core`),U(e,Et(o,X,I),l,ee+`(${z}, use${t}Core, [`+(d||a)+(c?"], ["+c:a)+"]);",n,r)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>ne(B,(([t,l,n,o,d],r)=>{const s=e?[ge+` const ${r}: typeof ${r}Decl = ${d}(${t}): ${1==l?"any":l} =>`,n]:[ge+` function ${r}${d}(${t}): ${1==l?"ComponentReturnType":l};`];return e||O(s,Pt(o)),E(s,a),s}));s(null,l,me,"Store",ie,Ht+"ized"+ie),s(0,L,"ComponentReturnType"),s(null,L,"ExtraProps"),s(0,D,G);const Q=I(J,G+" | "+me,`Used when you need to refer to a ${G} in a React hook or component`),K=I(ke+Re,Ot(j+Te+G,j+`ById?: {[${j}Id: Id]: ${G}}`),`Used with the ${ke} component, so that a `+G+" can be passed into the context of an application");s(0,"react","ReactElement","ComponentType"),s(1,"react","React"),s(1,N,Q,K);const X=z+Te+Q;i("{createContext, useContext, useMemo}","React"),i("Context",`createContext<[${G}?, {[${j}Id: Id]: ${G}}?]>([])`),U("Create"+G,`create: () => ${G}, create`+be,G,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${G} within a React application with convenient memoization`);const Y=U(G,"id?: Id",G+ve,["{",qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${G} from within a ${ke} component context`),ee=$("useHook",z+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${j} = ${Y}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${j} : ${z})?.getStore(), ...postParams)`]),ae=$("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=$("wrap",Et("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=i("NullComponent","() => null");if(!q(e)){const[e,t,n,d,r,i,y,T,v,V,x,R,P,E]=o;s(null,D,e,t,n,r,i,y,T,v,V,x,R,P),s(0,D,d),s(1,D,G),s(null,l,u,"IdOrNull");const O=$("tableView",`{${j}, rowComponent, getRowComponentProps`+al+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+ae+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ll,W,_t,"/>","))",al,", tableId,",");"]),L=$("getDefaultTableComponent","tableId: Id",k(S(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+de),J=$("getDefaultCellComponent","tableId: Id, cellId: Id",k(S(((e,t,l)=>`tableId == ${l} ? ${k(A(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+de} : `)))+de);_(b,b,e,et(1,0)+$e);const z=_(C,C,n+Ne,lt(p,Le)+$e);_(De+b+ie,De+b+ie,el,et(1,9)+Kt,Et(Bt(b)+Qt+t,Bt(b)+be),Ft(b),Yt,Et(ol,`tables: ${t})`+Ue,Zt),rl),_(ue+b+ie,ue+b+ie,ie,et(1,12),a,a,a,dl,rl);const B=I(f+Re,Ot("tableId?: TId","rowId: Id","cellId?: CId",j+Te+G,Ut),nt(Ie+f),`<TId extends ${n}, CId extends ${d}<TId>>`),F=I(h+Re,Ot("tableId?: TId","rowId: Id",j+Te+G,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${B}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,nl,Ut),nt(Ie+h),`<TId extends ${n}>`),U=I(p+Re,Ot("tableId?: TId",j+Te+G,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps",nl,Ut),nt(Ie+p),`<TId extends ${n}>`),H=I("Sorted"+p+Re,Ot("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",j+Te+G,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps",nl,Ut),nt(Ie+"sorted "+p),`<TId extends ${n}>`),Q=I(b+Re,Ot(j+Te+G,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${U}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,nl,Ut),nt(Ye(1,1)));s(1,N,Q,U,H,F,B),Z(b+Il,"{"+j+", tableComponents, getTableComponentProps"+al+"}: "+Q,[oe+`(${z}(${j}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+L+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ae}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",W,_t,"/>;","}), separator)"],et(1,13)+$e),S(((e,t,l)=>{const[n,o,d,r,I]=le(E,e);s(null,D,n,o,d,r,I),_(t+p,p,n,ct(e)+$e,a,l),_(t+p+w,p+w,u,lt(f,"the whole of "+st(e))+$e,a,l);const c=_(t+g,g,u,lt(h,st(e))+$e,a,l),$=_(t+m,m,u,lt(h,st(e),1)+$e,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",l+", cellId, descending, offset, limit");_(t+h,h,d,$t(e)+$e,sl,Et(l,tl));const i=_(t+w,w,I+Ne,lt(f,It(e))+$e,sl,Et(l,tl));_(De+t+p+ie,De+p+ie,el,ct(e,9)+Kt,Et(Bt(p)+Qt+o,Bt(p)+be),Et(l,Ft(p)),Yt,Et(ol,`table: ${o})`+Ue,Zt),rl),_(ue+t+p+ie,ue+p+ie,ie,ct(e,12),a,l,a,dl,rl),_(De+t+h+ie,De+h+ie,el,$t(e,9)+Kt,Et(sl,Bt(h)+Qt+r,Bt(h)+be),Et(l,tl,Ft(h)),Yt,Et(ol,`row: ${r})`+Ue,Zt),rl),_("Add"+t+h+ie,"Add"+h+ie,el,$t(e,10)+Kt,Et(Bt(h)+Qt+r,Bt(h)+be),Et(l,Ft(h)),Yt,"then?: ("+Et(sl+ve,"store: Store","row: "+r+")"+Ue,"then"+be)+", reuseRowIds?: boolean",rl+", reuseRowIds"),_(De+t+xe+h+ie,De+xe+h+ie,el,$t(e,11)+Kt,Et(sl,Bt(xe+h)+Qt+r,Bt(xe+h)+be),Et(l,tl,Ft(xe+h)),Yt,Et(ol,`partialRow: ${r})`+Ue,Zt),rl),_(ue+t+h+ie,ue+h+ie,ie,$t(e,12),sl,Et(l,tl),a,dl,rl);const b=Z(t+h+Il,"{rowId, "+j+", cellComponents, getCellComponentProps"+al+`}: ${F}<'${e}'>`,[oe+`(${i}(rowId, ${j}).map((cellId) => {`,"const Cell = (cellComponents?.[cellId] ?? "+J+`(${l}, cellId)) as React.ComponentType<CellProps<typeof `+l+", typeof cellId>>;","return <Cell",`{...${ae}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${l}}`,ll,"cellId={cellId}",W,_t,"/>;","})"+al+", rowId)"],$t(e,13)+$e);Z(t+"Sorted"+p+Il,"{cellId, descending, offset, limit, ...props}: "+H+`<'${e}'>`,O+"(props, "+$+`(cellId, descending, offset, limit, props.${j}), ${l}, ${b});`,ct(e,13)+", sorted"+$e),Z(t+p+Il,`props: ${U}<'${e}'>`,O+"(props, "+c+`(props.${j}), ${l}, ${b});`,ct(e,13)+$e),A(e,((n,o,d,r,I)=>{const c="Map"+St(o,1);s(0,D,c),s(1,D,c);const $=_(t+I+f,f,o+(M(d)?ve:a),it(e,n)+$e,sl,Et(l,tl,r));_(De+t+I+f+ie,De+f+ie,el,it(e,n,9)+Kt,Et(sl,Bt(f)+Qt+o+" | "+c,Bt(f)+be),Et(l,tl,r,Ft(f)),Yt,Et(ol,`cell: ${o} | ${c})`+Ue,Zt),rl),_(ue+t+I+f+ie,ue+f+ie,ie,it(e,n,12),Et(sl,"forceDel?: boolean"),Et(l,tl,r,"forceDel"),a,dl,rl),Z(t+I+f+Il,`{rowId, ${j}, debugIds}: `+B+`<'${e}', '${n}'>`,[oe+`('' + ${$}(rowId, `+j+`) ?? '', undefined, debugIds, ${r})`],it(e,n,13)+$e)}))}));const q=k(S((e=>le(E,e)?.[4]??a))," | ");_(b+c,b+c,Fe,et(1,8)+" changes",cl(r),$l()),_(C+c,C+c,Fe,rt(2,0,1),cl(i),$l()),_(p+c,p+c,Fe,rt(3,0),cl(y,`tableId: ${n} | null`),$l("tableId")),_(p+w+c,p+w+c,Fe,rt(14,3,1),cl(T,`tableId: ${n} | null`),$l("tableId")),_(g+c,g+c,Fe,rt(4,3,1),cl(v,`tableId: ${n} | null`),$l("tableId")),_(m+c,m+c,Fe,rt(13,3,1),cl(V,`tableId: ${n} | null`,"cellId: "+q+ve,"descending: boolean","offset: number","limit: number"+ve),$l("tableId","cellId","descending","offset","limit")),_(h+c,h+c,Fe,rt(5,3),cl(x,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(w+c,w+c,Fe,rt(6,5,1),cl(R,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(f+c,f+c,Fe,rt(7,5),cl(P,`tableId: ${n} | null`,tl+": IdOrNull",`cellId: ${q} | null`),$l("tableId",tl,"cellId"))}if(!q(t)){const[e,t,l,n,o,r]=d;s(null,D,...d),s(1,D,G);const i=$("getDefaultValueComponent","valueId: Id",k(P(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+de);_(T,T,e,et(2,0)+$e);const u=_(v,v,l+Ne,lt(y,Le)+$e);_(De+T+ie,De+T+ie,el,et(2,9)+Kt,Et(Bt(T)+Qt+t,Bt(T)+be),Ft(T),Yt,Et(ol,`values: ${t})`+Ue,Zt),rl),_(De+xe+T+ie,De+xe+T+ie,el,et(2,11)+Kt,Et(Bt(xe+T)+Qt+t,Bt(xe+T)+be),Ft(xe+T),Yt,Et(ol,`partialValues: ${t})`+Ue,Zt),rl),_(ue+T+ie,ue+T+ie,ie,et(2,12),a,a,a,dl,rl);const p=I(y+Re,Ot("valueId?: VId",j+Te+G,Ut),nt("a Value"),`<VId extends ${l}>`),b=I(T+Re,Ot(j+Te+G,"valueComponents?: {readonly [VId in "+l+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${l}) => ExtraProps`,nl,Ut),nt(Ye(2,1)));s(1,N,b,p),Z(T+Il,"{"+j+", valueComponents, getValueComponentProps"+al+"}: "+b,[oe+`(${u}(${j}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+i+"(valueId);","return <Value",`{...${ae}(getValueComponentProps, valueId)}`,"key={valueId}",W,_t,"/>;","}), separator)"],et(2,13)+$e),P(((e,t,l,n,o)=>{const d="Map"+St(t,1);s(0,D,d),s(1,D,d);const r=_(o+y,y,t,ut(e)+$e,a,n);_(De+o+y+ie,De+y+ie,el,ut(e,9)+Kt,Et(Bt(y)+Qt+t+" | "+d,Bt(y)+be),Et(n,Ft(y)),Yt,Et(ol,`value: ${t} | ${d})`+Ue,Zt),rl),_(ue+o+y+ie,ue+y+ie,ie,ut(e,12),a,n,a,dl,rl),Z(o+y+Il,`{${j}, debugIds}: ${p}<'${e}'>`,[oe+`('' + ${r}(`+j+`) ?? '', undefined, debugIds, ${n})`],ut(e,13)+$e)})),_(T+c,T+c,Fe,et(2,8)+" changes",cl(n),$l()),_(v+c,v+c,Fe,rt(10,0,1),cl(o),$l()),_(y+c,y+c,Fe,rt(11,0),cl(r,`valueId: ${l} | null`),$l("valueId"))}return Z(ke,`{${j}, ${j}ById, children}: `+K+" & {children: React.ReactNode}",["{",qt,"return (","<Context."+ke,"value={useMemo(",`() => [${j} ?? contextValue[0], {...contextValue[1], ...${j}ById}],`,`[${j}, ${j}ById, contextValue],`,")}>","{children}",`</Context.${ke}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[r(...V(0),...x(),...H(0)),r(...V(1),...R(),...H(1))]},ul=(e,t,l)=>{if(q(e)&&q(t))return[a,a,a,a];const[n,o,d,r]=Wt(e,t,l);return[n,o,...il(e,t,l,d,r)]},pl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},bl=Lt((e=>{const t=()=>{const t=L(e.getTablesSchemaJson());return!q(t)||V(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=te();if(V(a,(t=>V(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=de(n,a,(()=>[B(o),te(),[0],0])),[r,s,[I]]=d,c=de(s,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),oe(s,o,c),d[3]++,r==B(o)})))))return t[l]={},Y(n,(([e,,[,n],o],d)=>{t[l][d]={[s]:e,...o==A(a)?{[I]:n}:{}}})),1}))?t:{}},l=()=>{const t=L(e.getValuesSchemaJson());return q(t)&&e.forEachValue(((e,l)=>{t[e]={[s]:B(l)}})),t},a=e=>ul(t(),l(),e),n=async e=>{const t=["d.ts","ts","d.ts","tsx"];let l;try{l=(await import("prettier")).format}catch(e){l=e=>e}return S(a(e),((e,a)=>xt(l(e,{...pl,filepath:"_."+t[a]}))))};return _({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let r=0,s=0;const I={};d(((e,l)=>{r++;let a=0;l((()=>a++)),s+=a,t&&(I[e]={rowCells:a})})),a+=r,n+=s,t&&(o[e]={tableRows:r,tableCells:s,rows:I})})),{totalTables:l,totalRows:a,totalCells:n,totalValues:A(e.getValueIds()),jsonLength:Rt(e.getJson()),...t?{detail:{tables:o}}:{}}},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=bl},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=e=>typeof e,l="tinybase",a="",n=",",o=t(a),d=t(!0),s=t(0),r="type",I="default",c="Listener",$="get",i="add",u="Ids",p="Table",b=p+"s",C=p+u,h="Row",m=h+u,g="Sorted"+h+u,f="Cell",w=f+u,y="Value",T=y+"s",v=y+u,V=(e,t)=>e.every(t),x=(e,t)=>e.sort(t),R=(e,t)=>e.forEach(t),k=(e,t=a)=>e.join(t),S=(e,t)=>e.map(t),A=e=>e.length,P=(e,t)=>e.filter(t),E=(e,...t)=>e.push(...t),D=e=>e.pop(),O=(e,...t)=>e.unshift(...t),N=e=>e.shift(),L=JSON.parse,G=isFinite,j=(e,t)=>e instanceof t,M=e=>null==e,J=e=>e==o||e==d,z=e=>t(e)==o,W=e=>Array.isArray(e),B=e=>{const l=t(e);return J(l)||l==s&&G(e)?l:void 0},F=Object,U=F.keys,_=F.freeze,Z=e=>j(e,F)&&e.constructor==F,H=(e,t)=>S(F.entries(e),(([e,l])=>t(l,e))),Q=e=>A(U(e)),q=e=>Z(e)&&0==Q(e),K=(e,t)=>e?.has(t)??!1,X=e=>[...e?.values()??[]],Y=(e,t)=>e?.forEach(t),ee=(e,t)=>e?.delete(t),te=e=>new Map(e),le=(e,t)=>e?.get(t),ae=(e,t)=>Y(e,((e,l)=>t(l,e))),ne=(e,t)=>S([...e?.entries()??[]],(([e,l])=>t(l,e))),oe=(e,t,l)=>M(l)?(ee(e,t),e):e?.set(t,l),de=(e,t,l)=>(K(e,t)||oe(e,t,l()),le(e,t)),se=e=>e.toUpperCase(),re=e=>e.toLowerCase(),Ie="a ",ce="A function for",$e=", and registers a listener so that any changes to that result will cause a re-render",ie="Callback",ue="Del",pe="Deps",be=pe+"?: React.DependencyList",Ce="doRollback?: DoRollback",he="actions: () => Return, "+Ce,me="export",ge="Id",fe="Invalid",we="Json",ye=re(c),Te="?: ",ve=" | undefined",Ve="NonNullable",xe="Partial",Re="Props",ke="Provider",Se=`Registers a ${ye} that will be called`,Ae="Represents",Pe="rowId: "+ge,Ee="Schema",De="Set",Oe=", descending?: boolean, offset?: number, limit?: number",Ne="[]",Le="the Store",Ge="Transaction",je=Ge+"Changes",Me=re(Ge),Je="Execute a "+Me+" to make multiple mutations",ze="Explicitly starts a "+Me,We="Explicitly finishes a "+Me,Be="the end of the "+Me,Fe="void",Ue=" => "+Fe,_e="WhenSet",Ze=" when setting it",He=Ie+"string serialization of",Qe=" ",qe="Gets a callback that can ",Ke="the ",Xe=" the schema for",Ye=(e=0,t=0)=>`the ${ht[e]}content of`+(t?Qe+Le:a),et=(e=0,t,l=0)=>pt[t]+Qe+Ye(e,1)+(l?" when setting it":a),tt=(e,t=0)=>Ae+` a Row when ${t?"s":"g"}etting ${Ye()} the '${e}' `+p,lt=(e,t,l=0)=>`Gets ${l?"sorted, paginated":"the"} Ids of the ${e}s in `+t,at=(e,t)=>`Calls a function for each ${e} in `+t,nt=e=>"The props passed to a component that renders "+e,ot=e=>"A function that takes "+e,dt=(e,t=0)=>ce+" listening to changes to "+Ct[e]+" in "+Ct[t],st=(e,t,l=0)=>Se+" whenever "+Ct[e]+" in "+Ct[t]+" change"+(l?a:"s"),rt=e=>`the '${e}' `+p,It=e=>"the specified Row in "+rt(e),ct=(e,t=0)=>pt[t]+` ${Ye()} `+rt(e),$t=(e,t=0)=>pt[t]+` ${Ye()} `+It(e),it=(e,t,l=0)=>pt[l]+` the '${t}' Cell for `+It(e),ut=(e,t=0)=>pt[t]+` the '${e}' Value`,pt=["Gets","Checks existence of","Sets","Deletes","Sets part of",Ae,"Gets "+He,"Sets "+He,Se+" whenever",qe+"set",qe+"add",qe+"set part of",qe+"delete","Renders","Gets "+He+Xe,"Sets"+Xe,"Deletes"+Xe],bt=[$,"has","set","del","set","forEach",i,a],Ct=[Le,b,Ke+p+Qe+u,Ie+p,Ke+h+Qe+u,Ie+h,Ke+f+Qe+u,Ie+f,"invalid Cell changes",T,Ke+y+Qe+u,Ie+y,"invalid Value changes",Ke+"sorted "+h+Qe+u,Ke+f+Qe+u+" anywhere"],ht=[a,"tabular ","keyed value "],mt=e=>new Set(W(e)||M(e)?e:[e]),gt=(e,t)=>e?.add(t),ft=/[^A-Za-z]+/,wt=/[^A-Za-z0-9]+/,yt=/^( *)\/\*\* *(.*?) *\*\/$/gm,Tt=(e,t,l)=>e.substring(t,l),vt=e=>e.includes(n),Vt=(e,t,l,a=1)=>{const n=`${t}${1==a?"":a}`;return K(e,n)?Vt(e,t,l,a+1):(oe(e,n,l),n)},xt=e=>e.replace(yt,((e,t,l)=>{const a=77-Rt(t);return`${t}/**\n${l.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),t+" * $1\n")}${t} */`})),Rt=e=>e.length,kt=e=>e.flat(1e3),St=(e,t=0)=>k(S(e.split(wt),((e,l)=>(l>0||t?se:re)(Tt(e,0,1))+Tt(e,1)))),At=e=>se(k((e&&!ft.test(e[0])?e:" "+e).split(wt),"_")),Pt=e=>`/** ${e}. */`,Et=(...e)=>k(P(e,(e=>e)),", "),Dt=(...e)=>"{"+k(e,"; ")+"}",Ot=(...e)=>Dt(...S(e,(e=>"readonly "+e))),Nt=()=>{const e=[te(),te(),te(),te()],t=te(),l=te(),n=e=>{const t=e.indexOf(" as ");return-1!=t?e.substring(t+4):e};return[(...e)=>k(kt(e),"\n"),(t,l,...a)=>R(a,(a=>R([0,1],(n=>(t??n)==n?gt(de(e[n],l,mt),a):0)))),(e,l,n,o=a,d=1)=>Vt(t,e,[l,n,o,d]),(e,t,a)=>Vt(l,e,W(a)?[`(${t}) => {`,a,"}"]:[`(${t}) => ${a}`]),(e,t)=>le(l,e)===t?e:Vt(l,e,t),(t=0)=>S([...x(ne(e[t],((e,t)=>`import {${k(x(X(e),((e,t)=>n(e)>n(t)?1:-1)),", ")}} from '${t}';`)),((e,t)=>vt(e)!=vt(t)?vt(e)?-1:1:e>t?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ne(t,(([e,t,l,n],o)=>[Pt(t),`${n?me+" ":a}type ${o}${l} = ${e};`,a])),()=>ne(l,((e,t)=>(e=W(e)?e:[e],E(e,D(e)+";"),[`const ${t} = ${N(e)}`,e,a])))]},Lt=e=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Gt=(e,t,l)=>[t=>H(e,((e,a)=>t(a,St(a,1),l(At(a),`'${a}'`)))),(t,a)=>H(e[t],((e,t)=>a(t,e[r],e[I],l(At(t),`'${t}'`),St(t,1)))),e=>H(t,((t,a)=>e(a,t[r],t[I],l(At(a),`'${a}'`),St(a,1))))],jt=(e,t,l,n)=>[(n,o)=>{const d=n+": "+o,s=e(b,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...l(e,((e,t,l)=>`'${e}'${M(l)?"?":a}: ${t}`)))+"}"))),et(1,5)),r=e(b+_e,Dt(...t((e=>`'${e}'?: {[rowId: Id]: `+Dt(...l(e,((e,t)=>`'${e}'?: ${t}`)))+"}"))),et(1,5,1)),I=e(p+ge,"keyof "+s,"A "+p+" Id in "+Le),$=`<TId extends ${I}>`,i=e(p,Ve+`<${s}[TId]>`,"A "+p+" in "+Le,$),u=e(p+_e,Ve+`<${r}[TId]>`,"A "+p+" in "+Le+Ze,$),y=e(h,i+"<TId>[Id]","A "+h+" in a "+p,$),T=e(h+_e,u+"<TId>[Id]","A "+h+" in a "+p+Ze,$),v=e(f+ge,`Extract<keyof ${y}<TId>, Id>`,"A "+f+" Id in a "+h,$),V=e(f,Ve+`<${s}[TId]>[Id][CId]`,"A "+f+" in a "+h,`<TId extends ${I}, CId extends ${v}<TId>>`),x=e("CellIdCellArray",`CId extends ${v}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,f+" Ids and types in a "+h,`<TId extends ${I}, CId = ${v}<TId>>`,0),R=e(f+ie,`(...[cellId, cell]: ${x}<TId>)`+Ue,ot(Ie+f+" Id, and "+f),$),k=e(h+ie,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ue+") "+Ue,ot(Ie+h+" Id, and a "+f+" iterator"),$),S=e(p+f+ie,`(cellId: ${v}<TId>, count: number) `+Ue,ot(Ie+f+" Id, and count of how many times it appears"),$),A=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Ue}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),P=e(p+ie,`(...[tableId, forEachRow]: ${A})`+Ue,ot(Ie+p+" Id, and a "+h+" iterator"),a),E=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${v}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${E}) => CellChange`,ce+" returning information about any Cell's changes during a "+Me),O=e(b+c,`(${d}, getCellChange: ${D}${ve})`+Ue,dt(1)),N=e(C+c,`(${d})`+Ue,dt(2)),L=e(p+c,`(${d}, tableId: ${I}, getCellChange: ${D}${ve})`+Ue,dt(3)),G=e(p+w+c,`(${d}, tableId: ${I})`+Ue,dt(14,3)),j=e(m+c,`(${d}, tableId: ${I})`+Ue,dt(4,3)),J=e(g+c,"("+Et(d,"tableId: "+I,"cellId: Id"+ve,"descending: boolean","offset: number","limit: number"+ve,"sortedRowIds: Ids")+")"+Ue,dt(13,3)),z=e(h+c,"("+Et(""+d,"tableId: "+I,Pe,`getCellChange: ${D}${ve}`)+")"+Ue,dt(5,3)),W=e(w+c,"("+Et(""+d,"tableId: "+I,Pe)+")"+Ue,dt(6,5)),B=e("CellListenerArgsArrayInner",`CId extends ${v}<TId> ? [${d}, tableId: TId, ${Pe}, cellId: CId, newCell: ${V}<TId, CId> ${ve}, oldCell: ${V}<TId, CId> ${ve}, getCellChange: ${D} ${ve}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${v}<TId>>`,0),F=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+B+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[s,r,I,i,u,y,T,v,V,R,k,S,P,O,N,L,G,j,J,z,W,e(f+c,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${F})`+Ue,dt(7,5)),e(fe+f+c,`(${d}, tableId: Id, ${Pe}, cellId: Id, invalidCells: any[])`+Ue,dt(8))]},(t,l)=>{const o=t+": "+l,d=e(T,Dt(...n(((e,t,l)=>`'${e}'${M(l)?"?":a}: ${t}`))),et(2,5)),s=e(T+_e,Dt(...n(((e,t)=>`'${e}'?: ${t}`))),et(2,5,1)),r=e(y+ge,"keyof "+d,"A "+y+" Id in "+Le),I=e(y,Ve+`<${d}[VId]>`,"A "+y+" Id in "+Le,`<VId extends ${r}>`),$=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+Le,`<VId = ${r}>`,0),i=e(y+ie,`(...[valueId, value]: ${$})`+Ue,ot(Ie+y+" Id, and "+y)),u=e("GetValueChange",`(valueId: ${r}) => ValueChange`,ce+" returning information about any Value's changes during a "+Me),p=e(T+c,`(${o}, getValueChange: ${u}${ve})`+Ue,dt(9)),b=e(v+c,`(${o})`+Ue,dt(10)),C=e("ValueListenerArgsArray",`VId extends ${r} ? [${o}, valueId: VId, newValue: ${I}<VId> ${ve}, oldValue: ${I}<VId> ${ve}, getValueChange: ${u} ${ve}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[d,s,r,I,i,p,b,e(y+c,`(...[${t}, valueId, newValue, oldValue, getValueChange]: `+C+")"+Ue,dt(11)),e(fe+y+c,`(${o}, valueId: Id, invalidValues: any[])`+Ue,dt(12))]},(t,l)=>e(Ge+c,`(${t}: ${l}, getTransactionChanges: GetTransactionChanges, getTransactionLog: GetTransactionLog)`+Ue,ce+" listening to the completion of a "+Me)],Mt=(e,t=a,l=a)=>`store.${e}(${t})`+(l?" as "+l:a),Jt=(e,t=a)=>`fluent(() => ${Mt(e,t)})`,zt=(e,t=a,l=a)=>`store.${e}(${t?t+", ":a}proxy(listener)${l?", "+l:a})`,Wt=(e,t,n)=>{const[o,s,$,V,x,S,A,P]=Nt(),[D,N,L]=Gt(e,t,x),[G,j,J]=jt($,D,N,L),W=te(),B=(e=0)=>ne(W,(([t,l,n,o,d],s)=>{const r=e?[s+`: ${d}(${t}): ${l} => ${n},`]:[s+d+`(${t}): ${l};`];return e||O(r,Pt(o)),E(r,a),r})),F=(e,t,l,n,o,d=a)=>Vt(W,e,[t,l,n,o,d]),U=(e,t,l,n,o,d=a,s=a,r=a)=>F(bt[e]+t+(4==e?xe:a)+l,d,n,(n==H?Jt:Mt)(bt[e]+(4==e?xe:a)+l,s,e?void 0:n),o,r),_=(e,t,l,n=a,o=a,d=1,s=a)=>F(i+e+c,(n?n+", ":a)+ye+": "+t+(d?", mutator?: boolean":a),ge,zt(i+e+c,o,d?"mutator":a),l,s),Z=`./${St(n)}.d`,H=St(n,1),Q=St(H),K=[],Y=te();let ee=[],de=[];if(s(1,Z,H,`create${H} as create${H}Decl`),q(e))s(null,l,b);else{s(0,l,"CellChange"),s(null,l,u);const[e,t,n,o,c,i,y,T,v,V,S,A,P,O,L,j,J,W,B,F,q,ae,ne]=G(Q,H),de=te();D(((e,t)=>{const l=`<'${e}'>`,a=[$(t+p,o+l,Ae+` the '${e}' `+p),$(t+p+_e,c+l,Ae+` the '${e}' `+p+Ze),$(t+h,i+l,tt(e)),$(t+h+_e,y+l,tt(e,1)),$(t+f+ge,T+l,`A Cell Id for the '${e}' `+p),$(t+f+ie,V+l,ot(`a Cell Id and value from a Row in the '${e}' `+p)),$(t+h+ie,S+l,ot(`a Row Id from the '${e}' Table, and a Cell iterator`)),$(t+p+f+ie,A+l,ot(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];oe(de,e,a),s(1,Z,...a)})),s(1,Z,e,t,n,T,P,O,L,j,J,W,B,F,q,ae,ne),ee=[e,t,n,T,O,L,j,J,W,B,F,q,ae,de],R([[e],[d],[H,"tables: "+t,"tables"],[H]],(([e,t,l],n)=>U(n,a,b,e,et(1,n),t,l))),U(0,a,C,n+Ne,lt(p,Le)),U(5,a,p,Fe,at(p,Le),"tableCallback: "+P,"tableCallback as any"),D(((e,t,l)=>{const[n,o,s,r,I,c,$,i]=le(de,e);R([[n],[d],[H,"table: "+o,", table"],[H]],(([n,o,d=a],s)=>U(s,t,p,n,ct(e,s),o,l+d))),U(0,t,p+w,u,lt(f,"the whole of "+rt(e)),a,l),U(5,t,p+f,Fe,at(p+f,"the whole of "+rt(e)),"tableCellCallback: "+i,l+", tableCellCallback as any"),U(0,t,m,u,lt(h,rt(e)),a,l),U(0,t,g,u,lt(h,rt(e),1),"cellId?: "+I+Oe,l+", cellId, descending, offset, limit"),U(5,t,h,Fe,at(h,rt(e)),"rowCallback: "+$,l+", rowCallback as any"),R([[s],[d],[H,", row: "+r,", row"],[H],[H,", partialRow: "+r,", partialRow"]],(([n,o=a,d=a],s)=>U(s,t,h,n,$t(e,s),Pe+o,l+", rowId"+d))),U(6,t,h,ge+ve,"Add a new Row to "+rt(e),"row: "+r+", reuseIds?: boolean",l+", row, reuseIds"),U(0,t,w,I+Ne,lt(f,It(e)),Pe,l+", rowId"),U(5,t,f,Fe,at(f,It(e)),Pe+", cellCallback: "+c,l+", rowId, cellCallback as any"),N(e,((n,o,s,r,I)=>{const c="Map"+St(o,1);oe(Y,o,c);const $=o+(M(s)?ve:a);R([[$],[d],[H,`, cell: ${o} | `+c,", cell as any"],[H]],(([o,d=a,s=a],c)=>U(c,t+I,f,o,it(e,n,c),Pe+d,l+", rowId, "+r+s))),U(1,t+I,p+f,d,pt[1]+` the '${n}' Cell anywhere in `+rt(e),a,l+", "+r)}))})),U(0,a,b+we,we,et(1,6)),U(2,a,b+we,H,et(1,7),"tablesJson: "+we,"tables"+we),_(b,O,et(1,8)+" changes"),_(C,L,st(2,0,1)),_(p,j,st(3,0),`tableId: ${n} | null`,"tableId"),_(p+w,J,st(14,3,1),`tableId: ${n} | null`,"tableId"),_(m,W,st(4,3,1),`tableId: ${n} | null`,"tableId"),_(g,B,st(13,3,1),Et("tableId: TId",`cellId: ${T}<TId>`+ve,"descending: boolean","offset: number","limit: number"+ve),Et("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(h,F,st(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(w,q,st(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,ae,st(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${k(D((e=>le(de,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),_(fe+f,ne,Se+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),s(1,Z,...X(Y)),E(K,".set"+b+Ee+"({",kt(D(((e,t,l)=>[`[${l}]: {`,...N(e,((e,t,l,n)=>`[${n}]: {[${x(At(r),`'${r}'`)}]: ${x(At(t),`'${t}'`)}${M(l)?a:`, [${x(At(I),`'${I}'`)}]: `+(z(l)?x(At(l),`'${l}'`):l)}},`)),"},"]))),"})")}if(q(t))s(null,l,T);else{const[e,t,n,o,c,$,i,u,p]=j(Q,H);s(1,Z,e,t,n,c,$,i,u,p),de=[e,t,n,$,i,u],R([[e],[d],[H,"values: "+t,"values"],[H],[H,"partialValues: "+t,"partialValues"]],(([e,t,l],n)=>U(n,a,T,e,et(2,n),t,l))),U(0,a,v,n+Ne,lt(y,Le)),U(5,a,y,"void",at(y,Le),"valueCallback: "+c,"valueCallback as any"),L(((e,t,l,n,o)=>{const s="Map"+St(t,1);oe(Y,t,s),R([[t],[d],[H,`value: ${t} | `+s,", value as any"],[H]],(([t,l,d=a],s)=>U(s,o,y,t,ut(e,s),l,n+d)))})),U(0,a,T+we,we,et(2,6)),U(2,a,T+we,H,et(2,7),"valuesJson: "+we,"values"+we),_(T,$,et(2,8)+" changes"),_(v,i,st(10,0,1)),_(y,u,st(11,0),`valueId: ${n} | null`,"valueId"),_(fe+y,p,Se+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),s(1,Z,...X(Y)),s(0,l,"ValueChange"),E(K,".set"+T+Ee+"({",L(((e,t,l,n)=>[`[${n}]: {[${x(At(r),`'${r}'`)}]: ${x(At(t),`'${t}'`)}${M(l)?a:`, [${x(At(I),`'${I}'`)}]: `+(z(l)?x(At(l),`'${l}'`):l)}},`])),"})")}U(0,a,"Content",`[${b}, ${T}]`,et(0,0)),U(2,a,"Content",H,et(0,2),`[tables, values]: [${b}, ${T}]`,"[tables, values]"),U(2,a,je,H,`Applies a set of ${je} to the Store`,"transactionChanges: "+je,"transactionChanges"),ae(Y,((e,t)=>$(t,`(cell: ${e}${ve}) => `+e,`Takes a ${e} Cell value and returns another`))),s(null,l,"DoRollback",ge,"IdOrNull",we,"Store",je),s(0,l,"Get"+je,"GetTransactionLog"),U(0,a,we,we,et(0,6)),U(2,a,we,H,et(0,7),"tablesAndValuesJson: "+we,"tablesAndValuesJson"),U(7,a,Me,"Return",Je,he,"actions, doRollback","<Return>"),U(7,a,"start"+Ge,H,ze),U(7,a,"finish"+Ge,H,We,Ce,"doRollback");const se=J(Q,H);return _("Start"+Ge,se,Se+" just before the start of the "+Me,a,a,0),_("WillFinish"+Ge,se,Se+" just before "+Be,a,a,0),_("DidFinish"+Ge,se,Se+" just after "+Be,a,a,0),U(7,a,"call"+c,H,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,c,H,"Remove a listener that was previously added to "+Le,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",pt[0]+" the underlying Store object"),s(1,l,"createStore"),s(1,Z,H,`create${H} as create${H}Decl`,se),x("store",["createStore()",...K]),V("fluent","actions: () => Store",["actions();",`return ${Q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${Q}, ...params)`),x(Q,["{",...B(1),"}"]),[o(...S(0),...A(),me+" interface "+H+" {",...B(0),"}",a,Pt(`Creates a ${H} object`),me+" function create"+H+"(): "+H+";"),o(...S(1),me+" const create"+H+": typeof create"+H+"Decl = () => {",...P(),`return Object.freeze(${Q});`,"};"),ee,de]},Bt=e=>$+e,Ft=e=>Et(Bt(e),Bt(e)+pe),Ut="debugIds?: boolean",_t="debugIds={debugIds}",Zt="then"+be,Ht="Parameter",Qt=": (parameter: "+Ht+", store: Store) => ",qt="const contextValue = useContext(Context);",Kt=", based on a parameter",Xt=": ",Yt="<"+Ht+",>",el=Ht+"ized"+ie+"<"+Ht+">",tl="rowId",ll="rowId={rowId}",al=", separator, debugIds",nl="separator?: ReactElement | string",ol="then?: (store: Store",dl=Et(ol+")"+Ue,Zt),sl="then, then"+pe,rl=tl+Xt+ge,Il="View",cl=(e,...t)=>Et(...t,ye+": "+e,ye+be,"mutator?: boolean"),$l=(...e)=>Et(...e,ye,ye+pe,"mutator"),il=(e,t,n,o,d)=>{const[s,r,I,$,i,V,x,R]=Nt(),[S,A,P]=Gt(e,t,i),D=`./${St(n)}.d`,N=`./${St(n)}-ui-react.d`,L="tinybase/ui-react",G=St(n,1),j=St(G),J=G+"Or"+G+ge,z=j+"Or"+G+ge,W=j+`={${j}}`,B=te(),F=(e,t,l,n,o,d=a)=>(r(1,N,e+" as "+e+"Decl"),Vt(B,e,[t,l,n,o,d])),U=(e,t,l,n,o,d=a)=>F("use"+e,t,l,n,o,d),_=(e,t,l,n,o=a,d=a,s=a,I=a,c=a)=>(r(1,L,`use${t} as use${t}Core`),U(e,Et(o,X,I),l,ee+`(${z}, use${t}Core, [`+(d||a)+(c?"], ["+c:a)+"]);",n,s)),Z=(e,t,l,a)=>F(e,t,1,l,a),H=(e=0)=>ne(B,(([t,l,n,o,d],s)=>{const r=e?[me+` const ${s}: typeof ${s}Decl = ${d}(${t}): ${1==l?"any":l} =>`,n]:[me+` function ${s}${d}(${t}): ${1==l?"ComponentReturnType":l};`];return e||O(r,Pt(o)),E(r,a),r}));r(null,l,ge,"Store",ie,Ht+"ized"+ie),r(0,L,"ComponentReturnType"),r(1,L,"useCellIds"),r(null,L,"ExtraProps"),r(0,D,G);const Q=I(J,G+" | "+ge,`Used when you need to refer to a ${G} in a React hook or component`),K=I(ke+Re,Ot(j+Te+G,j+`ById?: {[${j}Id: Id]: ${G}}`),`Used with the ${ke} component, so that a `+G+" can be passed into the context of an application");r(0,"react","ReactElement","ComponentType"),r(1,"react","React"),r(1,N,Q,K);const X=z+Te+Q;i("{createContext, useContext, useMemo}","React"),i("Context",`createContext<[${G}?, {[${j}Id: Id]: ${G}}?]>([])`),U("Create"+G,`create: () => ${G}, create`+be,G,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${G} within a React application with convenient memoization`);const Y=U(G,"id?: Id",G+ve,["{",qt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${G} from within a ${ke} component context`),ee=$("useHook",z+`: ${Q} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${j} = ${Y}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${j} : ${z})?.getStore(), ...postParams)`]),ae=$("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=$("wrap",Et("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),de=$("useCustomOrDefaultCellIds",Et("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${z}?: ${Q} | undefined`),[`const defaultCellIds = ${ee}(${z}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),se=i("NullComponent","() => null");if(!q(e)){const[e,t,n,d,s,i,y,T,v,V,x,R,P,E]=o;r(null,D,e,t,n,s,i,y,T,v,V,x,R,P),r(0,D,d),r(1,D,G),r(null,l,u,"IdOrNull");const O=$("tableView",`{${j}, rowComponent, getRowComponentProps, customCellIds`+al+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+ae+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ll,"customCellIds={customCellIds}",W,_t,"/>","))",al,", tableId,",");"]),L=$("getDefaultTableComponent","tableId: Id",k(S(((e,t,l)=>`tableId == ${l} ? ${t}TableView : `)))+se),J=$("getDefaultCellComponent","tableId: Id, cellId: Id",k(S(((e,t,l)=>`tableId == ${l} ? ${k(A(e,((e,l,a,n,o)=>`cellId == ${n} ? `+t+o+"CellView : ")))+se} : `)))+se);_(b,b,e,et(1,0)+$e);const z=_(C,C,n+Ne,lt(p,Le)+$e);_(De+b+ie,De+b+ie,el,et(1,9)+Kt,Et(Bt(b)+Qt+t,Bt(b)+be),Ft(b),Yt,Et(ol,`tables: ${t})`+Ue,Zt),sl),_(ue+b+ie,ue+b+ie,ie,et(1,12),a,a,a,dl,sl);const B=I(f+Re,Ot("tableId?: TId","rowId: Id","cellId?: CId",j+Te+G,Ut),nt(Ie+f),`<TId extends ${n}, CId extends ${d}<TId>>`),F=I(h+Re,Ot("tableId?: TId","rowId: Id",j+Te+G,"cellComponents?: {readonly [CId in "+d+`<TId>]?: ComponentType<${B}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${d}<TId>) => ExtraProps`,`customCellIds?: ${d}<TId>[]`,nl,Ut),nt(Ie+h),`<TId extends ${n}>`),U=I(p+Re,Ot("tableId?: TId",j+Te+G,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",nl,Ut),nt(Ie+p),`<TId extends ${n}>`),H=I("Sorted"+p+Re,Ot("tableId?: TId","cellId?: "+d+"<TId>","descending?: boolean","offset?: number","limit?: number",j+Te+G,`rowComponent?: ComponentType<${F}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",nl,Ut),nt(Ie+"sorted "+p),`<TId extends ${n}>`),Q=I(b+Re,Ot(j+Te+G,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${U}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,nl,Ut),nt(Ye(1,1)));r(1,N,Q,U,H,F,B),Z(b+Il,"{"+j+", tableComponents, getTableComponentProps"+al+"}: "+Q,[oe+`(${z}(${j}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+L+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ae}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",W,_t,"/>;","}), separator)"],et(1,13)+$e),S(((e,t,l)=>{const[n,o,d,s,I]=le(E,e);r(null,D,n,o,d,s,I),_(t+p,p,n,ct(e)+$e,a,l),_(t+p+w,p+w,u,lt(f,"the whole of "+rt(e))+$e,a,l);const c=_(t+m,m,u,lt(h,rt(e))+$e,a,l),$=_(t+g,g,u,lt(h,rt(e),1)+$e,"cellId?: "+I+", descending?: boolean, offset?: number, limit?: number",l+", cellId, descending, offset, limit");_(t+h,h,d,$t(e)+$e,rl,Et(l,tl)),_(t+w,w,I+Ne,lt(f,It(e))+$e,rl,Et(l,tl)),_(De+t+p+ie,De+p+ie,el,ct(e,9)+Kt,Et(Bt(p)+Qt+o,Bt(p)+be),Et(l,Ft(p)),Yt,Et(ol,`table: ${o})`+Ue,Zt),sl),_(ue+t+p+ie,ue+p+ie,ie,ct(e,12),a,l,a,dl,sl),_(De+t+h+ie,De+h+ie,el,$t(e,9)+Kt,Et(rl,Bt(h)+Qt+s,Bt(h)+be),Et(l,tl,Ft(h)),Yt,Et(ol,`row: ${s})`+Ue,Zt),sl),_("Add"+t+h+ie,"Add"+h+ie,el,$t(e,10)+Kt,Et(Bt(h)+Qt+s,Bt(h)+be),Et(l,Ft(h)),Yt,"then?: ("+Et(rl+ve,"store: Store","row: "+s+")"+Ue,"then"+be)+", reuseRowIds?: boolean",sl+", reuseRowIds"),_(De+t+xe+h+ie,De+xe+h+ie,el,$t(e,11)+Kt,Et(rl,Bt(xe+h)+Qt+s,Bt(xe+h)+be),Et(l,tl,Ft(xe+h)),Yt,Et(ol,`partialRow: ${s})`+Ue,Zt),sl),_(ue+t+h+ie,ue+h+ie,ie,$t(e,12),rl,Et(l,tl),a,dl,sl);const i=Z(t+h+Il,"{rowId, "+j+", cellComponents, getCellComponentProps, customCellIds"+al+`}: ${F}<'${e}'>`,[oe+`(${de}(customCellIds, `+l+`, rowId, ${j}).map((cellId: ${I}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+J+`(${l}, cellId)) as React.ComponentType<CellProps<typeof `+l+", typeof cellId>>;","return <Cell",`{...${ae}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${l}}`,ll,"cellId={cellId}",W,_t,"/>;","})"+al+", rowId)"],$t(e,13)+$e);Z(t+"Sorted"+p+Il,"{cellId, descending, offset, limit, ...props}: "+H+`<'${e}'>`,O+"(props, "+$+`(cellId, descending, offset, limit, props.${j}), ${l}, ${i});`,ct(e,13)+", sorted"+$e),Z(t+p+Il,`props: ${U}<'${e}'>`,O+"(props, "+c+`(props.${j}), ${l}, ${i});`,ct(e,13)+$e),A(e,((n,o,d,s,I)=>{const c="Map"+St(o,1);r(0,D,c),r(1,D,c);const $=_(t+I+f,f,o+(M(d)?ve:a),it(e,n)+$e,rl,Et(l,tl,s));_(De+t+I+f+ie,De+f+ie,el,it(e,n,9)+Kt,Et(rl,Bt(f)+Qt+o+" | "+c,Bt(f)+be),Et(l,tl,s,Ft(f)),Yt,Et(ol,`cell: ${o} | ${c})`+Ue,Zt),sl),_(ue+t+I+f+ie,ue+f+ie,ie,it(e,n,12),Et(rl,"forceDel?: boolean"),Et(l,tl,s,"forceDel"),a,dl,sl),Z(t+I+f+Il,`{rowId, ${j}, debugIds}: `+B+`<'${e}', '${n}'>`,[oe+`('' + ${$}(rowId, `+j+`) ?? '', undefined, debugIds, ${s})`],it(e,n,13)+$e)}))}));const q=k(S((e=>le(E,e)?.[4]??a))," | ");_(b+c,b+c,Fe,et(1,8)+" changes",cl(s),$l()),_(C+c,C+c,Fe,st(2,0,1),cl(i),$l()),_(p+c,p+c,Fe,st(3,0),cl(y,`tableId: ${n} | null`),$l("tableId")),_(p+w+c,p+w+c,Fe,st(14,3,1),cl(T,`tableId: ${n} | null`),$l("tableId")),_(m+c,m+c,Fe,st(4,3,1),cl(v,`tableId: ${n} | null`),$l("tableId")),_(g+c,g+c,Fe,st(13,3,1),cl(V,`tableId: ${n} | null`,"cellId: "+q+ve,"descending: boolean","offset: number","limit: number"+ve),$l("tableId","cellId","descending","offset","limit")),_(h+c,h+c,Fe,st(5,3),cl(x,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(w+c,w+c,Fe,st(6,5,1),cl(R,`tableId: ${n} | null`,tl+": IdOrNull"),$l("tableId",tl)),_(f+c,f+c,Fe,st(7,5),cl(P,`tableId: ${n} | null`,tl+": IdOrNull",`cellId: ${q} | null`),$l("tableId",tl,"cellId"))}if(!q(t)){const[e,t,l,n,o,s]=d;r(null,D,...d),r(1,D,G);const i=$("getDefaultValueComponent","valueId: Id",k(P(((e,t,l,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+se);_(T,T,e,et(2,0)+$e);const u=_(v,v,l+Ne,lt(y,Le)+$e);_(De+T+ie,De+T+ie,el,et(2,9)+Kt,Et(Bt(T)+Qt+t,Bt(T)+be),Ft(T),Yt,Et(ol,`values: ${t})`+Ue,Zt),sl),_(De+xe+T+ie,De+xe+T+ie,el,et(2,11)+Kt,Et(Bt(xe+T)+Qt+t,Bt(xe+T)+be),Ft(xe+T),Yt,Et(ol,`partialValues: ${t})`+Ue,Zt),sl),_(ue+T+ie,ue+T+ie,ie,et(2,12),a,a,a,dl,sl);const p=I(y+Re,Ot("valueId?: VId",j+Te+G,Ut),nt("a Value"),`<VId extends ${l}>`),b=I(T+Re,Ot(j+Te+G,"valueComponents?: {readonly [VId in "+l+`]?: ComponentType<${p}<VId>>;}`,`getValueComponentProps?: (valueId: ${l}) => ExtraProps`,nl,Ut),nt(Ye(2,1)));r(1,N,b,p),Z(T+Il,"{"+j+", valueComponents, getValueComponentProps"+al+"}: "+b,[oe+`(${u}(${j}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+i+"(valueId);","return <Value",`{...${ae}(getValueComponentProps, valueId)}`,"key={valueId}",W,_t,"/>;","}), separator)"],et(2,13)+$e),P(((e,t,l,n,o)=>{const d="Map"+St(t,1);r(0,D,d),r(1,D,d);const s=_(o+y,y,t,ut(e)+$e,a,n);_(De+o+y+ie,De+y+ie,el,ut(e,9)+Kt,Et(Bt(y)+Qt+t+" | "+d,Bt(y)+be),Et(n,Ft(y)),Yt,Et(ol,`value: ${t} | ${d})`+Ue,Zt),sl),_(ue+o+y+ie,ue+y+ie,ie,ut(e,12),a,n,a,dl,sl),Z(o+y+Il,`{${j}, debugIds}: ${p}<'${e}'>`,[oe+`('' + ${s}(`+j+`) ?? '', undefined, debugIds, ${n})`],ut(e,13)+$e)})),_(T+c,T+c,Fe,et(2,8)+" changes",cl(n),$l()),_(v+c,v+c,Fe,st(10,0,1),cl(o),$l()),_(y+c,y+c,Fe,st(11,0),cl(s,`valueId: ${l} | null`),$l("valueId"))}return Z(ke,`{${j}, ${j}ById, children}: `+K+" & {children: React.ReactNode}",["{",qt,"return (","<Context."+ke,"value={useMemo(",`() => [${j} ?? contextValue[0], {...contextValue[1], ...${j}ById}],`,`[${j}, ${j}ById, contextValue],`,")}>","{children}",`</Context.${ke}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[s(...V(0),...x(),...H(0)),s(...V(1),...R(),...H(1))]},ul=(e,t,l)=>{if(q(e)&&q(t))return[a,a,a,a];const[n,o,d,s]=Wt(e,t,l);return[n,o,...il(e,t,l,d,s)]},pl={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},bl=Lt((e=>{const t=()=>{const t=L(e.getTablesSchemaJson());return!q(t)||V(e.getTableIds(),(l=>{const a=e.getRowIds(l),n=te();if(V(a,(t=>V(e.getCellIds(l,t),(a=>{const o=e.getCell(l,t,a),d=de(n,a,(()=>[B(o),te(),[0],0])),[s,r,[I]]=d,c=de(r,o,(()=>0))+1;return c>I&&(d[2]=[c,o]),oe(r,o,c),d[3]++,s==B(o)})))))return t[l]={},Y(n,(([e,,[,n],o],d)=>{t[l][d]={[r]:e,...o==A(a)?{[I]:n}:{}}})),1}))?t:{}},l=()=>{const t=L(e.getValuesSchemaJson());return q(t)&&e.forEachValue(((e,l)=>{t[e]={[r]:B(l)}})),t},a=e=>ul(t(),l(),e),n=async e=>{const t=["d.ts","ts","d.ts","tsx"];let l;try{l=(await import("prettier")).format}catch(e){l=e=>e}return S(a(e),((e,a)=>xt(l(e,{...pl,filepath:"_."+t[a]}))))};return _({getStoreStats:t=>{let l=0,a=0,n=0;const o={};return e.forEachTable(((e,d)=>{l++;let s=0,r=0;const I={};d(((e,l)=>{s++;let a=0;l((()=>a++)),r+=a,t&&(I[e]={rowCells:a})})),a+=s,n+=r,t&&(o[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:l,totalRows:a,totalCells:n,totalValues:A(e.getValueIds()),jsonLength:Rt(e.getJson()),...t?{detail:{tables:o}}:{}}},getStoreTablesSchema:t,getStoreValuesSchema:l,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=bl},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
package/lib/umd/tools.js.gz
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,l;e=this,l=function(e,l,t){"use strict";const n=(e,l)=>e.map(l),o=e=>null==e,{createContext:s,useContext:a}=t;s([]);const d=(e,...l)=>o(e)?{}:e(...l),{createElement:r,useCallback:u,useState:i}=t,c=(e,l,t)=>{const n=u(e,l);return t?n:void 0},I=(e,l)=>o(e)||e[0]!=l?void 0:`sorted ${e[1]?"de":"a"}scending`,b=({cellId:e,sorting:l,label:t=e??"",onClick:n})=>r("th",{onClick:c((()=>n?.(e)),[n,e],!o(n)),className:I(l,e)},t),m=({tableId:e,rowIds:t,store:o,cellComponent:s=l.CellView,getCellComponentProps:a,className:u,headerRow:i,idColumn:c,customCellIds:I,sorting:m,onHeaderThClick:C})=>{const f=l.useTableCellIds(e,o),h=I??f;return r("table",{className:u},!1===i?null:r("thead",null,r("tr",null,!1===c?null:r(b,{sorting:m,label:"Id",onClick:C}),n(h,(e=>r(b,{key:e,cellId:e,sorting:m,onClick:C}))))),r("tbody",null,n(t,(l=>r("tr",{key:l},!1===c?null:r("th",null,l),n(h,(t=>r("td",{key:t},r(s,{...d(a,l,t),tableId:e,rowId:l,cellId:t,store:o})))))))))};e.SortedTableInHtmlTable=({tableId:e,cellId:t,descending:n,offset:o,limit:s,store:a,sortOnClick:d,...u})=>{const[I,b]=i([t,!!n]),C=c((e=>b([e,e==I[0]&&!I[1]])),[I],d);return r(m,{...u,tableId:e,store:a,rowIds:l.useSortedRowIds(e,...I,o,s,a),sorting:I,onHeaderThClick:C})},e.TableInHtmlTable=({tableId:e,store:t,...n})=>r(m,{...n,tableId:e,store:t,rowIds:l.useRowIds(e,t)}),e.ValuesInHtmlTable=({store:e,valueComponent:t=l.ValueView,getValueComponentProps:o,className:s,headerRow:a,idColumn:u})=>r("table",{className:s},!1===a?null:r("thead",null,r("tr",null,!1===u?null:r("th",null,"Id"),r("th",null,"Value"))),r("tbody",null,n(l.useValueIds(e),(l=>r("tr",{key:l},!1===u?null:r("th",null,l),r("td",null,r(t,{...d(o,l),valueId:l,store:e})))))))},"object"==typeof exports&&"undefined"!=typeof module?l(exports,require("./ui-react"),require("react")):"function"==typeof define&&define.amd?define(["exports","./ui-react","react"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReactDom={},e.TinyBaseUiReact,e.React);
|
|
Binary file
|
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="",l=t(o),r="Ids",d="Table",u=d+"s",n=d+r,i="Row",a=i+r,I="Sorted"+i+r,c="Cell",w=c+r,R="Value",C=R+"s",b=R+r,p=(e,s)=>e.map(s),k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),m=e=>t(e)==l,h=()=>{},{createContext:L,useContext:V}=s,y=L([]),S=(e,s)=>{const t=V(y);return k(e)?t[s]:m(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1],e):e},T=(e,s)=>{const t=S(e,s);return k(e)||m(e)?t:e},f=e=>T(e,0),v=e=>T(e,2),P=e=>T(e,4),q=e=>T(e,6),x=e=>T(e,8),B=e=>T(e,10),{useCallback:M,useEffect:D,useMemo:A,useRef:F,useState:G}=s,E=(e,s,t=[])=>{const o=A((()=>s(e)),[e,...t]);return D((()=>()=>o.destroy()),[o]),o},Q=(e,s,t,o=[],l)=>{const[,r]=G(),d=M((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[u]=G(d),n=F(u);return A((()=>n.current=d()),[d]),U(e,s,((...e)=>{n.current=k(l)?d():e[l],r([])}),[],o),n.current},U=(e,s,t,o=[],l=[],...r)=>D((()=>{const o=s?.["add"+e+"Listener"]?.(...l,t,...r);return()=>s?.delListener(o)}),[s,...l,...o,...r]),j=(e,s,t,o=[],l=h,r=[],...d)=>{const u=f(e);return M((e=>g(u,(o=>g(t(e,o),(e=>l(o["set"+s](...d,e),e)))))),[u,s,...o,...r,...d])},z=(e,s,t=h,o=[],...l)=>{const r=f(e);return M((()=>t(r?.["del"+s](...l))),[r,s,...o,...l])},H=(e,s,t)=>{const o=B(e);return M((()=>o?.[s](t)),[o,s,t])},J=e=>Q(n,f(e),[],[]),K=(e,s)=>Q(a,f(s),[],[e]),N=(e,s,t,o=0,l,r)=>Q(I,f(r),[],[e,s,t,o,l],6),O=(e,s,t)=>Q(w,f(t),[],[e,s]),W=(e,s,t,o)=>Q(c,f(o),void 0,[e,s,t],4),X=e=>Q(b,f(e),[],[]),Y=(e,s)=>Q(R,f(s),void 0,[e]),Z=(e,s)=>Q("Metric",v(s),void 0,[e]),$=(e,s)=>Q("SliceIds",P(s),[],[e]),_=(e,s,t)=>Q("SliceRowIds",P(t),[],[e,s]),ee=(e,s,t)=>Q("RemoteRowId",q(t),void 0,[e,s]),se=(e,s,t)=>Q("LocalRowIds",q(t),[],[e,s]),te=(e,s,t)=>Q("LinkedRowIds",q(t),[],[e,s]),oe=(e,s)=>Q("ResultRowIds",x(s),[],[e]),le=(e,s,t,o=0,l,r)=>Q("ResultSortedRowIds",x(r),[],[e,s,t,o,l],6),re=(e,s,t)=>Q("ResultCellIds",x(t),[],[e,s]),de=(e,s,t,o)=>Q("ResultCell",x(o),void 0,[e,s,t]),ue=e=>Q("CheckpointIds",B(e),[[],void 0,[]]),ne=(e,s)=>Q("Checkpoint",B(s),void 0,[e]),ie=e=>H(e,"goBackward"),ae=e=>H(e,"goForward"),{createElement:Ie,useMemo:ce}=s,we=({tableId:e,store:s,rowComponent:t=he,getRowComponentProps:o,separator:l,debugIds:r},d)=>ge(p(d,(l=>Ie(t,{...ke(o,l),key:l,tableId:e,rowId:l,store:s,debugIds:r}))),l,r,e),Re=({queryId:e,queries:s,resultRowComponent:t=Te,getResultRowComponentProps:o,separator:l,debugIds:r},d)=>ge(p(d,(l=>Ie(t,{...ke(o,l),key:l,queryId:e,rowId:l,queries:s,debugIds:r}))),l,r,e),Ce=e=>{const s=q(e);return[s,s?.getStore()]},be=({relationshipId:e,relationships:s,rowComponent:t=he,getRowComponentProps:o,separator:l,debugIds:r},d,u)=>{const[n,i]=Ce(s),a=n?.getLocalTableId(e),I=d(e,u,n);return ge(p(I,(e=>Ie(t,{...ke(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:r}))),l,r,u)},pe=e=>({checkpoints:s,checkpointComponent:t=fe,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const d=B(s);return ge(p(e(ue(d)),(e=>Ie(t,{...ke(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:r}))),l)},ke=(e,s)=>k(e)?{}:e(s),ge=(e,s,t,o)=>{const l=k(s)||!Array.isArray(e)?e:p(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},me=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>ge(o+(W(e,s,t,l)??o),void 0,r,t),he=({tableId:e,rowId:s,store:t,cellComponent:o=me,getCellComponentProps:l,separator:r,debugIds:d})=>ge(p(O(e,s,t),(r=>Ie(o,{...ke(l,r),key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:d}))),r,d,s),Le=e=>we(e,K(e.tableId,e.store)),Ve=({valueId:e,store:s,debugIds:t})=>ge(o+(Y(e,s)??o),void 0,t,e),ye=({indexId:e,sliceId:s,indexes:t,rowComponent:o=he,getRowComponentProps:l,separator:r,debugIds:d})=>{const u=P(t),n=u?.getStore(),i=u?.getTableId(e),a=_(e,s,u);return ge(p(a,(e=>Ie(o,{...ke(l,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),r,d,s)},Se=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>ge(o+(de(e,s,t,l)??o),void 0,r,t),Te=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Se,getResultCellComponentProps:l,separator:r,debugIds:d})=>ge(p(re(e,s,t),(r=>Ie(o,{...ke(l,r),key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:d}))),r,d,s),fe=({checkpoints:e,checkpointId:s,debugIds:t})=>ge(ne(s,e)??o,void 0,t,s),ve=pe((e=>e[0])),Pe=pe((e=>k(e[1])?[]:[e[1]])),qe=pe((e=>e[2]));e.BackwardCheckpointsView=ve,e.CellView=me,e.CheckpointView=fe,e.CurrentCheckpointView=Pe,e.ForwardCheckpointsView=qe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ye,getSliceComponentProps:o,separator:l,debugIds:r})=>ge(p($(e,s),(l=>Ie(t,{...ke(o,l),key:l,indexId:e,sliceId:l,indexes:s,debugIds:r}))),l,r,e),e.LinkedRowsView=e=>be(e,te,e.firstRowId),e.LocalRowsView=e=>be(e,se,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>ge(Z(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:d,relationships:u,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:w})=>{const R=s.useContext(y);return Ie(y.Provider,{value:ce((()=>[e??R[0],{...R[1],...t},o??R[2],{...R[3],...l},r??R[4],{...R[5],...d},u??R[6],{...R[7],...n},i??R[8],{...R[9],...a},I??R[10],{...R[11],...c}]),[e,t,o,l,r,d,u,n,i,a,I,c,R])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=he,getRowComponentProps:l,debugIds:r})=>{const[d,u]=Ce(t),n=d?.getRemoteTableId(e),i=ee(e,s,d);return ge(k(n)||k(i)?null:Ie(o,{...ke(l,i),key:i,tableId:n,rowId:i,store:u,debugIds:r}),void 0,r,s)},e.ResultCellView=Se,e.ResultRowView=Te,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>Re(l,le(l.queryId,e,s,t,o,l.queries)),e.ResultTableView=e=>Re(e,oe(e.queryId,e.queries)),e.RowView=he,e.SliceView=ye,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>we(l,N(l.tableId,e,s,t,o,l.store)),e.TableView=Le,e.TablesView=({store:e,tableComponent:s=Le,getTableComponentProps:t,separator:o,debugIds:l})=>ge(p(J(e),(o=>Ie(s,{...ke(t,o),key:o,tableId:o,store:e,debugIds:l}))),o),e.ValueView=Ve,e.ValuesView=({store:e,valueComponent:s=Ve,getValueComponentProps:t,separator:o,debugIds:l})=>ge(p(X(e),(o=>Ie(s,{...ke(t,o),key:o,valueId:o,store:e,debugIds:l}))),o),e.tableView=we,e.useAddRowCallback=(e,s,t=[],o,l=h,r=[],d=!0)=>{const u=f(o);return M((t=>g(u,(o=>g(s(t,o),(s=>l(o.addRow(e,s,d),o,s)))))),[u,e,...t,...r,d])},e.useCell=W,e.useCellIds=O,e.useCellIdsListener=(e,s,t,o,l,r)=>U(w,f(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,d)=>U(c,f(d),o,l,[e,s,t],r),e.useCheckpoint=ne,e.useCheckpointIds=ue,e.useCheckpointIdsListener=(e,s,t)=>U("CheckpointIds",B(t),e,s),e.useCheckpointListener=(e,s,t,o)=>U("Checkpoint",B(o),s,t,[e]),e.useCheckpoints=e=>S(e,10),e.useCreateCheckpoints=(e,s,t)=>E(e,s,t),e.useCreateIndexes=(e,s,t)=>E(e,s,t),e.useCreateMetrics=(e,s,t)=>E(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=G(),d=A((()=>s(e)),[e,...t]);return D((()=>((async()=>{await(o?.(d)),r(1)})(),()=>{d.destroy()})),[d,...l]),d},e.useCreateQueries=(e,s,t)=>E(e,s,t),e.useCreateRelationships=(e,s,t)=>E(e,s,t),e.useCreateStore=(e,s=[])=>A(e,s),e.useDelCellCallback=(e,s,t,o,l,r,d)=>z(l,c,r,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>z(t,i,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>z(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>z(e,u,s,t),e.useDelValueCallback=(e,s,t,o)=>z(s,R,t,o,e),e.useDelValuesCallback=(e,s,t)=>z(e,C,s,t),e.useGoBackwardCallback=ie,e.useGoForwardCallback=ae,e.useGoToCallback=(e,s=[],t,o=h,l=[])=>{const r=B(t);return M((s=>g(r,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>S(e,4),e.useLinkedRowIds=te,e.useLinkedRowIdsListener=(e,s,t,o,l)=>U("LinkedRowIds",q(l),t,o,[e,s]),e.useLocalRowIds=se,e.useLocalRowIdsListener=(e,s,t,o,l)=>U("LocalRowIds",q(l),t,o,[e,s]),e.useMetric=Z,e.useMetricListener=(e,s,t,o)=>U("Metric",v(o),s,t,[e]),e.useMetrics=e=>S(e,2),e.useQueries=e=>S(e,8),e.useRedoInformation=e=>{const s=B(e),[,,[t]]=ue(s);return[!k(t),ae(s),t,g(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationships=e=>S(e,6),e.useRemoteRowId=ee,e.useRemoteRowIdListener=(e,s,t,o,l)=>U("RemoteRowId",q(l),t,o,[e,s]),e.useResultCell=de,e.useResultCellIds=re,e.useResultCellIdsListener=(e,s,t,o,l)=>U("ResultCellIds",x(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>U("ResultCell",x(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>Q("ResultRow",x(t),{},[e,s]),e.useResultRowIds=oe,e.useResultRowIdsListener=(e,s,t,o)=>U("ResultRowIds",x(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>U("ResultRow",x(l),t,o,[e,s]),e.useResultSortedRowIds=le,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,d,u)=>U("ResultSortedRowIds",x(u),r,d,[e,s,t,o,l]),e.useResultTable=(e,s)=>Q("ResultTable",x(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>U("ResultTable",x(o),s,t,[e]),e.useRow=(e,s,t)=>Q(i,f(t),{},[e,s]),e.useRowIds=K,e.useRowIdsListener=(e,s,t,o,l)=>U(a,f(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>U(i,f(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,d,u)=>j(r,c,o,l,d,u,e,s,t),e.useSetCheckpointCallback=(e=h,s=[],t,o=h,l=[])=>{const r=B(t);return M((s=>g(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,d)=>j(l,"PartialRow",t,o,r,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>j(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,d)=>j(l,i,t,o,r,d,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>j(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>j(t,u,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>j(o,R,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>j(t,C,e,s,o,l),e.useSliceIds=$,e.useSliceIdsListener=(e,s,t,o)=>U("SliceIds",P(o),s,t,[e]),e.useSliceRowIds=_,e.useSliceRowIdsListener=(e,s,t,o,l)=>U("SliceRowIds",P(l),t,o,[e,s]),e.useSortedRowIds=N,e.useSortedRowIdsListener=(e,s,t,o,l,r,d,u,n)=>U(I,f(n),r,d,[e,s,t,o,l],u),e.useStore=e=>S(e,0),e.useTable=(e,s)=>Q(d,f(s),{},[e]),e.useTableCellIds=(e,s)=>Q(d+w,f(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>U(d+w,f(l),s,t,[e],o),e.useTableIds=J,e.useTableIdsListener=(e,s,t,o)=>U(n,f(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>U(d,f(l),s,t,[e],o),e.useTables=e=>Q(u,f(e),{}),e.useTablesListener=(e,s,t,o)=>U(u,f(o),e,s,[],t),e.useUndoInformation=e=>{const s=B(e),[t,l]=ue(s);return[(r=t,!(0==(e=>e.length)(r))),ie(s),l,g(l,(e=>s?.getCheckpoint(e)))??o];var r},e.useValue=Y,e.useValueIds=X,e.useValueIdsListener=(e,s,t,o)=>U(b,f(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>U(R,f(l),s,t,[e],o),e.useValues=e=>Q(C,f(e),{}),e.useValuesListener=(e,s,t,o)=>U(C,f(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,o="",l=t(o),r="Ids",d="Table",u=d+"s",n=d+r,i="Row",a=i+r,I="Sorted"+i+r,c="Cell",w=c+r,C="Value",R=C+"s",b=C+r,p=(e,s)=>e.map(s),k=e=>null==e,g=(e,s,t)=>k(e)?t?.():s(e),m=e=>t(e)==l,h=()=>{},{createContext:L,useContext:V}=s,y=L([]),S=(e,s)=>{const t=V(y);return k(e)?t[s]:m(e)?((e,s)=>g(e,(e=>e[s])))(t[s+1],e):e},T=(e,s)=>{const t=S(e,s);return k(e)||m(e)?t:e},f=(e,...s)=>k(e)?{}:e(...s),v=e=>T(e,0),P=e=>T(e,2),q=e=>T(e,4),x=e=>T(e,6),B=e=>T(e,8),M=e=>T(e,10),{useCallback:D,useEffect:A,useMemo:F,useRef:G,useState:E}=s,Q=(e,s,t=[])=>{const o=F((()=>s(e)),[e,...t]);return A((()=>()=>o.destroy()),[o]),o},U=(e,s,t,o=[],l)=>{const[,r]=E(),d=D((()=>s?.["get"+e]?.(...o)??t),[s,...o]),[u]=E(d),n=G(u);return F((()=>n.current=d()),[d]),j(e,s,((...e)=>{n.current=k(l)?d():e[l],r([])}),[],o),n.current},j=(e,s,t,o=[],l=[],...r)=>A((()=>{const o=s?.["add"+e+"Listener"]?.(...l,t,...r);return()=>s?.delListener(o)}),[s,...l,...o,...r]),z=(e,s,t,o=[],l=h,r=[],...d)=>{const u=v(e);return D((e=>g(u,(o=>g(t(e,o),(e=>l(o["set"+s](...d,e),e)))))),[u,s,...o,...r,...d])},H=(e,s,t=h,o=[],...l)=>{const r=v(e);return D((()=>t(r?.["del"+s](...l))),[r,s,...o,...l])},J=(e,s,t)=>{const o=M(e);return D((()=>o?.[s](t)),[o,s,t])},K=e=>U(n,v(e),[],[]),N=(e,s)=>U(a,v(s),[],[e]),O=(e,s,t,o=0,l,r)=>U(I,v(r),[],[e,s,t,o,l],6),W=(e,s,t)=>U(w,v(t),[],[e,s]),X=(e,s,t,o)=>U(c,v(o),void 0,[e,s,t],4),Y=e=>U(b,v(e),[],[]),Z=(e,s)=>U(C,v(s),void 0,[e]),$=(e,s)=>U("Metric",P(s),void 0,[e]),_=(e,s)=>U("SliceIds",q(s),[],[e]),ee=(e,s,t)=>U("SliceRowIds",q(t),[],[e,s]),se=(e,s,t)=>U("RemoteRowId",x(t),void 0,[e,s]),te=(e,s,t)=>U("LocalRowIds",x(t),[],[e,s]),oe=(e,s,t)=>U("LinkedRowIds",x(t),[],[e,s]),le=(e,s)=>U("ResultRowIds",B(s),[],[e]),re=(e,s,t,o=0,l,r)=>U("ResultSortedRowIds",B(r),[],[e,s,t,o,l],6),de=(e,s,t)=>U("ResultCellIds",B(t),[],[e,s]),ue=(e,s,t,o)=>U("ResultCell",B(o),void 0,[e,s,t]),ne=e=>U("CheckpointIds",M(e),[[],void 0,[]]),ie=(e,s)=>U("Checkpoint",M(s),void 0,[e]),ae=e=>J(e,"goBackward"),Ie=e=>J(e,"goForward"),{createElement:ce,useMemo:we}=s,Ce=({tableId:e,store:s,rowComponent:t=he,getRowComponentProps:o,customCellIds:l,separator:r,debugIds:d},u)=>ge(p(u,(r=>ce(t,{...f(o,r),key:r,tableId:e,rowId:r,customCellIds:l,store:s,debugIds:d}))),r,d,e),Re=({queryId:e,queries:s,resultRowComponent:t=Te,getResultRowComponentProps:o,separator:l,debugIds:r},d)=>ge(p(d,(l=>ce(t,{...f(o,l),key:l,queryId:e,rowId:l,queries:s,debugIds:r}))),l,r,e),be=e=>{const s=x(e);return[s,s?.getStore()]},pe=({relationshipId:e,relationships:s,rowComponent:t=he,getRowComponentProps:o,separator:l,debugIds:r},d,u)=>{const[n,i]=be(s),a=n?.getLocalTableId(e),I=d(e,u,n);return ge(p(I,(e=>ce(t,{...f(o,e),key:e,tableId:a,rowId:e,store:i,debugIds:r}))),l,r,u)},ke=e=>({checkpoints:s,checkpointComponent:t=fe,getCheckpointComponentProps:o,separator:l,debugIds:r})=>{const d=M(s);return ge(p(e(ne(d)),(e=>ce(t,{...f(o,e),key:e,checkpoints:d,checkpointId:e,debugIds:r}))),l)},ge=(e,s,t,o)=>{const l=k(s)||!Array.isArray(e)?e:p(e,((e,t)=>t>0?[s,e]:e));return t?[o,":{",l,"}"]:l},me=({tableId:e,rowId:s,cellId:t,store:l,debugIds:r})=>ge(o+(X(e,s,t,l)??o),void 0,r,t),he=({tableId:e,rowId:s,store:t,cellComponent:o=me,getCellComponentProps:l,customCellIds:r,separator:d,debugIds:u})=>ge(p(((e,s,t,o)=>{const l=W(s,t,o);return e??l})(r,e,s,t),(r=>ce(o,{...f(l,r),key:r,tableId:e,rowId:s,cellId:r,store:t,debugIds:u}))),d,u,s),Le=e=>Ce(e,N(e.tableId,e.store)),Ve=({valueId:e,store:s,debugIds:t})=>ge(o+(Z(e,s)??o),void 0,t,e),ye=({indexId:e,sliceId:s,indexes:t,rowComponent:o=he,getRowComponentProps:l,separator:r,debugIds:d})=>{const u=q(t),n=u?.getStore(),i=u?.getTableId(e),a=ee(e,s,u);return ge(p(a,(e=>ce(o,{...f(l,e),key:e,tableId:i,rowId:e,store:n,debugIds:d}))),r,d,s)},Se=({queryId:e,rowId:s,cellId:t,queries:l,debugIds:r})=>ge(o+(ue(e,s,t,l)??o),void 0,r,t),Te=({queryId:e,rowId:s,queries:t,resultCellComponent:o=Se,getResultCellComponentProps:l,separator:r,debugIds:d})=>ge(p(de(e,s,t),(r=>ce(o,{...f(l,r),key:r,queryId:e,rowId:s,cellId:r,queries:t,debugIds:d}))),r,d,s),fe=({checkpoints:e,checkpointId:s,debugIds:t})=>ge(ie(s,e)??o,void 0,t,s),ve=ke((e=>e[0])),Pe=ke((e=>k(e[1])?[]:[e[1]])),qe=ke((e=>e[2]));e.BackwardCheckpointsView=ve,e.CellView=me,e.CheckpointView=fe,e.CurrentCheckpointView=Pe,e.ForwardCheckpointsView=qe,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ye,getSliceComponentProps:o,separator:l,debugIds:r})=>ge(p(_(e,s),(l=>ce(t,{...f(o,l),key:l,indexId:e,sliceId:l,indexes:s,debugIds:r}))),l,r,e),e.LinkedRowsView=e=>pe(e,oe,e.firstRowId),e.LocalRowsView=e=>pe(e,te,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>ge($(e,s)??o,void 0,t,e),e.Provider=({store:e,storesById:t,metrics:o,metricsById:l,indexes:r,indexesById:d,relationships:u,relationshipsById:n,queries:i,queriesById:a,checkpoints:I,checkpointsById:c,children:w})=>{const C=s.useContext(y);return ce(y.Provider,{value:we((()=>[e??C[0],{...C[1],...t},o??C[2],{...C[3],...l},r??C[4],{...C[5],...d},u??C[6],{...C[7],...n},i??C[8],{...C[9],...a},I??C[10],{...C[11],...c}]),[e,t,o,l,r,d,u,n,i,a,I,c,C])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:o=he,getRowComponentProps:l,debugIds:r})=>{const[d,u]=be(t),n=d?.getRemoteTableId(e),i=se(e,s,d);return ge(k(n)||k(i)?null:ce(o,{...f(l,i),key:i,tableId:n,rowId:i,store:u,debugIds:r}),void 0,r,s)},e.ResultCellView=Se,e.ResultRowView=Te,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>Re(l,re(l.queryId,e,s,t,o,l.queries)),e.ResultTableView=e=>Re(e,le(e.queryId,e.queries)),e.RowView=he,e.SliceView=ye,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:o,...l})=>Ce(l,O(l.tableId,e,s,t,o,l.store)),e.TableView=Le,e.TablesView=({store:e,tableComponent:s=Le,getTableComponentProps:t,separator:o,debugIds:l})=>ge(p(K(e),(o=>ce(s,{...f(t,o),key:o,tableId:o,store:e,debugIds:l}))),o),e.ValueView=Ve,e.ValuesView=({store:e,valueComponent:s=Ve,getValueComponentProps:t,separator:o,debugIds:l})=>ge(p(Y(e),(o=>ce(s,{...f(t,o),key:o,valueId:o,store:e,debugIds:l}))),o),e.useAddRowCallback=(e,s,t=[],o,l=h,r=[],d=!0)=>{const u=v(o);return D((t=>g(u,(o=>g(s(t,o),(s=>l(o.addRow(e,s,d),o,s)))))),[u,e,...t,...r,d])},e.useCell=X,e.useCellIds=W,e.useCellIdsListener=(e,s,t,o,l,r)=>j(w,v(r),t,o,[e,s],l),e.useCellListener=(e,s,t,o,l,r,d)=>j(c,v(d),o,l,[e,s,t],r),e.useCheckpoint=ie,e.useCheckpointIds=ne,e.useCheckpointIdsListener=(e,s,t)=>j("CheckpointIds",M(t),e,s),e.useCheckpointListener=(e,s,t,o)=>j("Checkpoint",M(o),s,t,[e]),e.useCheckpoints=e=>S(e,10),e.useCreateCheckpoints=(e,s,t)=>Q(e,s,t),e.useCreateIndexes=(e,s,t)=>Q(e,s,t),e.useCreateMetrics=(e,s,t)=>Q(e,s,t),e.useCreatePersister=(e,s,t=[],o,l=[])=>{const[,r]=E(),d=F((()=>s(e)),[e,...t]);return A((()=>((async()=>{await(o?.(d)),r(1)})(),()=>{d.destroy()})),[d,...l]),d},e.useCreateQueries=(e,s,t)=>Q(e,s,t),e.useCreateRelationships=(e,s,t)=>Q(e,s,t),e.useCreateStore=(e,s=[])=>F(e,s),e.useDelCellCallback=(e,s,t,o,l,r,d)=>H(l,c,r,d,e,s,t,o),e.useDelRowCallback=(e,s,t,o,l)=>H(t,i,o,l,e,s),e.useDelTableCallback=(e,s,t,o)=>H(s,d,t,o,e),e.useDelTablesCallback=(e,s,t)=>H(e,u,s,t),e.useDelValueCallback=(e,s,t,o)=>H(s,C,t,o,e),e.useDelValuesCallback=(e,s,t)=>H(e,R,s,t),e.useGoBackwardCallback=ae,e.useGoForwardCallback=Ie,e.useGoToCallback=(e,s=[],t,o=h,l=[])=>{const r=M(t);return D((s=>g(r,(t=>g(e(s),(e=>o(t.goTo(e),e)))))),[r,...s,...l])},e.useIndexes=e=>S(e,4),e.useLinkedRowIds=oe,e.useLinkedRowIdsListener=(e,s,t,o,l)=>j("LinkedRowIds",x(l),t,o,[e,s]),e.useLocalRowIds=te,e.useLocalRowIdsListener=(e,s,t,o,l)=>j("LocalRowIds",x(l),t,o,[e,s]),e.useMetric=$,e.useMetricListener=(e,s,t,o)=>j("Metric",P(o),s,t,[e]),e.useMetrics=e=>S(e,2),e.useQueries=e=>S(e,8),e.useRedoInformation=e=>{const s=M(e),[,,[t]]=ne(s);return[!k(t),Ie(s),t,g(t,(e=>s?.getCheckpoint(e)))??o]},e.useRelationships=e=>S(e,6),e.useRemoteRowId=se,e.useRemoteRowIdListener=(e,s,t,o,l)=>j("RemoteRowId",x(l),t,o,[e,s]),e.useResultCell=ue,e.useResultCellIds=de,e.useResultCellIdsListener=(e,s,t,o,l)=>j("ResultCellIds",B(l),t,o,[e,s]),e.useResultCellListener=(e,s,t,o,l,r)=>j("ResultCell",B(r),o,l,[e,s,t]),e.useResultRow=(e,s,t)=>U("ResultRow",B(t),{},[e,s]),e.useResultRowIds=le,e.useResultRowIdsListener=(e,s,t,o)=>j("ResultRowIds",B(o),s,t,[e]),e.useResultRowListener=(e,s,t,o,l)=>j("ResultRow",B(l),t,o,[e,s]),e.useResultSortedRowIds=re,e.useResultSortedRowIdsListener=(e,s,t,o,l,r,d,u)=>j("ResultSortedRowIds",B(u),r,d,[e,s,t,o,l]),e.useResultTable=(e,s)=>U("ResultTable",B(s),{},[e]),e.useResultTableListener=(e,s,t,o)=>j("ResultTable",B(o),s,t,[e]),e.useRow=(e,s,t)=>U(i,v(t),{},[e,s]),e.useRowIds=N,e.useRowIdsListener=(e,s,t,o,l)=>j(a,v(l),s,t,[e],o),e.useRowListener=(e,s,t,o,l,r)=>j(i,v(r),t,o,[e,s],l),e.useSetCellCallback=(e,s,t,o,l,r,d,u)=>z(r,c,o,l,d,u,e,s,t),e.useSetCheckpointCallback=(e=h,s=[],t,o=h,l=[])=>{const r=M(t);return D((s=>g(r,(t=>{const l=e(s);o(t.addCheckpoint(l),t,l)}))),[r,...s,...l])},e.useSetPartialRowCallback=(e,s,t,o,l,r,d)=>z(l,"PartialRow",t,o,r,d,e,s),e.useSetPartialValuesCallback=(e,s,t,o,l)=>z(t,"PartialValues",e,s,o,l),e.useSetRowCallback=(e,s,t,o,l,r,d)=>z(l,i,t,o,r,d,e,s),e.useSetTableCallback=(e,s,t,o,l,r)=>z(o,d,s,t,l,r,e),e.useSetTablesCallback=(e,s,t,o,l)=>z(t,u,e,s,o,l),e.useSetValueCallback=(e,s,t,o,l,r)=>z(o,C,s,t,l,r,e),e.useSetValuesCallback=(e,s,t,o,l)=>z(t,R,e,s,o,l),e.useSliceIds=_,e.useSliceIdsListener=(e,s,t,o)=>j("SliceIds",q(o),s,t,[e]),e.useSliceRowIds=ee,e.useSliceRowIdsListener=(e,s,t,o,l)=>j("SliceRowIds",q(l),t,o,[e,s]),e.useSortedRowIds=O,e.useSortedRowIdsListener=(e,s,t,o,l,r,d,u,n)=>j(I,v(n),r,d,[e,s,t,o,l],u),e.useStore=e=>S(e,0),e.useTable=(e,s)=>U(d,v(s),{},[e]),e.useTableCellIds=(e,s)=>U(d+w,v(s),[],[e]),e.useTableCellIdsListener=(e,s,t,o,l)=>j(d+w,v(l),s,t,[e],o),e.useTableIds=K,e.useTableIdsListener=(e,s,t,o)=>j(n,v(o),e,s,[],t),e.useTableListener=(e,s,t,o,l)=>j(d,v(l),s,t,[e],o),e.useTables=e=>U(u,v(e),{}),e.useTablesListener=(e,s,t,o)=>j(u,v(o),e,s,[],t),e.useUndoInformation=e=>{const s=M(e),[t,l]=ne(s);return[(r=t,!(0==(e=>e.length)(r))),ae(s),l,g(l,(e=>s?.getCheckpoint(e)))??o];var r},e.useValue=Z,e.useValueIds=Y,e.useValueIdsListener=(e,s,t,o)=>j(b,v(o),e,s,[],t),e.useValueListener=(e,s,t,o,l)=>j(C,v(l),s,t,[e],o),e.useValues=e=>U(R,v(e),{}),e.useValuesListener=(e,s,t,o)=>j(R,v(o),e,s,[],t)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
package/lib/umd/ui-react.js.gz
CHANGED
|
Binary file
|