tinybase 5.3.1 → 5.3.2
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/cjs/common/index.cjs +5 -7
- package/cjs/common/with-schemas/index.cjs +5 -7
- package/cjs/es6/common/index.cjs +5 -7
- package/cjs/es6/common/with-schemas/index.cjs +5 -7
- package/cjs/es6/index.cjs +18 -12
- package/cjs/es6/indexes/index.cjs +0 -6
- package/cjs/es6/indexes/with-schemas/index.cjs +0 -6
- package/cjs/es6/mergeable-store/index.cjs +17 -11
- package/cjs/es6/mergeable-store/with-schemas/index.cjs +17 -11
- package/cjs/es6/metrics/index.cjs +1 -1
- package/cjs/es6/metrics/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/common/index.cjs +1 -1
- package/cjs/es6/min/common/index.cjs.gz +0 -0
- package/cjs/es6/min/common/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/common/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/index.cjs +1 -1
- package/cjs/es6/min/index.cjs.gz +0 -0
- package/cjs/es6/min/indexes/index.cjs +1 -1
- package/cjs/es6/min/indexes/index.cjs.gz +0 -0
- package/cjs/es6/min/indexes/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/indexes/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/mergeable-store/index.cjs +1 -1
- package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
- package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-pglite/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-pglite/index.cjs.gz +0 -0
- package/cjs/es6/min/persisters/persister-pglite/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/persisters/persister-pglite/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/store/index.cjs +1 -1
- package/cjs/es6/min/store/index.cjs.gz +0 -0
- package/cjs/es6/min/store/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/store/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-local/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-local/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-local/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/tools/index.cjs +1 -1
- package/cjs/es6/min/tools/index.cjs.gz +0 -0
- package/cjs/es6/min/tools/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/tools/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/index.cjs +1 -1
- package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-dom/index.cjs +1 -1
- package/cjs/es6/min/ui-react-dom/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-dom/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react-dom/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/persisters/persister-pglite/index.cjs +1 -1
- package/cjs/es6/persisters/persister-pglite/with-schemas/index.cjs +1 -1
- package/cjs/es6/queries/index.cjs +1 -1
- package/cjs/es6/queries/with-schemas/index.cjs +1 -1
- package/cjs/es6/store/index.cjs +0 -6
- package/cjs/es6/store/with-schemas/index.cjs +0 -6
- package/cjs/es6/synchronizers/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-broadcast-channel/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-local/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-local/with-schemas/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-ws-client/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +5 -7
- package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +5 -7
- package/cjs/es6/synchronizers/with-schemas/index.cjs +5 -7
- package/cjs/es6/tools/index.cjs +7 -4
- package/cjs/es6/tools/with-schemas/index.cjs +7 -4
- package/cjs/es6/ui-react/index.cjs +101 -109
- package/cjs/es6/ui-react/with-schemas/index.cjs +101 -109
- package/cjs/es6/ui-react-dom/index.cjs +14 -8
- package/cjs/es6/ui-react-dom/with-schemas/index.cjs +14 -8
- package/cjs/es6/ui-react-inspector/index.cjs +18 -16
- package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +18 -16
- package/cjs/es6/with-schemas/index.cjs +18 -12
- package/cjs/index.cjs +18 -12
- package/cjs/indexes/index.cjs +0 -6
- package/cjs/indexes/with-schemas/index.cjs +0 -6
- package/cjs/mergeable-store/index.cjs +17 -11
- package/cjs/mergeable-store/with-schemas/index.cjs +17 -11
- package/cjs/metrics/index.cjs +1 -1
- package/cjs/metrics/with-schemas/index.cjs +1 -1
- package/cjs/min/common/index.cjs +1 -1
- package/cjs/min/common/index.cjs.gz +0 -0
- package/cjs/min/common/with-schemas/index.cjs +1 -1
- package/cjs/min/common/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/index.cjs +1 -1
- package/cjs/min/index.cjs.gz +0 -0
- package/cjs/min/indexes/index.cjs +1 -1
- package/cjs/min/indexes/index.cjs.gz +0 -0
- package/cjs/min/indexes/with-schemas/index.cjs +1 -1
- package/cjs/min/indexes/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/mergeable-store/index.cjs +1 -1
- package/cjs/min/mergeable-store/index.cjs.gz +0 -0
- package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
- package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-pglite/index.cjs +1 -1
- package/cjs/min/persisters/persister-pglite/index.cjs.gz +0 -0
- package/cjs/min/persisters/persister-pglite/with-schemas/index.cjs +1 -1
- package/cjs/min/persisters/persister-pglite/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/store/index.cjs +1 -1
- package/cjs/min/store/index.cjs.gz +0 -0
- package/cjs/min/store/with-schemas/index.cjs +1 -1
- package/cjs/min/store/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/index.cjs +1 -1
- package/cjs/min/synchronizers/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-local/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-local/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-local/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/tools/index.cjs +1 -1
- package/cjs/min/tools/index.cjs.gz +0 -0
- package/cjs/min/tools/with-schemas/index.cjs +1 -1
- package/cjs/min/tools/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/ui-react/index.cjs +1 -1
- package/cjs/min/ui-react/index.cjs.gz +0 -0
- package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/ui-react-dom/index.cjs +1 -1
- package/cjs/min/ui-react-dom/index.cjs.gz +0 -0
- package/cjs/min/ui-react-dom/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react-dom/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
- package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/with-schemas/index.cjs +1 -1
- package/cjs/min/with-schemas/index.cjs.gz +0 -0
- package/cjs/persisters/persister-pglite/index.cjs +1 -1
- package/cjs/persisters/persister-pglite/with-schemas/index.cjs +1 -1
- package/cjs/queries/index.cjs +1 -1
- package/cjs/queries/with-schemas/index.cjs +1 -1
- package/cjs/store/index.cjs +0 -6
- package/cjs/store/with-schemas/index.cjs +0 -6
- package/cjs/synchronizers/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-broadcast-channel/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-local/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-local/with-schemas/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-ws-client/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-ws-server/index.cjs +5 -7
- package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +5 -7
- package/cjs/synchronizers/with-schemas/index.cjs +5 -7
- package/cjs/tools/index.cjs +7 -4
- package/cjs/tools/with-schemas/index.cjs +7 -4
- package/cjs/ui-react/index.cjs +97 -107
- package/cjs/ui-react/with-schemas/index.cjs +97 -107
- package/cjs/ui-react-dom/index.cjs +14 -8
- package/cjs/ui-react-dom/with-schemas/index.cjs +14 -8
- package/cjs/ui-react-inspector/index.cjs +18 -16
- package/cjs/ui-react-inspector/with-schemas/index.cjs +18 -16
- package/cjs/with-schemas/index.cjs +18 -12
- package/common/index.js +5 -7
- package/common/with-schemas/index.js +5 -7
- package/es6/common/index.js +5 -7
- package/es6/common/with-schemas/index.js +5 -7
- package/es6/index.js +18 -12
- package/es6/indexes/index.js +0 -6
- package/es6/indexes/with-schemas/index.js +0 -6
- package/es6/mergeable-store/index.js +17 -11
- package/es6/mergeable-store/with-schemas/index.js +17 -11
- package/es6/metrics/index.js +1 -1
- package/es6/metrics/with-schemas/index.js +1 -1
- package/es6/min/common/index.js +1 -1
- package/es6/min/common/index.js.gz +0 -0
- package/es6/min/common/with-schemas/index.js +1 -1
- package/es6/min/common/with-schemas/index.js.gz +0 -0
- package/es6/min/index.js +1 -1
- package/es6/min/index.js.gz +0 -0
- package/es6/min/indexes/index.js +1 -1
- package/es6/min/indexes/index.js.gz +0 -0
- package/es6/min/indexes/with-schemas/index.js +1 -1
- package/es6/min/indexes/with-schemas/index.js.gz +0 -0
- package/es6/min/mergeable-store/index.js +1 -1
- package/es6/min/mergeable-store/index.js.gz +0 -0
- package/es6/min/mergeable-store/with-schemas/index.js +1 -1
- package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/es6/min/persisters/persister-pglite/index.js +1 -1
- package/es6/min/persisters/persister-pglite/index.js.gz +0 -0
- package/es6/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/es6/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/es6/min/store/index.js +1 -1
- package/es6/min/store/index.js.gz +0 -0
- package/es6/min/store/with-schemas/index.js +1 -1
- package/es6/min/store/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/index.js +1 -1
- package/es6/min/synchronizers/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-local/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/es6/min/tools/index.js +1 -1
- package/es6/min/tools/index.js.gz +0 -0
- package/es6/min/tools/with-schemas/index.js +1 -1
- package/es6/min/tools/with-schemas/index.js.gz +0 -0
- package/es6/min/ui-react/index.js +1 -1
- package/es6/min/ui-react/index.js.gz +0 -0
- package/es6/min/ui-react/with-schemas/index.js +1 -1
- package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/es6/min/ui-react-dom/index.js +1 -1
- package/es6/min/ui-react-dom/index.js.gz +0 -0
- package/es6/min/ui-react-dom/with-schemas/index.js +1 -1
- package/es6/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/index.js +1 -1
- package/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/es6/min/with-schemas/index.js +1 -1
- package/es6/min/with-schemas/index.js.gz +0 -0
- package/es6/persisters/persister-pglite/index.js +1 -1
- package/es6/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/es6/queries/index.js +1 -1
- package/es6/queries/with-schemas/index.js +1 -1
- package/es6/store/index.js +0 -6
- package/es6/store/with-schemas/index.js +0 -6
- package/es6/synchronizers/index.js +5 -7
- package/es6/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
- package/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
- package/es6/synchronizers/synchronizer-local/index.js +5 -7
- package/es6/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
- package/es6/synchronizers/synchronizer-ws-client/index.js +5 -7
- package/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
- package/es6/synchronizers/synchronizer-ws-server/index.js +5 -7
- package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
- package/es6/synchronizers/with-schemas/index.js +5 -7
- package/es6/tools/index.js +7 -4
- package/es6/tools/with-schemas/index.js +7 -4
- package/es6/ui-react/index.js +101 -109
- package/es6/ui-react/with-schemas/index.js +101 -109
- package/es6/ui-react-dom/index.js +14 -8
- package/es6/ui-react-dom/with-schemas/index.js +14 -8
- package/es6/ui-react-inspector/index.js +18 -16
- package/es6/ui-react-inspector/with-schemas/index.js +18 -16
- package/es6/with-schemas/index.js +18 -12
- package/index.js +18 -12
- package/indexes/index.js +0 -6
- package/indexes/with-schemas/index.js +0 -6
- package/mergeable-store/index.js +17 -11
- package/mergeable-store/with-schemas/index.js +17 -11
- package/metrics/index.js +1 -1
- package/metrics/with-schemas/index.js +1 -1
- package/min/common/index.js +1 -1
- package/min/common/index.js.gz +0 -0
- package/min/common/with-schemas/index.js +1 -1
- package/min/common/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/indexes/index.js +1 -1
- package/min/indexes/index.js.gz +0 -0
- package/min/indexes/with-schemas/index.js +1 -1
- package/min/indexes/with-schemas/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/index.js +1 -1
- package/min/synchronizers/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/with-schemas/index.js +1 -1
- package/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/min/tools/index.js +1 -1
- package/min/tools/index.js.gz +0 -0
- package/min/tools/with-schemas/index.js +1 -1
- package/min/tools/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/package.json +3 -3
- package/persisters/persister-pglite/index.js +1 -1
- package/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/queries/index.js +1 -1
- package/queries/with-schemas/index.js +1 -1
- package/store/index.js +0 -6
- package/store/with-schemas/index.js +0 -6
- package/synchronizers/index.js +5 -7
- package/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
- package/synchronizers/synchronizer-local/index.js +5 -7
- package/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
- package/synchronizers/synchronizer-ws-client/index.js +5 -7
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
- package/synchronizers/synchronizer-ws-server/index.js +5 -7
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
- package/synchronizers/with-schemas/index.js +5 -7
- package/tools/index.js +7 -4
- package/tools/with-schemas/index.js +7 -4
- package/ui-react/index.js +97 -107
- package/ui-react/with-schemas/index.js +97 -107
- package/ui-react-dom/index.js +14 -8
- package/ui-react-dom/with-schemas/index.js +14 -8
- package/ui-react-inspector/index.js +18 -16
- package/ui-react-inspector/with-schemas/index.js +18 -16
- package/umd/common/index.js +5 -7
- package/umd/common/with-schemas/index.js +5 -7
- package/umd/es6/common/index.js +5 -7
- package/umd/es6/common/with-schemas/index.js +5 -7
- package/umd/es6/index.js +18 -12
- package/umd/es6/indexes/index.js +0 -6
- package/umd/es6/indexes/with-schemas/index.js +0 -6
- package/umd/es6/mergeable-store/index.js +17 -11
- package/umd/es6/mergeable-store/with-schemas/index.js +17 -11
- package/umd/es6/metrics/index.js +1 -1
- package/umd/es6/metrics/with-schemas/index.js +1 -1
- package/umd/es6/min/common/index.js +1 -1
- package/umd/es6/min/common/index.js.gz +0 -0
- package/umd/es6/min/common/with-schemas/index.js +1 -1
- package/umd/es6/min/common/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/index.js +1 -1
- package/umd/es6/min/index.js.gz +0 -0
- package/umd/es6/min/indexes/index.js +1 -1
- package/umd/es6/min/indexes/index.js.gz +0 -0
- package/umd/es6/min/indexes/with-schemas/index.js +1 -1
- package/umd/es6/min/indexes/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/mergeable-store/index.js +1 -1
- package/umd/es6/min/mergeable-store/index.js.gz +0 -0
- package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
- package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-pglite/index.js +1 -1
- package/umd/es6/min/persisters/persister-pglite/index.js.gz +0 -0
- package/umd/es6/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/umd/es6/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/store/index.js +1 -1
- package/umd/es6/min/store/index.js.gz +0 -0
- package/umd/es6/min/store/with-schemas/index.js +1 -1
- package/umd/es6/min/store/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/index.js +1 -1
- package/umd/es6/min/synchronizers/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-local/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/tools/index.js +1 -1
- package/umd/es6/min/tools/index.js.gz +0 -0
- package/umd/es6/min/tools/with-schemas/index.js +1 -1
- package/umd/es6/min/tools/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/ui-react/index.js +1 -1
- package/umd/es6/min/ui-react/index.js.gz +0 -0
- package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/ui-react-dom/index.js +1 -1
- package/umd/es6/min/ui-react-dom/index.js.gz +0 -0
- package/umd/es6/min/ui-react-dom/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/with-schemas/index.js +1 -1
- package/umd/es6/min/with-schemas/index.js.gz +0 -0
- package/umd/es6/persisters/persister-pglite/index.js +1 -1
- package/umd/es6/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/umd/es6/queries/index.js +1 -1
- package/umd/es6/queries/with-schemas/index.js +1 -1
- package/umd/es6/store/index.js +0 -6
- package/umd/es6/store/with-schemas/index.js +0 -6
- package/umd/es6/synchronizers/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-local/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-ws-client/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-ws-server/index.js +5 -7
- package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
- package/umd/es6/synchronizers/with-schemas/index.js +5 -7
- package/umd/es6/tools/index.js +7 -4
- package/umd/es6/tools/with-schemas/index.js +7 -4
- package/umd/es6/ui-react/index.js +101 -118
- package/umd/es6/ui-react/with-schemas/index.js +101 -118
- package/umd/es6/ui-react-dom/index.js +14 -8
- package/umd/es6/ui-react-dom/with-schemas/index.js +14 -8
- package/umd/es6/ui-react-inspector/index.js +18 -16
- package/umd/es6/ui-react-inspector/with-schemas/index.js +18 -16
- package/umd/es6/with-schemas/index.js +18 -12
- package/umd/index.js +18 -12
- package/umd/indexes/index.js +0 -6
- package/umd/indexes/with-schemas/index.js +0 -6
- package/umd/mergeable-store/index.js +17 -11
- package/umd/mergeable-store/with-schemas/index.js +17 -11
- package/umd/metrics/index.js +1 -1
- package/umd/metrics/with-schemas/index.js +1 -1
- package/umd/min/common/index.js +1 -1
- package/umd/min/common/index.js.gz +0 -0
- package/umd/min/common/with-schemas/index.js +1 -1
- package/umd/min/common/with-schemas/index.js.gz +0 -0
- package/umd/min/index.js +1 -1
- package/umd/min/index.js.gz +0 -0
- package/umd/min/indexes/index.js +1 -1
- package/umd/min/indexes/index.js.gz +0 -0
- package/umd/min/indexes/with-schemas/index.js +1 -1
- package/umd/min/indexes/with-schemas/index.js.gz +0 -0
- package/umd/min/mergeable-store/index.js +1 -1
- package/umd/min/mergeable-store/index.js.gz +0 -0
- package/umd/min/mergeable-store/with-schemas/index.js +1 -1
- package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/umd/min/persisters/persister-pglite/index.js +1 -1
- package/umd/min/persisters/persister-pglite/index.js.gz +0 -0
- package/umd/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/umd/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/umd/min/store/index.js +1 -1
- package/umd/min/store/index.js.gz +0 -0
- package/umd/min/store/with-schemas/index.js +1 -1
- package/umd/min/store/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/index.js +1 -1
- package/umd/min/synchronizers/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-local/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/umd/min/tools/index.js +1 -1
- package/umd/min/tools/index.js.gz +0 -0
- package/umd/min/tools/with-schemas/index.js +1 -1
- package/umd/min/tools/with-schemas/index.js.gz +0 -0
- package/umd/min/ui-react/index.js +1 -1
- package/umd/min/ui-react/index.js.gz +0 -0
- package/umd/min/ui-react/with-schemas/index.js +1 -1
- package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
- package/umd/min/ui-react-dom/index.js +1 -1
- package/umd/min/ui-react-dom/index.js.gz +0 -0
- package/umd/min/ui-react-dom/with-schemas/index.js +1 -1
- package/umd/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/index.js +1 -1
- package/umd/min/ui-react-inspector/index.js.gz +0 -0
- package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/umd/min/with-schemas/index.js +1 -1
- package/umd/min/with-schemas/index.js.gz +0 -0
- package/umd/persisters/persister-pglite/index.js +1 -1
- package/umd/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/umd/queries/index.js +1 -1
- package/umd/queries/with-schemas/index.js +1 -1
- package/umd/store/index.js +0 -6
- package/umd/store/with-schemas/index.js +0 -6
- package/umd/synchronizers/index.js +5 -7
- package/umd/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
- package/umd/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
- package/umd/synchronizers/synchronizer-local/index.js +5 -7
- package/umd/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
- package/umd/synchronizers/synchronizer-ws-client/index.js +5 -7
- package/umd/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
- package/umd/synchronizers/synchronizer-ws-server/index.js +5 -7
- package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
- package/umd/synchronizers/with-schemas/index.js +5 -7
- package/umd/tools/index.js +7 -4
- package/umd/tools/with-schemas/index.js +7 -4
- package/umd/ui-react/index.js +97 -110
- package/umd/ui-react/with-schemas/index.js +97 -110
- package/umd/ui-react-dom/index.js +14 -8
- package/umd/ui-react-dom/with-schemas/index.js +14 -8
- package/umd/ui-react-inspector/index.js +18 -16
- package/umd/ui-react-inspector/with-schemas/index.js +18 -16
- package/umd/with-schemas/index.js +18 -12
- package/with-schemas/index.js +18 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e){"use strict";const t=Promise,a=globalThis,n=Math,s=n.floor,o=e=>null==e,r=(e,t,a)=>o(e)?a?.():t(e),i=e=>Array.isArray(e),l=e=>e.length,c=e=>{throw Error(e)},u=(e,t)=>e.forEach(t),g=(e
|
|
1
|
+
var e,t;e=this,t=function(e){"use strict";const t=Promise,a=globalThis,n=Math,s=n.floor,o=e=>null==e,r=(e,t,a)=>o(e)?a?.():t(e),i=e=>Array.isArray(e),l=e=>e.length,c=e=>{throw Error(e)},u=(e,t)=>e.forEach(t),g=(e,...t)=>e.push(...t),d=e=>e.shift(),f=Object,y=e=>f.getPrototypeOf(e),h=f.entries,p=f.keys,v=f.freeze,w=(e,t)=>u(h(e),(([e,a])=>t(a,e))),b=e=>(e=>!o(e)&&r(y(e),(e=>e==f.prototype||o(y(e))),(()=>!0)))(e)&&0==(e=>l(p(e)))(e),C=(e,t,a)=>(((e,t)=>t in e)(e,t)||(e[t]=a()),e[t]),S=e=>o(e)||0==(e=>e?.size??0)(e),M=(e,t)=>e?.forEach(t),A=(e,t)=>e?.delete(t),T=e=>new Map(e),m=(e,t)=>e?.get(t),D=(e,t,a)=>o(a)?(A(e,t),e):e?.set(t,a),L=(e,t,a,n)=>{var s,o;return s=e,o=t,s?.has(o)?n?.(m(e,t)):D(e,t,a()),m(e,t)},H=(e,t,a,n,s=0)=>r((a?L:m)(e,t[s],s>l(t)-2?a:T),(o=>{if(s>l(t)-2)return n?.(o)&&D(e,t[s]),o;const r=H(o,t,a,n,s+1);return S(o)&&D(e,t[s]),r})),z=(e,t)=>t?[e,t]:[e],G=(e,t)=>((e??"")>(t??"")?e:t)??"",R=(e="")=>z(((e=[])=>f.fromEntries(e))(),e),E=e=>new Set(i(e)||o(e)?e:[e]),V=/^\d+$/,x=T(),P=T(),j=(e,t,a,n,s,f,y,h={},p=[])=>{let w,C,z,G=0,R=0,j=0;L(x,p,(()=>0)),L(P,p,(()=>[]));const O=T(),[$,k,B,F,N]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!b(e)||!b(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!b(e)||!b(t),t.setContent]:c("Store type not supported by this Persister"))(y,e),[U,q,I]=(()=>{let e;const[t,a]=(()=>{const e=[];let t=0;return[a=>(a?d(e):null)??""+t++,t=>{V.test(t)&&l(e)<1e3&&g(e,t)}]})(),n=T();return[(a,s,o,r=[],i=()=>[])=>{e??=_;const l=t(1);var c,u;return D(n,l,[a,s,o,r,i]),c=H(s,o??[""],E),u=l,c?.add(u),l},(t,a,...s)=>u(((e,t=[""])=>{const a=[],n=(e,s)=>s==l(t)?g(a,e):null===t[s]?M(e,(e=>n(e,s+1))):u([t[s],null],(t=>n(m(e,t),s+1)));return n(e,0),a})(t,a),(t=>M(t,(t=>m(n,t)[0](e,...a??[],...s))))),e=>r(m(n,e),(([,t,s])=>(H(t,s??[""],void 0,(t=>(A(t,e),S(t)?1:0))),D(n,e),a(e),s))),t=>r(m(n,t),(([t,,a=[],n,s])=>{const r=(...i)=>{const c=l(i);c==l(a)?t(e,...i,...s(i)):o(a[c])?u(n[c]?.(...i)??[],(e=>r(...i,e))):r(...i,a[c])};r()}))]})(),J=e=>{e!=G&&(G=e,q(O,void 0,G))},K=t=>{($&&i(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},Q=async e=>(2!=G&&(J(1),R++,await Z((async()=>{try{const e=await t();i(e)?K(e):c("Content is not an array "+e)}catch(t){f?.(t),e&&N(e)}J(0)}))),_),W=()=>(C&&(s(C),C=void 0),_),X=async e=>(1!=G&&(J(2),j++,await Z((async()=>{try{await a(k,e)}catch(e){f?.(e)}J(0)}))),_),Y=()=>(r(z,e.delListener),z=void 0,_),Z=async(...e)=>(g(m(P,p),...e),await(async()=>{if(!m(x,p)){for(D(x,p,1);!o(w=d(m(P,p)));)try{await w()}catch(e){f?.(e)}D(x,p,0)}})(),_),_={load:Q,startAutoLoad:async e=>{await W().load(e);try{C=await n((async(e,t)=>{t||e?2!=G&&(J(1),R++,K(t??e),J(0)):await Q()}))}catch(e){f?.(e)}return _},stopAutoLoad:W,isAutoLoading:()=>!o(C),save:X,startAutoSave:async()=>(await Y().save(),z=e.addDidFinishTransactionListener((()=>{const e=B();F(e)&&X(e)})),_),stopAutoSave:Y,isAutoSaving:()=>!o(z),getStatus:()=>G,addStatusListener:e=>U(e,O),delListener:t=>(I(t),e),schedule:Z,getStore:()=>e,destroy:()=>(m(P,p).splice(0,void 0),W().stopAutoSave()),getStats:()=>({loads:R,saves:j}),...h};return v(_)},O=((e,t="")=>"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(t,void 0))(),$=a.crypto?e=>a.crypto.getRandomValues(e):e=>(e=>e.map((()=>s(256*n.random()))))(e);e.Message={Response:0,GetContentHashes:1,ContentHashes:2,ContentDiff:3,GetTableDiff:4,GetRowDiff:5,GetCellDiff:6,GetValueDiff:7},e.createCustomSynchronizer=(e,a,n,s,i,l,c,u,g={})=>{let d,f=0,y=0;const h=T(),p=(e,t,n,s)=>{f++,l?.(e,t,n,s),a(e,t,n,s)},v=async(e,a,n="")=>new t(((t,s)=>{const o=((e=16)=>{return t=(e,t)=>e+O[63&t],$(new Uint8Array(e)).reduce(t,"");var t})(),r=setTimeout((()=>{A(h,o),s(`No response from ${e??"anyone"} to ${o}, `+a)}),1e3*i);D(h,o,[e,(e,a)=>{clearTimeout(r),A(h,o),t([e,a])}]),p(e,o,a,n)})),S=(e,[t,a])=>{w(t,(([t,a],n)=>{const s=C(e[0],n,R);w(t,(([e,t],a)=>{const n=C(s[0],a,R);w(e,(([e,t],a)=>n[0][a]=z(e,t))),n[1]=G(n[1],t)})),s[1]=G(s[1],a)})),e[1]=G(e[1],a)},M=async(t=null,a)=>{o(a)&&([a,t]=await v(t,1));const[n,s]=a,[r,i]=e.getMergeableContentHashes();let l=R();if(r!=n){const[a,n]=(await v(t,4,e.getMergeableTableHashes()))[0];if(l=a,!b(n)){const[a,s]=(await v(t,5,e.getMergeableRowHashes(n)))[0];if(S(l,a),!b(s)){const a=(await v(t,6,e.getMergeableCellHashes(s)))[0];S(l,a)}}}return[l,i==s?R():(await v(t,7,e.getMergeableValueHashes()))[0],1]},L=j(e,(async()=>{const e=await M();return b(e[0][0])&&b(e[1][0])?void 0:e}),(async(t,a)=>a?p(null,null,3,a):p(null,null,2,e.getMergeableContentHashes())),(e=>d=e),(()=>d=void 0),u,2,{startSync:async e=>await(await L.startAutoLoad(e)).startAutoSave(),stopSync:()=>L.stopAutoLoad().stopAutoSave(),destroy:()=>(s(),L.stopSync()),getSynchronizerStats:()=>({sends:f,receives:y}),...g});return n(((t,a,n,s)=>{y++,c?.(t,a,n,s),0==n?r(m(h,a),(([e,a])=>o(e)||e==t?a(s,t):0)):2==n&&L.isAutoLoading()?M(t,s).then((e=>{d?.(void 0,e)})):3==n&&L.isAutoLoading()?d?.(void 0,s):r(1==n&&L.isAutoSaving()?e.getMergeableContentHashes():4==n?e.getMergeableTableDiff(s):5==n?e.getMergeableRowDiff(s):6==n?e.getMergeableCellDiff(s):7==n?e.getMergeableValueDiff(s):void 0,(e=>{p(t,a,0,e)}))})),L}},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseSynchronizers={});
|
|
Binary file
|
package/umd/min/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,l;e=this,l=function(e){"use strict";const l=e=>typeof e,t="tinybase",a="",n=",",d=l(a),o=l(!0),s=l(0),r="type",I="default",$="Listener",c="get",u="add",i="Has",b="Ids",p="Table",C=p+"s",h=p+b,m="Row",g=m+b,f="Sorted"+m+b,w="Cell",T=w+b,y="Value",v=y+"s",x=y+b,V=Promise,R=isFinite,A=e=>null==e,k=(e,l,t)=>A(e)?t?.():l(e),S=e=>e==d||e==o,P=e=>l(e)==d,O=e=>Array.isArray(e),E=(e,l,t)=>e.slice(l,t),N=e=>e.length,D=async e=>V.all(e),L=e=>{const t=l(e);return S(t)||t==s&&R(e)?t:void 0},j=(e,l)=>e.every(l),G=(e,l)=>e.sort(l),H=(e,l)=>e.forEach(l),M=(e,l=a)=>e.join(l),J=(e,l)=>e.map(l),z=(e,l)=>e.filter(l),W=(e,...l)=>e.push(...l),B=e=>e.pop(),F=(e,...l)=>e.unshift(...l),U=e=>e.shift(),_=Object,Z=e=>_.getPrototypeOf(e),Q=_.entries,q=e=>!A(e)&&k(Z(e),(e=>e==_.prototype||A(Z(e))),(()=>!0)),K=_.keys,X=_.freeze,Y=(e,l)=>J(Q(e),(([e,t])=>l(t,e))),ee=e=>N(K(e)),le=e=>q(e)&&0==ee(e),te=(e,l)=>e?.has(l)??!1,ae=e=>[...e?.values()??[]],ne=(e,l)=>e?.forEach(l),de=(e,l)=>e?.delete(l),oe=e=>new Map(e),se=(e,l)=>e?.get(l),re=(e,l)=>ne(e,((e,t)=>l(t,e))),Ie=(e,l)=>J([...e?.entries()??[]],(([e,t])=>l(t,e))),$e=(e,l,t)=>A(t)?(de(e,l),e):e?.set(l,t),ce=(e,l,t,a)=>(te(e,l)||$e(e,l,t()),se(e,l)),ue=e=>e.toUpperCase(),ie=e=>e.toLowerCase(),be="a ",pe="A function for",Ce=", and registers a listener so that any changes to that result will cause a re-render",he="Callback",me="Changes",ge="Count",fe="Del",we="Deps",Te=we+"?: React.DependencyList",ye="doRollback?: DoRollback",ve="actions: () => Return, "+ye,xe="export",Ve="Id",Re="Invalid",Ae="Json",ke=ie($),Se="?: ",Pe=" | undefined",Oe="NonNullable",Ee="Partial",Ne="Props",De="Provider",Le=`Registers a ${ke} that will be called`,je="Represents",Ge="rowId: "+Ve,He="Schema",Me="Set",Je=", descending?: boolean, offset?: number, limit?: number",ze="[]",We="the Store",Be="Transaction",Fe=ie(Be),Ue="Execute a "+Fe+" to make multiple mutations",_e="Explicitly starts a "+Fe,Ze="Explicitly finishes a "+Fe,Qe="the end of the "+Fe,qe="void",Ke=" => "+qe,Xe="WhenSet",Ye=" when setting it",el=be+"string serialization of",ll=" ",tl="Gets a callback that can ",al="the ",nl=" the schema for",dl=(e=0)=>e?"the existence of ":"",ol=(e=0,l=0,t=0)=>dl(t)+`the ${vl[e]}content of`+(l?ll+We:a),sl=(e=0,l,t=0,n=0)=>wl[l]+ll+dl(n)+ol(e,1)+(t?" when setting it":a),rl=(e,l=0)=>je+` a Row when ${l?"s":"g"}etting ${ol()} the '${e}' `+p,Il=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,$l=(e,l)=>`Calls a function for each ${e} in `+l,cl=e=>"The props passed to a component that renders "+e,ul=e=>"A function that takes "+e,il=(e,l=0,t=0)=>pe+" listening to changes to "+dl(t)+yl[e]+" in "+yl[l],bl=(e,l,t=0,n=0)=>Le+" whenever "+dl(n)+yl[e]+" in "+yl[l]+" change"+(t?a:"s"),pl=e=>`the '${e}' `+p,Cl=e=>"the specified Row in "+pl(e),hl=(e,l=0,t=0)=>wl[l]+ll+ol(0,0,t)+ll+pl(e),ml=(e,l=0,t=0)=>wl[l]+` ${ol(0,0,t)} `+Cl(e),gl=(e,l,t=0,a=0)=>wl[t]+ll+dl(a)+`the '${l}' Cell for `+Cl(e),fl=(e,l=0,t=0)=>wl[l]+ll+dl(t)+`the '${e}' Value`,wl=["Gets","Checks existence of","Sets","Deletes","Sets part of",je,"Gets "+el,"Sets "+el,Le+" whenever",tl+"set",tl+"add",tl+"set part of",tl+"delete","Renders","Gets "+el+nl,"Sets"+nl,"Deletes"+nl],Tl=[c,"has","set","del","set","forEach",u,a],yl=[We,C,al+p+ll+b,be+p,al+m+ll+b,be+m,al+w+ll+b,be+w,"invalid Cell changes",v,al+y+ll+b,be+y,"invalid Value changes",al+"sorted "+m+ll+b,al+w+ll+b+" anywhere",al+"number of Rows",be+w+" anywhere"],vl=[a,"tabular ","keyed value "],xl=e=>new Set(O(e)||A(e)?e:[e]),Vl=(e,l)=>e?.add(l),Rl=/[^A-Za-z]+/,Al=/[^A-Za-z0-9]+/,kl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Sl=e=>e.includes(n),Pl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return te(e,n)?Pl(e,l,t,a+1):($e(e,n,t),n)},Ol=e=>e.replace(kl,((e,l,t)=>{const a=77-N(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),El=e=>e.flat(1e3),Nl=(e,l=0)=>M(J(e.split(Al),((e,t)=>(t>0||l?ue:ie)(E(e,0,1))+E(e,1)))),Dl=e=>ue(M((e&&!Rl.test(e[0])?e:" "+e).split(Al),"_")),Ll=e=>`/** ${e}. */`,jl=(...e)=>M(z(e,(e=>e)),", "),Gl=(...e)=>"{"+M(e,"; ")+"}",Hl=(...e)=>Gl(...J(e,(e=>"readonly "+e))),Ml=()=>{const e=[oe(),oe(),oe(),oe()],l=oe(),t=oe(),n=e=>{const l=e.indexOf(" as ");return-1!=l?E(e,l+4):e};return[(...e)=>M(El(e),"\n"),(l,t,...a)=>H(a,(a=>H([0,1],(n=>(l??n)==n?Vl(ce(e[n],t,xl),a):0)))),(e,t,n,d=a,o=1)=>Pl(l,e,[t,n,d,o]),(e,l,a)=>Pl(t,e,O(a)?[`(${l}) => {`,a,"}"]:[`(${l}) => ${a}`]),(e,l)=>se(t,e)===l?e:Pl(t,e,l),(l=0)=>J([...G(Ie(e[l],((e,l)=>`import {${M(G(ae(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Sl(e)!=Sl(l)?Sl(e)?-1:1:e>l?1:-1)),a],(e=>e.replace("{React}","React"))),()=>Ie(l,(([e,l,t,n],d)=>[Ll(l),`${n?xe+" ":a}type ${d}${t} = ${e};`,a])),()=>Ie(t,((e,l)=>(e=O(e)?e:[e],W(e,B(e)+";"),[`const ${l} = ${U(e)}`,e,a])))]},Jl=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},zl=(e,l,t)=>[l=>Y(e,((e,a)=>l(a,Nl(a,1),t(Dl(a),`'${a}'`)))),(l,a)=>Y(e[l],((e,l)=>a(l,e[r],e[I],t(Dl(l),`'${l}'`),Nl(l,1)))),e=>Y(l,((l,a)=>e(a,l[r],l[I],t(Dl(a),`'${a}'`),Nl(a,1))))],Wl=(e,l,t,n)=>[(n,d)=>{const o=n+": "+d,s=e(C,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...t(e,((e,l,t)=>`'${e}'${A(t)?"?":a}: ${l}`)))+"}"))),sl(1,5)),r=e(C+Xe,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...t(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),sl(1,5,1)),I=e(p+Ve,"keyof "+s,"A "+p+" Id in "+We),c=`<TId extends ${I}>`,u=e(p,Oe+`<${s}[TId]>`,"A "+p+" in "+We,c),b=e(p+Xe,Oe+`<${r}[TId]>`,"A "+p+" in "+We+Ye,c),y=e(m,u+"<TId>[Id]","A "+m+" in a "+p,c),v=e(m+Xe,b+"<TId>[Id]","A "+m+" in a "+p+Ye,c),x=e(w+Ve,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+m,c),V=e(w,Oe+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+m,`<TId extends ${I}, CId extends ${x}<TId>>`),R=e("CellIdCellArray",`CId extends ${x}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,w+" Ids and types in a "+m,`<TId extends ${I}, CId = ${x}<TId>>`,0),k=e(w+he,`(...[cellId, cell]: ${R}<TId>)`+Ke,ul(be+w+" Id, and "+w),c),S=e(m+he,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ke+") "+Ke,ul(be+m+" Id, and a "+w+" iterator"),c),P=e(p+w+he,`(cellId: ${x}<TId>, count: number) `+Ke,ul(be+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${Ke}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),E=e(p+he,`(...[tableId, forEachRow]: ${O})`+Ke,ul(be+p+" Id, and a "+m+" iterator"),a),N=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${x}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,pe+" returning information about any Cell's changes during a "+Fe),L=e(i+C+$,`(${o}, hasTables: boolean)`+Ke,il(1,0,1)),j=e(C+$,`(${o}, getCellChange: ${D}${Pe})`+Ke,il(1)),G=e(h+$,`(${o})`+Ke,il(2)),H=e(i+p+$,`(${o}, tableId: ${I}, hasTable: boolean)`+Ke,il(3,0,1)),M=e(p+$,`(${o}, tableId: ${I}, getCellChange: ${D}${Pe})`+Ke,il(3)),J=e(p+T+$,`(${o}, tableId: ${I})`+Ke,il(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${I} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${I}>`,0),B=e(i+p+w+$,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Ke,il(16,3,1)),F=e(m+"Count"+$,`(${o}, tableId: ${I})`+Ke,il(15,3)),U=e(g+$,`(${o}, tableId: ${I})`+Ke,il(4,3)),_=e(f+$,"("+jl(o,"tableId: "+I,"cellId: Id"+Pe,"descending: boolean","offset: number","limit: number"+Pe,"sortedRowIds: Ids")+")"+Ke,il(13,3)),Z=e(i+m+$,"("+jl(""+o,"tableId: "+I,Ge,"hasRow: boolean")+")"+Ke,il(5,3,1)),Q=e(m+$,"("+jl(""+o,"tableId: "+I,Ge,`getCellChange: ${D}${Pe}`)+")"+Ke,il(5,3)),q=e(T+$,"("+jl(""+o,"tableId: "+I,Ge)+")"+Ke,il(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${I} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${I}>`,0),Y=e(i+w+$,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Ke,il(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, newCell: ${V}<TId, CId> ${Pe}, oldCell: ${V}<TId, CId> ${Pe}, getCellChange: ${D} ${Pe}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[s,r,I,u,b,y,v,x,V,k,S,P,E,L,j,G,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+$,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Ke,il(7,5)),e(Re+w+$,`(${o}, tableId: Id, ${Ge}, cellId: Id, invalidCells: any[])`+Ke,il(8))]},(l,t)=>{const d=l+": "+t,o=e(v,Gl(...n(((e,l,t)=>`'${e}'${A(t)?"?":a}: ${l}`))),sl(2,5)),s=e(v+Xe,Gl(...n(((e,l)=>`'${e}'?: ${l}`))),sl(2,5,1)),r=e(y+Ve,"keyof "+o,"A "+y+" Id in "+We),I=e(y,Oe+`<${o}[VId]>`,"A "+y+" Id in "+We,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+We,`<VId = ${r}>`,0),u=e(y+he,`(...[valueId, value]: ${c})`+Ke,ul(be+y+" Id, and "+y)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,pe+" returning information about any Value's changes during a "+Fe),p=e(i+v+$,`(${d}, hasValues: boolean)`+Ke,il(9,0,1)),C=e(v+$,`(${d}, getValueChange: ${b}${Pe})`+Ke,il(9)),h=e(x+$,`(${d})`+Ke,il(10)),m=e(i+y+$,`(${d}, valueId: ValueId, hasValue: boolean)`+Ke,il(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${I}<VId> ${Pe}, oldValue: ${I}<VId> ${Pe}, getValueChange: ${b} ${Pe}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,I,u,p,C,h,m,e(y+$,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+Ke,il(11)),e(Re+y+$,`(${d}, valueId: Id, invalidValues: any[])`+Ke,il(12))]},(l,t)=>e(Be+$,`(${l}: ${t})`+Ke,pe+" listening to the completion of a "+Fe)],Bl=(e,l=a,t=a)=>`store.${e}(${l})`+(t?" as "+t:a),Fl=(e,l=a)=>`fluent(() => ${Bl(e,l)})`,Ul=(e,l=a,t=a)=>`store.${e}(${l?l+", ":a}proxy(listener)${t?", "+t:a})`,_l=(e,l,n)=>{const[d,s,c,V,R,k,S,O]=Ml(),[E,N,D]=zl(e,l,R),[L,j,G]=Wl(c,E,N,D),J=oe(),z=(e=0)=>Ie(J,(([l,t,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${t} => ${n},`]:[s+o+`(${l}): ${t};`];return e||F(r,Ll(d)),W(r,a),r})),B=(e,l,t,n,d,o=a)=>Pl(J,e,[l,t,n,d,o]),U=(e,l,t,n,d,o=a,s=a,r=a)=>B(Tl[e]+l+(4==e?Ee:a)+t,o,n,(n==Q?Fl:Bl)(Tl[e]+(4==e?Ee:a)+t,s,e?void 0:n),d,r),_=(e,l,t,n=a,d=a,o=1,s=a)=>B(u+e+$,(n?n+", ":a)+ke+": "+l+(o?", mutator?: boolean":a),Ve,Ul(u+e+$,d,o?"mutator":a),t,s),Z=`./${Nl(n)}.d`,Q=Nl(n,1),q=Nl(Q),K=[],X=oe();let Y=[],ee=[];if(s(1,Z,Q,`create${Q} as create${Q}Decl`),le(e))s(null,t,C);else{s(0,t,"CellChange"),s(null,t,b);const[e,l,n,d,$,u,y,v,x,V,k,S,O,D,j,G,J,z,B,F,ee,le,te,ne,de,re,Ie,ce,ue]=L(q,Q),ie=oe();E(((e,l)=>{const t=`<'${e}'>`,a=[c(l+p,d+t,je+` the '${e}' `+p),c(l+p+Xe,$+t,je+` the '${e}' `+p+Ye),c(l+m,u+t,rl(e)),c(l+m+Xe,y+t,rl(e,1)),c(l+w+Ve,v+t,`A Cell Id for the '${e}' `+p),c(l+w+he,V+t,ul(`a Cell Id and value from a Row in the '${e}' `+p)),c(l+m+he,k+t,ul(`a Row Id from the '${e}' Table, and a Cell iterator`)),c(l+p+w+he,S+t,ul(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];$e(ie,e,a),s(1,Z,...a)})),s(1,Z,e,l,n,v,O,D,j,G,J,z,B,F,ee,le,te,ne,de,re,Ie,ce,ue),Y=[e,l,n,v,D,j,G,J,z,B,F,ee,le,te,ne,de,re,Ie,ce,ie],H([[e],[o],[Q,"tables: "+l,"tables"],[Q]],(([e,l,t],n)=>U(n,a,C,e,sl(1,n),l,t))),U(0,a,h,n+ze,Il(p,We)),U(5,a,p,qe,$l(p,We),"tableCallback: "+O,"tableCallback as any"),E(((e,l,t)=>{const[n,d,s,r,I,$,c,u]=se(ie,e);H([[n],[o],[Q,"table: "+d,", table"],[Q]],(([n,d,o=a],s)=>U(s,l,p,n,hl(e,s),d,t+o))),U(0,l,p+T,b,Il(w,"the whole of "+pl(e)),a,t),U(5,l,p+w,qe,$l(p+w,"the whole of "+pl(e)),"tableCellCallback: "+u,t+", tableCellCallback as any"),U(0,l,m+ge,"number","Gets the number of Rows in the "+pl(e),a,t),U(0,l,g,b,Il(m,pl(e)),a,t),U(0,l,f,b,Il(m,pl(e),1),"cellId?: "+I+Je,t+", cellId, descending, offset, limit"),U(5,l,m,qe,$l(m,pl(e)),"rowCallback: "+c,t+", rowCallback as any"),H([[s],[o],[Q,", row: "+r,", row"],[Q],[Q,", partialRow: "+r,", partialRow"]],(([n,d=a,o=a],s)=>U(s,l,m,n,ml(e,s),Ge+d,t+", rowId"+o))),U(6,l,m,Ve+Pe,"Add a new Row to "+pl(e),"row: "+r+", reuseIds?: boolean",t+", row, reuseIds"),U(0,l,T,I+ze,Il(w,Cl(e)),Ge,t+", rowId"),U(5,l,w,qe,$l(w,Cl(e)),Ge+", cellCallback: "+$,t+", rowId, cellCallback as any"),N(e,((n,d,s,r,I)=>{const $="Map"+Nl(d,1);$e(X,d,$);const c=d+(A(s)?Pe:a);H([[c],[o],[Q,`, cell: ${d} | `+$,", cell as any"],[Q]],(([d,o=a,s=a],$)=>U($,l+I,w,d,gl(e,n,$),Ge+o,t+", rowId, "+r+s))),U(1,l+I,p+w,o,wl[1]+` the '${n}' Cell anywhere in `+pl(e),a,t+", "+r)}))})),U(0,a,C+Ae,Ae,sl(1,6)),U(2,a,C+Ae,Q,sl(1,7),"tablesJson: "+Ae,"tables"+Ae),_(i+C,D,sl(1,8,0,1)+" changes"),_(C,j,sl(1,8)+" changes"),_(h,G,bl(2,0,1)),_(i+p,J,bl(3,0,0,1),`tableId: ${n} | null`,"tableId"),_(p,z,bl(3,0),`tableId: ${n} | null`,"tableId"),_(p+T,B,bl(14,3,1),`tableId: ${n} | null`,"tableId"),_(i+p+w,F,bl(16,3,0,1),`tableId: ${n} | null, cellId: ${M(E((e=>se(ie,e)?.[4]??a))," | ")} | null`,"tableId, cellId"),_(m+ge,ee,bl(15,3),`tableId: ${n} | null`,"tableId"),_(g,le,bl(4,3,1),`tableId: ${n} | null`,"tableId"),_(f,te,bl(13,3,1),jl("tableId: TId",`cellId: ${v}<TId>`+Pe,"descending: boolean","offset: number","limit: number"+Pe),jl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(i+m,ne,bl(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(m,de,bl(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(T,re,bl(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(i+w,Ie,bl(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${M(E((e=>se(ie,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),_(w,ce,bl(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${M(E((e=>se(ie,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),_(Re+w,ue,Le+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),s(1,Z,...ae(X)),W(K,".set"+C+He+"({",El(E(((e,l,t)=>[`[${t}]: {`,...N(e,((e,l,t,n)=>`[${n}]: {[${R(Dl(r),`'${r}'`)}]: ${R(Dl(l),`'${l}'`)}${A(t)?a:`, [${R(Dl(I),`'${I}'`)}]: `+(P(t)?R(Dl(t),`'${t}'`):t)}},`)),"},"]))),"})")}if(le(l))s(null,t,v);else{const[e,l,n,d,$,c,u,b,p,C,h]=j(q,Q);s(1,Z,e,l,n,$,c,u,b,p,C,h),ee=[e,l,n,c,u,b,p,C],H([[e],[o],[Q,"values: "+l,"values"],[Q],[Q,"partialValues: "+l,"partialValues"]],(([e,l,t],n)=>U(n,a,v,e,sl(2,n),l,t))),U(0,a,x,n+ze,Il(y,We)),U(5,a,y,"void",$l(y,We),"valueCallback: "+$,"valueCallback as any"),D(((e,l,t,n,d)=>{const s="Map"+Nl(l,1);$e(X,l,s),H([[l],[o],[Q,`value: ${l} | `+s,", value as any"],[Q]],(([l,t,o=a],s)=>U(s,d,y,l,fl(e,s),t,n+o)))})),U(0,a,v+Ae,Ae,sl(2,6)),U(2,a,v+Ae,Q,sl(2,7),"valuesJson: "+Ae,"values"+Ae),_(i+v,c,sl(2,8,0,1)+" changes"),_(v,u,sl(2,8)+" changes"),_(x,b,bl(10,0,1)),_(i+y,p,bl(11,0,0,1),`valueId: ${n} | null`,"valueId"),_(y,C,bl(11,0),`valueId: ${n} | null`,"valueId"),_(Re+y,h,Le+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),s(1,Z,...ae(X)),s(0,t,"ValueChange"),W(K,".set"+v+He+"({",D(((e,l,t,n)=>[`[${n}]: {[${R(Dl(r),`'${r}'`)}]: ${R(Dl(l),`'${l}'`)}${A(t)?a:`, [${R(Dl(I),`'${I}'`)}]: `+(P(t)?R(Dl(t),`'${t}'`):t)}},`])),"})")}U(0,a,"Content",`[${C}, ${v}]`,sl(0,0)),U(2,a,"Content",Q,sl(0,2),`[tables, values]: [${C}, ${v}]`,"[tables, values]"),U(7,a,"applyChanges",Q,`Applies a set of ${me} to the Store`,"changes: "+me,"changes"),re(X,((e,l)=>c(l,`(cell: ${e}${Pe}) => `+e,`Takes a ${e} Cell value and returns another`))),s(null,t,"DoRollback",Ve,"IdOrNull",Ae,"Store",me),U(0,a,Ae,Ae,sl(0,6)),U(2,a,Ae,Q,sl(0,7),"tablesAndValuesJson: "+Ae,"tablesAndValuesJson"),U(7,a,Fe,"Return",Ue,ve,"actions, doRollback","<Return>"),U(7,a,"start"+Be,Q,_e),U(7,a,"finish"+Be,Q,Ze,ye,"doRollback");const te=G(q,Q);return _("Start"+Be,te,Le+" just before the start of the "+Fe,a,a,0),_("WillFinish"+Be,te,Le+" just before "+Qe,a,a,0),_("DidFinish"+Be,te,Le+" just after "+Qe,a,a,0),U(7,a,"call"+$,Q,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,$,Q,"Remove a listener that was previously added to "+We,"listenerId: Id","listenerId"),B("getStore",a,"Store","store",wl[0]+" the underlying Store object"),s(1,t,"createStore"),s(1,Z,Q,`create${Q} as create${Q}Decl`,te),R("store",["createStore()",...K]),V("fluent","actions: () => Store",["actions();",`return ${q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),R(q,["{",...z(1),"}"]),[d(...k(0),...S(),xe+" interface "+Q+" {",...z(0),"}",a,Ll(`Creates a ${Q} object`),xe+" function create"+Q+"(): "+Q+";"),d(...k(1),xe+" const create"+Q+": typeof create"+Q+"Decl = () => {",...O(),`return Object.freeze(${q});`,"};"),Y,ee]},Zl=e=>c+e,Ql=e=>jl(Zl(e),Zl(e)+we),ql="debugIds?: boolean",Kl="debugIds={debugIds}",Xl="then"+Te,Yl="Parameter",et=": (parameter: "+Yl+", store: Store) => ",lt="const contextValue = useContext(Context);",tt=", based on a parameter",at=": ",nt="<"+Yl+",>",dt=Yl+"ized"+he+"<"+Yl+">",ot="rowId",st="rowId={rowId}",rt=", separator, debugIds",It="separator?: ReactElement | string",$t="then?: (store: Store",ct=jl($t+")"+Ke,Xl),ut="then, then"+we,it=ot+at+Ve,bt="View",pt=(e,...l)=>jl(...l,ke+": "+e,ke+Te,"mutator?: boolean"),Ct=(...e)=>jl(...e,ke,ke+we,"mutator"),ht=(e,l,n,d,r)=>{const[I,c,u,V,R,k,S,P]=Ml(),[O,E,N]=zl(e,l,R),D=`./${Nl(n)}.d`,L=`./${Nl(n)}-ui-react.d`,j="tinybase/ui-react",G=Nl(n,1),H=Nl(G),J=G+"Or"+G+Ve,z=H+"Or"+G+Ve,B=H+`={${H}}`,U=oe(),_=(e,l,t,n,d,o=a)=>(c(1,L,e+" as "+e+"Decl"),Pl(U,e,[l,t,n,d,o])),Z=(e,l,t,n,d,o=a)=>_("use"+e,l,t,n,d,o),Q=(e,l,t,n,d=a,o=a,s=a,r=a,I=a)=>(c(1,j,`use${l} as use${l}Core`),Z(e,jl(d,ee,r),t,ae+`(${z}, use${l}Core, [`+(o||a)+(I?"], ["+I:a)+"]);",n,s)),q=(e,l,t,a)=>_(e,l,1,t,a),K=(e=0)=>Ie(U,(([l,t,n,d,o],s)=>{const r=e?[xe+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==t?"any":t} =>`,n]:[xe+` function ${s}${o}(${l}): ${1==t?"ComponentReturnType":t};`];return e||F(r,Ll(d)),W(r,a),r}));c(null,t,Ve,"Store",he,Yl+"ized"+he),c(0,j,"ComponentReturnType"),c(1,j,"useCellIds"),c(null,j,"ExtraProps"),c(0,D,G);const X=u(J,G+" | "+Ve,`Used when you need to refer to a ${G} in a React hook or component`),Y=u(De+Ne,Hl(H+Se+G,H+`ById?: {[${H}Id: Id]: ${G}}`),`Used with the ${De} component, so that a `+G+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,L,X,Y);const ee=z+Se+X;R("{createContext, useContext, useMemo}","React"),R("Context",`createContext<[${G}?, {[${H}Id: Id]: ${G}}?]>([])`),Z("Create"+G,`create: () => ${G}, create`+Te,G,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${G} within a React application with convenient memoization`);const te=Z(G,"id?: Id",G+Pe,["{",lt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${G} from within a ${De} component context`),ae=V("useHook",z+`: ${X} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${H} = ${te}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${H} : ${z})?.getStore(), ...postParams)`]),ne=V("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),de=V("wrap",jl("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;"]),re=V("useCustomOrDefaultCellIds",jl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${z}?: ${X} | undefined`),[`const defaultCellIds = ${ae}(${z}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=R("NullComponent","() => null");if(!le(e)){const[e,l,n,r,I,y,v,x,R,k,S,P,N,j,J,z,W,F,U,_]=d;c(null,D,e,l,n,I,y,v,x,R,k,S,P,N,j,J,z,W,U,F),c(0,D,r),c(1,D,G),c(null,t,b,"IdOrNull");const Z=V("tableView",`{${H}, rowComponent, getRowComponentProps, customCellIds`+rt+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${de}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",st,"customCellIds={customCellIds}",B,Kl,"/>","))",rt,", tableId,",");"]),K=V("getDefaultTableComponent","tableId: Id",M(O(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),X=V("getDefaultCellComponent","tableId: Id, cellId: Id",M(O(((e,l,t)=>`tableId == ${t} ? ${M(E(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);Q(i+C,i+C,o,sl(1,0,0,1)+Ce),Q(C,C,e,sl(1,0)+Ce);const Y=Q(h,h,n+ze,Il(p,We)+Ce);Q(Me+C+he,Me+C+he,dt,sl(1,9)+tt,jl(Zl(C)+et+l,Zl(C)+Te),Ql(C),nt,jl($t,`tables: ${l})`+Ke,Xl),ut),Q(fe+C+he,fe+C+he,he,sl(1,12),a,a,a,ct,ut);const ee=u(w+Ne,Hl("tableId?: TId","rowId: Id","cellId?: CId",H+Se+G,ql),cl(be+w),`<TId extends ${n}, CId extends ${r}<TId>>`),le=u(m+Ne,Hl("tableId?: TId","rowId: Id",H+Se+G,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${ee}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,It,ql),cl(be+m),`<TId extends ${n}>`),te=u(p+Ne,Hl("tableId?: TId",H+Se+G,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(be+p),`<TId extends ${n}>`),ae=u("Sorted"+p+Ne,Hl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",H+Se+G,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(be+"sorted "+p),`<TId extends ${n}>`),oe=u(C+Ne,Hl(H+Se+G,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${te}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,It,ql),cl(ol(1,1)));c(1,L,oe,te,ae,le,ee),q(C+bt,"{"+H+", tableComponents, getTableComponentProps"+rt+"}: "+oe,[de+`(${Y}(${H}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+K+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",B,Kl,"/>;","}), separator)"],sl(1,13)+Ce),O(((e,l,t)=>{const[n,d,r,I,$]=se(_,e);c(null,D,n,d,r,I,$),Q(i+l+p,i+p,o,hl(e,0,1)+Ce,a,t),Q(l+p,p,n,hl(e)+Ce,a,t),Q(l+p+T,p+T,b,Il(w,"the whole of "+pl(e))+Ce,a,t),Q(l+m+ge,m+ge,s,"Gets the number of Rows in "+pl(e)+Ce,a,t);const u=Q(l+g,g,b,Il(m,pl(e))+Ce,a,t),C=Q(l+f,f,b,Il(m,pl(e),1)+Ce,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",t+", cellId, descending, offset, limit");Q(i+l+m,i+m,o,ml(e,0,1)+Ce,it,jl(t,ot)),Q(l+m,m,r,ml(e)+Ce,it,jl(t,ot)),Q(l+T,T,$+ze,Il(w,Cl(e))+Ce,it,jl(t,ot)),Q(Me+l+p+he,Me+p+he,dt,hl(e,9)+tt,jl(Zl(p)+et+d,Zl(p)+Te),jl(t,Ql(p)),nt,jl($t,`table: ${d})`+Ke,Xl),ut),Q(fe+l+p+he,fe+p+he,he,hl(e,12),a,t,a,ct,ut),Q(Me+l+m+he,Me+m+he,dt,ml(e,9)+tt,jl(it,Zl(m)+et+I,Zl(m)+Te),jl(t,ot,Ql(m)),nt,jl($t,`row: ${I})`+Ke,Xl),ut),Q("Add"+l+m+he,"Add"+m+he,dt,ml(e,10)+tt,jl(Zl(m)+et+I,Zl(m)+Te),jl(t,Ql(m)),nt,"then?: ("+jl(it+Pe,"store: Store","row: "+I+")"+Ke,"then"+Te)+", reuseRowIds?: boolean",ut+", reuseRowIds"),Q(Me+l+Ee+m+he,Me+Ee+m+he,dt,ml(e,11)+tt,jl(it,Zl(Ee+m)+et+I,Zl(Ee+m)+Te),jl(t,ot,Ql(Ee+m)),nt,jl($t,`partialRow: ${I})`+Ke,Xl),ut),Q(fe+l+m+he,fe+m+he,he,ml(e,12),it,jl(t,ot),a,ct,ut);const h=q(l+m+bt,"{rowId, "+H+", cellComponents, getCellComponentProps, customCellIds"+rt+`}: ${le}<'${e}'>`,[de+`(${re}(customCellIds, `+t+`, rowId, ${H}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+X+`(${t}, cellId)) as React.ComponentType<CellProps<typeof `+t+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${t}}`,st,"cellId={cellId}",B,Kl,"/>;","})"+rt+", rowId)"],ml(e,13)+Ce);q(l+"Sorted"+p+bt,"{cellId, descending, offset, limit, ...props}: "+ae+`<'${e}'>`,Z+"(props, "+C+`(cellId, descending, offset, limit, props.${H}), ${t}, ${h});`,hl(e,13)+", sorted"+Ce),q(l+p+bt,`props: ${te}<'${e}'>`,Z+"(props, "+u+`(props.${H}), ${t}, ${h});`,hl(e,13)+Ce),E(e,((n,d,s,r,I)=>{const $="Map"+Nl(d,1);c(0,D,$),c(1,D,$),Q(i+l+I+p+w,i+p+w,o,`Gets ${dl(1)}the '${n}' Cell anywhere in `+pl(e)+Ce,a,jl(t,r)),Q(i+l+I+w,i+w,o,gl(e,n,0,1)+Ce,it,jl(t,ot,r));const u=Q(l+I+w,w,d+(A(s)?Pe:a),gl(e,n)+Ce,it,jl(t,ot,r));Q(Me+l+I+w+he,Me+w+he,dt,gl(e,n,9)+tt,jl(it,Zl(w)+et+d+" | "+$,Zl(w)+Te),jl(t,ot,r,Ql(w)),nt,jl($t,`cell: ${d} | ${$})`+Ke,Xl),ut),Q(fe+l+I+w+he,fe+w+he,he,gl(e,n,12),jl(it,"forceDel?: boolean"),jl(t,ot,r,"forceDel"),a,ct,ut),q(l+I+w+bt,`{rowId, ${H}, debugIds}: `+ee+`<'${e}', '${n}'>`,[de+`('' + ${u}(rowId, `+H+`) ?? '', undefined, debugIds, ${r})`],gl(e,n,13)+Ce)}))}));const Ie=M(O((e=>se(_,e)?.[4]??a))," | ");Q(i+C+$,i+C+$,qe,sl(1,8,0,1)+" changes",pt(I),Ct()),Q(C+$,C+$,qe,sl(1,8)+" changes",pt(y),Ct()),Q(h+$,h+$,qe,bl(2,0,1),pt(v),Ct()),Q(i+p+$,i+p+$,qe,bl(3,0,0,1),pt(x,`tableId: ${n} | null`),Ct("tableId")),Q(p+$,p+$,qe,bl(3,0),pt(R,`tableId: ${n} | null`),Ct("tableId")),Q(p+T+$,p+T+$,qe,bl(14,3,1),pt(k,`tableId: ${n} | null`),Ct("tableId")),Q(i+p+w+$,i+p+w+$,qe,bl(16,3,0,1),pt(S,`tableId: ${n} | null`,`cellId: ${Ie} | null`),Ct("tableId","cellId")),Q(m+ge+$,m+ge+$,qe,bl(15,3),pt(P,`tableId: ${n} | null`),Ct("tableId")),Q(g+$,g+$,qe,bl(4,3,1),pt(N,`tableId: ${n} | null`),Ct("tableId")),Q(f+$,f+$,qe,bl(13,3,1),pt(j,`tableId: ${n} | null`,"cellId: "+Ie+Pe,"descending: boolean","offset: number","limit: number"+Pe),Ct("tableId","cellId","descending","offset","limit")),Q(i+m+$,i+m+$,qe,bl(5,3,0,1),pt(J,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),Q(m+$,m+$,qe,bl(5,3),pt(z,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),Q(T+$,T+$,qe,bl(6,5,1),pt(W,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),Q(i+w+$,i+w+$,qe,bl(7,5,0,1),pt(F,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${Ie} | null`),Ct("tableId",ot,"cellId")),Q(w+$,w+$,qe,bl(7,5),pt(U,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${Ie} | null`),Ct("tableId",ot,"cellId"))}if(!le(l)){const[e,l,t,n,d,s,I,b]=r;c(null,D,...r),c(1,D,G);const p=V("getDefaultValueComponent","valueId: Id",M(N(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);Q(i+v,i+v,o,sl(2,0,0,1)+Ce),Q(v,v,e,sl(2,0)+Ce);const C=Q(x,x,t+ze,Il(y,We)+Ce);Q(Me+v+he,Me+v+he,dt,sl(2,9)+tt,jl(Zl(v)+et+l,Zl(v)+Te),Ql(v),nt,jl($t,`values: ${l})`+Ke,Xl),ut),Q(Me+Ee+v+he,Me+Ee+v+he,dt,sl(2,11)+tt,jl(Zl(Ee+v)+et+l,Zl(Ee+v)+Te),Ql(Ee+v),nt,jl($t,`partialValues: ${l})`+Ke,Xl),ut),Q(fe+v+he,fe+v+he,he,sl(2,12),a,a,a,ct,ut);const h=u(y+Ne,Hl("valueId?: VId",H+Se+G,ql),cl("a Value"),`<VId extends ${t}>`),m=u(v+Ne,Hl(H+Se+G,"valueComponents?: {readonly [VId in "+t+`]?: ComponentType<${h}<VId>>;}`,`getValueComponentProps?: (valueId: ${t}) => ExtraProps`,It,ql),cl(ol(2,1)));c(1,L,m,h),q(v+bt,"{"+H+", valueComponents, getValueComponentProps"+rt+"}: "+m,[de+`(${C}(${H}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+p+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",B,Kl,"/>;","}), separator)"],sl(2,13)+Ce),N(((e,l,t,n,d)=>{const s="Map"+Nl(l,1);c(0,D,s),c(1,D,s),Q(i+d+y,i+y,o,fl(e,0,1)+Ce,a,n);const r=Q(d+y,y,l,fl(e)+Ce,a,n);Q(Me+d+y+he,Me+y+he,dt,fl(e,9)+tt,jl(Zl(y)+et+l+" | "+s,Zl(y)+Te),jl(n,Ql(y)),nt,jl($t,`value: ${l} | ${s})`+Ke,Xl),ut),Q(fe+d+y+he,fe+y+he,he,fl(e,12),a,n,a,ct,ut),q(d+y+bt,`{${H}, debugIds}: ${h}<'${e}'>`,[de+`('' + ${r}(`+H+`) ?? '', undefined, debugIds, ${n})`],fl(e,13)+Ce)})),Q(i+v+$,i+v+$,qe,sl(2,8,0,1)+" changes",pt(n),Ct()),Q(v+$,v+$,qe,sl(2,8)+" changes",pt(d),Ct()),Q(x+$,x+$,qe,bl(10,0,1),pt(s),Ct()),Q(i+y+$,i+y+$,qe,bl(11,0,0,1),pt(I,`valueId: ${t} | null`),Ct("valueId")),Q(y+$,y+$,qe,bl(11,0),pt(b,`valueId: ${t} | null`),Ct("valueId"))}return q(De,`{${H}, ${H}ById, children}: `+Y+" & {readonly children: React.ReactNode}",["{",lt,"return (","<Context."+De,"value={useMemo(",`() => [${H} ?? contextValue[0], {...contextValue[1], ...${H}ById}],`,`[${H}, ${H}ById, contextValue],`,")}>","{children}",`</Context.${De}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[I(...k(0),...S(),...K(0)),I(...k(1),...P(),...K(1))]},mt=(e,l,t)=>{if(le(e)&&le(l))return[a,a,a,a];const[n,d,o,s]=_l(e,l,t);return[n,d,...ht(e,l,t,o,s)]},gt=JSON.parse,ft="prettier/",wt=ft+"plugins/",Tt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},yt=Jl((e=>{const l=()=>{const l=gt(e.getTablesSchemaJson());return!le(l)||j(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=oe();if(j(a,(l=>j(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=ce(n,a,(()=>[L(d),oe(),[0],0])),[s,r,[I]]=o,$=ce(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),$e(r,d,$),o[3]++,s==L(d)})))))return l[t]={},ne(n,(([e,,[,n],d],o)=>{l[t][o]={[r]:e,...d==N(a)?{[I]:n}:{}}})),1}))?l:{}},t=()=>{const l=gt(e.getValuesSchemaJson());return le(l)&&e.forEachValue(((e,t)=>{l[e]={[r]:L(t)}})),l},a=e=>mt(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(ft+"standalone")).format,W(t,await import(wt+"estree"),await import(wt+"typescript"))}catch{n=async e=>e}return await D(J(a(e),(async(e,a)=>Ol(await n(e,{...Tt,plugins:t,filepath:"_."+l[a]})))))};return X({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:N(e.getValueIds()),jsonLength:N(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=yt},"object"==typeof exports&&"undefined"!=typeof module?l(exports):"function"==typeof define&&define.amd?define(["exports"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
1
|
+
var e,l;e=this,l=function(e){"use strict";const l=e=>typeof e,t="tinybase",a="",n=",",d=l(a),o=l(!0),s=l(0),r="type",I="default",$="Listener",c="get",u="add",i="Has",b="Ids",p="Table",C=p+"s",h=p+b,m="Row",g=m+b,f="Sorted"+m+b,w="Cell",T=w+b,y="Value",v=y+"s",x=y+b,V="Transaction",R="Partial",A=(e,l=a,t)=>e.split(l,t),k=Promise,S=isFinite,P=e=>null==e,O=(e,l,t)=>P(e)?t?.():l(e),E=e=>e==d||e==o,N=e=>l(e)==d,D=e=>Array.isArray(e),L=(e,l,t)=>e.slice(l,t),j=e=>e.length,G=async e=>k.all(e),H=e=>{const t=l(e);return E(t)||t==s&&S(e)?t:void 0},M=(e,l)=>e.every(l),J=(e,l)=>e.sort(l),z=(e,l)=>e.forEach(l),W=(e,l=a)=>e.join(l),B=(e,l)=>e.map(l),F=(e,l)=>e.filter(l),U=(e,...l)=>e.push(...l),_=e=>e.pop(),Z=(e,...l)=>e.unshift(...l),Q=e=>e.shift(),q=Object,K=e=>q.getPrototypeOf(e),X=q.entries,Y=e=>!P(e)&&O(K(e),(e=>e==q.prototype||P(K(e))),(()=>!0)),ee=q.keys,le=q.freeze,te=(e,l)=>B(X(e),(([e,t])=>l(t,e))),ae=e=>j(ee(e)),ne=e=>Y(e)&&0==ae(e),de=(e,l)=>e?.has(l)??!1,oe=e=>[...e?.values()??[]],se=(e,l)=>e?.forEach(l),re=(e,l)=>e?.delete(l),Ie=e=>new Map(e),$e=(e,l)=>e?.get(l),ce=(e,l)=>se(e,((e,t)=>l(t,e))),ue=(e,l)=>B([...e?.entries()??[]],(([e,t])=>l(t,e))),ie=(e,l,t)=>P(t)?(re(e,l),e):e?.set(l,t),be=(e,l,t,a)=>(de(e,l)||ie(e,l,t()),$e(e,l)),pe=e=>e.toUpperCase(),Ce=e=>e.toLowerCase(),he="a ",me="A function for",ge=", and registers a listener so that any changes to that result will cause a re-render",fe="Callback",we="Changes",Te="Count",ye="Del",ve="Deps",xe=ve+"?: React.DependencyList",Ve="doRollback?: DoRollback",Re="actions: () => Return, "+Ve,Ae="export",ke="Id",Se="Invalid",Pe="Json",Oe=Ce($),Ee="?: ",Ne=" | undefined",De="NonNullable",Le="Props",je="Provider",Ge=`Registers a ${Oe} that will be called`,He="Represents",Me="rowId: "+ke,Je="Schema",ze="Set",We=", descending?: boolean, offset?: number, limit?: number",Be="[]",Fe="the Store",Ue=Ce(V),_e="Execute a "+Ue+" to make multiple mutations",Ze="Explicitly starts a "+Ue,Qe="Explicitly finishes a "+Ue,qe="the end of the "+Ue,Ke="void",Xe=" => "+Ke,Ye="WhenSet",el=" when setting it",ll=he+"string serialization of",tl=" ",al="Gets a callback that can ",nl="the ",dl=" the schema for",ol=(e=0)=>e?"the existence of ":"",sl=(e=0,l=0,t=0)=>ol(t)+`the ${xl[e]}content of`+(l?tl+Fe:a),rl=(e=0,l,t=0,n=0)=>Tl[l]+tl+ol(n)+sl(e,1)+(t?" when setting it":a),Il=(e,l=0)=>He+` a Row when ${l?"s":"g"}etting ${sl()} the '${e}' `+p,$l=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,cl=(e,l)=>`Calls a function for each ${e} in `+l,ul=e=>"The props passed to a component that renders "+e,il=e=>"A function that takes "+e,bl=(e,l=0,t=0)=>me+" listening to changes to "+ol(t)+vl[e]+" in "+vl[l],pl=(e,l,t=0,n=0)=>Ge+" whenever "+ol(n)+vl[e]+" in "+vl[l]+" change"+(t?a:"s"),Cl=e=>`the '${e}' `+p,hl=e=>"the specified Row in "+Cl(e),ml=(e,l=0,t=0)=>Tl[l]+tl+sl(0,0,t)+tl+Cl(e),gl=(e,l=0,t=0)=>Tl[l]+` ${sl(0,0,t)} `+hl(e),fl=(e,l,t=0,a=0)=>Tl[t]+tl+ol(a)+`the '${l}' Cell for `+hl(e),wl=(e,l=0,t=0)=>Tl[l]+tl+ol(t)+`the '${e}' Value`,Tl=["Gets","Checks existence of","Sets","Deletes","Sets part of",He,"Gets "+ll,"Sets "+ll,Ge+" whenever",al+"set",al+"add",al+"set part of",al+"delete","Renders","Gets "+ll+dl,"Sets"+dl,"Deletes"+dl],yl=[c,"has","set","del","set","forEach",u,a],vl=[Fe,C,nl+p+tl+b,he+p,nl+m+tl+b,he+m,nl+w+tl+b,he+w,"invalid Cell changes",v,nl+y+tl+b,he+y,"invalid Value changes",nl+"sorted "+m+tl+b,nl+w+tl+b+" anywhere",nl+"number of Rows",he+w+" anywhere"],xl=[a,"tabular ","keyed value "],Vl=e=>new Set(D(e)||P(e)?e:[e]),Rl=(e,l)=>e?.add(l),Al=/[^A-Za-z]+/,kl=/[^A-Za-z0-9]+/,Sl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Pl=e=>e.includes(n),Ol=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return de(e,n)?Ol(e,l,t,a+1):(ie(e,n,t),n)},El=e=>e.replace(Sl,((e,l,t)=>{const a=77-j(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),Nl=e=>e.flat(1e3),Dl=(e,l=0)=>W(B(A(e,kl),((e,t)=>(t>0||l?pe:Ce)(L(e,0,1))+L(e,1)))),Ll=e=>pe(W(A(e&&!Al.test(e[0])?e:" "+e,kl),"_")),jl=e=>`/** ${e}. */`,Gl=(...e)=>W(F(e,(e=>e)),", "),Hl=(...e)=>"{"+W(e,"; ")+"}",Ml=(...e)=>Hl(...B(e,(e=>"readonly "+e))),Jl=()=>{const e=[Ie(),Ie(),Ie(),Ie()],l=Ie(),t=Ie(),n=e=>{const l=e.indexOf(" as ");return-1!=l?L(e,l+4):e};return[(...e)=>W(Nl(e),"\n"),(l,t,...a)=>z(a,(a=>z([0,1],(n=>(l??n)==n?Rl(be(e[n],t,Vl),a):0)))),(e,t,n,d=a,o=1)=>Ol(l,e,[t,n,d,o]),(e,l,a)=>Ol(t,e,D(a)?[`(${l}) => {`,a,"}"]:[`(${l}) => ${a}`]),(e,l)=>$e(t,e)===l?e:Ol(t,e,l),(l=0)=>B([...J(ue(e[l],((e,l)=>`import {${W(J(oe(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Pl(e)!=Pl(l)?Pl(e)?-1:1:e>l?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ue(l,(([e,l,t,n],d)=>[jl(l),`${n?Ae+" ":a}type ${d}${t} = ${e};`,a])),()=>ue(t,((e,l)=>(e=D(e)?e:[e],U(e,_(e)+";"),[`const ${l} = ${Q(e)}`,e,a])))]},zl=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Wl=(e,l,t)=>[l=>te(e,((e,a)=>l(a,Dl(a,1),t(Ll(a),`'${a}'`)))),(l,a)=>te(e[l],((e,l)=>a(l,e[r],e[I],t(Ll(l),`'${l}'`),Dl(l,1)))),e=>te(l,((l,a)=>e(a,l[r],l[I],t(Ll(a),`'${a}'`),Dl(a,1))))],Bl=(e,l,t,n)=>[(n,d)=>{const o=n+": "+d,s=e(C,Hl(...l((e=>`'${e}'?: {[rowId: Id]: `+Hl(...t(e,((e,l,t)=>`'${e}'${P(t)?"?":a}: ${l}`)))+"}"))),rl(1,5)),r=e(C+Ye,Hl(...l((e=>`'${e}'?: {[rowId: Id]: `+Hl(...t(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),rl(1,5,1)),I=e(p+ke,"keyof "+s,"A "+p+" Id in "+Fe),c=`<TId extends ${I}>`,u=e(p,De+`<${s}[TId]>`,"A "+p+" in "+Fe,c),b=e(p+Ye,De+`<${r}[TId]>`,"A "+p+" in "+Fe+el,c),y=e(m,u+"<TId>[Id]","A "+m+" in a "+p,c),v=e(m+Ye,b+"<TId>[Id]","A "+m+" in a "+p+el,c),x=e(w+ke,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+m,c),V=e(w,De+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+m,`<TId extends ${I}, CId extends ${x}<TId>>`),R=e("CellIdCellArray",`CId extends ${x}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,w+" Ids and types in a "+m,`<TId extends ${I}, CId = ${x}<TId>>`,0),A=e(w+fe,`(...[cellId, cell]: ${R}<TId>)`+Xe,il(he+w+" Id, and "+w),c),k=e(m+fe,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Xe+") "+Xe,il(he+m+" Id, and a "+w+" iterator"),c),S=e(p+w+fe,`(cellId: ${x}<TId>, count: number) `+Xe,il(he+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Xe}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),E=e(p+fe,`(...[tableId, forEachRow]: ${O})`+Xe,il(he+p+" Id, and a "+m+" iterator"),a),N=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${x}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,me+" returning information about any Cell's changes during a "+Ue),L=e(i+C+$,`(${o}, hasTables: boolean)`+Xe,bl(1,0,1)),j=e(C+$,`(${o}, getCellChange: ${D}${Ne})`+Xe,bl(1)),G=e(h+$,`(${o})`+Xe,bl(2)),H=e(i+p+$,`(${o}, tableId: ${I}, hasTable: boolean)`+Xe,bl(3,0,1)),M=e(p+$,`(${o}, tableId: ${I}, getCellChange: ${D}${Ne})`+Xe,bl(3)),J=e(p+T+$,`(${o}, tableId: ${I})`+Xe,bl(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${I} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${I}>`,0),B=e(i+p+w+$,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Xe,bl(16,3,1)),F=e(m+"Count"+$,`(${o}, tableId: ${I})`+Xe,bl(15,3)),U=e(g+$,`(${o}, tableId: ${I})`+Xe,bl(4,3)),_=e(f+$,"("+Gl(o,"tableId: "+I,"cellId: Id"+Ne,"descending: boolean","offset: number","limit: number"+Ne,"sortedRowIds: Ids")+")"+Xe,bl(13,3)),Z=e(i+m+$,"("+Gl(""+o,"tableId: "+I,Me,"hasRow: boolean")+")"+Xe,bl(5,3,1)),Q=e(m+$,"("+Gl(""+o,"tableId: "+I,Me,`getCellChange: ${D}${Ne}`)+")"+Xe,bl(5,3)),q=e(T+$,"("+Gl(""+o,"tableId: "+I,Me)+")"+Xe,bl(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Me}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${I} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${I}>`,0),Y=e(i+w+$,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Xe,bl(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Me}, cellId: CId, newCell: ${V}<TId, CId> ${Ne}, oldCell: ${V}<TId, CId> ${Ne}, getCellChange: ${D} ${Ne}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[s,r,I,u,b,y,v,x,V,A,k,S,E,L,j,G,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+$,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Xe,bl(7,5)),e(Se+w+$,`(${o}, tableId: Id, ${Me}, cellId: Id, invalidCells: any[])`+Xe,bl(8))]},(l,t)=>{const d=l+": "+t,o=e(v,Hl(...n(((e,l,t)=>`'${e}'${P(t)?"?":a}: ${l}`))),rl(2,5)),s=e(v+Ye,Hl(...n(((e,l)=>`'${e}'?: ${l}`))),rl(2,5,1)),r=e(y+ke,"keyof "+o,"A "+y+" Id in "+Fe),I=e(y,De+`<${o}[VId]>`,"A "+y+" Id in "+Fe,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+Fe,`<VId = ${r}>`,0),u=e(y+fe,`(...[valueId, value]: ${c})`+Xe,il(he+y+" Id, and "+y)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,me+" returning information about any Value's changes during a "+Ue),p=e(i+v+$,`(${d}, hasValues: boolean)`+Xe,bl(9,0,1)),C=e(v+$,`(${d}, getValueChange: ${b}${Ne})`+Xe,bl(9)),h=e(x+$,`(${d})`+Xe,bl(10)),m=e(i+y+$,`(${d}, valueId: ValueId, hasValue: boolean)`+Xe,bl(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${I}<VId> ${Ne}, oldValue: ${I}<VId> ${Ne}, getValueChange: ${b} ${Ne}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,I,u,p,C,h,m,e(y+$,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+Xe,bl(11)),e(Se+y+$,`(${d}, valueId: Id, invalidValues: any[])`+Xe,bl(12))]},(l,t)=>e(V+$,`(${l}: ${t})`+Xe,me+" listening to the completion of a "+Ue)],Fl=(e,l=a,t=a)=>`store.${e}(${l})`+(t?" as "+t:a),Ul=(e,l=a)=>`fluent(() => ${Fl(e,l)})`,_l=(e,l=a,t=a)=>`store.${e}(${l?l+", ":a}proxy(listener)${t?", "+t:a})`,Zl=(e,l,n)=>{const[d,s,c,A,k,S,O,E]=Jl(),[D,L,j]=Wl(e,l,k),[G,H,M]=Bl(c,D,L,j),J=Ie(),B=(e=0)=>ue(J,(([l,t,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${t} => ${n},`]:[s+o+`(${l}): ${t};`];return e||Z(r,jl(d)),U(r,a),r})),F=(e,l,t,n,d,o=a)=>Ol(J,e,[l,t,n,d,o]),_=(e,l,t,n,d,o=a,s=a,r=a)=>F(yl[e]+l+(4==e?R:a)+t,o,n,(n==K?Ul:Fl)(yl[e]+(4==e?R:a)+t,s,e?void 0:n),d,r),Q=(e,l,t,n=a,d=a,o=1,s=a)=>F(u+e+$,(n?n+", ":a)+Oe+": "+l+(o?", mutator?: boolean":a),ke,_l(u+e+$,d,o?"mutator":a),t,s),q=`./${Dl(n)}.d`,K=Dl(n,1),X=Dl(K),Y=[],ee=Ie();let le=[],te=[];if(s(1,q,K,`create${K} as create${K}Decl`),ne(e))s(null,t,C);else{s(0,t,"CellChange"),s(null,t,b);const[e,l,n,d,$,u,y,v,x,V,R,A,S,O,E,j,H,M,J,B,F,Z,te,ae,ne,de,se,re,ce]=G(X,K),ue=Ie();D(((e,l)=>{const t=`<'${e}'>`,a=[c(l+p,d+t,He+` the '${e}' `+p),c(l+p+Ye,$+t,He+` the '${e}' `+p+el),c(l+m,u+t,Il(e)),c(l+m+Ye,y+t,Il(e,1)),c(l+w+ke,v+t,`A Cell Id for the '${e}' `+p),c(l+w+fe,V+t,il(`a Cell Id and value from a Row in the '${e}' `+p)),c(l+m+fe,R+t,il(`a Row Id from the '${e}' Table, and a Cell iterator`)),c(l+p+w+fe,A+t,il(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ie(ue,e,a),s(1,q,...a)})),s(1,q,e,l,n,v,S,O,E,j,H,M,J,B,F,Z,te,ae,ne,de,se,re,ce),le=[e,l,n,v,O,E,j,H,M,J,B,F,Z,te,ae,ne,de,se,re,ue],z([[e],[o],[K,"tables: "+l,"tables"],[K]],(([e,l,t],n)=>_(n,a,C,e,rl(1,n),l,t))),_(0,a,h,n+Be,$l(p,Fe)),_(5,a,p,Ke,cl(p,Fe),"tableCallback: "+S,"tableCallback as any"),D(((e,l,t)=>{const[n,d,s,r,I,$,c,u]=$e(ue,e);z([[n],[o],[K,"table: "+d,", table"],[K]],(([n,d,o=a],s)=>_(s,l,p,n,ml(e,s),d,t+o))),_(0,l,p+T,b,$l(w,"the whole of "+Cl(e)),a,t),_(5,l,p+w,Ke,cl(p+w,"the whole of "+Cl(e)),"tableCellCallback: "+u,t+", tableCellCallback as any"),_(0,l,m+Te,"number","Gets the number of Rows in the "+Cl(e),a,t),_(0,l,g,b,$l(m,Cl(e)),a,t),_(0,l,f,b,$l(m,Cl(e),1),"cellId?: "+I+We,t+", cellId, descending, offset, limit"),_(5,l,m,Ke,cl(m,Cl(e)),"rowCallback: "+c,t+", rowCallback as any"),z([[s],[o],[K,", row: "+r,", row"],[K],[K,", partialRow: "+r,", partialRow"]],(([n,d=a,o=a],s)=>_(s,l,m,n,gl(e,s),Me+d,t+", rowId"+o))),_(6,l,m,ke+Ne,"Add a new Row to "+Cl(e),"row: "+r+", reuseIds?: boolean",t+", row, reuseIds"),_(0,l,T,I+Be,$l(w,hl(e)),Me,t+", rowId"),_(5,l,w,Ke,cl(w,hl(e)),Me+", cellCallback: "+$,t+", rowId, cellCallback as any"),L(e,((n,d,s,r,I)=>{const $="Map"+Dl(d,1);ie(ee,d,$);const c=d+(P(s)?Ne:a);z([[c],[o],[K,`, cell: ${d} | `+$,", cell as any"],[K]],(([d,o=a,s=a],$)=>_($,l+I,w,d,fl(e,n,$),Me+o,t+", rowId, "+r+s))),_(1,l+I,p+w,o,Tl[1]+` the '${n}' Cell anywhere in `+Cl(e),a,t+", "+r)}))})),_(0,a,C+Pe,Pe,rl(1,6)),_(2,a,C+Pe,K,rl(1,7),"tablesJson: "+Pe,"tables"+Pe),Q(i+C,O,rl(1,8,0,1)+" changes"),Q(C,E,rl(1,8)+" changes"),Q(h,j,pl(2,0,1)),Q(i+p,H,pl(3,0,0,1),`tableId: ${n} | null`,"tableId"),Q(p,M,pl(3,0),`tableId: ${n} | null`,"tableId"),Q(p+T,J,pl(14,3,1),`tableId: ${n} | null`,"tableId"),Q(i+p+w,B,pl(16,3,0,1),`tableId: ${n} | null, cellId: ${W(D((e=>$e(ue,e)?.[4]??a))," | ")} | null`,"tableId, cellId"),Q(m+Te,F,pl(15,3),`tableId: ${n} | null`,"tableId"),Q(g,Z,pl(4,3,1),`tableId: ${n} | null`,"tableId"),Q(f,te,pl(13,3,1),Gl("tableId: TId",`cellId: ${v}<TId>`+Ne,"descending: boolean","offset: number","limit: number"+Ne),Gl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),Q(i+m,ae,pl(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(m,ne,pl(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(T,de,pl(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(i+w,se,pl(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${W(D((e=>$e(ue,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),Q(w,re,pl(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${W(D((e=>$e(ue,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),Q(Se+w,ce,Ge+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),s(1,q,...oe(ee)),U(Y,".set"+C+Je+"({",Nl(D(((e,l,t)=>[`[${t}]: {`,...L(e,((e,l,t,n)=>`[${n}]: {[${k(Ll(r),`'${r}'`)}]: ${k(Ll(l),`'${l}'`)}${P(t)?a:`, [${k(Ll(I),`'${I}'`)}]: `+(N(t)?k(Ll(t),`'${t}'`):t)}},`)),"},"]))),"})")}if(ne(l))s(null,t,v);else{const[e,l,n,d,$,c,u,b,p,C,h]=H(X,K);s(1,q,e,l,n,$,c,u,b,p,C,h),te=[e,l,n,c,u,b,p,C],z([[e],[o],[K,"values: "+l,"values"],[K],[K,"partialValues: "+l,"partialValues"]],(([e,l,t],n)=>_(n,a,v,e,rl(2,n),l,t))),_(0,a,x,n+Be,$l(y,Fe)),_(5,a,y,"void",cl(y,Fe),"valueCallback: "+$,"valueCallback as any"),j(((e,l,t,n,d)=>{const s="Map"+Dl(l,1);ie(ee,l,s),z([[l],[o],[K,`value: ${l} | `+s,", value as any"],[K]],(([l,t,o=a],s)=>_(s,d,y,l,wl(e,s),t,n+o)))})),_(0,a,v+Pe,Pe,rl(2,6)),_(2,a,v+Pe,K,rl(2,7),"valuesJson: "+Pe,"values"+Pe),Q(i+v,c,rl(2,8,0,1)+" changes"),Q(v,u,rl(2,8)+" changes"),Q(x,b,pl(10,0,1)),Q(i+y,p,pl(11,0,0,1),`valueId: ${n} | null`,"valueId"),Q(y,C,pl(11,0),`valueId: ${n} | null`,"valueId"),Q(Se+y,h,Ge+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),s(1,q,...oe(ee)),s(0,t,"ValueChange"),U(Y,".set"+v+Je+"({",j(((e,l,t,n)=>[`[${n}]: {[${k(Ll(r),`'${r}'`)}]: ${k(Ll(l),`'${l}'`)}${P(t)?a:`, [${k(Ll(I),`'${I}'`)}]: `+(N(t)?k(Ll(t),`'${t}'`):t)}},`])),"})")}_(0,a,"Content",`[${C}, ${v}]`,rl(0,0)),_(2,a,"Content",K,rl(0,2),`[tables, values]: [${C}, ${v}]`,"[tables, values]"),_(7,a,"applyChanges",K,`Applies a set of ${we} to the Store`,"changes: "+we,"changes"),ce(ee,((e,l)=>c(l,`(cell: ${e}${Ne}) => `+e,`Takes a ${e} Cell value and returns another`))),s(null,t,"DoRollback",ke,"IdOrNull",Pe,"Store",we),_(0,a,Pe,Pe,rl(0,6)),_(2,a,Pe,K,rl(0,7),"tablesAndValuesJson: "+Pe,"tablesAndValuesJson"),_(7,a,Ue,"Return",_e,Re,"actions, doRollback","<Return>"),_(7,a,"start"+V,K,Ze),_(7,a,"finish"+V,K,Qe,Ve,"doRollback");const ae=M(X,K);return Q("Start"+V,ae,Ge+" just before the start of the "+Ue,a,a,0),Q("WillFinish"+V,ae,Ge+" just before "+qe,a,a,0),Q("DidFinish"+V,ae,Ge+" just after "+qe,a,a,0),_(7,a,"call"+$,K,"Manually provoke a listener to be called","listenerId: Id","listenerId"),_(3,a,$,K,"Remove a listener that was previously added to "+Fe,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",Tl[0]+" the underlying Store object"),s(1,t,"createStore"),s(1,q,K,`create${K} as create${K}Decl`,ae),k("store",["createStore()",...Y]),A("fluent","actions: () => Store",["actions();",`return ${X};`]),A("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${X}, ...params)`),k(X,["{",...B(1),"}"]),[d(...S(0),...O(),Ae+" interface "+K+" {",...B(0),"}",a,jl(`Creates a ${K} object`),Ae+" function create"+K+"(): "+K+";"),d(...S(1),Ae+" const create"+K+": typeof create"+K+"Decl = () => {",...E(),`return Object.freeze(${X});`,"};"),le,te]},Ql=e=>c+e,ql=e=>Gl(Ql(e),Ql(e)+ve),Kl="debugIds?: boolean",Xl="debugIds={debugIds}",Yl="then"+xe,et="Parameter",lt=": (parameter: "+et+", store: Store) => ",tt="const contextValue = useContext(Context);",at=", based on a parameter",nt=": ",dt="<"+et+",>",ot=et+"ized"+fe+"<"+et+">",st="rowId",rt="rowId={rowId}",It=", separator, debugIds",$t="separator?: ReactElement | string",ct="then?: (store: Store",ut=Gl(ct+")"+Xe,Yl),it="then, then"+ve,bt=st+nt+ke,pt="View",Ct=(e,...l)=>Gl(...l,Oe+": "+e,Oe+xe,"mutator?: boolean"),ht=(...e)=>Gl(...e,Oe,Oe+ve,"mutator"),mt=(e,l,n,d,r)=>{const[I,c,u,V,A,k,S,O]=Jl(),[E,N,D]=Wl(e,l,A),L=`./${Dl(n)}.d`,j=`./${Dl(n)}-ui-react.d`,G="tinybase/ui-react",H=Dl(n,1),M=Dl(H),J=H+"Or"+H+ke,z=M+"Or"+H+ke,B=M+`={${M}}`,F=Ie(),_=(e,l,t,n,d,o=a)=>(c(1,j,e+" as "+e+"Decl"),Ol(F,e,[l,t,n,d,o])),Q=(e,l,t,n,d,o=a)=>_("use"+e,l,t,n,d,o),q=(e,l,t,n,d=a,o=a,s=a,r=a,I=a)=>(c(1,G,`use${l} as use${l}Core`),Q(e,Gl(d,le,r),t,ae+`(${z}, use${l}Core, [`+(o||a)+(I?"], ["+I:a)+"]);",n,s)),K=(e,l,t,a)=>_(e,l,1,t,a),X=(e=0)=>ue(F,(([l,t,n,d,o],s)=>{const r=e?[Ae+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==t?"any":t} =>`,n]:[Ae+` function ${s}${o}(${l}): ${1==t?"ComponentReturnType":t};`];return e||Z(r,jl(d)),U(r,a),r}));c(null,t,ke,"Store",fe,et+"ized"+fe),c(0,G,"ComponentReturnType"),c(1,G,"useCellIds"),c(null,G,"ExtraProps"),c(0,L,H);const Y=u(J,H+" | "+ke,`Used when you need to refer to a ${H} in a React hook or component`),ee=u(je+Le,Ml(M+Ee+H,M+`ById?: {[${M}Id: Id]: ${H}}`),`Used with the ${je} component, so that a `+H+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,j,Y,ee);const le=z+Ee+Y;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${H}?, {[${M}Id: Id]: ${H}}?]>([])`),Q("Create"+H,`create: () => ${H}, create`+xe,H,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${H} within a React application with convenient memoization`);const te=Q(H,"id?: Id",H+Ne,["{",tt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${H} from within a ${je} component context`),ae=V("useHook",z+`: ${Y} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${M} : ${z})?.getStore(), ...postParams)`]),de=V("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=V("wrap",Gl("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;"]),se=V("useCustomOrDefaultCellIds",Gl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${z}?: ${Y} | undefined`),[`const defaultCellIds = ${ae}(${z}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),re=A("NullComponent","() => null");if(!ne(e)){const[e,l,n,r,I,y,v,x,A,k,S,O,D,G,J,z,F,U,_,Z]=d;c(null,L,e,l,n,I,y,v,x,A,k,S,O,D,G,J,z,F,_,U),c(0,L,r),c(1,L,H),c(null,t,b,"IdOrNull");const Q=V("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+It+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+de+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",rt,"customCellIds={customCellIds}",B,Xl,"/>","))",It,", tableId,",");"]),X=V("getDefaultTableComponent","tableId: Id",W(E(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+re),Y=V("getDefaultCellComponent","tableId: Id, cellId: Id",W(E(((e,l,t)=>`tableId == ${t} ? ${W(N(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+re} : `)))+re);q(i+C,i+C,o,rl(1,0,0,1)+ge),q(C,C,e,rl(1,0)+ge);const ee=q(h,h,n+Be,$l(p,Fe)+ge);q(ze+C+fe,ze+C+fe,ot,rl(1,9)+at,Gl(Ql(C)+lt+l,Ql(C)+xe),ql(C),dt,Gl(ct,`tables: ${l})`+Xe,Yl),it),q(ye+C+fe,ye+C+fe,fe,rl(1,12),a,a,a,ut,it);const le=u(w+Le,Ml("tableId?: TId","rowId: Id","cellId?: CId",M+Ee+H,Kl),ul(he+w),`<TId extends ${n}, CId extends ${r}<TId>>`),te=u(m+Le,Ml("tableId?: TId","rowId: Id",M+Ee+H,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${le}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,$t,Kl),ul(he+m),`<TId extends ${n}>`),ae=u(p+Le,Ml("tableId?: TId",M+Ee+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",$t,Kl),ul(he+p),`<TId extends ${n}>`),ne=u("Sorted"+p+Le,Ml("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+Ee+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",$t,Kl),ul(he+"sorted "+p),`<TId extends ${n}>`),Ie=u(C+Le,Ml(M+Ee+H,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${ae}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,$t,Kl),ul(sl(1,1)));c(1,j,Ie,ae,ne,te,le),K(C+pt,"{"+M+", tableComponents, getTableComponentProps"+It+"}: "+Ie,[oe+`(${ee}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+X+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${de}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",B,Xl,"/>;","}), separator)"],rl(1,13)+ge),E(((e,l,t)=>{const[n,d,r,I,$]=$e(Z,e);c(null,L,n,d,r,I,$),q(i+l+p,i+p,o,ml(e,0,1)+ge,a,t),q(l+p,p,n,ml(e)+ge,a,t),q(l+p+T,p+T,b,$l(w,"the whole of "+Cl(e))+ge,a,t),q(l+m+Te,m+Te,s,"Gets the number of Rows in "+Cl(e)+ge,a,t);const u=q(l+g,g,b,$l(m,Cl(e))+ge,a,t),C=q(l+f,f,b,$l(m,Cl(e),1)+ge,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",t+", cellId, descending, offset, limit");q(i+l+m,i+m,o,gl(e,0,1)+ge,bt,Gl(t,st)),q(l+m,m,r,gl(e)+ge,bt,Gl(t,st)),q(l+T,T,$+Be,$l(w,hl(e))+ge,bt,Gl(t,st)),q(ze+l+p+fe,ze+p+fe,ot,ml(e,9)+at,Gl(Ql(p)+lt+d,Ql(p)+xe),Gl(t,ql(p)),dt,Gl(ct,`table: ${d})`+Xe,Yl),it),q(ye+l+p+fe,ye+p+fe,fe,ml(e,12),a,t,a,ut,it),q(ze+l+m+fe,ze+m+fe,ot,gl(e,9)+at,Gl(bt,Ql(m)+lt+I,Ql(m)+xe),Gl(t,st,ql(m)),dt,Gl(ct,`row: ${I})`+Xe,Yl),it),q("Add"+l+m+fe,"Add"+m+fe,ot,gl(e,10)+at,Gl(Ql(m)+lt+I,Ql(m)+xe),Gl(t,ql(m)),dt,"then?: ("+Gl(bt+Ne,"store: Store","row: "+I+")"+Xe,"then"+xe)+", reuseRowIds?: boolean",it+", reuseRowIds"),q(ze+l+R+m+fe,ze+R+m+fe,ot,gl(e,11)+at,Gl(bt,Ql(R+m)+lt+I,Ql(R+m)+xe),Gl(t,st,ql(R+m)),dt,Gl(ct,`partialRow: ${I})`+Xe,Yl),it),q(ye+l+m+fe,ye+m+fe,fe,gl(e,12),bt,Gl(t,st),a,ut,it);const h=K(l+m+pt,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+It+`}: ${te}<'${e}'>`,[oe+`(${se}(customCellIds, `+t+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+Y+`(${t}, cellId)) as React.ComponentType<CellProps<typeof `+t+", typeof cellId>>;","return <Cell",`{...${de}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${t}}`,rt,"cellId={cellId}",B,Xl,"/>;","})"+It+", rowId)"],gl(e,13)+ge);K(l+"Sorted"+p+pt,"{cellId, descending, offset, limit, ...props}: "+ne+`<'${e}'>`,Q+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${t}, ${h});`,ml(e,13)+", sorted"+ge),K(l+p+pt,`props: ${ae}<'${e}'>`,Q+"(props, "+u+`(props.${M}), ${t}, ${h});`,ml(e,13)+ge),N(e,((n,d,s,r,I)=>{const $="Map"+Dl(d,1);c(0,L,$),c(1,L,$),q(i+l+I+p+w,i+p+w,o,`Gets ${ol(1)}the '${n}' Cell anywhere in `+Cl(e)+ge,a,Gl(t,r)),q(i+l+I+w,i+w,o,fl(e,n,0,1)+ge,bt,Gl(t,st,r));const u=q(l+I+w,w,d+(P(s)?Ne:a),fl(e,n)+ge,bt,Gl(t,st,r));q(ze+l+I+w+fe,ze+w+fe,ot,fl(e,n,9)+at,Gl(bt,Ql(w)+lt+d+" | "+$,Ql(w)+xe),Gl(t,st,r,ql(w)),dt,Gl(ct,`cell: ${d} | ${$})`+Xe,Yl),it),q(ye+l+I+w+fe,ye+w+fe,fe,fl(e,n,12),Gl(bt,"forceDel?: boolean"),Gl(t,st,r,"forceDel"),a,ut,it),K(l+I+w+pt,`{rowId, ${M}, debugIds}: `+le+`<'${e}', '${n}'>`,[oe+`('' + ${u}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],fl(e,n,13)+ge)}))}));const ce=W(E((e=>$e(Z,e)?.[4]??a))," | ");q(i+C+$,i+C+$,Ke,rl(1,8,0,1)+" changes",Ct(I),ht()),q(C+$,C+$,Ke,rl(1,8)+" changes",Ct(y),ht()),q(h+$,h+$,Ke,pl(2,0,1),Ct(v),ht()),q(i+p+$,i+p+$,Ke,pl(3,0,0,1),Ct(x,`tableId: ${n} | null`),ht("tableId")),q(p+$,p+$,Ke,pl(3,0),Ct(A,`tableId: ${n} | null`),ht("tableId")),q(p+T+$,p+T+$,Ke,pl(14,3,1),Ct(k,`tableId: ${n} | null`),ht("tableId")),q(i+p+w+$,i+p+w+$,Ke,pl(16,3,0,1),Ct(S,`tableId: ${n} | null`,`cellId: ${ce} | null`),ht("tableId","cellId")),q(m+Te+$,m+Te+$,Ke,pl(15,3),Ct(O,`tableId: ${n} | null`),ht("tableId")),q(g+$,g+$,Ke,pl(4,3,1),Ct(D,`tableId: ${n} | null`),ht("tableId")),q(f+$,f+$,Ke,pl(13,3,1),Ct(G,`tableId: ${n} | null`,"cellId: "+ce+Ne,"descending: boolean","offset: number","limit: number"+Ne),ht("tableId","cellId","descending","offset","limit")),q(i+m+$,i+m+$,Ke,pl(5,3,0,1),Ct(J,`tableId: ${n} | null`,st+": IdOrNull"),ht("tableId",st)),q(m+$,m+$,Ke,pl(5,3),Ct(z,`tableId: ${n} | null`,st+": IdOrNull"),ht("tableId",st)),q(T+$,T+$,Ke,pl(6,5,1),Ct(F,`tableId: ${n} | null`,st+": IdOrNull"),ht("tableId",st)),q(i+w+$,i+w+$,Ke,pl(7,5,0,1),Ct(U,`tableId: ${n} | null`,st+": IdOrNull",`cellId: ${ce} | null`),ht("tableId",st,"cellId")),q(w+$,w+$,Ke,pl(7,5),Ct(_,`tableId: ${n} | null`,st+": IdOrNull",`cellId: ${ce} | null`),ht("tableId",st,"cellId"))}if(!ne(l)){const[e,l,t,n,d,s,I,b]=r;c(null,L,...r),c(1,L,H);const p=V("getDefaultValueComponent","valueId: Id",W(D(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+re);q(i+v,i+v,o,rl(2,0,0,1)+ge),q(v,v,e,rl(2,0)+ge);const C=q(x,x,t+Be,$l(y,Fe)+ge);q(ze+v+fe,ze+v+fe,ot,rl(2,9)+at,Gl(Ql(v)+lt+l,Ql(v)+xe),ql(v),dt,Gl(ct,`values: ${l})`+Xe,Yl),it),q(ze+R+v+fe,ze+R+v+fe,ot,rl(2,11)+at,Gl(Ql(R+v)+lt+l,Ql(R+v)+xe),ql(R+v),dt,Gl(ct,`partialValues: ${l})`+Xe,Yl),it),q(ye+v+fe,ye+v+fe,fe,rl(2,12),a,a,a,ut,it);const h=u(y+Le,Ml("valueId?: VId",M+Ee+H,Kl),ul("a Value"),`<VId extends ${t}>`),m=u(v+Le,Ml(M+Ee+H,"valueComponents?: {readonly [VId in "+t+`]?: ComponentType<${h}<VId>>;}`,`getValueComponentProps?: (valueId: ${t}) => ExtraProps`,$t,Kl),ul(sl(2,1)));c(1,j,m,h),K(v+pt,"{"+M+", valueComponents, getValueComponentProps"+It+"}: "+m,[oe+`(${C}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+p+"(valueId);","return <Value",`{...${de}(getValueComponentProps, valueId)}`,"key={valueId}",B,Xl,"/>;","}), separator)"],rl(2,13)+ge),D(((e,l,t,n,d)=>{const s="Map"+Dl(l,1);c(0,L,s),c(1,L,s),q(i+d+y,i+y,o,wl(e,0,1)+ge,a,n);const r=q(d+y,y,l,wl(e)+ge,a,n);q(ze+d+y+fe,ze+y+fe,ot,wl(e,9)+at,Gl(Ql(y)+lt+l+" | "+s,Ql(y)+xe),Gl(n,ql(y)),dt,Gl(ct,`value: ${l} | ${s})`+Xe,Yl),it),q(ye+d+y+fe,ye+y+fe,fe,wl(e,12),a,n,a,ut,it),K(d+y+pt,`{${M}, debugIds}: ${h}<'${e}'>`,[oe+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],wl(e,13)+ge)})),q(i+v+$,i+v+$,Ke,rl(2,8,0,1)+" changes",Ct(n),ht()),q(v+$,v+$,Ke,rl(2,8)+" changes",Ct(d),ht()),q(x+$,x+$,Ke,pl(10,0,1),Ct(s),ht()),q(i+y+$,i+y+$,Ke,pl(11,0,0,1),Ct(I,`valueId: ${t} | null`),ht("valueId")),q(y+$,y+$,Ke,pl(11,0),Ct(b,`valueId: ${t} | null`),ht("valueId"))}return K(je,`{${M}, ${M}ById, children}: `+ee+" & {readonly children: React.ReactNode}",["{",tt,"return (","<Context."+je,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${je}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[I(...k(0),...S(),...X(0)),I(...k(1),...O(),...X(1))]},gt=(e,l,t)=>{if(ne(e)&&ne(l))return[a,a,a,a];const[n,d,o,s]=Zl(e,l,t);return[n,d,...mt(e,l,t,o,s)]},ft=JSON.parse,wt="prettier/",Tt=wt+"plugins/",yt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},vt=zl((e=>{const l=()=>{const l=ft(e.getTablesSchemaJson());return!ne(l)||M(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=Ie();if(M(a,(l=>M(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=be(n,a,(()=>[H(d),Ie(),[0],0])),[s,r,[I]]=o,$=be(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),ie(r,d,$),o[3]++,s==H(d)})))))return l[t]={},se(n,(([e,,[,n],d],o)=>{l[t][o]={[r]:e,...d==j(a)?{[I]:n}:{}}})),1}))?l:{}},t=()=>{const l=ft(e.getValuesSchemaJson());return ne(l)&&e.forEachValue(((e,t)=>{l[e]={[r]:H(t)}})),l},a=e=>gt(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(wt+"standalone")).format,U(t,await import(Tt+"estree"),await import(Tt+"typescript"))}catch{n=async e=>e}return await G(B(a(e),(async(e,a)=>El(await n(e,{...yt,plugins:t,filepath:"_."+l[a]})))))};return le({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:j(e.getValueIds()),jsonLength:j(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=vt},"object"==typeof exports&&"undefined"!=typeof module?l(exports):"function"==typeof define&&define.amd?define(["exports"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,l;e=this,l=function(e){"use strict";const l=e=>typeof e,t="tinybase",a="",n=",",d=l(a),o=l(!0),s=l(0),r="type",I="default",$="Listener",c="get",u="add",i="Has",b="Ids",p="Table",C=p+"s",h=p+b,m="Row",g=m+b,f="Sorted"+m+b,w="Cell",T=w+b,y="Value",v=y+"s",x=y+b,V=Promise,R=isFinite,A=e=>null==e,k=(e,l,t)=>A(e)?t?.():l(e),S=e=>e==d||e==o,P=e=>l(e)==d,O=e=>Array.isArray(e),E=(e,l,t)=>e.slice(l,t),N=e=>e.length,D=async e=>V.all(e),L=e=>{const t=l(e);return S(t)||t==s&&R(e)?t:void 0},j=(e,l)=>e.every(l),G=(e,l)=>e.sort(l),H=(e,l)=>e.forEach(l),M=(e,l=a)=>e.join(l),J=(e,l)=>e.map(l),z=(e,l)=>e.filter(l),W=(e,...l)=>e.push(...l),B=e=>e.pop(),F=(e,...l)=>e.unshift(...l),U=e=>e.shift(),_=Object,Z=e=>_.getPrototypeOf(e),Q=_.entries,q=e=>!A(e)&&k(Z(e),(e=>e==_.prototype||A(Z(e))),(()=>!0)),K=_.keys,X=_.freeze,Y=(e,l)=>J(Q(e),(([e,t])=>l(t,e))),ee=e=>N(K(e)),le=e=>q(e)&&0==ee(e),te=(e,l)=>e?.has(l)??!1,ae=e=>[...e?.values()??[]],ne=(e,l)=>e?.forEach(l),de=(e,l)=>e?.delete(l),oe=e=>new Map(e),se=(e,l)=>e?.get(l),re=(e,l)=>ne(e,((e,t)=>l(t,e))),Ie=(e,l)=>J([...e?.entries()??[]],(([e,t])=>l(t,e))),$e=(e,l,t)=>A(t)?(de(e,l),e):e?.set(l,t),ce=(e,l,t,a)=>(te(e,l)||$e(e,l,t()),se(e,l)),ue=e=>e.toUpperCase(),ie=e=>e.toLowerCase(),be="a ",pe="A function for",Ce=", and registers a listener so that any changes to that result will cause a re-render",he="Callback",me="Changes",ge="Count",fe="Del",we="Deps",Te=we+"?: React.DependencyList",ye="doRollback?: DoRollback",ve="actions: () => Return, "+ye,xe="export",Ve="Id",Re="Invalid",Ae="Json",ke=ie($),Se="?: ",Pe=" | undefined",Oe="NonNullable",Ee="Partial",Ne="Props",De="Provider",Le=`Registers a ${ke} that will be called`,je="Represents",Ge="rowId: "+Ve,He="Schema",Me="Set",Je=", descending?: boolean, offset?: number, limit?: number",ze="[]",We="the Store",Be="Transaction",Fe=ie(Be),Ue="Execute a "+Fe+" to make multiple mutations",_e="Explicitly starts a "+Fe,Ze="Explicitly finishes a "+Fe,Qe="the end of the "+Fe,qe="void",Ke=" => "+qe,Xe="WhenSet",Ye=" when setting it",el=be+"string serialization of",ll=" ",tl="Gets a callback that can ",al="the ",nl=" the schema for",dl=(e=0)=>e?"the existence of ":"",ol=(e=0,l=0,t=0)=>dl(t)+`the ${vl[e]}content of`+(l?ll+We:a),sl=(e=0,l,t=0,n=0)=>wl[l]+ll+dl(n)+ol(e,1)+(t?" when setting it":a),rl=(e,l=0)=>je+` a Row when ${l?"s":"g"}etting ${ol()} the '${e}' `+p,Il=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,$l=(e,l)=>`Calls a function for each ${e} in `+l,cl=e=>"The props passed to a component that renders "+e,ul=e=>"A function that takes "+e,il=(e,l=0,t=0)=>pe+" listening to changes to "+dl(t)+yl[e]+" in "+yl[l],bl=(e,l,t=0,n=0)=>Le+" whenever "+dl(n)+yl[e]+" in "+yl[l]+" change"+(t?a:"s"),pl=e=>`the '${e}' `+p,Cl=e=>"the specified Row in "+pl(e),hl=(e,l=0,t=0)=>wl[l]+ll+ol(0,0,t)+ll+pl(e),ml=(e,l=0,t=0)=>wl[l]+` ${ol(0,0,t)} `+Cl(e),gl=(e,l,t=0,a=0)=>wl[t]+ll+dl(a)+`the '${l}' Cell for `+Cl(e),fl=(e,l=0,t=0)=>wl[l]+ll+dl(t)+`the '${e}' Value`,wl=["Gets","Checks existence of","Sets","Deletes","Sets part of",je,"Gets "+el,"Sets "+el,Le+" whenever",tl+"set",tl+"add",tl+"set part of",tl+"delete","Renders","Gets "+el+nl,"Sets"+nl,"Deletes"+nl],Tl=[c,"has","set","del","set","forEach",u,a],yl=[We,C,al+p+ll+b,be+p,al+m+ll+b,be+m,al+w+ll+b,be+w,"invalid Cell changes",v,al+y+ll+b,be+y,"invalid Value changes",al+"sorted "+m+ll+b,al+w+ll+b+" anywhere",al+"number of Rows",be+w+" anywhere"],vl=[a,"tabular ","keyed value "],xl=e=>new Set(O(e)||A(e)?e:[e]),Vl=(e,l)=>e?.add(l),Rl=/[^A-Za-z]+/,Al=/[^A-Za-z0-9]+/,kl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Sl=e=>e.includes(n),Pl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return te(e,n)?Pl(e,l,t,a+1):($e(e,n,t),n)},Ol=e=>e.replace(kl,((e,l,t)=>{const a=77-N(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),El=e=>e.flat(1e3),Nl=(e,l=0)=>M(J(e.split(Al),((e,t)=>(t>0||l?ue:ie)(E(e,0,1))+E(e,1)))),Dl=e=>ue(M((e&&!Rl.test(e[0])?e:" "+e).split(Al),"_")),Ll=e=>`/** ${e}. */`,jl=(...e)=>M(z(e,(e=>e)),", "),Gl=(...e)=>"{"+M(e,"; ")+"}",Hl=(...e)=>Gl(...J(e,(e=>"readonly "+e))),Ml=()=>{const e=[oe(),oe(),oe(),oe()],l=oe(),t=oe(),n=e=>{const l=e.indexOf(" as ");return-1!=l?E(e,l+4):e};return[(...e)=>M(El(e),"\n"),(l,t,...a)=>H(a,(a=>H([0,1],(n=>(l??n)==n?Vl(ce(e[n],t,xl),a):0)))),(e,t,n,d=a,o=1)=>Pl(l,e,[t,n,d,o]),(e,l,a)=>Pl(t,e,O(a)?[`(${l}) => {`,a,"}"]:[`(${l}) => ${a}`]),(e,l)=>se(t,e)===l?e:Pl(t,e,l),(l=0)=>J([...G(Ie(e[l],((e,l)=>`import {${M(G(ae(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Sl(e)!=Sl(l)?Sl(e)?-1:1:e>l?1:-1)),a],(e=>e.replace("{React}","React"))),()=>Ie(l,(([e,l,t,n],d)=>[Ll(l),`${n?xe+" ":a}type ${d}${t} = ${e};`,a])),()=>Ie(t,((e,l)=>(e=O(e)?e:[e],W(e,B(e)+";"),[`const ${l} = ${U(e)}`,e,a])))]},Jl=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},zl=(e,l,t)=>[l=>Y(e,((e,a)=>l(a,Nl(a,1),t(Dl(a),`'${a}'`)))),(l,a)=>Y(e[l],((e,l)=>a(l,e[r],e[I],t(Dl(l),`'${l}'`),Nl(l,1)))),e=>Y(l,((l,a)=>e(a,l[r],l[I],t(Dl(a),`'${a}'`),Nl(a,1))))],Wl=(e,l,t,n)=>[(n,d)=>{const o=n+": "+d,s=e(C,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...t(e,((e,l,t)=>`'${e}'${A(t)?"?":a}: ${l}`)))+"}"))),sl(1,5)),r=e(C+Xe,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...t(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),sl(1,5,1)),I=e(p+Ve,"keyof "+s,"A "+p+" Id in "+We),c=`<TId extends ${I}>`,u=e(p,Oe+`<${s}[TId]>`,"A "+p+" in "+We,c),b=e(p+Xe,Oe+`<${r}[TId]>`,"A "+p+" in "+We+Ye,c),y=e(m,u+"<TId>[Id]","A "+m+" in a "+p,c),v=e(m+Xe,b+"<TId>[Id]","A "+m+" in a "+p+Ye,c),x=e(w+Ve,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+m,c),V=e(w,Oe+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+m,`<TId extends ${I}, CId extends ${x}<TId>>`),R=e("CellIdCellArray",`CId extends ${x}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,w+" Ids and types in a "+m,`<TId extends ${I}, CId = ${x}<TId>>`,0),k=e(w+he,`(...[cellId, cell]: ${R}<TId>)`+Ke,ul(be+w+" Id, and "+w),c),S=e(m+he,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ke+") "+Ke,ul(be+m+" Id, and a "+w+" iterator"),c),P=e(p+w+he,`(cellId: ${x}<TId>, count: number) `+Ke,ul(be+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${Ke}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),E=e(p+he,`(...[tableId, forEachRow]: ${O})`+Ke,ul(be+p+" Id, and a "+m+" iterator"),a),N=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${x}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,pe+" returning information about any Cell's changes during a "+Fe),L=e(i+C+$,`(${o}, hasTables: boolean)`+Ke,il(1,0,1)),j=e(C+$,`(${o}, getCellChange: ${D}${Pe})`+Ke,il(1)),G=e(h+$,`(${o})`+Ke,il(2)),H=e(i+p+$,`(${o}, tableId: ${I}, hasTable: boolean)`+Ke,il(3,0,1)),M=e(p+$,`(${o}, tableId: ${I}, getCellChange: ${D}${Pe})`+Ke,il(3)),J=e(p+T+$,`(${o}, tableId: ${I})`+Ke,il(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${I} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${I}>`,0),B=e(i+p+w+$,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Ke,il(16,3,1)),F=e(m+"Count"+$,`(${o}, tableId: ${I})`+Ke,il(15,3)),U=e(g+$,`(${o}, tableId: ${I})`+Ke,il(4,3)),_=e(f+$,"("+jl(o,"tableId: "+I,"cellId: Id"+Pe,"descending: boolean","offset: number","limit: number"+Pe,"sortedRowIds: Ids")+")"+Ke,il(13,3)),Z=e(i+m+$,"("+jl(""+o,"tableId: "+I,Ge,"hasRow: boolean")+")"+Ke,il(5,3,1)),Q=e(m+$,"("+jl(""+o,"tableId: "+I,Ge,`getCellChange: ${D}${Pe}`)+")"+Ke,il(5,3)),q=e(T+$,"("+jl(""+o,"tableId: "+I,Ge)+")"+Ke,il(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${I} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${I}>`,0),Y=e(i+w+$,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Ke,il(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, newCell: ${V}<TId, CId> ${Pe}, oldCell: ${V}<TId, CId> ${Pe}, getCellChange: ${D} ${Pe}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[s,r,I,u,b,y,v,x,V,k,S,P,E,L,j,G,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+$,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Ke,il(7,5)),e(Re+w+$,`(${o}, tableId: Id, ${Ge}, cellId: Id, invalidCells: any[])`+Ke,il(8))]},(l,t)=>{const d=l+": "+t,o=e(v,Gl(...n(((e,l,t)=>`'${e}'${A(t)?"?":a}: ${l}`))),sl(2,5)),s=e(v+Xe,Gl(...n(((e,l)=>`'${e}'?: ${l}`))),sl(2,5,1)),r=e(y+Ve,"keyof "+o,"A "+y+" Id in "+We),I=e(y,Oe+`<${o}[VId]>`,"A "+y+" Id in "+We,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+We,`<VId = ${r}>`,0),u=e(y+he,`(...[valueId, value]: ${c})`+Ke,ul(be+y+" Id, and "+y)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,pe+" returning information about any Value's changes during a "+Fe),p=e(i+v+$,`(${d}, hasValues: boolean)`+Ke,il(9,0,1)),C=e(v+$,`(${d}, getValueChange: ${b}${Pe})`+Ke,il(9)),h=e(x+$,`(${d})`+Ke,il(10)),m=e(i+y+$,`(${d}, valueId: ValueId, hasValue: boolean)`+Ke,il(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${I}<VId> ${Pe}, oldValue: ${I}<VId> ${Pe}, getValueChange: ${b} ${Pe}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,I,u,p,C,h,m,e(y+$,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+Ke,il(11)),e(Re+y+$,`(${d}, valueId: Id, invalidValues: any[])`+Ke,il(12))]},(l,t)=>e(Be+$,`(${l}: ${t})`+Ke,pe+" listening to the completion of a "+Fe)],Bl=(e,l=a,t=a)=>`store.${e}(${l})`+(t?" as "+t:a),Fl=(e,l=a)=>`fluent(() => ${Bl(e,l)})`,Ul=(e,l=a,t=a)=>`store.${e}(${l?l+", ":a}proxy(listener)${t?", "+t:a})`,_l=(e,l,n)=>{const[d,s,c,V,R,k,S,O]=Ml(),[E,N,D]=zl(e,l,R),[L,j,G]=Wl(c,E,N,D),J=oe(),z=(e=0)=>Ie(J,(([l,t,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${t} => ${n},`]:[s+o+`(${l}): ${t};`];return e||F(r,Ll(d)),W(r,a),r})),B=(e,l,t,n,d,o=a)=>Pl(J,e,[l,t,n,d,o]),U=(e,l,t,n,d,o=a,s=a,r=a)=>B(Tl[e]+l+(4==e?Ee:a)+t,o,n,(n==Q?Fl:Bl)(Tl[e]+(4==e?Ee:a)+t,s,e?void 0:n),d,r),_=(e,l,t,n=a,d=a,o=1,s=a)=>B(u+e+$,(n?n+", ":a)+ke+": "+l+(o?", mutator?: boolean":a),Ve,Ul(u+e+$,d,o?"mutator":a),t,s),Z=`./${Nl(n)}.d`,Q=Nl(n,1),q=Nl(Q),K=[],X=oe();let Y=[],ee=[];if(s(1,Z,Q,`create${Q} as create${Q}Decl`),le(e))s(null,t,C);else{s(0,t,"CellChange"),s(null,t,b);const[e,l,n,d,$,u,y,v,x,V,k,S,O,D,j,G,J,z,B,F,ee,le,te,ne,de,re,Ie,ce,ue]=L(q,Q),ie=oe();E(((e,l)=>{const t=`<'${e}'>`,a=[c(l+p,d+t,je+` the '${e}' `+p),c(l+p+Xe,$+t,je+` the '${e}' `+p+Ye),c(l+m,u+t,rl(e)),c(l+m+Xe,y+t,rl(e,1)),c(l+w+Ve,v+t,`A Cell Id for the '${e}' `+p),c(l+w+he,V+t,ul(`a Cell Id and value from a Row in the '${e}' `+p)),c(l+m+he,k+t,ul(`a Row Id from the '${e}' Table, and a Cell iterator`)),c(l+p+w+he,S+t,ul(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];$e(ie,e,a),s(1,Z,...a)})),s(1,Z,e,l,n,v,O,D,j,G,J,z,B,F,ee,le,te,ne,de,re,Ie,ce,ue),Y=[e,l,n,v,D,j,G,J,z,B,F,ee,le,te,ne,de,re,Ie,ce,ie],H([[e],[o],[Q,"tables: "+l,"tables"],[Q]],(([e,l,t],n)=>U(n,a,C,e,sl(1,n),l,t))),U(0,a,h,n+ze,Il(p,We)),U(5,a,p,qe,$l(p,We),"tableCallback: "+O,"tableCallback as any"),E(((e,l,t)=>{const[n,d,s,r,I,$,c,u]=se(ie,e);H([[n],[o],[Q,"table: "+d,", table"],[Q]],(([n,d,o=a],s)=>U(s,l,p,n,hl(e,s),d,t+o))),U(0,l,p+T,b,Il(w,"the whole of "+pl(e)),a,t),U(5,l,p+w,qe,$l(p+w,"the whole of "+pl(e)),"tableCellCallback: "+u,t+", tableCellCallback as any"),U(0,l,m+ge,"number","Gets the number of Rows in the "+pl(e),a,t),U(0,l,g,b,Il(m,pl(e)),a,t),U(0,l,f,b,Il(m,pl(e),1),"cellId?: "+I+Je,t+", cellId, descending, offset, limit"),U(5,l,m,qe,$l(m,pl(e)),"rowCallback: "+c,t+", rowCallback as any"),H([[s],[o],[Q,", row: "+r,", row"],[Q],[Q,", partialRow: "+r,", partialRow"]],(([n,d=a,o=a],s)=>U(s,l,m,n,ml(e,s),Ge+d,t+", rowId"+o))),U(6,l,m,Ve+Pe,"Add a new Row to "+pl(e),"row: "+r+", reuseIds?: boolean",t+", row, reuseIds"),U(0,l,T,I+ze,Il(w,Cl(e)),Ge,t+", rowId"),U(5,l,w,qe,$l(w,Cl(e)),Ge+", cellCallback: "+$,t+", rowId, cellCallback as any"),N(e,((n,d,s,r,I)=>{const $="Map"+Nl(d,1);$e(X,d,$);const c=d+(A(s)?Pe:a);H([[c],[o],[Q,`, cell: ${d} | `+$,", cell as any"],[Q]],(([d,o=a,s=a],$)=>U($,l+I,w,d,gl(e,n,$),Ge+o,t+", rowId, "+r+s))),U(1,l+I,p+w,o,wl[1]+` the '${n}' Cell anywhere in `+pl(e),a,t+", "+r)}))})),U(0,a,C+Ae,Ae,sl(1,6)),U(2,a,C+Ae,Q,sl(1,7),"tablesJson: "+Ae,"tables"+Ae),_(i+C,D,sl(1,8,0,1)+" changes"),_(C,j,sl(1,8)+" changes"),_(h,G,bl(2,0,1)),_(i+p,J,bl(3,0,0,1),`tableId: ${n} | null`,"tableId"),_(p,z,bl(3,0),`tableId: ${n} | null`,"tableId"),_(p+T,B,bl(14,3,1),`tableId: ${n} | null`,"tableId"),_(i+p+w,F,bl(16,3,0,1),`tableId: ${n} | null, cellId: ${M(E((e=>se(ie,e)?.[4]??a))," | ")} | null`,"tableId, cellId"),_(m+ge,ee,bl(15,3),`tableId: ${n} | null`,"tableId"),_(g,le,bl(4,3,1),`tableId: ${n} | null`,"tableId"),_(f,te,bl(13,3,1),jl("tableId: TId",`cellId: ${v}<TId>`+Pe,"descending: boolean","offset: number","limit: number"+Pe),jl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(i+m,ne,bl(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(m,de,bl(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(T,re,bl(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(i+w,Ie,bl(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${M(E((e=>se(ie,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),_(w,ce,bl(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${M(E((e=>se(ie,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),_(Re+w,ue,Le+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),s(1,Z,...ae(X)),W(K,".set"+C+He+"({",El(E(((e,l,t)=>[`[${t}]: {`,...N(e,((e,l,t,n)=>`[${n}]: {[${R(Dl(r),`'${r}'`)}]: ${R(Dl(l),`'${l}'`)}${A(t)?a:`, [${R(Dl(I),`'${I}'`)}]: `+(P(t)?R(Dl(t),`'${t}'`):t)}},`)),"},"]))),"})")}if(le(l))s(null,t,v);else{const[e,l,n,d,$,c,u,b,p,C,h]=j(q,Q);s(1,Z,e,l,n,$,c,u,b,p,C,h),ee=[e,l,n,c,u,b,p,C],H([[e],[o],[Q,"values: "+l,"values"],[Q],[Q,"partialValues: "+l,"partialValues"]],(([e,l,t],n)=>U(n,a,v,e,sl(2,n),l,t))),U(0,a,x,n+ze,Il(y,We)),U(5,a,y,"void",$l(y,We),"valueCallback: "+$,"valueCallback as any"),D(((e,l,t,n,d)=>{const s="Map"+Nl(l,1);$e(X,l,s),H([[l],[o],[Q,`value: ${l} | `+s,", value as any"],[Q]],(([l,t,o=a],s)=>U(s,d,y,l,fl(e,s),t,n+o)))})),U(0,a,v+Ae,Ae,sl(2,6)),U(2,a,v+Ae,Q,sl(2,7),"valuesJson: "+Ae,"values"+Ae),_(i+v,c,sl(2,8,0,1)+" changes"),_(v,u,sl(2,8)+" changes"),_(x,b,bl(10,0,1)),_(i+y,p,bl(11,0,0,1),`valueId: ${n} | null`,"valueId"),_(y,C,bl(11,0),`valueId: ${n} | null`,"valueId"),_(Re+y,h,Le+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),s(1,Z,...ae(X)),s(0,t,"ValueChange"),W(K,".set"+v+He+"({",D(((e,l,t,n)=>[`[${n}]: {[${R(Dl(r),`'${r}'`)}]: ${R(Dl(l),`'${l}'`)}${A(t)?a:`, [${R(Dl(I),`'${I}'`)}]: `+(P(t)?R(Dl(t),`'${t}'`):t)}},`])),"})")}U(0,a,"Content",`[${C}, ${v}]`,sl(0,0)),U(2,a,"Content",Q,sl(0,2),`[tables, values]: [${C}, ${v}]`,"[tables, values]"),U(7,a,"applyChanges",Q,`Applies a set of ${me} to the Store`,"changes: "+me,"changes"),re(X,((e,l)=>c(l,`(cell: ${e}${Pe}) => `+e,`Takes a ${e} Cell value and returns another`))),s(null,t,"DoRollback",Ve,"IdOrNull",Ae,"Store",me),U(0,a,Ae,Ae,sl(0,6)),U(2,a,Ae,Q,sl(0,7),"tablesAndValuesJson: "+Ae,"tablesAndValuesJson"),U(7,a,Fe,"Return",Ue,ve,"actions, doRollback","<Return>"),U(7,a,"start"+Be,Q,_e),U(7,a,"finish"+Be,Q,Ze,ye,"doRollback");const te=G(q,Q);return _("Start"+Be,te,Le+" just before the start of the "+Fe,a,a,0),_("WillFinish"+Be,te,Le+" just before "+Qe,a,a,0),_("DidFinish"+Be,te,Le+" just after "+Qe,a,a,0),U(7,a,"call"+$,Q,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,a,$,Q,"Remove a listener that was previously added to "+We,"listenerId: Id","listenerId"),B("getStore",a,"Store","store",wl[0]+" the underlying Store object"),s(1,t,"createStore"),s(1,Z,Q,`create${Q} as create${Q}Decl`,te),R("store",["createStore()",...K]),V("fluent","actions: () => Store",["actions();",`return ${q};`]),V("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),R(q,["{",...z(1),"}"]),[d(...k(0),...S(),xe+" interface "+Q+" {",...z(0),"}",a,Ll(`Creates a ${Q} object`),xe+" function create"+Q+"(): "+Q+";"),d(...k(1),xe+" const create"+Q+": typeof create"+Q+"Decl = () => {",...O(),`return Object.freeze(${q});`,"};"),Y,ee]},Zl=e=>c+e,Ql=e=>jl(Zl(e),Zl(e)+we),ql="debugIds?: boolean",Kl="debugIds={debugIds}",Xl="then"+Te,Yl="Parameter",et=": (parameter: "+Yl+", store: Store) => ",lt="const contextValue = useContext(Context);",tt=", based on a parameter",at=": ",nt="<"+Yl+",>",dt=Yl+"ized"+he+"<"+Yl+">",ot="rowId",st="rowId={rowId}",rt=", separator, debugIds",It="separator?: ReactElement | string",$t="then?: (store: Store",ct=jl($t+")"+Ke,Xl),ut="then, then"+we,it=ot+at+Ve,bt="View",pt=(e,...l)=>jl(...l,ke+": "+e,ke+Te,"mutator?: boolean"),Ct=(...e)=>jl(...e,ke,ke+we,"mutator"),ht=(e,l,n,d,r)=>{const[I,c,u,V,R,k,S,P]=Ml(),[O,E,N]=zl(e,l,R),D=`./${Nl(n)}.d`,L=`./${Nl(n)}-ui-react.d`,j="tinybase/ui-react",G=Nl(n,1),H=Nl(G),J=G+"Or"+G+Ve,z=H+"Or"+G+Ve,B=H+`={${H}}`,U=oe(),_=(e,l,t,n,d,o=a)=>(c(1,L,e+" as "+e+"Decl"),Pl(U,e,[l,t,n,d,o])),Z=(e,l,t,n,d,o=a)=>_("use"+e,l,t,n,d,o),Q=(e,l,t,n,d=a,o=a,s=a,r=a,I=a)=>(c(1,j,`use${l} as use${l}Core`),Z(e,jl(d,ee,r),t,ae+`(${z}, use${l}Core, [`+(o||a)+(I?"], ["+I:a)+"]);",n,s)),q=(e,l,t,a)=>_(e,l,1,t,a),K=(e=0)=>Ie(U,(([l,t,n,d,o],s)=>{const r=e?[xe+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==t?"any":t} =>`,n]:[xe+` function ${s}${o}(${l}): ${1==t?"ComponentReturnType":t};`];return e||F(r,Ll(d)),W(r,a),r}));c(null,t,Ve,"Store",he,Yl+"ized"+he),c(0,j,"ComponentReturnType"),c(1,j,"useCellIds"),c(null,j,"ExtraProps"),c(0,D,G);const X=u(J,G+" | "+Ve,`Used when you need to refer to a ${G} in a React hook or component`),Y=u(De+Ne,Hl(H+Se+G,H+`ById?: {[${H}Id: Id]: ${G}}`),`Used with the ${De} component, so that a `+G+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,L,X,Y);const ee=z+Se+X;R("{createContext, useContext, useMemo}","React"),R("Context",`createContext<[${G}?, {[${H}Id: Id]: ${G}}?]>([])`),Z("Create"+G,`create: () => ${G}, create`+Te,G,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${G} within a React application with convenient memoization`);const te=Z(G,"id?: Id",G+Pe,["{",lt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${G} from within a ${De} component context`),ae=V("useHook",z+`: ${X} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${H} = ${te}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${H} : ${z})?.getStore(), ...postParams)`]),ne=V("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),de=V("wrap",jl("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;"]),re=V("useCustomOrDefaultCellIds",jl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${z}?: ${X} | undefined`),[`const defaultCellIds = ${ae}(${z}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=R("NullComponent","() => null");if(!le(e)){const[e,l,n,r,I,y,v,x,R,k,S,P,N,j,J,z,W,F,U,_]=d;c(null,D,e,l,n,I,y,v,x,R,k,S,P,N,j,J,z,W,U,F),c(0,D,r),c(1,D,G),c(null,t,b,"IdOrNull");const Z=V("tableView",`{${H}, rowComponent, getRowComponentProps, customCellIds`+rt+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${de}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",st,"customCellIds={customCellIds}",B,Kl,"/>","))",rt,", tableId,",");"]),K=V("getDefaultTableComponent","tableId: Id",M(O(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),X=V("getDefaultCellComponent","tableId: Id, cellId: Id",M(O(((e,l,t)=>`tableId == ${t} ? ${M(E(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);Q(i+C,i+C,o,sl(1,0,0,1)+Ce),Q(C,C,e,sl(1,0)+Ce);const Y=Q(h,h,n+ze,Il(p,We)+Ce);Q(Me+C+he,Me+C+he,dt,sl(1,9)+tt,jl(Zl(C)+et+l,Zl(C)+Te),Ql(C),nt,jl($t,`tables: ${l})`+Ke,Xl),ut),Q(fe+C+he,fe+C+he,he,sl(1,12),a,a,a,ct,ut);const ee=u(w+Ne,Hl("tableId?: TId","rowId: Id","cellId?: CId",H+Se+G,ql),cl(be+w),`<TId extends ${n}, CId extends ${r}<TId>>`),le=u(m+Ne,Hl("tableId?: TId","rowId: Id",H+Se+G,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${ee}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,It,ql),cl(be+m),`<TId extends ${n}>`),te=u(p+Ne,Hl("tableId?: TId",H+Se+G,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(be+p),`<TId extends ${n}>`),ae=u("Sorted"+p+Ne,Hl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",H+Se+G,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(be+"sorted "+p),`<TId extends ${n}>`),oe=u(C+Ne,Hl(H+Se+G,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${te}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,It,ql),cl(ol(1,1)));c(1,L,oe,te,ae,le,ee),q(C+bt,"{"+H+", tableComponents, getTableComponentProps"+rt+"}: "+oe,[de+`(${Y}(${H}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+K+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",B,Kl,"/>;","}), separator)"],sl(1,13)+Ce),O(((e,l,t)=>{const[n,d,r,I,$]=se(_,e);c(null,D,n,d,r,I,$),Q(i+l+p,i+p,o,hl(e,0,1)+Ce,a,t),Q(l+p,p,n,hl(e)+Ce,a,t),Q(l+p+T,p+T,b,Il(w,"the whole of "+pl(e))+Ce,a,t),Q(l+m+ge,m+ge,s,"Gets the number of Rows in "+pl(e)+Ce,a,t);const u=Q(l+g,g,b,Il(m,pl(e))+Ce,a,t),C=Q(l+f,f,b,Il(m,pl(e),1)+Ce,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",t+", cellId, descending, offset, limit");Q(i+l+m,i+m,o,ml(e,0,1)+Ce,it,jl(t,ot)),Q(l+m,m,r,ml(e)+Ce,it,jl(t,ot)),Q(l+T,T,$+ze,Il(w,Cl(e))+Ce,it,jl(t,ot)),Q(Me+l+p+he,Me+p+he,dt,hl(e,9)+tt,jl(Zl(p)+et+d,Zl(p)+Te),jl(t,Ql(p)),nt,jl($t,`table: ${d})`+Ke,Xl),ut),Q(fe+l+p+he,fe+p+he,he,hl(e,12),a,t,a,ct,ut),Q(Me+l+m+he,Me+m+he,dt,ml(e,9)+tt,jl(it,Zl(m)+et+I,Zl(m)+Te),jl(t,ot,Ql(m)),nt,jl($t,`row: ${I})`+Ke,Xl),ut),Q("Add"+l+m+he,"Add"+m+he,dt,ml(e,10)+tt,jl(Zl(m)+et+I,Zl(m)+Te),jl(t,Ql(m)),nt,"then?: ("+jl(it+Pe,"store: Store","row: "+I+")"+Ke,"then"+Te)+", reuseRowIds?: boolean",ut+", reuseRowIds"),Q(Me+l+Ee+m+he,Me+Ee+m+he,dt,ml(e,11)+tt,jl(it,Zl(Ee+m)+et+I,Zl(Ee+m)+Te),jl(t,ot,Ql(Ee+m)),nt,jl($t,`partialRow: ${I})`+Ke,Xl),ut),Q(fe+l+m+he,fe+m+he,he,ml(e,12),it,jl(t,ot),a,ct,ut);const h=q(l+m+bt,"{rowId, "+H+", cellComponents, getCellComponentProps, customCellIds"+rt+`}: ${le}<'${e}'>`,[de+`(${re}(customCellIds, `+t+`, rowId, ${H}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+X+`(${t}, cellId)) as React.ComponentType<CellProps<typeof `+t+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${t}}`,st,"cellId={cellId}",B,Kl,"/>;","})"+rt+", rowId)"],ml(e,13)+Ce);q(l+"Sorted"+p+bt,"{cellId, descending, offset, limit, ...props}: "+ae+`<'${e}'>`,Z+"(props, "+C+`(cellId, descending, offset, limit, props.${H}), ${t}, ${h});`,hl(e,13)+", sorted"+Ce),q(l+p+bt,`props: ${te}<'${e}'>`,Z+"(props, "+u+`(props.${H}), ${t}, ${h});`,hl(e,13)+Ce),E(e,((n,d,s,r,I)=>{const $="Map"+Nl(d,1);c(0,D,$),c(1,D,$),Q(i+l+I+p+w,i+p+w,o,`Gets ${dl(1)}the '${n}' Cell anywhere in `+pl(e)+Ce,a,jl(t,r)),Q(i+l+I+w,i+w,o,gl(e,n,0,1)+Ce,it,jl(t,ot,r));const u=Q(l+I+w,w,d+(A(s)?Pe:a),gl(e,n)+Ce,it,jl(t,ot,r));Q(Me+l+I+w+he,Me+w+he,dt,gl(e,n,9)+tt,jl(it,Zl(w)+et+d+" | "+$,Zl(w)+Te),jl(t,ot,r,Ql(w)),nt,jl($t,`cell: ${d} | ${$})`+Ke,Xl),ut),Q(fe+l+I+w+he,fe+w+he,he,gl(e,n,12),jl(it,"forceDel?: boolean"),jl(t,ot,r,"forceDel"),a,ct,ut),q(l+I+w+bt,`{rowId, ${H}, debugIds}: `+ee+`<'${e}', '${n}'>`,[de+`('' + ${u}(rowId, `+H+`) ?? '', undefined, debugIds, ${r})`],gl(e,n,13)+Ce)}))}));const Ie=M(O((e=>se(_,e)?.[4]??a))," | ");Q(i+C+$,i+C+$,qe,sl(1,8,0,1)+" changes",pt(I),Ct()),Q(C+$,C+$,qe,sl(1,8)+" changes",pt(y),Ct()),Q(h+$,h+$,qe,bl(2,0,1),pt(v),Ct()),Q(i+p+$,i+p+$,qe,bl(3,0,0,1),pt(x,`tableId: ${n} | null`),Ct("tableId")),Q(p+$,p+$,qe,bl(3,0),pt(R,`tableId: ${n} | null`),Ct("tableId")),Q(p+T+$,p+T+$,qe,bl(14,3,1),pt(k,`tableId: ${n} | null`),Ct("tableId")),Q(i+p+w+$,i+p+w+$,qe,bl(16,3,0,1),pt(S,`tableId: ${n} | null`,`cellId: ${Ie} | null`),Ct("tableId","cellId")),Q(m+ge+$,m+ge+$,qe,bl(15,3),pt(P,`tableId: ${n} | null`),Ct("tableId")),Q(g+$,g+$,qe,bl(4,3,1),pt(N,`tableId: ${n} | null`),Ct("tableId")),Q(f+$,f+$,qe,bl(13,3,1),pt(j,`tableId: ${n} | null`,"cellId: "+Ie+Pe,"descending: boolean","offset: number","limit: number"+Pe),Ct("tableId","cellId","descending","offset","limit")),Q(i+m+$,i+m+$,qe,bl(5,3,0,1),pt(J,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),Q(m+$,m+$,qe,bl(5,3),pt(z,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),Q(T+$,T+$,qe,bl(6,5,1),pt(W,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),Q(i+w+$,i+w+$,qe,bl(7,5,0,1),pt(F,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${Ie} | null`),Ct("tableId",ot,"cellId")),Q(w+$,w+$,qe,bl(7,5),pt(U,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${Ie} | null`),Ct("tableId",ot,"cellId"))}if(!le(l)){const[e,l,t,n,d,s,I,b]=r;c(null,D,...r),c(1,D,G);const p=V("getDefaultValueComponent","valueId: Id",M(N(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);Q(i+v,i+v,o,sl(2,0,0,1)+Ce),Q(v,v,e,sl(2,0)+Ce);const C=Q(x,x,t+ze,Il(y,We)+Ce);Q(Me+v+he,Me+v+he,dt,sl(2,9)+tt,jl(Zl(v)+et+l,Zl(v)+Te),Ql(v),nt,jl($t,`values: ${l})`+Ke,Xl),ut),Q(Me+Ee+v+he,Me+Ee+v+he,dt,sl(2,11)+tt,jl(Zl(Ee+v)+et+l,Zl(Ee+v)+Te),Ql(Ee+v),nt,jl($t,`partialValues: ${l})`+Ke,Xl),ut),Q(fe+v+he,fe+v+he,he,sl(2,12),a,a,a,ct,ut);const h=u(y+Ne,Hl("valueId?: VId",H+Se+G,ql),cl("a Value"),`<VId extends ${t}>`),m=u(v+Ne,Hl(H+Se+G,"valueComponents?: {readonly [VId in "+t+`]?: ComponentType<${h}<VId>>;}`,`getValueComponentProps?: (valueId: ${t}) => ExtraProps`,It,ql),cl(ol(2,1)));c(1,L,m,h),q(v+bt,"{"+H+", valueComponents, getValueComponentProps"+rt+"}: "+m,[de+`(${C}(${H}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+p+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",B,Kl,"/>;","}), separator)"],sl(2,13)+Ce),N(((e,l,t,n,d)=>{const s="Map"+Nl(l,1);c(0,D,s),c(1,D,s),Q(i+d+y,i+y,o,fl(e,0,1)+Ce,a,n);const r=Q(d+y,y,l,fl(e)+Ce,a,n);Q(Me+d+y+he,Me+y+he,dt,fl(e,9)+tt,jl(Zl(y)+et+l+" | "+s,Zl(y)+Te),jl(n,Ql(y)),nt,jl($t,`value: ${l} | ${s})`+Ke,Xl),ut),Q(fe+d+y+he,fe+y+he,he,fl(e,12),a,n,a,ct,ut),q(d+y+bt,`{${H}, debugIds}: ${h}<'${e}'>`,[de+`('' + ${r}(`+H+`) ?? '', undefined, debugIds, ${n})`],fl(e,13)+Ce)})),Q(i+v+$,i+v+$,qe,sl(2,8,0,1)+" changes",pt(n),Ct()),Q(v+$,v+$,qe,sl(2,8)+" changes",pt(d),Ct()),Q(x+$,x+$,qe,bl(10,0,1),pt(s),Ct()),Q(i+y+$,i+y+$,qe,bl(11,0,0,1),pt(I,`valueId: ${t} | null`),Ct("valueId")),Q(y+$,y+$,qe,bl(11,0),pt(b,`valueId: ${t} | null`),Ct("valueId"))}return q(De,`{${H}, ${H}ById, children}: `+Y+" & {readonly children: React.ReactNode}",["{",lt,"return (","<Context."+De,"value={useMemo(",`() => [${H} ?? contextValue[0], {...contextValue[1], ...${H}ById}],`,`[${H}, ${H}ById, contextValue],`,")}>","{children}",`</Context.${De}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[I(...k(0),...S(),...K(0)),I(...k(1),...P(),...K(1))]},mt=(e,l,t)=>{if(le(e)&&le(l))return[a,a,a,a];const[n,d,o,s]=_l(e,l,t);return[n,d,...ht(e,l,t,o,s)]},gt=JSON.parse,ft="prettier/",wt=ft+"plugins/",Tt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},yt=Jl((e=>{const l=()=>{const l=gt(e.getTablesSchemaJson());return!le(l)||j(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=oe();if(j(a,(l=>j(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=ce(n,a,(()=>[L(d),oe(),[0],0])),[s,r,[I]]=o,$=ce(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),$e(r,d,$),o[3]++,s==L(d)})))))return l[t]={},ne(n,(([e,,[,n],d],o)=>{l[t][o]={[r]:e,...d==N(a)?{[I]:n}:{}}})),1}))?l:{}},t=()=>{const l=gt(e.getValuesSchemaJson());return le(l)&&e.forEachValue(((e,t)=>{l[e]={[r]:L(t)}})),l},a=e=>mt(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(ft+"standalone")).format,W(t,await import(wt+"estree"),await import(wt+"typescript"))}catch{n=async e=>e}return await D(J(a(e),(async(e,a)=>Ol(await n(e,{...Tt,plugins:t,filepath:"_."+l[a]})))))};return X({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:N(e.getValueIds()),jsonLength:N(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=yt},"object"==typeof exports&&"undefined"!=typeof module?l(exports):"function"==typeof define&&define.amd?define(["exports"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
1
|
+
var e,l;e=this,l=function(e){"use strict";const l=e=>typeof e,t="tinybase",a="",n=",",d=l(a),o=l(!0),s=l(0),r="type",I="default",$="Listener",c="get",u="add",i="Has",b="Ids",p="Table",C=p+"s",h=p+b,m="Row",g=m+b,f="Sorted"+m+b,w="Cell",T=w+b,y="Value",v=y+"s",x=y+b,V="Transaction",R="Partial",A=(e,l=a,t)=>e.split(l,t),k=Promise,S=isFinite,P=e=>null==e,O=(e,l,t)=>P(e)?t?.():l(e),E=e=>e==d||e==o,N=e=>l(e)==d,D=e=>Array.isArray(e),L=(e,l,t)=>e.slice(l,t),j=e=>e.length,G=async e=>k.all(e),H=e=>{const t=l(e);return E(t)||t==s&&S(e)?t:void 0},M=(e,l)=>e.every(l),J=(e,l)=>e.sort(l),z=(e,l)=>e.forEach(l),W=(e,l=a)=>e.join(l),B=(e,l)=>e.map(l),F=(e,l)=>e.filter(l),U=(e,...l)=>e.push(...l),_=e=>e.pop(),Z=(e,...l)=>e.unshift(...l),Q=e=>e.shift(),q=Object,K=e=>q.getPrototypeOf(e),X=q.entries,Y=e=>!P(e)&&O(K(e),(e=>e==q.prototype||P(K(e))),(()=>!0)),ee=q.keys,le=q.freeze,te=(e,l)=>B(X(e),(([e,t])=>l(t,e))),ae=e=>j(ee(e)),ne=e=>Y(e)&&0==ae(e),de=(e,l)=>e?.has(l)??!1,oe=e=>[...e?.values()??[]],se=(e,l)=>e?.forEach(l),re=(e,l)=>e?.delete(l),Ie=e=>new Map(e),$e=(e,l)=>e?.get(l),ce=(e,l)=>se(e,((e,t)=>l(t,e))),ue=(e,l)=>B([...e?.entries()??[]],(([e,t])=>l(t,e))),ie=(e,l,t)=>P(t)?(re(e,l),e):e?.set(l,t),be=(e,l,t,a)=>(de(e,l)||ie(e,l,t()),$e(e,l)),pe=e=>e.toUpperCase(),Ce=e=>e.toLowerCase(),he="a ",me="A function for",ge=", and registers a listener so that any changes to that result will cause a re-render",fe="Callback",we="Changes",Te="Count",ye="Del",ve="Deps",xe=ve+"?: React.DependencyList",Ve="doRollback?: DoRollback",Re="actions: () => Return, "+Ve,Ae="export",ke="Id",Se="Invalid",Pe="Json",Oe=Ce($),Ee="?: ",Ne=" | undefined",De="NonNullable",Le="Props",je="Provider",Ge=`Registers a ${Oe} that will be called`,He="Represents",Me="rowId: "+ke,Je="Schema",ze="Set",We=", descending?: boolean, offset?: number, limit?: number",Be="[]",Fe="the Store",Ue=Ce(V),_e="Execute a "+Ue+" to make multiple mutations",Ze="Explicitly starts a "+Ue,Qe="Explicitly finishes a "+Ue,qe="the end of the "+Ue,Ke="void",Xe=" => "+Ke,Ye="WhenSet",el=" when setting it",ll=he+"string serialization of",tl=" ",al="Gets a callback that can ",nl="the ",dl=" the schema for",ol=(e=0)=>e?"the existence of ":"",sl=(e=0,l=0,t=0)=>ol(t)+`the ${xl[e]}content of`+(l?tl+Fe:a),rl=(e=0,l,t=0,n=0)=>Tl[l]+tl+ol(n)+sl(e,1)+(t?" when setting it":a),Il=(e,l=0)=>He+` a Row when ${l?"s":"g"}etting ${sl()} the '${e}' `+p,$l=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,cl=(e,l)=>`Calls a function for each ${e} in `+l,ul=e=>"The props passed to a component that renders "+e,il=e=>"A function that takes "+e,bl=(e,l=0,t=0)=>me+" listening to changes to "+ol(t)+vl[e]+" in "+vl[l],pl=(e,l,t=0,n=0)=>Ge+" whenever "+ol(n)+vl[e]+" in "+vl[l]+" change"+(t?a:"s"),Cl=e=>`the '${e}' `+p,hl=e=>"the specified Row in "+Cl(e),ml=(e,l=0,t=0)=>Tl[l]+tl+sl(0,0,t)+tl+Cl(e),gl=(e,l=0,t=0)=>Tl[l]+` ${sl(0,0,t)} `+hl(e),fl=(e,l,t=0,a=0)=>Tl[t]+tl+ol(a)+`the '${l}' Cell for `+hl(e),wl=(e,l=0,t=0)=>Tl[l]+tl+ol(t)+`the '${e}' Value`,Tl=["Gets","Checks existence of","Sets","Deletes","Sets part of",He,"Gets "+ll,"Sets "+ll,Ge+" whenever",al+"set",al+"add",al+"set part of",al+"delete","Renders","Gets "+ll+dl,"Sets"+dl,"Deletes"+dl],yl=[c,"has","set","del","set","forEach",u,a],vl=[Fe,C,nl+p+tl+b,he+p,nl+m+tl+b,he+m,nl+w+tl+b,he+w,"invalid Cell changes",v,nl+y+tl+b,he+y,"invalid Value changes",nl+"sorted "+m+tl+b,nl+w+tl+b+" anywhere",nl+"number of Rows",he+w+" anywhere"],xl=[a,"tabular ","keyed value "],Vl=e=>new Set(D(e)||P(e)?e:[e]),Rl=(e,l)=>e?.add(l),Al=/[^A-Za-z]+/,kl=/[^A-Za-z0-9]+/,Sl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Pl=e=>e.includes(n),Ol=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return de(e,n)?Ol(e,l,t,a+1):(ie(e,n,t),n)},El=e=>e.replace(Sl,((e,l,t)=>{const a=77-j(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),Nl=e=>e.flat(1e3),Dl=(e,l=0)=>W(B(A(e,kl),((e,t)=>(t>0||l?pe:Ce)(L(e,0,1))+L(e,1)))),Ll=e=>pe(W(A(e&&!Al.test(e[0])?e:" "+e,kl),"_")),jl=e=>`/** ${e}. */`,Gl=(...e)=>W(F(e,(e=>e)),", "),Hl=(...e)=>"{"+W(e,"; ")+"}",Ml=(...e)=>Hl(...B(e,(e=>"readonly "+e))),Jl=()=>{const e=[Ie(),Ie(),Ie(),Ie()],l=Ie(),t=Ie(),n=e=>{const l=e.indexOf(" as ");return-1!=l?L(e,l+4):e};return[(...e)=>W(Nl(e),"\n"),(l,t,...a)=>z(a,(a=>z([0,1],(n=>(l??n)==n?Rl(be(e[n],t,Vl),a):0)))),(e,t,n,d=a,o=1)=>Ol(l,e,[t,n,d,o]),(e,l,a)=>Ol(t,e,D(a)?[`(${l}) => {`,a,"}"]:[`(${l}) => ${a}`]),(e,l)=>$e(t,e)===l?e:Ol(t,e,l),(l=0)=>B([...J(ue(e[l],((e,l)=>`import {${W(J(oe(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Pl(e)!=Pl(l)?Pl(e)?-1:1:e>l?1:-1)),a],(e=>e.replace("{React}","React"))),()=>ue(l,(([e,l,t,n],d)=>[jl(l),`${n?Ae+" ":a}type ${d}${t} = ${e};`,a])),()=>ue(t,((e,l)=>(e=D(e)?e:[e],U(e,_(e)+";"),[`const ${l} = ${Q(e)}`,e,a])))]},zl=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Wl=(e,l,t)=>[l=>te(e,((e,a)=>l(a,Dl(a,1),t(Ll(a),`'${a}'`)))),(l,a)=>te(e[l],((e,l)=>a(l,e[r],e[I],t(Ll(l),`'${l}'`),Dl(l,1)))),e=>te(l,((l,a)=>e(a,l[r],l[I],t(Ll(a),`'${a}'`),Dl(a,1))))],Bl=(e,l,t,n)=>[(n,d)=>{const o=n+": "+d,s=e(C,Hl(...l((e=>`'${e}'?: {[rowId: Id]: `+Hl(...t(e,((e,l,t)=>`'${e}'${P(t)?"?":a}: ${l}`)))+"}"))),rl(1,5)),r=e(C+Ye,Hl(...l((e=>`'${e}'?: {[rowId: Id]: `+Hl(...t(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),rl(1,5,1)),I=e(p+ke,"keyof "+s,"A "+p+" Id in "+Fe),c=`<TId extends ${I}>`,u=e(p,De+`<${s}[TId]>`,"A "+p+" in "+Fe,c),b=e(p+Ye,De+`<${r}[TId]>`,"A "+p+" in "+Fe+el,c),y=e(m,u+"<TId>[Id]","A "+m+" in a "+p,c),v=e(m+Ye,b+"<TId>[Id]","A "+m+" in a "+p+el,c),x=e(w+ke,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+m,c),V=e(w,De+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+m,`<TId extends ${I}, CId extends ${x}<TId>>`),R=e("CellIdCellArray",`CId extends ${x}<TId> ? [cellId: CId, cell: ${V}<TId, CId>] : never`,w+" Ids and types in a "+m,`<TId extends ${I}, CId = ${x}<TId>>`,0),A=e(w+fe,`(...[cellId, cell]: ${R}<TId>)`+Xe,il(he+w+" Id, and "+w),c),k=e(m+fe,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Xe+") "+Xe,il(he+m+" Id, and a "+w+" iterator"),c),S=e(p+w+fe,`(cellId: ${x}<TId>, count: number) `+Xe,il(he+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${I} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Xe}] : never`,p+" Ids and callback types",`<TId = ${I}>`,0),E=e(p+fe,`(...[tableId, forEachRow]: ${O})`+Xe,il(he+p+" Id, and a "+m+" iterator"),a),N=e("TableIdRowIdCellIdArray",`TId extends ${I} ? [tableId: TId, rowId: Id, cellId: ${x}<TId>] : never`,"Ids for GetCellChange",`<TId = ${I}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,me+" returning information about any Cell's changes during a "+Ue),L=e(i+C+$,`(${o}, hasTables: boolean)`+Xe,bl(1,0,1)),j=e(C+$,`(${o}, getCellChange: ${D}${Ne})`+Xe,bl(1)),G=e(h+$,`(${o})`+Xe,bl(2)),H=e(i+p+$,`(${o}, tableId: ${I}, hasTable: boolean)`+Xe,bl(3,0,1)),M=e(p+$,`(${o}, tableId: ${I}, getCellChange: ${D}${Ne})`+Xe,bl(3)),J=e(p+T+$,`(${o}, tableId: ${I})`+Xe,bl(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${I} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${I}>`,0),B=e(i+p+w+$,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Xe,bl(16,3,1)),F=e(m+"Count"+$,`(${o}, tableId: ${I})`+Xe,bl(15,3)),U=e(g+$,`(${o}, tableId: ${I})`+Xe,bl(4,3)),_=e(f+$,"("+Gl(o,"tableId: "+I,"cellId: Id"+Ne,"descending: boolean","offset: number","limit: number"+Ne,"sortedRowIds: Ids")+")"+Xe,bl(13,3)),Z=e(i+m+$,"("+Gl(""+o,"tableId: "+I,Me,"hasRow: boolean")+")"+Xe,bl(5,3,1)),Q=e(m+$,"("+Gl(""+o,"tableId: "+I,Me,`getCellChange: ${D}${Ne}`)+")"+Xe,bl(5,3)),q=e(T+$,"("+Gl(""+o,"tableId: "+I,Me)+")"+Xe,bl(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Me}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${I} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${I}>`,0),Y=e(i+w+$,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Xe,bl(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${x}<TId> ? [${o}, tableId: TId, ${Me}, cellId: CId, newCell: ${V}<TId, CId> ${Ne}, oldCell: ${V}<TId, CId> ${Ne}, getCellChange: ${D} ${Ne}] : never`,"Cell args for CellListener",`<TId extends ${I}, CId = ${x}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${I} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${I}>`,0);return[s,r,I,u,b,y,v,x,V,A,k,S,E,L,j,G,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+$,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Xe,bl(7,5)),e(Se+w+$,`(${o}, tableId: Id, ${Me}, cellId: Id, invalidCells: any[])`+Xe,bl(8))]},(l,t)=>{const d=l+": "+t,o=e(v,Hl(...n(((e,l,t)=>`'${e}'${P(t)?"?":a}: ${l}`))),rl(2,5)),s=e(v+Ye,Hl(...n(((e,l)=>`'${e}'?: ${l}`))),rl(2,5,1)),r=e(y+ke,"keyof "+o,"A "+y+" Id in "+Fe),I=e(y,De+`<${o}[VId]>`,"A "+y+" Id in "+Fe,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${I}<VId>] : never`,y+" Ids and types in "+Fe,`<VId = ${r}>`,0),u=e(y+fe,`(...[valueId, value]: ${c})`+Xe,il(he+y+" Id, and "+y)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,me+" returning information about any Value's changes during a "+Ue),p=e(i+v+$,`(${d}, hasValues: boolean)`+Xe,bl(9,0,1)),C=e(v+$,`(${d}, getValueChange: ${b}${Ne})`+Xe,bl(9)),h=e(x+$,`(${d})`+Xe,bl(10)),m=e(i+y+$,`(${d}, valueId: ValueId, hasValue: boolean)`+Xe,bl(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${I}<VId> ${Ne}, oldValue: ${I}<VId> ${Ne}, getValueChange: ${b} ${Ne}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,I,u,p,C,h,m,e(y+$,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+Xe,bl(11)),e(Se+y+$,`(${d}, valueId: Id, invalidValues: any[])`+Xe,bl(12))]},(l,t)=>e(V+$,`(${l}: ${t})`+Xe,me+" listening to the completion of a "+Ue)],Fl=(e,l=a,t=a)=>`store.${e}(${l})`+(t?" as "+t:a),Ul=(e,l=a)=>`fluent(() => ${Fl(e,l)})`,_l=(e,l=a,t=a)=>`store.${e}(${l?l+", ":a}proxy(listener)${t?", "+t:a})`,Zl=(e,l,n)=>{const[d,s,c,A,k,S,O,E]=Jl(),[D,L,j]=Wl(e,l,k),[G,H,M]=Bl(c,D,L,j),J=Ie(),B=(e=0)=>ue(J,(([l,t,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${t} => ${n},`]:[s+o+`(${l}): ${t};`];return e||Z(r,jl(d)),U(r,a),r})),F=(e,l,t,n,d,o=a)=>Ol(J,e,[l,t,n,d,o]),_=(e,l,t,n,d,o=a,s=a,r=a)=>F(yl[e]+l+(4==e?R:a)+t,o,n,(n==K?Ul:Fl)(yl[e]+(4==e?R:a)+t,s,e?void 0:n),d,r),Q=(e,l,t,n=a,d=a,o=1,s=a)=>F(u+e+$,(n?n+", ":a)+Oe+": "+l+(o?", mutator?: boolean":a),ke,_l(u+e+$,d,o?"mutator":a),t,s),q=`./${Dl(n)}.d`,K=Dl(n,1),X=Dl(K),Y=[],ee=Ie();let le=[],te=[];if(s(1,q,K,`create${K} as create${K}Decl`),ne(e))s(null,t,C);else{s(0,t,"CellChange"),s(null,t,b);const[e,l,n,d,$,u,y,v,x,V,R,A,S,O,E,j,H,M,J,B,F,Z,te,ae,ne,de,se,re,ce]=G(X,K),ue=Ie();D(((e,l)=>{const t=`<'${e}'>`,a=[c(l+p,d+t,He+` the '${e}' `+p),c(l+p+Ye,$+t,He+` the '${e}' `+p+el),c(l+m,u+t,Il(e)),c(l+m+Ye,y+t,Il(e,1)),c(l+w+ke,v+t,`A Cell Id for the '${e}' `+p),c(l+w+fe,V+t,il(`a Cell Id and value from a Row in the '${e}' `+p)),c(l+m+fe,R+t,il(`a Row Id from the '${e}' Table, and a Cell iterator`)),c(l+p+w+fe,A+t,il(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ie(ue,e,a),s(1,q,...a)})),s(1,q,e,l,n,v,S,O,E,j,H,M,J,B,F,Z,te,ae,ne,de,se,re,ce),le=[e,l,n,v,O,E,j,H,M,J,B,F,Z,te,ae,ne,de,se,re,ue],z([[e],[o],[K,"tables: "+l,"tables"],[K]],(([e,l,t],n)=>_(n,a,C,e,rl(1,n),l,t))),_(0,a,h,n+Be,$l(p,Fe)),_(5,a,p,Ke,cl(p,Fe),"tableCallback: "+S,"tableCallback as any"),D(((e,l,t)=>{const[n,d,s,r,I,$,c,u]=$e(ue,e);z([[n],[o],[K,"table: "+d,", table"],[K]],(([n,d,o=a],s)=>_(s,l,p,n,ml(e,s),d,t+o))),_(0,l,p+T,b,$l(w,"the whole of "+Cl(e)),a,t),_(5,l,p+w,Ke,cl(p+w,"the whole of "+Cl(e)),"tableCellCallback: "+u,t+", tableCellCallback as any"),_(0,l,m+Te,"number","Gets the number of Rows in the "+Cl(e),a,t),_(0,l,g,b,$l(m,Cl(e)),a,t),_(0,l,f,b,$l(m,Cl(e),1),"cellId?: "+I+We,t+", cellId, descending, offset, limit"),_(5,l,m,Ke,cl(m,Cl(e)),"rowCallback: "+c,t+", rowCallback as any"),z([[s],[o],[K,", row: "+r,", row"],[K],[K,", partialRow: "+r,", partialRow"]],(([n,d=a,o=a],s)=>_(s,l,m,n,gl(e,s),Me+d,t+", rowId"+o))),_(6,l,m,ke+Ne,"Add a new Row to "+Cl(e),"row: "+r+", reuseIds?: boolean",t+", row, reuseIds"),_(0,l,T,I+Be,$l(w,hl(e)),Me,t+", rowId"),_(5,l,w,Ke,cl(w,hl(e)),Me+", cellCallback: "+$,t+", rowId, cellCallback as any"),L(e,((n,d,s,r,I)=>{const $="Map"+Dl(d,1);ie(ee,d,$);const c=d+(P(s)?Ne:a);z([[c],[o],[K,`, cell: ${d} | `+$,", cell as any"],[K]],(([d,o=a,s=a],$)=>_($,l+I,w,d,fl(e,n,$),Me+o,t+", rowId, "+r+s))),_(1,l+I,p+w,o,Tl[1]+` the '${n}' Cell anywhere in `+Cl(e),a,t+", "+r)}))})),_(0,a,C+Pe,Pe,rl(1,6)),_(2,a,C+Pe,K,rl(1,7),"tablesJson: "+Pe,"tables"+Pe),Q(i+C,O,rl(1,8,0,1)+" changes"),Q(C,E,rl(1,8)+" changes"),Q(h,j,pl(2,0,1)),Q(i+p,H,pl(3,0,0,1),`tableId: ${n} | null`,"tableId"),Q(p,M,pl(3,0),`tableId: ${n} | null`,"tableId"),Q(p+T,J,pl(14,3,1),`tableId: ${n} | null`,"tableId"),Q(i+p+w,B,pl(16,3,0,1),`tableId: ${n} | null, cellId: ${W(D((e=>$e(ue,e)?.[4]??a))," | ")} | null`,"tableId, cellId"),Q(m+Te,F,pl(15,3),`tableId: ${n} | null`,"tableId"),Q(g,Z,pl(4,3,1),`tableId: ${n} | null`,"tableId"),Q(f,te,pl(13,3,1),Gl("tableId: TId",`cellId: ${v}<TId>`+Ne,"descending: boolean","offset: number","limit: number"+Ne),Gl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),Q(i+m,ae,pl(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(m,ne,pl(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(T,de,pl(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(i+w,se,pl(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${W(D((e=>$e(ue,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),Q(w,re,pl(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${W(D((e=>$e(ue,e)?.[4]??a))," | ")} | null`,"tableId, rowId, cellId"),Q(Se+w,ce,Ge+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),s(1,q,...oe(ee)),U(Y,".set"+C+Je+"({",Nl(D(((e,l,t)=>[`[${t}]: {`,...L(e,((e,l,t,n)=>`[${n}]: {[${k(Ll(r),`'${r}'`)}]: ${k(Ll(l),`'${l}'`)}${P(t)?a:`, [${k(Ll(I),`'${I}'`)}]: `+(N(t)?k(Ll(t),`'${t}'`):t)}},`)),"},"]))),"})")}if(ne(l))s(null,t,v);else{const[e,l,n,d,$,c,u,b,p,C,h]=H(X,K);s(1,q,e,l,n,$,c,u,b,p,C,h),te=[e,l,n,c,u,b,p,C],z([[e],[o],[K,"values: "+l,"values"],[K],[K,"partialValues: "+l,"partialValues"]],(([e,l,t],n)=>_(n,a,v,e,rl(2,n),l,t))),_(0,a,x,n+Be,$l(y,Fe)),_(5,a,y,"void",cl(y,Fe),"valueCallback: "+$,"valueCallback as any"),j(((e,l,t,n,d)=>{const s="Map"+Dl(l,1);ie(ee,l,s),z([[l],[o],[K,`value: ${l} | `+s,", value as any"],[K]],(([l,t,o=a],s)=>_(s,d,y,l,wl(e,s),t,n+o)))})),_(0,a,v+Pe,Pe,rl(2,6)),_(2,a,v+Pe,K,rl(2,7),"valuesJson: "+Pe,"values"+Pe),Q(i+v,c,rl(2,8,0,1)+" changes"),Q(v,u,rl(2,8)+" changes"),Q(x,b,pl(10,0,1)),Q(i+y,p,pl(11,0,0,1),`valueId: ${n} | null`,"valueId"),Q(y,C,pl(11,0),`valueId: ${n} | null`,"valueId"),Q(Se+y,h,Ge+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),s(1,q,...oe(ee)),s(0,t,"ValueChange"),U(Y,".set"+v+Je+"({",j(((e,l,t,n)=>[`[${n}]: {[${k(Ll(r),`'${r}'`)}]: ${k(Ll(l),`'${l}'`)}${P(t)?a:`, [${k(Ll(I),`'${I}'`)}]: `+(N(t)?k(Ll(t),`'${t}'`):t)}},`])),"})")}_(0,a,"Content",`[${C}, ${v}]`,rl(0,0)),_(2,a,"Content",K,rl(0,2),`[tables, values]: [${C}, ${v}]`,"[tables, values]"),_(7,a,"applyChanges",K,`Applies a set of ${we} to the Store`,"changes: "+we,"changes"),ce(ee,((e,l)=>c(l,`(cell: ${e}${Ne}) => `+e,`Takes a ${e} Cell value and returns another`))),s(null,t,"DoRollback",ke,"IdOrNull",Pe,"Store",we),_(0,a,Pe,Pe,rl(0,6)),_(2,a,Pe,K,rl(0,7),"tablesAndValuesJson: "+Pe,"tablesAndValuesJson"),_(7,a,Ue,"Return",_e,Re,"actions, doRollback","<Return>"),_(7,a,"start"+V,K,Ze),_(7,a,"finish"+V,K,Qe,Ve,"doRollback");const ae=M(X,K);return Q("Start"+V,ae,Ge+" just before the start of the "+Ue,a,a,0),Q("WillFinish"+V,ae,Ge+" just before "+qe,a,a,0),Q("DidFinish"+V,ae,Ge+" just after "+qe,a,a,0),_(7,a,"call"+$,K,"Manually provoke a listener to be called","listenerId: Id","listenerId"),_(3,a,$,K,"Remove a listener that was previously added to "+Fe,"listenerId: Id","listenerId"),F("getStore",a,"Store","store",Tl[0]+" the underlying Store object"),s(1,t,"createStore"),s(1,q,K,`create${K} as create${K}Decl`,ae),k("store",["createStore()",...Y]),A("fluent","actions: () => Store",["actions();",`return ${X};`]),A("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${X}, ...params)`),k(X,["{",...B(1),"}"]),[d(...S(0),...O(),Ae+" interface "+K+" {",...B(0),"}",a,jl(`Creates a ${K} object`),Ae+" function create"+K+"(): "+K+";"),d(...S(1),Ae+" const create"+K+": typeof create"+K+"Decl = () => {",...E(),`return Object.freeze(${X});`,"};"),le,te]},Ql=e=>c+e,ql=e=>Gl(Ql(e),Ql(e)+ve),Kl="debugIds?: boolean",Xl="debugIds={debugIds}",Yl="then"+xe,et="Parameter",lt=": (parameter: "+et+", store: Store) => ",tt="const contextValue = useContext(Context);",at=", based on a parameter",nt=": ",dt="<"+et+",>",ot=et+"ized"+fe+"<"+et+">",st="rowId",rt="rowId={rowId}",It=", separator, debugIds",$t="separator?: ReactElement | string",ct="then?: (store: Store",ut=Gl(ct+")"+Xe,Yl),it="then, then"+ve,bt=st+nt+ke,pt="View",Ct=(e,...l)=>Gl(...l,Oe+": "+e,Oe+xe,"mutator?: boolean"),ht=(...e)=>Gl(...e,Oe,Oe+ve,"mutator"),mt=(e,l,n,d,r)=>{const[I,c,u,V,A,k,S,O]=Jl(),[E,N,D]=Wl(e,l,A),L=`./${Dl(n)}.d`,j=`./${Dl(n)}-ui-react.d`,G="tinybase/ui-react",H=Dl(n,1),M=Dl(H),J=H+"Or"+H+ke,z=M+"Or"+H+ke,B=M+`={${M}}`,F=Ie(),_=(e,l,t,n,d,o=a)=>(c(1,j,e+" as "+e+"Decl"),Ol(F,e,[l,t,n,d,o])),Q=(e,l,t,n,d,o=a)=>_("use"+e,l,t,n,d,o),q=(e,l,t,n,d=a,o=a,s=a,r=a,I=a)=>(c(1,G,`use${l} as use${l}Core`),Q(e,Gl(d,le,r),t,ae+`(${z}, use${l}Core, [`+(o||a)+(I?"], ["+I:a)+"]);",n,s)),K=(e,l,t,a)=>_(e,l,1,t,a),X=(e=0)=>ue(F,(([l,t,n,d,o],s)=>{const r=e?[Ae+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==t?"any":t} =>`,n]:[Ae+` function ${s}${o}(${l}): ${1==t?"ComponentReturnType":t};`];return e||Z(r,jl(d)),U(r,a),r}));c(null,t,ke,"Store",fe,et+"ized"+fe),c(0,G,"ComponentReturnType"),c(1,G,"useCellIds"),c(null,G,"ExtraProps"),c(0,L,H);const Y=u(J,H+" | "+ke,`Used when you need to refer to a ${H} in a React hook or component`),ee=u(je+Le,Ml(M+Ee+H,M+`ById?: {[${M}Id: Id]: ${H}}`),`Used with the ${je} component, so that a `+H+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,j,Y,ee);const le=z+Ee+Y;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${H}?, {[${M}Id: Id]: ${H}}?]>([])`),Q("Create"+H,`create: () => ${H}, create`+xe,H,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${H} within a React application with convenient memoization`);const te=Q(H,"id?: Id",H+Ne,["{",tt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${H} from within a ${je} component context`),ae=V("useHook",z+`: ${Y} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${z} as Id);`,`return hook(...preParams, ((${z} == null || typeof ${z} == 'string')`,`? ${M} : ${z})?.getStore(), ...postParams)`]),de=V("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=V("wrap",Gl("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;"]),se=V("useCustomOrDefaultCellIds",Gl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${z}?: ${Y} | undefined`),[`const defaultCellIds = ${ae}(${z}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),re=A("NullComponent","() => null");if(!ne(e)){const[e,l,n,r,I,y,v,x,A,k,S,O,D,G,J,z,F,U,_,Z]=d;c(null,L,e,l,n,I,y,v,x,A,k,S,O,D,G,J,z,F,_,U),c(0,L,r),c(1,L,H),c(null,t,b,"IdOrNull");const Q=V("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+It+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+de+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",rt,"customCellIds={customCellIds}",B,Xl,"/>","))",It,", tableId,",");"]),X=V("getDefaultTableComponent","tableId: Id",W(E(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+re),Y=V("getDefaultCellComponent","tableId: Id, cellId: Id",W(E(((e,l,t)=>`tableId == ${t} ? ${W(N(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+re} : `)))+re);q(i+C,i+C,o,rl(1,0,0,1)+ge),q(C,C,e,rl(1,0)+ge);const ee=q(h,h,n+Be,$l(p,Fe)+ge);q(ze+C+fe,ze+C+fe,ot,rl(1,9)+at,Gl(Ql(C)+lt+l,Ql(C)+xe),ql(C),dt,Gl(ct,`tables: ${l})`+Xe,Yl),it),q(ye+C+fe,ye+C+fe,fe,rl(1,12),a,a,a,ut,it);const le=u(w+Le,Ml("tableId?: TId","rowId: Id","cellId?: CId",M+Ee+H,Kl),ul(he+w),`<TId extends ${n}, CId extends ${r}<TId>>`),te=u(m+Le,Ml("tableId?: TId","rowId: Id",M+Ee+H,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${le}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,$t,Kl),ul(he+m),`<TId extends ${n}>`),ae=u(p+Le,Ml("tableId?: TId",M+Ee+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",$t,Kl),ul(he+p),`<TId extends ${n}>`),ne=u("Sorted"+p+Le,Ml("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+Ee+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",$t,Kl),ul(he+"sorted "+p),`<TId extends ${n}>`),Ie=u(C+Le,Ml(M+Ee+H,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${ae}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,$t,Kl),ul(sl(1,1)));c(1,j,Ie,ae,ne,te,le),K(C+pt,"{"+M+", tableComponents, getTableComponentProps"+It+"}: "+Ie,[oe+`(${ee}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+X+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${de}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",B,Xl,"/>;","}), separator)"],rl(1,13)+ge),E(((e,l,t)=>{const[n,d,r,I,$]=$e(Z,e);c(null,L,n,d,r,I,$),q(i+l+p,i+p,o,ml(e,0,1)+ge,a,t),q(l+p,p,n,ml(e)+ge,a,t),q(l+p+T,p+T,b,$l(w,"the whole of "+Cl(e))+ge,a,t),q(l+m+Te,m+Te,s,"Gets the number of Rows in "+Cl(e)+ge,a,t);const u=q(l+g,g,b,$l(m,Cl(e))+ge,a,t),C=q(l+f,f,b,$l(m,Cl(e),1)+ge,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",t+", cellId, descending, offset, limit");q(i+l+m,i+m,o,gl(e,0,1)+ge,bt,Gl(t,st)),q(l+m,m,r,gl(e)+ge,bt,Gl(t,st)),q(l+T,T,$+Be,$l(w,hl(e))+ge,bt,Gl(t,st)),q(ze+l+p+fe,ze+p+fe,ot,ml(e,9)+at,Gl(Ql(p)+lt+d,Ql(p)+xe),Gl(t,ql(p)),dt,Gl(ct,`table: ${d})`+Xe,Yl),it),q(ye+l+p+fe,ye+p+fe,fe,ml(e,12),a,t,a,ut,it),q(ze+l+m+fe,ze+m+fe,ot,gl(e,9)+at,Gl(bt,Ql(m)+lt+I,Ql(m)+xe),Gl(t,st,ql(m)),dt,Gl(ct,`row: ${I})`+Xe,Yl),it),q("Add"+l+m+fe,"Add"+m+fe,ot,gl(e,10)+at,Gl(Ql(m)+lt+I,Ql(m)+xe),Gl(t,ql(m)),dt,"then?: ("+Gl(bt+Ne,"store: Store","row: "+I+")"+Xe,"then"+xe)+", reuseRowIds?: boolean",it+", reuseRowIds"),q(ze+l+R+m+fe,ze+R+m+fe,ot,gl(e,11)+at,Gl(bt,Ql(R+m)+lt+I,Ql(R+m)+xe),Gl(t,st,ql(R+m)),dt,Gl(ct,`partialRow: ${I})`+Xe,Yl),it),q(ye+l+m+fe,ye+m+fe,fe,gl(e,12),bt,Gl(t,st),a,ut,it);const h=K(l+m+pt,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+It+`}: ${te}<'${e}'>`,[oe+`(${se}(customCellIds, `+t+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+Y+`(${t}, cellId)) as React.ComponentType<CellProps<typeof `+t+", typeof cellId>>;","return <Cell",`{...${de}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${t}}`,rt,"cellId={cellId}",B,Xl,"/>;","})"+It+", rowId)"],gl(e,13)+ge);K(l+"Sorted"+p+pt,"{cellId, descending, offset, limit, ...props}: "+ne+`<'${e}'>`,Q+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${t}, ${h});`,ml(e,13)+", sorted"+ge),K(l+p+pt,`props: ${ae}<'${e}'>`,Q+"(props, "+u+`(props.${M}), ${t}, ${h});`,ml(e,13)+ge),N(e,((n,d,s,r,I)=>{const $="Map"+Dl(d,1);c(0,L,$),c(1,L,$),q(i+l+I+p+w,i+p+w,o,`Gets ${ol(1)}the '${n}' Cell anywhere in `+Cl(e)+ge,a,Gl(t,r)),q(i+l+I+w,i+w,o,fl(e,n,0,1)+ge,bt,Gl(t,st,r));const u=q(l+I+w,w,d+(P(s)?Ne:a),fl(e,n)+ge,bt,Gl(t,st,r));q(ze+l+I+w+fe,ze+w+fe,ot,fl(e,n,9)+at,Gl(bt,Ql(w)+lt+d+" | "+$,Ql(w)+xe),Gl(t,st,r,ql(w)),dt,Gl(ct,`cell: ${d} | ${$})`+Xe,Yl),it),q(ye+l+I+w+fe,ye+w+fe,fe,fl(e,n,12),Gl(bt,"forceDel?: boolean"),Gl(t,st,r,"forceDel"),a,ut,it),K(l+I+w+pt,`{rowId, ${M}, debugIds}: `+le+`<'${e}', '${n}'>`,[oe+`('' + ${u}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],fl(e,n,13)+ge)}))}));const ce=W(E((e=>$e(Z,e)?.[4]??a))," | ");q(i+C+$,i+C+$,Ke,rl(1,8,0,1)+" changes",Ct(I),ht()),q(C+$,C+$,Ke,rl(1,8)+" changes",Ct(y),ht()),q(h+$,h+$,Ke,pl(2,0,1),Ct(v),ht()),q(i+p+$,i+p+$,Ke,pl(3,0,0,1),Ct(x,`tableId: ${n} | null`),ht("tableId")),q(p+$,p+$,Ke,pl(3,0),Ct(A,`tableId: ${n} | null`),ht("tableId")),q(p+T+$,p+T+$,Ke,pl(14,3,1),Ct(k,`tableId: ${n} | null`),ht("tableId")),q(i+p+w+$,i+p+w+$,Ke,pl(16,3,0,1),Ct(S,`tableId: ${n} | null`,`cellId: ${ce} | null`),ht("tableId","cellId")),q(m+Te+$,m+Te+$,Ke,pl(15,3),Ct(O,`tableId: ${n} | null`),ht("tableId")),q(g+$,g+$,Ke,pl(4,3,1),Ct(D,`tableId: ${n} | null`),ht("tableId")),q(f+$,f+$,Ke,pl(13,3,1),Ct(G,`tableId: ${n} | null`,"cellId: "+ce+Ne,"descending: boolean","offset: number","limit: number"+Ne),ht("tableId","cellId","descending","offset","limit")),q(i+m+$,i+m+$,Ke,pl(5,3,0,1),Ct(J,`tableId: ${n} | null`,st+": IdOrNull"),ht("tableId",st)),q(m+$,m+$,Ke,pl(5,3),Ct(z,`tableId: ${n} | null`,st+": IdOrNull"),ht("tableId",st)),q(T+$,T+$,Ke,pl(6,5,1),Ct(F,`tableId: ${n} | null`,st+": IdOrNull"),ht("tableId",st)),q(i+w+$,i+w+$,Ke,pl(7,5,0,1),Ct(U,`tableId: ${n} | null`,st+": IdOrNull",`cellId: ${ce} | null`),ht("tableId",st,"cellId")),q(w+$,w+$,Ke,pl(7,5),Ct(_,`tableId: ${n} | null`,st+": IdOrNull",`cellId: ${ce} | null`),ht("tableId",st,"cellId"))}if(!ne(l)){const[e,l,t,n,d,s,I,b]=r;c(null,L,...r),c(1,L,H);const p=V("getDefaultValueComponent","valueId: Id",W(D(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+re);q(i+v,i+v,o,rl(2,0,0,1)+ge),q(v,v,e,rl(2,0)+ge);const C=q(x,x,t+Be,$l(y,Fe)+ge);q(ze+v+fe,ze+v+fe,ot,rl(2,9)+at,Gl(Ql(v)+lt+l,Ql(v)+xe),ql(v),dt,Gl(ct,`values: ${l})`+Xe,Yl),it),q(ze+R+v+fe,ze+R+v+fe,ot,rl(2,11)+at,Gl(Ql(R+v)+lt+l,Ql(R+v)+xe),ql(R+v),dt,Gl(ct,`partialValues: ${l})`+Xe,Yl),it),q(ye+v+fe,ye+v+fe,fe,rl(2,12),a,a,a,ut,it);const h=u(y+Le,Ml("valueId?: VId",M+Ee+H,Kl),ul("a Value"),`<VId extends ${t}>`),m=u(v+Le,Ml(M+Ee+H,"valueComponents?: {readonly [VId in "+t+`]?: ComponentType<${h}<VId>>;}`,`getValueComponentProps?: (valueId: ${t}) => ExtraProps`,$t,Kl),ul(sl(2,1)));c(1,j,m,h),K(v+pt,"{"+M+", valueComponents, getValueComponentProps"+It+"}: "+m,[oe+`(${C}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+p+"(valueId);","return <Value",`{...${de}(getValueComponentProps, valueId)}`,"key={valueId}",B,Xl,"/>;","}), separator)"],rl(2,13)+ge),D(((e,l,t,n,d)=>{const s="Map"+Dl(l,1);c(0,L,s),c(1,L,s),q(i+d+y,i+y,o,wl(e,0,1)+ge,a,n);const r=q(d+y,y,l,wl(e)+ge,a,n);q(ze+d+y+fe,ze+y+fe,ot,wl(e,9)+at,Gl(Ql(y)+lt+l+" | "+s,Ql(y)+xe),Gl(n,ql(y)),dt,Gl(ct,`value: ${l} | ${s})`+Xe,Yl),it),q(ye+d+y+fe,ye+y+fe,fe,wl(e,12),a,n,a,ut,it),K(d+y+pt,`{${M}, debugIds}: ${h}<'${e}'>`,[oe+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],wl(e,13)+ge)})),q(i+v+$,i+v+$,Ke,rl(2,8,0,1)+" changes",Ct(n),ht()),q(v+$,v+$,Ke,rl(2,8)+" changes",Ct(d),ht()),q(x+$,x+$,Ke,pl(10,0,1),Ct(s),ht()),q(i+y+$,i+y+$,Ke,pl(11,0,0,1),Ct(I,`valueId: ${t} | null`),ht("valueId")),q(y+$,y+$,Ke,pl(11,0),Ct(b,`valueId: ${t} | null`),ht("valueId"))}return K(je,`{${M}, ${M}ById, children}: `+ee+" & {readonly children: React.ReactNode}",["{",tt,"return (","<Context."+je,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${je}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[I(...k(0),...S(),...X(0)),I(...k(1),...O(),...X(1))]},gt=(e,l,t)=>{if(ne(e)&&ne(l))return[a,a,a,a];const[n,d,o,s]=Zl(e,l,t);return[n,d,...mt(e,l,t,o,s)]},ft=JSON.parse,wt="prettier/",Tt=wt+"plugins/",yt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},vt=zl((e=>{const l=()=>{const l=ft(e.getTablesSchemaJson());return!ne(l)||M(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=Ie();if(M(a,(l=>M(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=be(n,a,(()=>[H(d),Ie(),[0],0])),[s,r,[I]]=o,$=be(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),ie(r,d,$),o[3]++,s==H(d)})))))return l[t]={},se(n,(([e,,[,n],d],o)=>{l[t][o]={[r]:e,...d==j(a)?{[I]:n}:{}}})),1}))?l:{}},t=()=>{const l=ft(e.getValuesSchemaJson());return ne(l)&&e.forEachValue(((e,t)=>{l[e]={[r]:H(t)}})),l},a=e=>gt(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(wt+"standalone")).format,U(t,await import(Tt+"estree"),await import(Tt+"typescript"))}catch{n=async e=>e}return await G(B(a(e),(async(e,a)=>El(await n(e,{...yt,plugins:t,filepath:"_."+l[a]})))))};return le({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:j(e.getValueIds()),jsonLength:j(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));e.createTools=vt},"object"==typeof exports&&"undefined"!=typeof module?l(exports):"function"==typeof define&&define.amd?define(["exports"],l):l((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseTools={});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,r="",o=t(r),u=t(t),n="Listener",i="Result",l="Has",d="Ids",a="Table",c=a+"s",I=a+d,C="Row",p=C+"Count",b=C+d,w="Sorted"+C+d,R="Cell",h=R+d,k="Value",y=k+"s",S=k+d,g="Status",L=globalThis,m=e=>null==e,T=(e,s,t)=>m(e)?t?.():s(e),V=e=>t(e)==o,P=e=>t(e)==u,f=e=>e.length,v=()=>{},x=(e,s)=>e.every(s),B=(e,s)=>f(e)===f(s)&&x(e,((e,t)=>s[t]===e)),M=(e,s)=>e.map(s),q=(e,s,t)=>e.with(s,t),H=Object,z=e=>H.getPrototypeOf(e),Q=H.entries,O=e=>!m(e)&&T(z(e),(e=>e==H.prototype||m(z(e))),(()=>!0)),D=H.keys,F=(e,s)=>T(e,(e=>e[s])),E=(e,s)=>s in e,A=(e,s)=>{const t=Q(e);return f(t)===f(D(s))&&x(t,(([e,t])=>O(t)?!!O(s[e])&&A(s[e],t):s[e]===t))},{createContext:G,useContext:j,useEffect:U}=s;var W=(e=>(e[e.Store=0]="Store",e[e.Metrics=1]="Metrics",e[e.Indexes=2]="Indexes",e[e.Relationships=3]="Relationships",e[e.Queries=4]="Queries",e[e.Checkpoints=5]="Checkpoints",e[e.Persister=6]="Persister",e[e.Synchronizer=7]="Synchronizer",e))(W||{});const _=(N=()=>G([]),E(J=L,K="tinybase_uirc")||(J[K]=N()),J[K]);var J,K,N;const X=(e,s)=>{const t=j(_);return m(e)?t[2*s]:V(e)?F(t[2*s+1]??{},e):e},Y=(e,s)=>{const t=X(e,s);return m(e)||V(e)?t:e},Z=(e,s,t)=>{const{16:r,17:o}=j(_);U((()=>(r?.(t,e,s),()=>o?.(t,e))),[r,e,s,t,o])},$=e=>D(j(_)[2*e+1]??{}),ee=e=>Y(e,0),se=e=>Y(e,1),te=e=>Y(e,2),re=e=>Y(e,3),oe=e=>Y(e,4),ue=e=>Y(e,5),ne=e=>Y(e,6),ie=e=>Y(e,7),le=e=>e.toLowerCase();le(n);const de="Transaction";le(de);const{useCallback:ae,useEffect:ce,useMemo:Ie,useLayoutEffect:Ce,useRef:pe,useState:be,useSyncExternalStore:we}=s,Re=[],he=[{},[],[Re,void 0,Re],void 0,!1,0],ke=[A,B,([e,s,t],[r,o,u])=>s===o&&B(e,r)&&B(t,u)],ye=(e,s)=>e===s,Se=(e,s,t=Re)=>{const[,r]=be(),[o,u]=be();return ce((()=>{const t=e?s(e):void 0;return u(t),r([]),t?.destroy}),[e,...t]),o},ge=(e,s,...t)=>{const r=e?.["add"+s+n]?.(...t);return()=>e?.delListener(r)},Le=(e,s,t,o=Re)=>{const u=pe(he[t]),n=ae((()=>{const r=s?.[(4==t?"has":"get")+e]?.(...o)??he[t];return(ke[t]??ye)(r,u.current)?u.current:u.current=r}),[s,t,e,...o]),i=ae((u=>ge(s,(4==t?l:r)+e,...o,u)),[s,t,e,...o]);return we(i,n,n)},me=(e,s,t,r=Re,o=Re,...u)=>Ce((()=>ge(s,e,...o,t,...u)),[s,e,...o,...r,...u]),Te=(e,s,t,r=Re,o=v,u=Re,...n)=>{const i=ee(e);return ae((e=>T(i,(r=>T(t(e,r),(t=>o(r["set"+s](...Ve(n,r,e),t),t)))))),[i,s,...r,...u,...Pe(n)])},Ve=(e,s,t)=>M(e,(e=>P(e)?e(t,s):e)),Pe=e=>{return s=e=>!P(e),e.filter(s);var s},fe=(e,s,t=v,r=Re,...o)=>{const u=ee(e);return ae((e=>t(u?.["del"+s](...Ve(o,u,e)))),[u,s,...r,...Pe(o)])},ve=(e,s,t)=>{const r=ue(e);return ae((()=>r?.[s](t)),[r,s,t])},xe=e=>Le(I,ee(e),1),Be=(e,s)=>Le(b,ee(s),1,[e]),Me=(e,s,t,r=0,o,u)=>Le(w,ee(u),1,[e,s,t,r,o]),qe=(e,s,t)=>Le(h,ee(t),1,[e,s]),He=(e,s,t,r)=>Le(R,ee(r),3,[e,s,t]),ze=e=>Le(S,ee(e),1),Qe=(e,s)=>Le(k,ee(s),3,[e]),Oe=(e,s)=>Le("Metric",se(s),3,[e]),De=(e,s)=>Le("SliceIds",te(s),1,[e]),Fe=(e,s,t)=>Le("Slice"+b,te(t),1,[e,s]),Ee=(e,s,t)=>Le("RemoteRowId",re(t),3,[e,s]),Ae=(e,s,t)=>Le("Local"+b,re(t),1,[e,s]),Ge=(e,s,t)=>Le("Linked"+b,re(t),1,[e,s]),je=(e,s)=>Le(i+b,oe(s),1,[e]),Ue=(e,s,t,r=0,o,u)=>Le(i+w,oe(u),1,[e,s,t,r,o]),We=(e,s,t)=>Le(i+h,oe(t),1,[e,s]),_e=(e,s,t,r)=>Le(i+R,oe(r),3,[e,s,t]),Je=e=>Le("CheckpointIds",ue(e),2),Ke=(e,s)=>Le("Checkpoint",ue(s),3,[e]),Ne=e=>ve(e,"goBackward"),Xe=e=>ve(e,"goForward"),{PureComponent:Ye,Fragment:Ze,createElement:$e,useCallback:es,useLayoutEffect:ss,useRef:ts,useState:rs}=s,os=(e,...s)=>m(e)?{}:e(...s),us=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:ns,useContext:is,useMemo:ls,useState:ds}=s,as=(e,s,t,r,o)=>[t??s[2*e],{...s[2*e+1],...r,...o[e]}],cs=({tableId:e,store:s,rowComponent:t=Rs,getRowComponentProps:r,customCellIds:o,separator:u,debugIds:n},i)=>bs(M(i,(u=>$e(t,{...os(r,u),key:u,tableId:e,rowId:u,customCellIds:o,store:s,debugIds:n}))),u,n,e),Is=({queryId:e,queries:s,resultRowComponent:t=gs,getResultRowComponentProps:r,separator:o,debugIds:u},n)=>bs(M(n,(o=>$e(t,{...os(r,o),key:o,queryId:e,rowId:o,queries:s,debugIds:u}))),o,u,e),Cs=({relationshipId:e,relationships:s,rowComponent:t=Rs,getRowComponentProps:r,separator:o,debugIds:u},n,i)=>{const[l,d,a]=us(re(s),e),c=n(e,i,l);return bs(M(c,(e=>$e(t,{...os(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:u}))),o,u,i)},ps=e=>({checkpoints:s,checkpointComponent:t=Ls,getCheckpointComponentProps:r,separator:o,debugIds:u})=>{const n=ue(s);return bs(M(e(Je(n)),(e=>$e(t,{...os(r,e),key:e,checkpoints:n,checkpointId:e,debugIds:u}))),o)},bs=(e,s,t,r)=>{const o=m(s)||!Array.isArray(e)?e:M(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},ws=({tableId:e,rowId:s,cellId:t,store:o,debugIds:u})=>bs(r+(He(e,s,t,o)??r),void 0,u,t),Rs=({tableId:e,rowId:s,store:t,cellComponent:r=ws,getCellComponentProps:o,customCellIds:u,separator:n,debugIds:i})=>bs(M(((e,s,t,r)=>{const o=qe(s,t,r);return e??o})(u,e,s,t),(u=>$e(r,{...os(o,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:i}))),n,i,s),hs=e=>cs(e,Be(e.tableId,e.store)),ks=({valueId:e,store:s,debugIds:t})=>bs(r+(Qe(e,s)??r),void 0,t,e),ys=({indexId:e,sliceId:s,indexes:t,rowComponent:r=Rs,getRowComponentProps:o,separator:u,debugIds:n})=>{const[i,l,d]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(te(t),e),a=Fe(e,s,i);return bs(M(a,(e=>$e(r,{...os(o,e),key:e,tableId:d,rowId:e,store:l,debugIds:n}))),u,n,s)},Ss=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:u})=>bs(r+(_e(e,s,t,o)??r),void 0,u,t),gs=({queryId:e,rowId:s,queries:t,resultCellComponent:r=Ss,getResultCellComponentProps:o,separator:u,debugIds:n})=>bs(M(We(e,s,t),(u=>$e(r,{...os(o,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:n}))),u,n,s),Ls=({checkpoints:e,checkpointId:s,debugIds:t})=>bs(Ke(s,e)??r,void 0,t,s),ms=ps((e=>e[0])),Ts=ps((e=>m(e[1])?[]:[e[1]])),Vs=ps((e=>e[2]));e.BackwardCheckpointsView=ms,e.CellView=ws,e.CheckpointView=Ls,e.CurrentCheckpointView=Ts,e.ForwardCheckpointsView=Vs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ys,getSliceComponentProps:r,separator:o,debugIds:u})=>bs(M(De(e,s),(o=>$e(t,{...os(r,o),key:o,indexId:e,sliceId:o,indexes:s,debugIds:u}))),o,u,e),e.LinkedRowsView=e=>Cs(e,Ge,e.firstRowId),e.LocalRowsView=e=>Cs(e,Ae,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>bs(Oe(e,s)??r,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:u,relationships:n,relationshipsById:i,queries:l,queriesById:d,checkpoints:a,checkpointsById:c,persister:I,persistersById:C,synchronizer:p,synchronizersById:b,children:w})=>{const R=is(_),[h,k]=ds((()=>M([,,,,,,,,].fill(0),((e,s)=>({}))))),y=ns(((e,s,t)=>k((r=>F(r[e],s)==t?r:q(r,e,{...r[e],[s]:t})))),[]),S=ns(((e,s)=>k((t=>E(t[e],s)?q(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return $e(_.Provider,{value:ls((()=>[...as(W.Store,R,e,s,h),...as(W.Metrics,R,t,r,h),...as(W.Indexes,R,o,u,h),...as(W.Relationships,R,n,i,h),...as(W.Queries,R,l,d,h),...as(W.Checkpoints,R,a,c,h),...as(W.Persister,R,I,C,h),...as(W.Synchronizer,R,p,b,h),y,S]),[h,e,s,t,r,o,u,n,i,l,d,a,c,I,C,p,b,R,y,S])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=Rs,getRowComponentProps:o,debugIds:u})=>{const[n,i,,l]=us(re(t),e),d=Ee(e,s,n);return bs(m(l)||m(d)?null:$e(r,{...os(o,d),key:d,tableId:l,rowId:d,store:i,debugIds:u}),void 0,u,s)},e.ResultCellView=Ss,e.ResultRowView=gs,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>Is(o,Ue(o.queryId,e,s,t,r,o.queries)),e.ResultTableView=e=>Is(e,je(e.queryId,e.queries)),e.RowView=Rs,e.SliceView=ys,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>cs(o,Me(o.tableId,e,s,t,r,o.store)),e.TableView=hs,e.TablesView=({store:e,tableComponent:s=hs,getTableComponentProps:t,separator:r,debugIds:o})=>bs(M(xe(e),(r=>$e(s,{...os(t,r),key:r,tableId:r,store:e,debugIds:o}))),r),e.ValueView=ks,e.ValuesView=({store:e,valueComponent:s=ks,getValueComponentProps:t,separator:r,debugIds:o})=>bs(M(ze(e),(r=>$e(s,{...os(t,r),key:r,valueId:r,store:e,debugIds:o}))),r),e.useAddRowCallback=(e,s,t=Re,r,o=v,u=Re,n=!0)=>{const i=ee(r);return ae((t=>T(i,(r=>T(s(t,r),(s=>o(r.addRow(P(e)?e(t,r):e,s,n),r,s)))))),[i,e,...t,...u,n])},e.useCell=He,e.useCellIds=qe,e.useCellIdsListener=(e,s,t,r,o,u)=>me(h,ee(u),t,r,[e,s],o),e.useCellListener=(e,s,t,r,o,u,n)=>me(R,ee(n),r,o,[e,s,t],u),e.useCheckpoint=Ke,e.useCheckpointIds=Je,e.useCheckpointIdsListener=(e,s,t)=>me("CheckpointIds",ue(t),e,s),e.useCheckpointListener=(e,s,t,r)=>me("Checkpoint",ue(r),s,t,[e]),e.useCheckpoints=e=>X(e,5),e.useCheckpointsIds=()=>$(5),e.useCheckpointsOrCheckpointsById=ue,e.useCreateCheckpoints=(e,s,t)=>Se(e,s,t),e.useCreateIndexes=(e,s,t)=>Se(e,s,t),e.useCreateMergeableStore=(e,s=Re)=>Ie(e,s),e.useCreateMetrics=(e,s,t)=>Se(e,s,t),e.useCreatePersister=(e,s,t=Re,r,o=Re,u,n=Re)=>{const[,i]=be(),[l,d]=be();return ce((()=>{(async()=>{const t=e?await s(e):void 0;d(t),t&&r&&(async()=>{await r(t),i([])})()})()}),[e,...t,...o]),ce((()=>()=>{l&&(l.destroy(),u?.(l))}),[l,...n]),l},e.useCreateQueries=(e,s,t)=>Se(e,s,t),e.useCreateRelationships=(e,s,t)=>Se(e,s,t),e.useCreateStore=(e,s=Re)=>Ie(e,s),e.useCreateSynchronizer=(e,s,t=Re,r,o=Re)=>{const[u,n]=be();return ce((()=>{(async()=>{const t=e?await s(e):void 0;n(t)})()}),[e,...t]),ce((()=>()=>{u&&(u.destroy(),r?.(u))}),[u,...o]),u},e.useDelCellCallback=(e,s,t,r,o,u,n)=>fe(o,R,u,n,e,s,t,r),e.useDelRowCallback=(e,s,t,r,o)=>fe(t,C,r,o,e,s),e.useDelTableCallback=(e,s,t,r)=>fe(s,a,t,r,e),e.useDelTablesCallback=(e,s,t)=>fe(e,c,s,t),e.useDelValueCallback=(e,s,t,r)=>fe(s,k,t,r,e),e.useDelValuesCallback=(e,s,t)=>fe(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>me("DidFinish"+de,ee(t),e,s),e.useGoBackwardCallback=Ne,e.useGoForwardCallback=Xe,e.useGoToCallback=(e,s=Re,t,r=v,o=Re)=>{const u=ue(t);return ae((s=>T(u,(t=>T(e(s),(e=>r(t.goTo(e),e)))))),[u,...s,...o])},e.useHasCell=(e,s,t,r)=>Le(R,ee(r),4,[e,s,t]),e.useHasCellListener=(e,s,t,r,o,u,n)=>me(l+R,ee(n),r,o,[e,s,t],u),e.useHasRow=(e,s,t)=>Le(C,ee(t),4,[e,s]),e.useHasRowListener=(e,s,t,r,o,u)=>me(l+C,ee(u),t,r,[e,s],o),e.useHasTable=(e,s)=>Le(a,ee(s),4,[e]),e.useHasTableCell=(e,s,t)=>Le(a+R,ee(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,r,o,u)=>me(l+a+R,ee(u),t,r,[e,s],o),e.useHasTableListener=(e,s,t,r,o)=>me(l+a,ee(o),s,t,[e],r),e.useHasTables=e=>Le(c,ee(e),4,[]),e.useHasTablesListener=(e,s,t,r)=>me(l+c,ee(r),e,s,[],t),e.useHasValue=(e,s)=>Le(k,ee(s),4,[e]),e.useHasValueListener=(e,s,t,r,o)=>me(l+k,ee(o),s,t,[e],r),e.useHasValues=e=>Le(y,ee(e),4,[]),e.useHasValuesListener=(e,s,t,r)=>me(l+y,ee(r),e,s,[],t),e.useIndexIds=e=>Le("IndexIds",te(e),1),e.useIndexes=e=>X(e,2),e.useIndexesIds=()=>$(2),e.useIndexesOrIndexesById=te,e.useLinkedRowIds=Ge,e.useLinkedRowIdsListener=(e,s,t,r,o)=>me("Linked"+b,re(o),t,r,[e,s]),e.useLocalRowIds=Ae,e.useLocalRowIdsListener=(e,s,t,r,o)=>me("Local"+b,re(o),t,r,[e,s]),e.useMetric=Oe,e.useMetricIds=e=>Le("MetricIds",se(e),1),e.useMetricListener=(e,s,t,r)=>me("Metric",se(r),s,t,[e]),e.useMetrics=e=>X(e,1),e.useMetricsIds=()=>$(1),e.useMetricsOrMetricsById=se,e.usePersister=e=>X(e,6),e.usePersisterIds=()=>$(6),e.usePersisterOrPersisterById=ne,e.usePersisterStatus=e=>Le(g,ne(e),5,[]),e.usePersisterStatusListener=(e,s,t)=>me(g,ne(t),e,s,[]),e.useProvideCheckpoints=(e,s)=>Z(e,s,5),e.useProvideIndexes=(e,s)=>Z(e,s,2),e.useProvideMetrics=(e,s)=>Z(e,s,1),e.useProvidePersister=(e,s)=>Z(e,s,6),e.useProvideQueries=(e,s)=>Z(e,s,4),e.useProvideRelationships=(e,s)=>Z(e,s,3),e.useProvideStore=(e,s)=>Z(e,s,0),e.useProvideSynchronizer=(e,s)=>Z(e,s,7),e.useQueries=e=>X(e,4),e.useQueriesIds=()=>$(4),e.useQueriesOrQueriesById=oe,e.useQueryIds=e=>Le("QueryIds",oe(e),1),e.useRedoInformation=e=>{const s=ue(e),[,,[t]]=Je(s);return[!m(t),Xe(s),t,T(t,(e=>s?.getCheckpoint(e)))??r]},e.useRelationshipIds=e=>Le("RelationshipIds",re(e),1),e.useRelationships=e=>X(e,3),e.useRelationshipsIds=()=>$(3),e.useRelationshipsOrRelationshipsById=re,e.useRemoteRowId=Ee,e.useRemoteRowIdListener=(e,s,t,r,o)=>me("RemoteRowId",re(o),t,r,[e,s]),e.useResultCell=_e,e.useResultCellIds=We,e.useResultCellIdsListener=(e,s,t,r,o)=>me(i+h,oe(o),t,r,[e,s]),e.useResultCellListener=(e,s,t,r,o,u)=>me(i+R,oe(u),r,o,[e,s,t]),e.useResultRow=(e,s,t)=>Le(i+C,oe(t),0,[e,s]),e.useResultRowCount=(e,s)=>Le(i+p,oe(s),5,[e]),e.useResultRowCountListener=(e,s,t,r)=>me(i+p,oe(r),s,t,[e]),e.useResultRowIds=je,e.useResultRowIdsListener=(e,s,t,r)=>me(i+b,oe(r),s,t,[e]),e.useResultRowListener=(e,s,t,r,o)=>me(i+C,oe(o),t,r,[e,s]),e.useResultSortedRowIds=Ue,e.useResultSortedRowIdsListener=(e,s,t,r,o,u,n,l)=>me(i+w,oe(l),u,n,[e,s,t,r,o]),e.useResultTable=(e,s)=>Le(i+a,oe(s),0,[e]),e.useResultTableCellIds=(e,s)=>Le(i+a+h,oe(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,r)=>me(i+a+h,oe(r),s,t,[e]),e.useResultTableListener=(e,s,t,r)=>me(i+a,oe(r),s,t,[e]),e.useRow=(e,s,t)=>Le(C,ee(t),0,[e,s]),e.useRowCount=(e,s)=>Le(p,ee(s),5,[e]),e.useRowCountListener=(e,s,t,r,o)=>me(p,ee(o),s,t,[e],r),e.useRowIds=Be,e.useRowIdsListener=(e,s,t,r,o)=>me(b,ee(o),s,t,[e],r),e.useRowListener=(e,s,t,r,o,u)=>me(C,ee(u),t,r,[e,s],o),e.useSetCellCallback=(e,s,t,r,o,u,n,i)=>Te(u,R,r,o,n,i,e,s,t),e.useSetCheckpointCallback=(e=v,s=Re,t,r=v,o=Re)=>{const u=ue(t);return ae((s=>T(u,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[u,...s,...o])},e.useSetPartialRowCallback=(e,s,t,r,o,u,n)=>Te(o,"PartialRow",t,r,u,n,e,s),e.useSetPartialValuesCallback=(e,s,t,r,o)=>Te(t,"PartialValues",e,s,r,o),e.useSetRowCallback=(e,s,t,r,o,u,n)=>Te(o,C,t,r,u,n,e,s),e.useSetTableCallback=(e,s,t,r,o,u)=>Te(r,a,s,t,o,u,e),e.useSetTablesCallback=(e,s,t,r,o)=>Te(t,c,e,s,r,o),e.useSetValueCallback=(e,s,t,r,o,u)=>Te(r,k,s,t,o,u,e),e.useSetValuesCallback=(e,s,t,r,o)=>Te(t,y,e,s,r,o),e.useSliceIds=De,e.useSliceIdsListener=(e,s,t,r)=>me("SliceIds",te(r),s,t,[e]),e.useSliceRowIds=Fe,e.useSliceRowIdsListener=(e,s,t,r,o)=>me("Slice"+b,te(o),t,r,[e,s]),e.useSortedRowIds=Me,e.useSortedRowIdsListener=(e,s,t,r,o,u,n,i,l)=>me(w,ee(l),u,n,[e,s,t,r,o],i),e.useStartTransactionListener=(e,s,t)=>me("Start"+de,ee(t),e,s),e.useStore=e=>X(e,0),e.useStoreIds=()=>$(0),e.useStoreOrStoreById=ee,e.useSynchronizer=e=>X(e,7),e.useSynchronizerIds=()=>$(7),e.useSynchronizerOrSynchronizerById=ie,e.useSynchronizerStatus=e=>Le(g,ie(e),5,[]),e.useSynchronizerStatusListener=(e,s,t)=>me(g,ie(t),e,s,[]),e.useTable=(e,s)=>Le(a,ee(s),0,[e]),e.useTableCellIds=(e,s)=>Le(a+h,ee(s),1,[e]),e.useTableCellIdsListener=(e,s,t,r,o)=>me(a+h,ee(o),s,t,[e],r),e.useTableIds=xe,e.useTableIdsListener=(e,s,t,r)=>me(I,ee(r),e,s,Re,t),e.useTableListener=(e,s,t,r,o)=>me(a,ee(o),s,t,[e],r),e.useTables=e=>Le(c,ee(e),0),e.useTablesListener=(e,s,t,r)=>me(c,ee(r),e,s,Re,t),e.useUndoInformation=e=>{const s=ue(e),[t,o]=Je(s);return[(u=t,!(0==f(u))),Ne(s),o,T(o,(e=>s?.getCheckpoint(e)))??r];var u},e.useValue=Qe,e.useValueIds=ze,e.useValueIdsListener=(e,s,t,r)=>me(S,ee(r),e,s,Re,t),e.useValueListener=(e,s,t,r,o)=>me(k,ee(o),s,t,[e],r),e.useValues=e=>Le(y,ee(e),0),e.useValuesListener=(e,s,t,r)=>me(y,ee(r),e,s,Re,t),e.useWillFinishTransactionListener=(e,s,t)=>me("WillFinish"+de,ee(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,r="",o=t(r),u=t(t),n="Result",l="Has",i="Ids",d="Table",a=d+"s",c=d+i,I="Row",C=I+"Count",p=I+i,b="Sorted"+I+i,w="Cell",R=w+i,k="Value",y=k+"s",h=k+i,g="Transaction",L="Partial",S="Finish",m="Status",T="Metric",V="Slice",P="RemoteRowId",v="Local",f="Linked",x="Checkpoint",B=globalThis,q=e=>null==e,H=(e,s,t)=>q(e)?t?.():s(e),M=e=>t(e)==o,z=e=>t(e)==u,O=e=>e.length,D=()=>{},Q=(e,s)=>e.every(s),F=(e,s)=>O(e)===O(s)&&Q(e,((e,t)=>s[t]===e)),E=(e,s)=>e.map(s),A=(e,s,t)=>e.with(s,t),{PureComponent:G,Fragment:j,createContext:U,createElement:W,useCallback:_,useContext:J,useEffect:K,useLayoutEffect:N,useMemo:X,useRef:Y,useState:Z,useSyncExternalStore:$}=s,ee=(e,...s)=>q(e)?{}:e(...s),se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],te=Object,re=e=>te.getPrototypeOf(e),oe=te.entries,ue=e=>!q(e)&&H(re(e),(e=>e==te.prototype||q(re(e))),(()=>!0)),ne=te.keys,le=(e,s)=>H(e,(e=>e[s])),ie=(e,s)=>s in e,de=(e,s)=>{const t=oe(e);return O(t)===O(ne(s))&&Q(t,(([e,t])=>ue(t)?!!ue(s[e])&&de(s[e],t):s[e]===t))},ae=(Ce=()=>U([]),ie(ce=B,Ie="tinybase_uirc")||(ce[Ie]=Ce()),ce[Ie]);var ce,Ie,Ce;const pe=(e,s)=>{const t=J(ae);return q(e)?t[2*s]:M(e)?le(t[2*s+1]??{},e):e},be=(e,s)=>{const t=pe(e,s);return q(e)||M(e)?t:e},we=(e,s,t)=>{const{16:r,17:o}=J(ae);K((()=>(r?.(t,e,s),()=>o?.(t,e))),[r,e,s,t,o])},Re=e=>ne(J(ae)[2*e+1]??{}),ke=e=>be(e,0),ye=e=>be(e,1),he=e=>be(e,2),ge=e=>be(e,3),Le=e=>be(e,4),Se=e=>be(e,5),me=e=>be(e,6),Te=e=>be(e,7),Ve=[],Pe=[{},[],[Ve,void 0,Ve],void 0,!1,0],ve=[de,F,([e,s,t],[r,o,u])=>s===o&&F(e,r)&&F(t,u)],fe=(e,s)=>e===s,xe=(e,s,t=Ve)=>{const[,r]=Z(),[o,u]=Z();return K((()=>{const t=e?s(e):void 0;return u(t),r([]),t?.destroy}),[e,...t]),o},Be=(e,s,...t)=>{const r=e?.["add"+s+"Listener"]?.(...t);return()=>e?.delListener(r)},qe=(e,s,t,o=Ve)=>{const u=Y(Pe[t]),n=_((()=>{const r=s?.[(4==t?"has":"get")+e]?.(...o)??Pe[t];return(ve[t]??fe)(r,u.current)?u.current:u.current=r}),[s,t,e,...o]),i=_((u=>Be(s,(4==t?l:r)+e,...o,u)),[s,t,e,...o]);return $(i,n,n)},He=(e,s,t,r=Ve,o=Ve,...u)=>N((()=>Be(s,e,...o,t,...u)),[s,e,...o,...r,...u]),Me=(e,s,t,r=Ve,o=D,u=Ve,...n)=>{const l=ke(e);return _((e=>H(l,(r=>H(t(e,r),(t=>o(r["set"+s](...ze(n,r,e),t),t)))))),[l,s,...r,...u,...Oe(n)])},ze=(e,s,t)=>E(e,(e=>z(e)?e(t,s):e)),Oe=e=>{return s=e=>!z(e),e.filter(s);var s},De=(e,s,t=D,r=Ve,...o)=>{const u=ke(e);return _((e=>t(u?.["del"+s](...ze(o,u,e)))),[u,s,...r,...Oe(o)])},Qe=(e,s,t)=>{const r=Se(e);return _((()=>r?.[s](t)),[r,s,t])},Fe=e=>qe(c,ke(e),1),Ee=(e,s)=>qe(p,ke(s),1,[e]),Ae=(e,s,t,r=0,o,u)=>qe(b,ke(u),1,[e,s,t,r,o]),Ge=(e,s,t)=>qe(R,ke(t),1,[e,s]),je=(e,s,t,r)=>qe(w,ke(r),3,[e,s,t]),Ue=e=>qe(h,ke(e),1),We=(e,s)=>qe(k,ke(s),3,[e]),_e=(e,s)=>qe(T,ye(s),3,[e]),Je=(e,s)=>qe(V+i,he(s),1,[e]),Ke=(e,s,t)=>qe(V+p,he(t),1,[e,s]),Ne=(e,s,t)=>qe(P,ge(t),3,[e,s]),Xe=(e,s,t)=>qe(v+p,ge(t),1,[e,s]),Ye=(e,s,t)=>qe(f+p,ge(t),1,[e,s]),Ze=(e,s)=>qe(n+p,Le(s),1,[e]),$e=(e,s,t,r=0,o,u)=>qe(n+b,Le(u),1,[e,s,t,r,o]),es=(e,s,t)=>qe(n+R,Le(t),1,[e,s]),ss=(e,s,t,r)=>qe(n+w,Le(r),3,[e,s,t]),ts=e=>qe(x+i,Se(e),2),rs=(e,s)=>qe(x,Se(s),3,[e]),os=e=>Qe(e,"goBackward"),us=e=>Qe(e,"goForward"),ns=(e,s,t,r,o)=>[t??s[2*e],{...s[2*e+1],...r,...o[e]}],ls=({tableId:e,store:s,rowComponent:t=Cs,getRowComponentProps:r,customCellIds:o,separator:u,debugIds:n},l)=>cs(E(l,(u=>W(t,{...ee(r,u),key:u,tableId:e,rowId:u,customCellIds:o,store:s,debugIds:n}))),u,n,e),is=({queryId:e,queries:s,resultRowComponent:t=ks,getResultRowComponentProps:r,separator:o,debugIds:u},n)=>cs(E(n,(o=>W(t,{...ee(r,o),key:o,queryId:e,rowId:o,queries:s,debugIds:u}))),o,u,e),ds=({relationshipId:e,relationships:s,rowComponent:t=Cs,getRowComponentProps:r,separator:o,debugIds:u},n,l)=>{const[i,d,a]=se(ge(s),e),c=n(e,l,i);return cs(E(c,(e=>W(t,{...ee(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:u}))),o,u,l)},as=e=>({checkpoints:s,checkpointComponent:t=ys,getCheckpointComponentProps:r,separator:o,debugIds:u})=>{const n=Se(s);return cs(E(e(ts(n)),(e=>W(t,{...ee(r,e),key:e,checkpoints:n,checkpointId:e,debugIds:u}))),o)},cs=(e,s,t,r)=>{const o=q(s)||!Array.isArray(e)?e:E(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},Is=({tableId:e,rowId:s,cellId:t,store:o,debugIds:u})=>cs(r+(je(e,s,t,o)??r),void 0,u,t),Cs=({tableId:e,rowId:s,store:t,cellComponent:r=Is,getCellComponentProps:o,customCellIds:u,separator:n,debugIds:l})=>cs(E(((e,s,t,r)=>{const o=Ge(s,t,r);return e??o})(u,e,s,t),(u=>W(r,{...ee(o,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),n,l,s),ps=e=>ls(e,Ee(e.tableId,e.store)),bs=({valueId:e,store:s,debugIds:t})=>cs(r+(We(e,s)??r),void 0,t,e),ws=({indexId:e,sliceId:s,indexes:t,rowComponent:r=Cs,getRowComponentProps:o,separator:u,debugIds:n})=>{const[l,i,d]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(he(t),e),a=Ke(e,s,l);return cs(E(a,(e=>W(r,{...ee(o,e),key:e,tableId:d,rowId:e,store:i,debugIds:n}))),u,n,s)},Rs=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:u})=>cs(r+(ss(e,s,t,o)??r),void 0,u,t),ks=({queryId:e,rowId:s,queries:t,resultCellComponent:r=Rs,getResultCellComponentProps:o,separator:u,debugIds:n})=>cs(E(es(e,s,t),(u=>W(r,{...ee(o,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:n}))),u,n,s),ys=({checkpoints:e,checkpointId:s,debugIds:t})=>cs(rs(s,e)??r,void 0,t,s),hs=as((e=>e[0])),gs=as((e=>q(e[1])?[]:[e[1]])),Ls=as((e=>e[2]));e.BackwardCheckpointsView=hs,e.CellView=Is,e.CheckpointView=ys,e.CurrentCheckpointView=gs,e.ForwardCheckpointsView=Ls,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ws,getSliceComponentProps:r,separator:o,debugIds:u})=>cs(E(Je(e,s),(o=>W(t,{...ee(r,o),key:o,indexId:e,sliceId:o,indexes:s,debugIds:u}))),o,u,e),e.LinkedRowsView=e=>ds(e,Ye,e.firstRowId),e.LocalRowsView=e=>ds(e,Xe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>cs(_e(e,s)??r,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:u,relationships:n,relationshipsById:l,queries:i,queriesById:d,checkpoints:a,checkpointsById:c,persister:I,persistersById:C,synchronizer:p,synchronizersById:b,children:w})=>{const R=J(ae),[k,y]=Z((()=>E([,,,,,,,,].fill(0),((e,s)=>({}))))),h=_(((e,s,t)=>y((r=>le(r[e],s)==t?r:A(r,e,{...r[e],[s]:t})))),[]),g=_(((e,s)=>y((t=>ie(t[e],s)?A(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return W(ae.Provider,{value:X((()=>[...ns(0,R,e,s,k),...ns(1,R,t,r,k),...ns(2,R,o,u,k),...ns(3,R,n,l,k),...ns(4,R,i,d,k),...ns(5,R,a,c,k),...ns(6,R,I,C,k),...ns(7,R,p,b,k),h,g]),[k,e,s,t,r,o,u,n,l,i,d,a,c,I,C,p,b,R,h,g])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=Cs,getRowComponentProps:o,debugIds:u})=>{const[n,l,,i]=se(ge(t),e),d=Ne(e,s,n);return cs(q(i)||q(d)?null:W(r,{...ee(o,d),key:d,tableId:i,rowId:d,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Rs,e.ResultRowView=ks,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>is(o,$e(o.queryId,e,s,t,r,o.queries)),e.ResultTableView=e=>is(e,Ze(e.queryId,e.queries)),e.RowView=Cs,e.SliceView=ws,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>ls(o,Ae(o.tableId,e,s,t,r,o.store)),e.TableView=ps,e.TablesView=({store:e,tableComponent:s=ps,getTableComponentProps:t,separator:r,debugIds:o})=>cs(E(Fe(e),(r=>W(s,{...ee(t,r),key:r,tableId:r,store:e,debugIds:o}))),r),e.ValueView=bs,e.ValuesView=({store:e,valueComponent:s=bs,getValueComponentProps:t,separator:r,debugIds:o})=>cs(E(Ue(e),(r=>W(s,{...ee(t,r),key:r,valueId:r,store:e,debugIds:o}))),r),e.useAddRowCallback=(e,s,t=Ve,r,o=D,u=Ve,n=!0)=>{const l=ke(r);return _((t=>H(l,(r=>H(s(t,r),(s=>o(r.addRow(z(e)?e(t,r):e,s,n),r,s)))))),[l,e,...t,...u,n])},e.useCell=je,e.useCellIds=Ge,e.useCellIdsListener=(e,s,t,r,o,u)=>He(R,ke(u),t,r,[e,s],o),e.useCellListener=(e,s,t,r,o,u,n)=>He(w,ke(n),r,o,[e,s,t],u),e.useCheckpoint=rs,e.useCheckpointIds=ts,e.useCheckpointIdsListener=(e,s,t)=>He(x+i,Se(t),e,s),e.useCheckpointListener=(e,s,t,r)=>He(x,Se(r),s,t,[e]),e.useCheckpoints=e=>pe(e,5),e.useCheckpointsIds=()=>Re(5),e.useCheckpointsOrCheckpointsById=Se,e.useCreateCheckpoints=(e,s,t)=>xe(e,s,t),e.useCreateIndexes=(e,s,t)=>xe(e,s,t),e.useCreateMergeableStore=(e,s=Ve)=>X(e,s),e.useCreateMetrics=(e,s,t)=>xe(e,s,t),e.useCreatePersister=(e,s,t=Ve,r,o=Ve,u,n=Ve)=>{const[,l]=Z(),[i,d]=Z();return K((()=>{(async()=>{const t=e?await s(e):void 0;d(t),t&&r&&(async()=>{await r(t),l([])})()})()}),[e,...t,...o]),K((()=>()=>{i&&(i.destroy(),u?.(i))}),[i,...n]),i},e.useCreateQueries=(e,s,t)=>xe(e,s,t),e.useCreateRelationships=(e,s,t)=>xe(e,s,t),e.useCreateStore=(e,s=Ve)=>X(e,s),e.useCreateSynchronizer=(e,s,t=Ve,r,o=Ve)=>{const[u,n]=Z();return K((()=>{(async()=>{const t=e?await s(e):void 0;n(t)})()}),[e,...t]),K((()=>()=>{u&&(u.destroy(),r?.(u))}),[u,...o]),u},e.useDelCellCallback=(e,s,t,r,o,u,n)=>De(o,w,u,n,e,s,t,r),e.useDelRowCallback=(e,s,t,r,o)=>De(t,I,r,o,e,s),e.useDelTableCallback=(e,s,t,r)=>De(s,d,t,r,e),e.useDelTablesCallback=(e,s,t)=>De(e,a,s,t),e.useDelValueCallback=(e,s,t,r)=>De(s,k,t,r,e),e.useDelValuesCallback=(e,s,t)=>De(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>He("Did"+S+g,ke(t),e,s),e.useGoBackwardCallback=os,e.useGoForwardCallback=us,e.useGoToCallback=(e,s=Ve,t,r=D,o=Ve)=>{const u=Se(t);return _((s=>H(u,(t=>H(e(s),(e=>r(t.goTo(e),e)))))),[u,...s,...o])},e.useHasCell=(e,s,t,r)=>qe(w,ke(r),4,[e,s,t]),e.useHasCellListener=(e,s,t,r,o,u,n)=>He(l+w,ke(n),r,o,[e,s,t],u),e.useHasRow=(e,s,t)=>qe(I,ke(t),4,[e,s]),e.useHasRowListener=(e,s,t,r,o,u)=>He(l+I,ke(u),t,r,[e,s],o),e.useHasTable=(e,s)=>qe(d,ke(s),4,[e]),e.useHasTableCell=(e,s,t)=>qe(d+w,ke(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,r,o,u)=>He(l+d+w,ke(u),t,r,[e,s],o),e.useHasTableListener=(e,s,t,r,o)=>He(l+d,ke(o),s,t,[e],r),e.useHasTables=e=>qe(a,ke(e),4,[]),e.useHasTablesListener=(e,s,t,r)=>He(l+a,ke(r),e,s,[],t),e.useHasValue=(e,s)=>qe(k,ke(s),4,[e]),e.useHasValueListener=(e,s,t,r,o)=>He(l+k,ke(o),s,t,[e],r),e.useHasValues=e=>qe(y,ke(e),4,[]),e.useHasValuesListener=(e,s,t,r)=>He(l+y,ke(r),e,s,[],t),e.useIndexIds=e=>qe("Index"+i,he(e),1),e.useIndexes=e=>pe(e,2),e.useIndexesIds=()=>Re(2),e.useIndexesOrIndexesById=he,e.useLinkedRowIds=Ye,e.useLinkedRowIdsListener=(e,s,t,r,o)=>He(f+p,ge(o),t,r,[e,s]),e.useLocalRowIds=Xe,e.useLocalRowIdsListener=(e,s,t,r,o)=>He(v+p,ge(o),t,r,[e,s]),e.useMetric=_e,e.useMetricIds=e=>qe(T+i,ye(e),1),e.useMetricListener=(e,s,t,r)=>He(T,ye(r),s,t,[e]),e.useMetrics=e=>pe(e,1),e.useMetricsIds=()=>Re(1),e.useMetricsOrMetricsById=ye,e.usePersister=e=>pe(e,6),e.usePersisterIds=()=>Re(6),e.usePersisterOrPersisterById=me,e.usePersisterStatus=e=>qe(m,me(e),5,[]),e.usePersisterStatusListener=(e,s,t)=>He(m,me(t),e,s,[]),e.useProvideCheckpoints=(e,s)=>we(e,s,5),e.useProvideIndexes=(e,s)=>we(e,s,2),e.useProvideMetrics=(e,s)=>we(e,s,1),e.useProvidePersister=(e,s)=>we(e,s,6),e.useProvideQueries=(e,s)=>we(e,s,4),e.useProvideRelationships=(e,s)=>we(e,s,3),e.useProvideStore=(e,s)=>we(e,s,0),e.useProvideSynchronizer=(e,s)=>we(e,s,7),e.useQueries=e=>pe(e,4),e.useQueriesIds=()=>Re(4),e.useQueriesOrQueriesById=Le,e.useQueryIds=e=>qe("Query"+i,Le(e),1),e.useRedoInformation=e=>{const s=Se(e),[,,[t]]=ts(s);return[!q(t),us(s),t,H(t,(e=>s?.getCheckpoint(e)))??r]},e.useRelationshipIds=e=>qe("Relationship"+i,ge(e),1),e.useRelationships=e=>pe(e,3),e.useRelationshipsIds=()=>Re(3),e.useRelationshipsOrRelationshipsById=ge,e.useRemoteRowId=Ne,e.useRemoteRowIdListener=(e,s,t,r,o)=>He(P,ge(o),t,r,[e,s]),e.useResultCell=ss,e.useResultCellIds=es,e.useResultCellIdsListener=(e,s,t,r,o)=>He(n+R,Le(o),t,r,[e,s]),e.useResultCellListener=(e,s,t,r,o,u)=>He(n+w,Le(u),r,o,[e,s,t]),e.useResultRow=(e,s,t)=>qe(n+I,Le(t),0,[e,s]),e.useResultRowCount=(e,s)=>qe(n+C,Le(s),5,[e]),e.useResultRowCountListener=(e,s,t,r)=>He(n+C,Le(r),s,t,[e]),e.useResultRowIds=Ze,e.useResultRowIdsListener=(e,s,t,r)=>He(n+p,Le(r),s,t,[e]),e.useResultRowListener=(e,s,t,r,o)=>He(n+I,Le(o),t,r,[e,s]),e.useResultSortedRowIds=$e,e.useResultSortedRowIdsListener=(e,s,t,r,o,u,l,i)=>He(n+b,Le(i),u,l,[e,s,t,r,o]),e.useResultTable=(e,s)=>qe(n+d,Le(s),0,[e]),e.useResultTableCellIds=(e,s)=>qe(n+d+R,Le(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,r)=>He(n+d+R,Le(r),s,t,[e]),e.useResultTableListener=(e,s,t,r)=>He(n+d,Le(r),s,t,[e]),e.useRow=(e,s,t)=>qe(I,ke(t),0,[e,s]),e.useRowCount=(e,s)=>qe(C,ke(s),5,[e]),e.useRowCountListener=(e,s,t,r,o)=>He(C,ke(o),s,t,[e],r),e.useRowIds=Ee,e.useRowIdsListener=(e,s,t,r,o)=>He(p,ke(o),s,t,[e],r),e.useRowListener=(e,s,t,r,o,u)=>He(I,ke(u),t,r,[e,s],o),e.useSetCellCallback=(e,s,t,r,o,u,n,l)=>Me(u,w,r,o,n,l,e,s,t),e.useSetCheckpointCallback=(e=D,s=Ve,t,r=D,o=Ve)=>{const u=Se(t);return _((s=>H(u,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[u,...s,...o])},e.useSetPartialRowCallback=(e,s,t,r,o,u,n)=>Me(o,L+I,t,r,u,n,e,s),e.useSetPartialValuesCallback=(e,s,t,r,o)=>Me(t,L+y,e,s,r,o),e.useSetRowCallback=(e,s,t,r,o,u,n)=>Me(o,I,t,r,u,n,e,s),e.useSetTableCallback=(e,s,t,r,o,u)=>Me(r,d,s,t,o,u,e),e.useSetTablesCallback=(e,s,t,r,o)=>Me(t,a,e,s,r,o),e.useSetValueCallback=(e,s,t,r,o,u)=>Me(r,k,s,t,o,u,e),e.useSetValuesCallback=(e,s,t,r,o)=>Me(t,y,e,s,r,o),e.useSliceIds=Je,e.useSliceIdsListener=(e,s,t,r)=>He(V+i,he(r),s,t,[e]),e.useSliceRowIds=Ke,e.useSliceRowIdsListener=(e,s,t,r,o)=>He(V+p,he(o),t,r,[e,s]),e.useSortedRowIds=Ae,e.useSortedRowIdsListener=(e,s,t,r,o,u,n,l,i)=>He(b,ke(i),u,n,[e,s,t,r,o],l),e.useStartTransactionListener=(e,s,t)=>He("Start"+g,ke(t),e,s),e.useStore=e=>pe(e,0),e.useStoreIds=()=>Re(0),e.useStoreOrStoreById=ke,e.useSynchronizer=e=>pe(e,7),e.useSynchronizerIds=()=>Re(7),e.useSynchronizerOrSynchronizerById=Te,e.useSynchronizerStatus=e=>qe(m,Te(e),5,[]),e.useSynchronizerStatusListener=(e,s,t)=>He(m,Te(t),e,s,[]),e.useTable=(e,s)=>qe(d,ke(s),0,[e]),e.useTableCellIds=(e,s)=>qe(d+R,ke(s),1,[e]),e.useTableCellIdsListener=(e,s,t,r,o)=>He(d+R,ke(o),s,t,[e],r),e.useTableIds=Fe,e.useTableIdsListener=(e,s,t,r)=>He(c,ke(r),e,s,Ve,t),e.useTableListener=(e,s,t,r,o)=>He(d,ke(o),s,t,[e],r),e.useTables=e=>qe(a,ke(e),0),e.useTablesListener=(e,s,t,r)=>He(a,ke(r),e,s,Ve,t),e.useUndoInformation=e=>{const s=Se(e),[t,o]=ts(s);return[(u=t,!(0==O(u))),os(s),o,H(o,(e=>s?.getCheckpoint(e)))??r];var u},e.useValue=We,e.useValueIds=Ue,e.useValueIdsListener=(e,s,t,r)=>He(h,ke(r),e,s,Ve,t),e.useValueListener=(e,s,t,r,o)=>He(k,ke(o),s,t,[e],r),e.useValues=e=>qe(y,ke(e),0),e.useValuesListener=(e,s,t,r)=>He(y,ke(r),e,s,Ve,t),e.useWillFinishTransactionListener=(e,s,t)=>He("Will"+S+g,ke(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,r="",o=t(r),u=t(t),n="Listener",i="Result",l="Has",d="Ids",a="Table",c=a+"s",I=a+d,C="Row",p=C+"Count",b=C+d,w="Sorted"+C+d,R="Cell",h=R+d,k="Value",y=k+"s",S=k+d,g="Status",L=globalThis,m=e=>null==e,T=(e,s,t)=>m(e)?t?.():s(e),V=e=>t(e)==o,P=e=>t(e)==u,f=e=>e.length,v=()=>{},x=(e,s)=>e.every(s),B=(e,s)=>f(e)===f(s)&&x(e,((e,t)=>s[t]===e)),M=(e,s)=>e.map(s),q=(e,s,t)=>e.with(s,t),H=Object,z=e=>H.getPrototypeOf(e),Q=H.entries,O=e=>!m(e)&&T(z(e),(e=>e==H.prototype||m(z(e))),(()=>!0)),D=H.keys,F=(e,s)=>T(e,(e=>e[s])),E=(e,s)=>s in e,A=(e,s)=>{const t=Q(e);return f(t)===f(D(s))&&x(t,(([e,t])=>O(t)?!!O(s[e])&&A(s[e],t):s[e]===t))},{createContext:G,useContext:j,useEffect:U}=s;var W=(e=>(e[e.Store=0]="Store",e[e.Metrics=1]="Metrics",e[e.Indexes=2]="Indexes",e[e.Relationships=3]="Relationships",e[e.Queries=4]="Queries",e[e.Checkpoints=5]="Checkpoints",e[e.Persister=6]="Persister",e[e.Synchronizer=7]="Synchronizer",e))(W||{});const _=(N=()=>G([]),E(J=L,K="tinybase_uirc")||(J[K]=N()),J[K]);var J,K,N;const X=(e,s)=>{const t=j(_);return m(e)?t[2*s]:V(e)?F(t[2*s+1]??{},e):e},Y=(e,s)=>{const t=X(e,s);return m(e)||V(e)?t:e},Z=(e,s,t)=>{const{16:r,17:o}=j(_);U((()=>(r?.(t,e,s),()=>o?.(t,e))),[r,e,s,t,o])},$=e=>D(j(_)[2*e+1]??{}),ee=e=>Y(e,0),se=e=>Y(e,1),te=e=>Y(e,2),re=e=>Y(e,3),oe=e=>Y(e,4),ue=e=>Y(e,5),ne=e=>Y(e,6),ie=e=>Y(e,7),le=e=>e.toLowerCase();le(n);const de="Transaction";le(de);const{useCallback:ae,useEffect:ce,useMemo:Ie,useLayoutEffect:Ce,useRef:pe,useState:be,useSyncExternalStore:we}=s,Re=[],he=[{},[],[Re,void 0,Re],void 0,!1,0],ke=[A,B,([e,s,t],[r,o,u])=>s===o&&B(e,r)&&B(t,u)],ye=(e,s)=>e===s,Se=(e,s,t=Re)=>{const[,r]=be(),[o,u]=be();return ce((()=>{const t=e?s(e):void 0;return u(t),r([]),t?.destroy}),[e,...t]),o},ge=(e,s,...t)=>{const r=e?.["add"+s+n]?.(...t);return()=>e?.delListener(r)},Le=(e,s,t,o=Re)=>{const u=pe(he[t]),n=ae((()=>{const r=s?.[(4==t?"has":"get")+e]?.(...o)??he[t];return(ke[t]??ye)(r,u.current)?u.current:u.current=r}),[s,t,e,...o]),i=ae((u=>ge(s,(4==t?l:r)+e,...o,u)),[s,t,e,...o]);return we(i,n,n)},me=(e,s,t,r=Re,o=Re,...u)=>Ce((()=>ge(s,e,...o,t,...u)),[s,e,...o,...r,...u]),Te=(e,s,t,r=Re,o=v,u=Re,...n)=>{const i=ee(e);return ae((e=>T(i,(r=>T(t(e,r),(t=>o(r["set"+s](...Ve(n,r,e),t),t)))))),[i,s,...r,...u,...Pe(n)])},Ve=(e,s,t)=>M(e,(e=>P(e)?e(t,s):e)),Pe=e=>{return s=e=>!P(e),e.filter(s);var s},fe=(e,s,t=v,r=Re,...o)=>{const u=ee(e);return ae((e=>t(u?.["del"+s](...Ve(o,u,e)))),[u,s,...r,...Pe(o)])},ve=(e,s,t)=>{const r=ue(e);return ae((()=>r?.[s](t)),[r,s,t])},xe=e=>Le(I,ee(e),1),Be=(e,s)=>Le(b,ee(s),1,[e]),Me=(e,s,t,r=0,o,u)=>Le(w,ee(u),1,[e,s,t,r,o]),qe=(e,s,t)=>Le(h,ee(t),1,[e,s]),He=(e,s,t,r)=>Le(R,ee(r),3,[e,s,t]),ze=e=>Le(S,ee(e),1),Qe=(e,s)=>Le(k,ee(s),3,[e]),Oe=(e,s)=>Le("Metric",se(s),3,[e]),De=(e,s)=>Le("SliceIds",te(s),1,[e]),Fe=(e,s,t)=>Le("Slice"+b,te(t),1,[e,s]),Ee=(e,s,t)=>Le("RemoteRowId",re(t),3,[e,s]),Ae=(e,s,t)=>Le("Local"+b,re(t),1,[e,s]),Ge=(e,s,t)=>Le("Linked"+b,re(t),1,[e,s]),je=(e,s)=>Le(i+b,oe(s),1,[e]),Ue=(e,s,t,r=0,o,u)=>Le(i+w,oe(u),1,[e,s,t,r,o]),We=(e,s,t)=>Le(i+h,oe(t),1,[e,s]),_e=(e,s,t,r)=>Le(i+R,oe(r),3,[e,s,t]),Je=e=>Le("CheckpointIds",ue(e),2),Ke=(e,s)=>Le("Checkpoint",ue(s),3,[e]),Ne=e=>ve(e,"goBackward"),Xe=e=>ve(e,"goForward"),{PureComponent:Ye,Fragment:Ze,createElement:$e,useCallback:es,useLayoutEffect:ss,useRef:ts,useState:rs}=s,os=(e,...s)=>m(e)?{}:e(...s),us=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],{useCallback:ns,useContext:is,useMemo:ls,useState:ds}=s,as=(e,s,t,r,o)=>[t??s[2*e],{...s[2*e+1],...r,...o[e]}],cs=({tableId:e,store:s,rowComponent:t=Rs,getRowComponentProps:r,customCellIds:o,separator:u,debugIds:n},i)=>bs(M(i,(u=>$e(t,{...os(r,u),key:u,tableId:e,rowId:u,customCellIds:o,store:s,debugIds:n}))),u,n,e),Is=({queryId:e,queries:s,resultRowComponent:t=gs,getResultRowComponentProps:r,separator:o,debugIds:u},n)=>bs(M(n,(o=>$e(t,{...os(r,o),key:o,queryId:e,rowId:o,queries:s,debugIds:u}))),o,u,e),Cs=({relationshipId:e,relationships:s,rowComponent:t=Rs,getRowComponentProps:r,separator:o,debugIds:u},n,i)=>{const[l,d,a]=us(re(s),e),c=n(e,i,l);return bs(M(c,(e=>$e(t,{...os(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:u}))),o,u,i)},ps=e=>({checkpoints:s,checkpointComponent:t=Ls,getCheckpointComponentProps:r,separator:o,debugIds:u})=>{const n=ue(s);return bs(M(e(Je(n)),(e=>$e(t,{...os(r,e),key:e,checkpoints:n,checkpointId:e,debugIds:u}))),o)},bs=(e,s,t,r)=>{const o=m(s)||!Array.isArray(e)?e:M(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},ws=({tableId:e,rowId:s,cellId:t,store:o,debugIds:u})=>bs(r+(He(e,s,t,o)??r),void 0,u,t),Rs=({tableId:e,rowId:s,store:t,cellComponent:r=ws,getCellComponentProps:o,customCellIds:u,separator:n,debugIds:i})=>bs(M(((e,s,t,r)=>{const o=qe(s,t,r);return e??o})(u,e,s,t),(u=>$e(r,{...os(o,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:i}))),n,i,s),hs=e=>cs(e,Be(e.tableId,e.store)),ks=({valueId:e,store:s,debugIds:t})=>bs(r+(Qe(e,s)??r),void 0,t,e),ys=({indexId:e,sliceId:s,indexes:t,rowComponent:r=Rs,getRowComponentProps:o,separator:u,debugIds:n})=>{const[i,l,d]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(te(t),e),a=Fe(e,s,i);return bs(M(a,(e=>$e(r,{...os(o,e),key:e,tableId:d,rowId:e,store:l,debugIds:n}))),u,n,s)},Ss=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:u})=>bs(r+(_e(e,s,t,o)??r),void 0,u,t),gs=({queryId:e,rowId:s,queries:t,resultCellComponent:r=Ss,getResultCellComponentProps:o,separator:u,debugIds:n})=>bs(M(We(e,s,t),(u=>$e(r,{...os(o,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:n}))),u,n,s),Ls=({checkpoints:e,checkpointId:s,debugIds:t})=>bs(Ke(s,e)??r,void 0,t,s),ms=ps((e=>e[0])),Ts=ps((e=>m(e[1])?[]:[e[1]])),Vs=ps((e=>e[2]));e.BackwardCheckpointsView=ms,e.CellView=ws,e.CheckpointView=Ls,e.CurrentCheckpointView=Ts,e.ForwardCheckpointsView=Vs,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ys,getSliceComponentProps:r,separator:o,debugIds:u})=>bs(M(De(e,s),(o=>$e(t,{...os(r,o),key:o,indexId:e,sliceId:o,indexes:s,debugIds:u}))),o,u,e),e.LinkedRowsView=e=>Cs(e,Ge,e.firstRowId),e.LocalRowsView=e=>Cs(e,Ae,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>bs(Oe(e,s)??r,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:u,relationships:n,relationshipsById:i,queries:l,queriesById:d,checkpoints:a,checkpointsById:c,persister:I,persistersById:C,synchronizer:p,synchronizersById:b,children:w})=>{const R=is(_),[h,k]=ds((()=>M([,,,,,,,,].fill(0),((e,s)=>({}))))),y=ns(((e,s,t)=>k((r=>F(r[e],s)==t?r:q(r,e,{...r[e],[s]:t})))),[]),S=ns(((e,s)=>k((t=>E(t[e],s)?q(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return $e(_.Provider,{value:ls((()=>[...as(W.Store,R,e,s,h),...as(W.Metrics,R,t,r,h),...as(W.Indexes,R,o,u,h),...as(W.Relationships,R,n,i,h),...as(W.Queries,R,l,d,h),...as(W.Checkpoints,R,a,c,h),...as(W.Persister,R,I,C,h),...as(W.Synchronizer,R,p,b,h),y,S]),[h,e,s,t,r,o,u,n,i,l,d,a,c,I,C,p,b,R,y,S])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=Rs,getRowComponentProps:o,debugIds:u})=>{const[n,i,,l]=us(re(t),e),d=Ee(e,s,n);return bs(m(l)||m(d)?null:$e(r,{...os(o,d),key:d,tableId:l,rowId:d,store:i,debugIds:u}),void 0,u,s)},e.ResultCellView=Ss,e.ResultRowView=gs,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>Is(o,Ue(o.queryId,e,s,t,r,o.queries)),e.ResultTableView=e=>Is(e,je(e.queryId,e.queries)),e.RowView=Rs,e.SliceView=ys,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>cs(o,Me(o.tableId,e,s,t,r,o.store)),e.TableView=hs,e.TablesView=({store:e,tableComponent:s=hs,getTableComponentProps:t,separator:r,debugIds:o})=>bs(M(xe(e),(r=>$e(s,{...os(t,r),key:r,tableId:r,store:e,debugIds:o}))),r),e.ValueView=ks,e.ValuesView=({store:e,valueComponent:s=ks,getValueComponentProps:t,separator:r,debugIds:o})=>bs(M(ze(e),(r=>$e(s,{...os(t,r),key:r,valueId:r,store:e,debugIds:o}))),r),e.useAddRowCallback=(e,s,t=Re,r,o=v,u=Re,n=!0)=>{const i=ee(r);return ae((t=>T(i,(r=>T(s(t,r),(s=>o(r.addRow(P(e)?e(t,r):e,s,n),r,s)))))),[i,e,...t,...u,n])},e.useCell=He,e.useCellIds=qe,e.useCellIdsListener=(e,s,t,r,o,u)=>me(h,ee(u),t,r,[e,s],o),e.useCellListener=(e,s,t,r,o,u,n)=>me(R,ee(n),r,o,[e,s,t],u),e.useCheckpoint=Ke,e.useCheckpointIds=Je,e.useCheckpointIdsListener=(e,s,t)=>me("CheckpointIds",ue(t),e,s),e.useCheckpointListener=(e,s,t,r)=>me("Checkpoint",ue(r),s,t,[e]),e.useCheckpoints=e=>X(e,5),e.useCheckpointsIds=()=>$(5),e.useCheckpointsOrCheckpointsById=ue,e.useCreateCheckpoints=(e,s,t)=>Se(e,s,t),e.useCreateIndexes=(e,s,t)=>Se(e,s,t),e.useCreateMergeableStore=(e,s=Re)=>Ie(e,s),e.useCreateMetrics=(e,s,t)=>Se(e,s,t),e.useCreatePersister=(e,s,t=Re,r,o=Re,u,n=Re)=>{const[,i]=be(),[l,d]=be();return ce((()=>{(async()=>{const t=e?await s(e):void 0;d(t),t&&r&&(async()=>{await r(t),i([])})()})()}),[e,...t,...o]),ce((()=>()=>{l&&(l.destroy(),u?.(l))}),[l,...n]),l},e.useCreateQueries=(e,s,t)=>Se(e,s,t),e.useCreateRelationships=(e,s,t)=>Se(e,s,t),e.useCreateStore=(e,s=Re)=>Ie(e,s),e.useCreateSynchronizer=(e,s,t=Re,r,o=Re)=>{const[u,n]=be();return ce((()=>{(async()=>{const t=e?await s(e):void 0;n(t)})()}),[e,...t]),ce((()=>()=>{u&&(u.destroy(),r?.(u))}),[u,...o]),u},e.useDelCellCallback=(e,s,t,r,o,u,n)=>fe(o,R,u,n,e,s,t,r),e.useDelRowCallback=(e,s,t,r,o)=>fe(t,C,r,o,e,s),e.useDelTableCallback=(e,s,t,r)=>fe(s,a,t,r,e),e.useDelTablesCallback=(e,s,t)=>fe(e,c,s,t),e.useDelValueCallback=(e,s,t,r)=>fe(s,k,t,r,e),e.useDelValuesCallback=(e,s,t)=>fe(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>me("DidFinish"+de,ee(t),e,s),e.useGoBackwardCallback=Ne,e.useGoForwardCallback=Xe,e.useGoToCallback=(e,s=Re,t,r=v,o=Re)=>{const u=ue(t);return ae((s=>T(u,(t=>T(e(s),(e=>r(t.goTo(e),e)))))),[u,...s,...o])},e.useHasCell=(e,s,t,r)=>Le(R,ee(r),4,[e,s,t]),e.useHasCellListener=(e,s,t,r,o,u,n)=>me(l+R,ee(n),r,o,[e,s,t],u),e.useHasRow=(e,s,t)=>Le(C,ee(t),4,[e,s]),e.useHasRowListener=(e,s,t,r,o,u)=>me(l+C,ee(u),t,r,[e,s],o),e.useHasTable=(e,s)=>Le(a,ee(s),4,[e]),e.useHasTableCell=(e,s,t)=>Le(a+R,ee(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,r,o,u)=>me(l+a+R,ee(u),t,r,[e,s],o),e.useHasTableListener=(e,s,t,r,o)=>me(l+a,ee(o),s,t,[e],r),e.useHasTables=e=>Le(c,ee(e),4,[]),e.useHasTablesListener=(e,s,t,r)=>me(l+c,ee(r),e,s,[],t),e.useHasValue=(e,s)=>Le(k,ee(s),4,[e]),e.useHasValueListener=(e,s,t,r,o)=>me(l+k,ee(o),s,t,[e],r),e.useHasValues=e=>Le(y,ee(e),4,[]),e.useHasValuesListener=(e,s,t,r)=>me(l+y,ee(r),e,s,[],t),e.useIndexIds=e=>Le("IndexIds",te(e),1),e.useIndexes=e=>X(e,2),e.useIndexesIds=()=>$(2),e.useIndexesOrIndexesById=te,e.useLinkedRowIds=Ge,e.useLinkedRowIdsListener=(e,s,t,r,o)=>me("Linked"+b,re(o),t,r,[e,s]),e.useLocalRowIds=Ae,e.useLocalRowIdsListener=(e,s,t,r,o)=>me("Local"+b,re(o),t,r,[e,s]),e.useMetric=Oe,e.useMetricIds=e=>Le("MetricIds",se(e),1),e.useMetricListener=(e,s,t,r)=>me("Metric",se(r),s,t,[e]),e.useMetrics=e=>X(e,1),e.useMetricsIds=()=>$(1),e.useMetricsOrMetricsById=se,e.usePersister=e=>X(e,6),e.usePersisterIds=()=>$(6),e.usePersisterOrPersisterById=ne,e.usePersisterStatus=e=>Le(g,ne(e),5,[]),e.usePersisterStatusListener=(e,s,t)=>me(g,ne(t),e,s,[]),e.useProvideCheckpoints=(e,s)=>Z(e,s,5),e.useProvideIndexes=(e,s)=>Z(e,s,2),e.useProvideMetrics=(e,s)=>Z(e,s,1),e.useProvidePersister=(e,s)=>Z(e,s,6),e.useProvideQueries=(e,s)=>Z(e,s,4),e.useProvideRelationships=(e,s)=>Z(e,s,3),e.useProvideStore=(e,s)=>Z(e,s,0),e.useProvideSynchronizer=(e,s)=>Z(e,s,7),e.useQueries=e=>X(e,4),e.useQueriesIds=()=>$(4),e.useQueriesOrQueriesById=oe,e.useQueryIds=e=>Le("QueryIds",oe(e),1),e.useRedoInformation=e=>{const s=ue(e),[,,[t]]=Je(s);return[!m(t),Xe(s),t,T(t,(e=>s?.getCheckpoint(e)))??r]},e.useRelationshipIds=e=>Le("RelationshipIds",re(e),1),e.useRelationships=e=>X(e,3),e.useRelationshipsIds=()=>$(3),e.useRelationshipsOrRelationshipsById=re,e.useRemoteRowId=Ee,e.useRemoteRowIdListener=(e,s,t,r,o)=>me("RemoteRowId",re(o),t,r,[e,s]),e.useResultCell=_e,e.useResultCellIds=We,e.useResultCellIdsListener=(e,s,t,r,o)=>me(i+h,oe(o),t,r,[e,s]),e.useResultCellListener=(e,s,t,r,o,u)=>me(i+R,oe(u),r,o,[e,s,t]),e.useResultRow=(e,s,t)=>Le(i+C,oe(t),0,[e,s]),e.useResultRowCount=(e,s)=>Le(i+p,oe(s),5,[e]),e.useResultRowCountListener=(e,s,t,r)=>me(i+p,oe(r),s,t,[e]),e.useResultRowIds=je,e.useResultRowIdsListener=(e,s,t,r)=>me(i+b,oe(r),s,t,[e]),e.useResultRowListener=(e,s,t,r,o)=>me(i+C,oe(o),t,r,[e,s]),e.useResultSortedRowIds=Ue,e.useResultSortedRowIdsListener=(e,s,t,r,o,u,n,l)=>me(i+w,oe(l),u,n,[e,s,t,r,o]),e.useResultTable=(e,s)=>Le(i+a,oe(s),0,[e]),e.useResultTableCellIds=(e,s)=>Le(i+a+h,oe(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,r)=>me(i+a+h,oe(r),s,t,[e]),e.useResultTableListener=(e,s,t,r)=>me(i+a,oe(r),s,t,[e]),e.useRow=(e,s,t)=>Le(C,ee(t),0,[e,s]),e.useRowCount=(e,s)=>Le(p,ee(s),5,[e]),e.useRowCountListener=(e,s,t,r,o)=>me(p,ee(o),s,t,[e],r),e.useRowIds=Be,e.useRowIdsListener=(e,s,t,r,o)=>me(b,ee(o),s,t,[e],r),e.useRowListener=(e,s,t,r,o,u)=>me(C,ee(u),t,r,[e,s],o),e.useSetCellCallback=(e,s,t,r,o,u,n,i)=>Te(u,R,r,o,n,i,e,s,t),e.useSetCheckpointCallback=(e=v,s=Re,t,r=v,o=Re)=>{const u=ue(t);return ae((s=>T(u,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[u,...s,...o])},e.useSetPartialRowCallback=(e,s,t,r,o,u,n)=>Te(o,"PartialRow",t,r,u,n,e,s),e.useSetPartialValuesCallback=(e,s,t,r,o)=>Te(t,"PartialValues",e,s,r,o),e.useSetRowCallback=(e,s,t,r,o,u,n)=>Te(o,C,t,r,u,n,e,s),e.useSetTableCallback=(e,s,t,r,o,u)=>Te(r,a,s,t,o,u,e),e.useSetTablesCallback=(e,s,t,r,o)=>Te(t,c,e,s,r,o),e.useSetValueCallback=(e,s,t,r,o,u)=>Te(r,k,s,t,o,u,e),e.useSetValuesCallback=(e,s,t,r,o)=>Te(t,y,e,s,r,o),e.useSliceIds=De,e.useSliceIdsListener=(e,s,t,r)=>me("SliceIds",te(r),s,t,[e]),e.useSliceRowIds=Fe,e.useSliceRowIdsListener=(e,s,t,r,o)=>me("Slice"+b,te(o),t,r,[e,s]),e.useSortedRowIds=Me,e.useSortedRowIdsListener=(e,s,t,r,o,u,n,i,l)=>me(w,ee(l),u,n,[e,s,t,r,o],i),e.useStartTransactionListener=(e,s,t)=>me("Start"+de,ee(t),e,s),e.useStore=e=>X(e,0),e.useStoreIds=()=>$(0),e.useStoreOrStoreById=ee,e.useSynchronizer=e=>X(e,7),e.useSynchronizerIds=()=>$(7),e.useSynchronizerOrSynchronizerById=ie,e.useSynchronizerStatus=e=>Le(g,ie(e),5,[]),e.useSynchronizerStatusListener=(e,s,t)=>me(g,ie(t),e,s,[]),e.useTable=(e,s)=>Le(a,ee(s),0,[e]),e.useTableCellIds=(e,s)=>Le(a+h,ee(s),1,[e]),e.useTableCellIdsListener=(e,s,t,r,o)=>me(a+h,ee(o),s,t,[e],r),e.useTableIds=xe,e.useTableIdsListener=(e,s,t,r)=>me(I,ee(r),e,s,Re,t),e.useTableListener=(e,s,t,r,o)=>me(a,ee(o),s,t,[e],r),e.useTables=e=>Le(c,ee(e),0),e.useTablesListener=(e,s,t,r)=>me(c,ee(r),e,s,Re,t),e.useUndoInformation=e=>{const s=ue(e),[t,o]=Je(s);return[(u=t,!(0==f(u))),Ne(s),o,T(o,(e=>s?.getCheckpoint(e)))??r];var u},e.useValue=Qe,e.useValueIds=ze,e.useValueIdsListener=(e,s,t,r)=>me(S,ee(r),e,s,Re,t),e.useValueListener=(e,s,t,r,o)=>me(k,ee(o),s,t,[e],r),e.useValues=e=>Le(y,ee(e),0),e.useValuesListener=(e,s,t,r)=>me(y,ee(r),e,s,Re,t),e.useWillFinishTransactionListener=(e,s,t)=>me("WillFinish"+de,ee(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
1
|
+
var e,s;e=this,s=function(e,s){"use strict";const t=e=>typeof e,r="",o=t(r),u=t(t),n="Result",l="Has",i="Ids",d="Table",a=d+"s",c=d+i,I="Row",C=I+"Count",p=I+i,b="Sorted"+I+i,w="Cell",R=w+i,k="Value",y=k+"s",h=k+i,g="Transaction",L="Partial",S="Finish",m="Status",T="Metric",V="Slice",P="RemoteRowId",v="Local",f="Linked",x="Checkpoint",B=globalThis,q=e=>null==e,H=(e,s,t)=>q(e)?t?.():s(e),M=e=>t(e)==o,z=e=>t(e)==u,O=e=>e.length,D=()=>{},Q=(e,s)=>e.every(s),F=(e,s)=>O(e)===O(s)&&Q(e,((e,t)=>s[t]===e)),E=(e,s)=>e.map(s),A=(e,s,t)=>e.with(s,t),{PureComponent:G,Fragment:j,createContext:U,createElement:W,useCallback:_,useContext:J,useEffect:K,useLayoutEffect:N,useMemo:X,useRef:Y,useState:Z,useSyncExternalStore:$}=s,ee=(e,...s)=>q(e)?{}:e(...s),se=(e,s)=>[e,e?.getStore(),e?.getLocalTableId(s),e?.getRemoteTableId(s)],te=Object,re=e=>te.getPrototypeOf(e),oe=te.entries,ue=e=>!q(e)&&H(re(e),(e=>e==te.prototype||q(re(e))),(()=>!0)),ne=te.keys,le=(e,s)=>H(e,(e=>e[s])),ie=(e,s)=>s in e,de=(e,s)=>{const t=oe(e);return O(t)===O(ne(s))&&Q(t,(([e,t])=>ue(t)?!!ue(s[e])&&de(s[e],t):s[e]===t))},ae=(Ce=()=>U([]),ie(ce=B,Ie="tinybase_uirc")||(ce[Ie]=Ce()),ce[Ie]);var ce,Ie,Ce;const pe=(e,s)=>{const t=J(ae);return q(e)?t[2*s]:M(e)?le(t[2*s+1]??{},e):e},be=(e,s)=>{const t=pe(e,s);return q(e)||M(e)?t:e},we=(e,s,t)=>{const{16:r,17:o}=J(ae);K((()=>(r?.(t,e,s),()=>o?.(t,e))),[r,e,s,t,o])},Re=e=>ne(J(ae)[2*e+1]??{}),ke=e=>be(e,0),ye=e=>be(e,1),he=e=>be(e,2),ge=e=>be(e,3),Le=e=>be(e,4),Se=e=>be(e,5),me=e=>be(e,6),Te=e=>be(e,7),Ve=[],Pe=[{},[],[Ve,void 0,Ve],void 0,!1,0],ve=[de,F,([e,s,t],[r,o,u])=>s===o&&F(e,r)&&F(t,u)],fe=(e,s)=>e===s,xe=(e,s,t=Ve)=>{const[,r]=Z(),[o,u]=Z();return K((()=>{const t=e?s(e):void 0;return u(t),r([]),t?.destroy}),[e,...t]),o},Be=(e,s,...t)=>{const r=e?.["add"+s+"Listener"]?.(...t);return()=>e?.delListener(r)},qe=(e,s,t,o=Ve)=>{const u=Y(Pe[t]),n=_((()=>{const r=s?.[(4==t?"has":"get")+e]?.(...o)??Pe[t];return(ve[t]??fe)(r,u.current)?u.current:u.current=r}),[s,t,e,...o]),i=_((u=>Be(s,(4==t?l:r)+e,...o,u)),[s,t,e,...o]);return $(i,n,n)},He=(e,s,t,r=Ve,o=Ve,...u)=>N((()=>Be(s,e,...o,t,...u)),[s,e,...o,...r,...u]),Me=(e,s,t,r=Ve,o=D,u=Ve,...n)=>{const l=ke(e);return _((e=>H(l,(r=>H(t(e,r),(t=>o(r["set"+s](...ze(n,r,e),t),t)))))),[l,s,...r,...u,...Oe(n)])},ze=(e,s,t)=>E(e,(e=>z(e)?e(t,s):e)),Oe=e=>{return s=e=>!z(e),e.filter(s);var s},De=(e,s,t=D,r=Ve,...o)=>{const u=ke(e);return _((e=>t(u?.["del"+s](...ze(o,u,e)))),[u,s,...r,...Oe(o)])},Qe=(e,s,t)=>{const r=Se(e);return _((()=>r?.[s](t)),[r,s,t])},Fe=e=>qe(c,ke(e),1),Ee=(e,s)=>qe(p,ke(s),1,[e]),Ae=(e,s,t,r=0,o,u)=>qe(b,ke(u),1,[e,s,t,r,o]),Ge=(e,s,t)=>qe(R,ke(t),1,[e,s]),je=(e,s,t,r)=>qe(w,ke(r),3,[e,s,t]),Ue=e=>qe(h,ke(e),1),We=(e,s)=>qe(k,ke(s),3,[e]),_e=(e,s)=>qe(T,ye(s),3,[e]),Je=(e,s)=>qe(V+i,he(s),1,[e]),Ke=(e,s,t)=>qe(V+p,he(t),1,[e,s]),Ne=(e,s,t)=>qe(P,ge(t),3,[e,s]),Xe=(e,s,t)=>qe(v+p,ge(t),1,[e,s]),Ye=(e,s,t)=>qe(f+p,ge(t),1,[e,s]),Ze=(e,s)=>qe(n+p,Le(s),1,[e]),$e=(e,s,t,r=0,o,u)=>qe(n+b,Le(u),1,[e,s,t,r,o]),es=(e,s,t)=>qe(n+R,Le(t),1,[e,s]),ss=(e,s,t,r)=>qe(n+w,Le(r),3,[e,s,t]),ts=e=>qe(x+i,Se(e),2),rs=(e,s)=>qe(x,Se(s),3,[e]),os=e=>Qe(e,"goBackward"),us=e=>Qe(e,"goForward"),ns=(e,s,t,r,o)=>[t??s[2*e],{...s[2*e+1],...r,...o[e]}],ls=({tableId:e,store:s,rowComponent:t=Cs,getRowComponentProps:r,customCellIds:o,separator:u,debugIds:n},l)=>cs(E(l,(u=>W(t,{...ee(r,u),key:u,tableId:e,rowId:u,customCellIds:o,store:s,debugIds:n}))),u,n,e),is=({queryId:e,queries:s,resultRowComponent:t=ks,getResultRowComponentProps:r,separator:o,debugIds:u},n)=>cs(E(n,(o=>W(t,{...ee(r,o),key:o,queryId:e,rowId:o,queries:s,debugIds:u}))),o,u,e),ds=({relationshipId:e,relationships:s,rowComponent:t=Cs,getRowComponentProps:r,separator:o,debugIds:u},n,l)=>{const[i,d,a]=se(ge(s),e),c=n(e,l,i);return cs(E(c,(e=>W(t,{...ee(r,e),key:e,tableId:a,rowId:e,store:d,debugIds:u}))),o,u,l)},as=e=>({checkpoints:s,checkpointComponent:t=ys,getCheckpointComponentProps:r,separator:o,debugIds:u})=>{const n=Se(s);return cs(E(e(ts(n)),(e=>W(t,{...ee(r,e),key:e,checkpoints:n,checkpointId:e,debugIds:u}))),o)},cs=(e,s,t,r)=>{const o=q(s)||!Array.isArray(e)?e:E(e,((e,t)=>t>0?[s,e]:e));return t?[r,":{",o,"}"]:o},Is=({tableId:e,rowId:s,cellId:t,store:o,debugIds:u})=>cs(r+(je(e,s,t,o)??r),void 0,u,t),Cs=({tableId:e,rowId:s,store:t,cellComponent:r=Is,getCellComponentProps:o,customCellIds:u,separator:n,debugIds:l})=>cs(E(((e,s,t,r)=>{const o=Ge(s,t,r);return e??o})(u,e,s,t),(u=>W(r,{...ee(o,u),key:u,tableId:e,rowId:s,cellId:u,store:t,debugIds:l}))),n,l,s),ps=e=>ls(e,Ee(e.tableId,e.store)),bs=({valueId:e,store:s,debugIds:t})=>cs(r+(We(e,s)??r),void 0,t,e),ws=({indexId:e,sliceId:s,indexes:t,rowComponent:r=Cs,getRowComponentProps:o,separator:u,debugIds:n})=>{const[l,i,d]=((e,s)=>[e,e?.getStore(),e?.getTableId(s)])(he(t),e),a=Ke(e,s,l);return cs(E(a,(e=>W(r,{...ee(o,e),key:e,tableId:d,rowId:e,store:i,debugIds:n}))),u,n,s)},Rs=({queryId:e,rowId:s,cellId:t,queries:o,debugIds:u})=>cs(r+(ss(e,s,t,o)??r),void 0,u,t),ks=({queryId:e,rowId:s,queries:t,resultCellComponent:r=Rs,getResultCellComponentProps:o,separator:u,debugIds:n})=>cs(E(es(e,s,t),(u=>W(r,{...ee(o,u),key:u,queryId:e,rowId:s,cellId:u,queries:t,debugIds:n}))),u,n,s),ys=({checkpoints:e,checkpointId:s,debugIds:t})=>cs(rs(s,e)??r,void 0,t,s),hs=as((e=>e[0])),gs=as((e=>q(e[1])?[]:[e[1]])),Ls=as((e=>e[2]));e.BackwardCheckpointsView=hs,e.CellView=Is,e.CheckpointView=ys,e.CurrentCheckpointView=gs,e.ForwardCheckpointsView=Ls,e.IndexView=({indexId:e,indexes:s,sliceComponent:t=ws,getSliceComponentProps:r,separator:o,debugIds:u})=>cs(E(Je(e,s),(o=>W(t,{...ee(r,o),key:o,indexId:e,sliceId:o,indexes:s,debugIds:u}))),o,u,e),e.LinkedRowsView=e=>ds(e,Ye,e.firstRowId),e.LocalRowsView=e=>ds(e,Xe,e.remoteRowId),e.MetricView=({metricId:e,metrics:s,debugIds:t})=>cs(_e(e,s)??r,void 0,t,e),e.Provider=({store:e,storesById:s,metrics:t,metricsById:r,indexes:o,indexesById:u,relationships:n,relationshipsById:l,queries:i,queriesById:d,checkpoints:a,checkpointsById:c,persister:I,persistersById:C,synchronizer:p,synchronizersById:b,children:w})=>{const R=J(ae),[k,y]=Z((()=>E([,,,,,,,,].fill(0),((e,s)=>({}))))),h=_(((e,s,t)=>y((r=>le(r[e],s)==t?r:A(r,e,{...r[e],[s]:t})))),[]),g=_(((e,s)=>y((t=>ie(t[e],s)?A(t,e,((e,s)=>(delete e[s],e))(t[e],s)):t))),[]);return W(ae.Provider,{value:X((()=>[...ns(0,R,e,s,k),...ns(1,R,t,r,k),...ns(2,R,o,u,k),...ns(3,R,n,l,k),...ns(4,R,i,d,k),...ns(5,R,a,c,k),...ns(6,R,I,C,k),...ns(7,R,p,b,k),h,g]),[k,e,s,t,r,o,u,n,l,i,d,a,c,I,C,p,b,R,h,g])},w)},e.RemoteRowView=({relationshipId:e,localRowId:s,relationships:t,rowComponent:r=Cs,getRowComponentProps:o,debugIds:u})=>{const[n,l,,i]=se(ge(t),e),d=Ne(e,s,n);return cs(q(i)||q(d)?null:W(r,{...ee(o,d),key:d,tableId:i,rowId:d,store:l,debugIds:u}),void 0,u,s)},e.ResultCellView=Rs,e.ResultRowView=ks,e.ResultSortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>is(o,$e(o.queryId,e,s,t,r,o.queries)),e.ResultTableView=e=>is(e,Ze(e.queryId,e.queries)),e.RowView=Cs,e.SliceView=ws,e.SortedTableView=({cellId:e,descending:s,offset:t,limit:r,...o})=>ls(o,Ae(o.tableId,e,s,t,r,o.store)),e.TableView=ps,e.TablesView=({store:e,tableComponent:s=ps,getTableComponentProps:t,separator:r,debugIds:o})=>cs(E(Fe(e),(r=>W(s,{...ee(t,r),key:r,tableId:r,store:e,debugIds:o}))),r),e.ValueView=bs,e.ValuesView=({store:e,valueComponent:s=bs,getValueComponentProps:t,separator:r,debugIds:o})=>cs(E(Ue(e),(r=>W(s,{...ee(t,r),key:r,valueId:r,store:e,debugIds:o}))),r),e.useAddRowCallback=(e,s,t=Ve,r,o=D,u=Ve,n=!0)=>{const l=ke(r);return _((t=>H(l,(r=>H(s(t,r),(s=>o(r.addRow(z(e)?e(t,r):e,s,n),r,s)))))),[l,e,...t,...u,n])},e.useCell=je,e.useCellIds=Ge,e.useCellIdsListener=(e,s,t,r,o,u)=>He(R,ke(u),t,r,[e,s],o),e.useCellListener=(e,s,t,r,o,u,n)=>He(w,ke(n),r,o,[e,s,t],u),e.useCheckpoint=rs,e.useCheckpointIds=ts,e.useCheckpointIdsListener=(e,s,t)=>He(x+i,Se(t),e,s),e.useCheckpointListener=(e,s,t,r)=>He(x,Se(r),s,t,[e]),e.useCheckpoints=e=>pe(e,5),e.useCheckpointsIds=()=>Re(5),e.useCheckpointsOrCheckpointsById=Se,e.useCreateCheckpoints=(e,s,t)=>xe(e,s,t),e.useCreateIndexes=(e,s,t)=>xe(e,s,t),e.useCreateMergeableStore=(e,s=Ve)=>X(e,s),e.useCreateMetrics=(e,s,t)=>xe(e,s,t),e.useCreatePersister=(e,s,t=Ve,r,o=Ve,u,n=Ve)=>{const[,l]=Z(),[i,d]=Z();return K((()=>{(async()=>{const t=e?await s(e):void 0;d(t),t&&r&&(async()=>{await r(t),l([])})()})()}),[e,...t,...o]),K((()=>()=>{i&&(i.destroy(),u?.(i))}),[i,...n]),i},e.useCreateQueries=(e,s,t)=>xe(e,s,t),e.useCreateRelationships=(e,s,t)=>xe(e,s,t),e.useCreateStore=(e,s=Ve)=>X(e,s),e.useCreateSynchronizer=(e,s,t=Ve,r,o=Ve)=>{const[u,n]=Z();return K((()=>{(async()=>{const t=e?await s(e):void 0;n(t)})()}),[e,...t]),K((()=>()=>{u&&(u.destroy(),r?.(u))}),[u,...o]),u},e.useDelCellCallback=(e,s,t,r,o,u,n)=>De(o,w,u,n,e,s,t,r),e.useDelRowCallback=(e,s,t,r,o)=>De(t,I,r,o,e,s),e.useDelTableCallback=(e,s,t,r)=>De(s,d,t,r,e),e.useDelTablesCallback=(e,s,t)=>De(e,a,s,t),e.useDelValueCallback=(e,s,t,r)=>De(s,k,t,r,e),e.useDelValuesCallback=(e,s,t)=>De(e,y,s,t),e.useDidFinishTransactionListener=(e,s,t)=>He("Did"+S+g,ke(t),e,s),e.useGoBackwardCallback=os,e.useGoForwardCallback=us,e.useGoToCallback=(e,s=Ve,t,r=D,o=Ve)=>{const u=Se(t);return _((s=>H(u,(t=>H(e(s),(e=>r(t.goTo(e),e)))))),[u,...s,...o])},e.useHasCell=(e,s,t,r)=>qe(w,ke(r),4,[e,s,t]),e.useHasCellListener=(e,s,t,r,o,u,n)=>He(l+w,ke(n),r,o,[e,s,t],u),e.useHasRow=(e,s,t)=>qe(I,ke(t),4,[e,s]),e.useHasRowListener=(e,s,t,r,o,u)=>He(l+I,ke(u),t,r,[e,s],o),e.useHasTable=(e,s)=>qe(d,ke(s),4,[e]),e.useHasTableCell=(e,s,t)=>qe(d+w,ke(t),4,[e,s]),e.useHasTableCellListener=(e,s,t,r,o,u)=>He(l+d+w,ke(u),t,r,[e,s],o),e.useHasTableListener=(e,s,t,r,o)=>He(l+d,ke(o),s,t,[e],r),e.useHasTables=e=>qe(a,ke(e),4,[]),e.useHasTablesListener=(e,s,t,r)=>He(l+a,ke(r),e,s,[],t),e.useHasValue=(e,s)=>qe(k,ke(s),4,[e]),e.useHasValueListener=(e,s,t,r,o)=>He(l+k,ke(o),s,t,[e],r),e.useHasValues=e=>qe(y,ke(e),4,[]),e.useHasValuesListener=(e,s,t,r)=>He(l+y,ke(r),e,s,[],t),e.useIndexIds=e=>qe("Index"+i,he(e),1),e.useIndexes=e=>pe(e,2),e.useIndexesIds=()=>Re(2),e.useIndexesOrIndexesById=he,e.useLinkedRowIds=Ye,e.useLinkedRowIdsListener=(e,s,t,r,o)=>He(f+p,ge(o),t,r,[e,s]),e.useLocalRowIds=Xe,e.useLocalRowIdsListener=(e,s,t,r,o)=>He(v+p,ge(o),t,r,[e,s]),e.useMetric=_e,e.useMetricIds=e=>qe(T+i,ye(e),1),e.useMetricListener=(e,s,t,r)=>He(T,ye(r),s,t,[e]),e.useMetrics=e=>pe(e,1),e.useMetricsIds=()=>Re(1),e.useMetricsOrMetricsById=ye,e.usePersister=e=>pe(e,6),e.usePersisterIds=()=>Re(6),e.usePersisterOrPersisterById=me,e.usePersisterStatus=e=>qe(m,me(e),5,[]),e.usePersisterStatusListener=(e,s,t)=>He(m,me(t),e,s,[]),e.useProvideCheckpoints=(e,s)=>we(e,s,5),e.useProvideIndexes=(e,s)=>we(e,s,2),e.useProvideMetrics=(e,s)=>we(e,s,1),e.useProvidePersister=(e,s)=>we(e,s,6),e.useProvideQueries=(e,s)=>we(e,s,4),e.useProvideRelationships=(e,s)=>we(e,s,3),e.useProvideStore=(e,s)=>we(e,s,0),e.useProvideSynchronizer=(e,s)=>we(e,s,7),e.useQueries=e=>pe(e,4),e.useQueriesIds=()=>Re(4),e.useQueriesOrQueriesById=Le,e.useQueryIds=e=>qe("Query"+i,Le(e),1),e.useRedoInformation=e=>{const s=Se(e),[,,[t]]=ts(s);return[!q(t),us(s),t,H(t,(e=>s?.getCheckpoint(e)))??r]},e.useRelationshipIds=e=>qe("Relationship"+i,ge(e),1),e.useRelationships=e=>pe(e,3),e.useRelationshipsIds=()=>Re(3),e.useRelationshipsOrRelationshipsById=ge,e.useRemoteRowId=Ne,e.useRemoteRowIdListener=(e,s,t,r,o)=>He(P,ge(o),t,r,[e,s]),e.useResultCell=ss,e.useResultCellIds=es,e.useResultCellIdsListener=(e,s,t,r,o)=>He(n+R,Le(o),t,r,[e,s]),e.useResultCellListener=(e,s,t,r,o,u)=>He(n+w,Le(u),r,o,[e,s,t]),e.useResultRow=(e,s,t)=>qe(n+I,Le(t),0,[e,s]),e.useResultRowCount=(e,s)=>qe(n+C,Le(s),5,[e]),e.useResultRowCountListener=(e,s,t,r)=>He(n+C,Le(r),s,t,[e]),e.useResultRowIds=Ze,e.useResultRowIdsListener=(e,s,t,r)=>He(n+p,Le(r),s,t,[e]),e.useResultRowListener=(e,s,t,r,o)=>He(n+I,Le(o),t,r,[e,s]),e.useResultSortedRowIds=$e,e.useResultSortedRowIdsListener=(e,s,t,r,o,u,l,i)=>He(n+b,Le(i),u,l,[e,s,t,r,o]),e.useResultTable=(e,s)=>qe(n+d,Le(s),0,[e]),e.useResultTableCellIds=(e,s)=>qe(n+d+R,Le(s),1,[e]),e.useResultTableCellIdsListener=(e,s,t,r)=>He(n+d+R,Le(r),s,t,[e]),e.useResultTableListener=(e,s,t,r)=>He(n+d,Le(r),s,t,[e]),e.useRow=(e,s,t)=>qe(I,ke(t),0,[e,s]),e.useRowCount=(e,s)=>qe(C,ke(s),5,[e]),e.useRowCountListener=(e,s,t,r,o)=>He(C,ke(o),s,t,[e],r),e.useRowIds=Ee,e.useRowIdsListener=(e,s,t,r,o)=>He(p,ke(o),s,t,[e],r),e.useRowListener=(e,s,t,r,o,u)=>He(I,ke(u),t,r,[e,s],o),e.useSetCellCallback=(e,s,t,r,o,u,n,l)=>Me(u,w,r,o,n,l,e,s,t),e.useSetCheckpointCallback=(e=D,s=Ve,t,r=D,o=Ve)=>{const u=Se(t);return _((s=>H(u,(t=>{const o=e(s);r(t.addCheckpoint(o),t,o)}))),[u,...s,...o])},e.useSetPartialRowCallback=(e,s,t,r,o,u,n)=>Me(o,L+I,t,r,u,n,e,s),e.useSetPartialValuesCallback=(e,s,t,r,o)=>Me(t,L+y,e,s,r,o),e.useSetRowCallback=(e,s,t,r,o,u,n)=>Me(o,I,t,r,u,n,e,s),e.useSetTableCallback=(e,s,t,r,o,u)=>Me(r,d,s,t,o,u,e),e.useSetTablesCallback=(e,s,t,r,o)=>Me(t,a,e,s,r,o),e.useSetValueCallback=(e,s,t,r,o,u)=>Me(r,k,s,t,o,u,e),e.useSetValuesCallback=(e,s,t,r,o)=>Me(t,y,e,s,r,o),e.useSliceIds=Je,e.useSliceIdsListener=(e,s,t,r)=>He(V+i,he(r),s,t,[e]),e.useSliceRowIds=Ke,e.useSliceRowIdsListener=(e,s,t,r,o)=>He(V+p,he(o),t,r,[e,s]),e.useSortedRowIds=Ae,e.useSortedRowIdsListener=(e,s,t,r,o,u,n,l,i)=>He(b,ke(i),u,n,[e,s,t,r,o],l),e.useStartTransactionListener=(e,s,t)=>He("Start"+g,ke(t),e,s),e.useStore=e=>pe(e,0),e.useStoreIds=()=>Re(0),e.useStoreOrStoreById=ke,e.useSynchronizer=e=>pe(e,7),e.useSynchronizerIds=()=>Re(7),e.useSynchronizerOrSynchronizerById=Te,e.useSynchronizerStatus=e=>qe(m,Te(e),5,[]),e.useSynchronizerStatusListener=(e,s,t)=>He(m,Te(t),e,s,[]),e.useTable=(e,s)=>qe(d,ke(s),0,[e]),e.useTableCellIds=(e,s)=>qe(d+R,ke(s),1,[e]),e.useTableCellIdsListener=(e,s,t,r,o)=>He(d+R,ke(o),s,t,[e],r),e.useTableIds=Fe,e.useTableIdsListener=(e,s,t,r)=>He(c,ke(r),e,s,Ve,t),e.useTableListener=(e,s,t,r,o)=>He(d,ke(o),s,t,[e],r),e.useTables=e=>qe(a,ke(e),0),e.useTablesListener=(e,s,t,r)=>He(a,ke(r),e,s,Ve,t),e.useUndoInformation=e=>{const s=Se(e),[t,o]=ts(s);return[(u=t,!(0==O(u))),os(s),o,H(o,(e=>s?.getCheckpoint(e)))??r];var u},e.useValue=We,e.useValueIds=Ue,e.useValueIdsListener=(e,s,t,r)=>He(h,ke(r),e,s,Ve,t),e.useValueListener=(e,s,t,r,o)=>He(k,ke(o),s,t,[e],r),e.useValues=e=>qe(y,ke(e),0),e.useValuesListener=(e,s,t,r)=>He(y,ke(r),e,s,Ve,t),e.useWillFinishTransactionListener=(e,s,t)=>He("Will"+S+g,ke(t),e,s)},"object"==typeof exports&&"undefined"!=typeof module?s(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).TinyBaseUiReact={},e.React);
|
|
Binary file
|