tinybase 4.0.0 → 4.0.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/bin/cli.js +1 -1
- package/lib/checkpoints.js +1 -1
- package/lib/checkpoints.js.gz +0 -0
- package/lib/cjs/checkpoints.cjs +1 -1
- package/lib/cjs/checkpoints.cjs.gz +0 -0
- package/lib/cjs/indexes.cjs +1 -1
- package/lib/cjs/indexes.cjs.gz +0 -0
- package/lib/cjs/metrics.cjs +1 -1
- package/lib/cjs/metrics.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-browser.cjs +1 -1
- package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
- package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-file.cjs +1 -1
- package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-remote.cjs +1 -1
- package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
- package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
- package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs/relationships.cjs +1 -1
- package/lib/cjs/relationships.cjs.gz +0 -0
- package/lib/cjs/store.cjs +1 -1
- package/lib/cjs/store.cjs.gz +0 -0
- package/lib/cjs/tinybase.cjs +1 -1
- package/lib/cjs/tinybase.cjs.gz +0 -0
- package/lib/cjs/tools.cjs +1 -1
- package/lib/cjs/tools.cjs.gz +0 -0
- package/lib/cjs/ui-react.cjs +1 -1
- package/lib/cjs/ui-react.cjs.gz +0 -0
- package/lib/cjs-es6/checkpoints.cjs +1 -1
- package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
- package/lib/cjs-es6/indexes.cjs +1 -1
- package/lib/cjs-es6/indexes.cjs.gz +0 -0
- package/lib/cjs-es6/metrics.cjs +1 -1
- package/lib/cjs-es6/metrics.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-browser.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-file.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-remote.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
- package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
- package/lib/cjs-es6/relationships.cjs +1 -1
- package/lib/cjs-es6/relationships.cjs.gz +0 -0
- package/lib/cjs-es6/store.cjs +1 -1
- package/lib/cjs-es6/store.cjs.gz +0 -0
- package/lib/cjs-es6/tinybase.cjs +1 -1
- package/lib/cjs-es6/tinybase.cjs.gz +0 -0
- package/lib/cjs-es6/tools.cjs +1 -1
- package/lib/cjs-es6/tools.cjs.gz +0 -0
- package/lib/cjs-es6/ui-react.cjs +1 -1
- package/lib/cjs-es6/ui-react.cjs.gz +0 -0
- package/lib/debug/checkpoints.js +6 -6
- package/lib/debug/indexes.js +7 -7
- package/lib/debug/metrics.js +12 -12
- package/lib/debug/persisters/persister-browser.js +10 -19
- package/lib/debug/persisters/persister-cr-sqlite-wasm.js +183 -132
- package/lib/debug/persisters/persister-file.js +10 -19
- package/lib/debug/persisters/persister-remote.js +10 -19
- package/lib/debug/persisters/persister-sqlite-wasm.js +178 -131
- package/lib/debug/persisters/persister-sqlite3.js +178 -132
- package/lib/debug/persisters.js +4 -4
- package/lib/debug/relationships.js +7 -7
- package/lib/debug/store.js +16 -24
- package/lib/debug/tinybase.js +20 -28
- package/lib/debug/tools.js +14 -13
- package/lib/debug/ui-react.js +4 -4
- package/lib/es6/checkpoints.js +1 -1
- package/lib/es6/checkpoints.js.gz +0 -0
- package/lib/es6/indexes.js +1 -1
- package/lib/es6/indexes.js.gz +0 -0
- package/lib/es6/metrics.js +1 -1
- package/lib/es6/metrics.js.gz +0 -0
- package/lib/es6/persisters/persister-browser.js +1 -1
- package/lib/es6/persisters/persister-browser.js.gz +0 -0
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-file.js +1 -1
- package/lib/es6/persisters/persister-file.js.gz +0 -0
- package/lib/es6/persisters/persister-remote.js +1 -1
- package/lib/es6/persisters/persister-remote.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/es6/persisters/persister-sqlite3.js +1 -1
- package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/es6/relationships.js +1 -1
- package/lib/es6/relationships.js.gz +0 -0
- package/lib/es6/store.js +1 -1
- package/lib/es6/store.js.gz +0 -0
- package/lib/es6/tinybase.js +1 -1
- package/lib/es6/tinybase.js.gz +0 -0
- package/lib/es6/tools.js +1 -1
- package/lib/es6/tools.js.gz +0 -0
- package/lib/es6/ui-react.js +1 -1
- package/lib/es6/ui-react.js.gz +0 -0
- package/lib/indexes.js +1 -1
- package/lib/indexes.js.gz +0 -0
- package/lib/metrics.js +1 -1
- package/lib/metrics.js.gz +0 -0
- package/lib/persisters/persister-browser.js +1 -1
- package/lib/persisters/persister-browser.js.gz +0 -0
- package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-file.js +1 -1
- package/lib/persisters/persister-file.js.gz +0 -0
- package/lib/persisters/persister-remote.js +1 -1
- package/lib/persisters/persister-remote.js.gz +0 -0
- package/lib/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/persisters/persister-sqlite3.js +1 -1
- package/lib/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/relationships.js +1 -1
- package/lib/relationships.js.gz +0 -0
- package/lib/store.js +1 -1
- package/lib/store.js.gz +0 -0
- package/lib/tinybase.js +1 -1
- package/lib/tinybase.js.gz +0 -0
- package/lib/tools.js +1 -1
- package/lib/tools.js.gz +0 -0
- package/lib/types/persisters.d.ts +7 -0
- package/lib/types/with-schemas/persisters.d.ts +7 -0
- package/lib/ui-react.js +1 -1
- package/lib/ui-react.js.gz +0 -0
- package/lib/umd/checkpoints.js +1 -1
- package/lib/umd/checkpoints.js.gz +0 -0
- package/lib/umd/indexes.js +1 -1
- package/lib/umd/indexes.js.gz +0 -0
- package/lib/umd/metrics.js +1 -1
- package/lib/umd/metrics.js.gz +0 -0
- package/lib/umd/persisters/persister-browser.js +1 -1
- package/lib/umd/persisters/persister-browser.js.gz +0 -0
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-file.js +1 -1
- package/lib/umd/persisters/persister-file.js.gz +0 -0
- package/lib/umd/persisters/persister-remote.js +1 -1
- package/lib/umd/persisters/persister-remote.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd/persisters/persister-sqlite3.js +1 -1
- package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd/relationships.js +1 -1
- package/lib/umd/relationships.js.gz +0 -0
- package/lib/umd/store.js +1 -1
- package/lib/umd/store.js.gz +0 -0
- package/lib/umd/tinybase.js +1 -1
- package/lib/umd/tinybase.js.gz +0 -0
- package/lib/umd/tools.js +1 -1
- package/lib/umd/tools.js.gz +0 -0
- package/lib/umd/ui-react.js +1 -1
- package/lib/umd/ui-react.js.gz +0 -0
- package/lib/umd-es6/checkpoints.js +1 -1
- package/lib/umd-es6/checkpoints.js.gz +0 -0
- package/lib/umd-es6/indexes.js +1 -1
- package/lib/umd-es6/indexes.js.gz +0 -0
- package/lib/umd-es6/metrics.js +1 -1
- package/lib/umd-es6/metrics.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-browser.js +1 -1
- package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
- package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-file.js +1 -1
- package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-remote.js +1 -1
- package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
- package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
- package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
- package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
- package/lib/umd-es6/relationships.js +1 -1
- package/lib/umd-es6/relationships.js.gz +0 -0
- package/lib/umd-es6/store.js +1 -1
- package/lib/umd-es6/store.js.gz +0 -0
- package/lib/umd-es6/tinybase.js +1 -1
- package/lib/umd-es6/tinybase.js.gz +0 -0
- package/lib/umd-es6/tools.js +1 -1
- package/lib/umd-es6/tools.js.gz +0 -0
- package/lib/umd-es6/ui-react.js +1 -1
- package/lib/umd-es6/ui-react.js.gz +0 -0
- package/package.json +33 -33
- package/readme.md +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinybase",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinybase",
|
|
6
6
|
"license": "MIT",
|
|
@@ -211,80 +211,80 @@
|
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": {
|
|
213
213
|
"@automerge/automerge": "^2.1.0-alpha.6",
|
|
214
|
-
"@babel/cli": "^7.22.
|
|
215
|
-
"@babel/core": "^7.22.
|
|
216
|
-
"@babel/preset-env": "^7.22.
|
|
214
|
+
"@babel/cli": "^7.22.10",
|
|
215
|
+
"@babel/core": "^7.22.10",
|
|
216
|
+
"@babel/preset-env": "^7.22.10",
|
|
217
217
|
"@babel/preset-react": "^7.22.5",
|
|
218
218
|
"@babel/preset-typescript": "^7.22.5",
|
|
219
219
|
"@rollup/plugin-replace": "^5.0.2",
|
|
220
220
|
"@rollup/plugin-terser": "^0.4.3",
|
|
221
|
-
"@sqlite.org/sqlite-wasm": "^3.42.0-
|
|
221
|
+
"@sqlite.org/sqlite-wasm": "^3.42.0-build7",
|
|
222
222
|
"@types/asciichart": "^1.5.6",
|
|
223
223
|
"@types/expect-puppeteer": "^5.0.3",
|
|
224
224
|
"@types/http-server": "^0.12.1",
|
|
225
|
-
"@types/jest": "^29.5.
|
|
225
|
+
"@types/jest": "^29.5.3",
|
|
226
226
|
"@types/jest-environment-puppeteer": "^5.0.3",
|
|
227
227
|
"@types/less": "^3.0.3",
|
|
228
|
-
"@types/node": "^20.
|
|
228
|
+
"@types/node": "^20.4.9",
|
|
229
229
|
"@types/puppeteer": "^5.4.7",
|
|
230
|
-
"@types/react": "^18.2.
|
|
231
|
-
"@types/react-dom": "^18.2.
|
|
230
|
+
"@types/react": "^18.2.20",
|
|
231
|
+
"@types/react-dom": "^18.2.7",
|
|
232
232
|
"@types/react-test-renderer": "^18.0.0",
|
|
233
233
|
"@types/tmp": "^0.2.3",
|
|
234
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
235
|
-
"@typescript-eslint/parser": "^
|
|
236
|
-
"@vlcn.io/crsqlite-wasm": "^0.
|
|
234
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
235
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
236
|
+
"@vlcn.io/crsqlite-wasm": "^0.14.0",
|
|
237
237
|
"asciichart": "^1.5.25",
|
|
238
238
|
"automerge-repo": "^0.1.0",
|
|
239
239
|
"babel-eslint": "^10.1.0",
|
|
240
|
-
"babel-jest": "^29.
|
|
241
|
-
"babel-plugin-transform-import-meta": "^2.2.
|
|
240
|
+
"babel-jest": "^29.6.2",
|
|
241
|
+
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
242
242
|
"babel-preset-minify": "^0.5.2",
|
|
243
243
|
"buffer-replace": "^1.0.0",
|
|
244
244
|
"country-flag-emoji-json": "^2.0.0",
|
|
245
|
-
"cspell": "^
|
|
246
|
-
"esbuild": "^0.
|
|
247
|
-
"eslint": "^8.
|
|
248
|
-
"eslint-config-prettier": "^
|
|
249
|
-
"eslint-plugin-jest": "^27.2.
|
|
250
|
-
"eslint-plugin-jsdoc": "^46.4.
|
|
251
|
-
"eslint-plugin-react": "
|
|
245
|
+
"cspell": "^7.0.0",
|
|
246
|
+
"esbuild": "^0.19.0",
|
|
247
|
+
"eslint": "^8.46.0",
|
|
248
|
+
"eslint-config-prettier": "^9.0.0",
|
|
249
|
+
"eslint-plugin-jest": "^27.2.3",
|
|
250
|
+
"eslint-plugin-jsdoc": "^46.4.6",
|
|
251
|
+
"eslint-plugin-react": "7.32.2",
|
|
252
252
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
253
|
-
"fake-indexeddb": "^4.0.
|
|
253
|
+
"fake-indexeddb": "^4.0.2",
|
|
254
254
|
"gulp": "^4.0.2",
|
|
255
255
|
"gulp-gzip": "^1.4.2",
|
|
256
256
|
"http-server": "^14.1.1",
|
|
257
|
-
"jest": "^29.
|
|
258
|
-
"jest-environment-jsdom": "^29.
|
|
257
|
+
"jest": "^29.6.2",
|
|
258
|
+
"jest-environment-jsdom": "^29.6.2",
|
|
259
259
|
"jest-fetch-mock": "^3.0.3",
|
|
260
260
|
"jest-puppeteer": "^9.0.0",
|
|
261
|
-
"less": "^4.
|
|
261
|
+
"less": "^4.2.0",
|
|
262
262
|
"prettier": "^2.8.8",
|
|
263
|
-
"puppeteer": "^
|
|
263
|
+
"puppeteer": "^21.0.2",
|
|
264
264
|
"react": "^18.2.0",
|
|
265
265
|
"react-dom": "^18.2.0",
|
|
266
266
|
"react-test-renderer": "^18.2.0",
|
|
267
|
-
"rollup": "^3.
|
|
267
|
+
"rollup": "^3.28.0",
|
|
268
268
|
"rollup-plugin-esbuild": "^5.0.0",
|
|
269
269
|
"rollup-plugin-gzip": "^3.1.0",
|
|
270
270
|
"rollup-plugin-preserve-shebang": "^1.0.1",
|
|
271
271
|
"rollup-plugin-prettier": "^3.0.0",
|
|
272
272
|
"sqlite3": "^5.1.6",
|
|
273
273
|
"tinybase": "file:./",
|
|
274
|
-
"tinydocs": "^0.1.
|
|
274
|
+
"tinydocs": "^0.1.29",
|
|
275
275
|
"tmp": "^0.2.1",
|
|
276
|
-
"ts-unused-exports": "^
|
|
276
|
+
"ts-unused-exports": "^10.0.0",
|
|
277
277
|
"typescript": "5.1.6",
|
|
278
|
-
"yjs": "^13.6.
|
|
278
|
+
"yjs": "^13.6.7"
|
|
279
279
|
},
|
|
280
280
|
"peerDependencies": {
|
|
281
|
-
"@sqlite.org/sqlite-wasm": "^3.42.0-
|
|
282
|
-
"@vlcn.io/crsqlite-wasm": "^0.
|
|
281
|
+
"@sqlite.org/sqlite-wasm": "^3.42.0-build4",
|
|
282
|
+
"@vlcn.io/crsqlite-wasm": "^0.14.0",
|
|
283
283
|
"automerge-repo": "^0.1.0",
|
|
284
284
|
"prettier": "^2.8.8",
|
|
285
285
|
"react": "^18.2.0",
|
|
286
286
|
"sqlite3": "^5.1.6",
|
|
287
|
-
"yjs": "^13.6.
|
|
287
|
+
"yjs": "^13.6.7"
|
|
288
288
|
},
|
|
289
289
|
"peerDependenciesMeta": {
|
|
290
290
|
"@sqlite.org/sqlite-wasm": {
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Why sacrifice
|
|
1
|
+
<section id="hero"><h2 id="the-reactive-data-store-for-local-first-apps">The <em>reactive</em> data store for <span>local-first apps</span>.</h2><p>Modern apps deserve better. Why trade reactive user experiences to be able to use relational data? Why sacrifice features for bundle size? And why does the cloud do all the work <a href="https://localfirstweb.dev/" target="_blank">anyway</a>?</p><p><em>TinyBase is a smart new way to structure your local app data:</em></p><ul><li>Manage <a href="#start-with-a-simple-key-value-store">key-value data</a>, <a href="#level-up-to-use-tabular-data">tabular data</a> - or both - with optional <a href="#apply-schemas-to-tables-values">schematization</a> to model it.</li><li><a href="#register-listeners-at-any-granularity">Flexibly reactive</a> to reconciled updates, so you only spend cycles on things that change.</li><li><a href="#build-complex-queries-with-tinyql">Powerful query engine</a> to select, join, filter, group, sort and paginate data - reactively.</li><li><a href="#create-indexes-for-fast-lookups">Indexing</a>, <a href="#define-metrics-and-aggregations">metrics</a>, <a href="#model-relationships-between-tables">relationships</a> - and even an <a href="#use-checkpoints-for-an-easy-undo-stack">undo stack</a> for your app state.</li><li><a href="#type-definitions-orm-like-apis">Type definitions & ORM-like APIs</a> (<em>new!</em>), based on a schema or inference.</li><li>Easily <a href="#persist-to-storage-sqlite-or-crdts">sync your data</a> to storage, (<em>new!</em>) SQLite, or (<em>new!</em>) CRDTs.</li><li>Use idiomatic, optional, <a href="#call-hooks-to-bind-to-data">bindings to React</a> for a fully reactive UI.</li></ul><p><em>Tiny by name, tiny by nature</em>, TinyBase only costs <a href="#did-we-say-tiny">4.7kB - 8.9kB</a> when compressed, and has zero dependencies. And of course it's <a href="#well-tested-and-documented">well tested</a>, <a href="https://tinybase.org/guides/the-basics/getting-started/">fully documented</a>, and <a href="https://github.com/tinyplex/tinybase">open source</a>.</p></section><p><a id="new" href="https://tinybase.org/guides/releases/#v4-0"><em>NEW!</em> v4.0 release</a></p><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h3 id="proud-to-be-sponsored-by">Proud to be sponsored by:</h3><p><a href="https://github.com/expo" target="_blank"><img title="expo" src="https://github.com/expo.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a><a href="https://github.com/arpitBhalla" target="_blank"><img title="arpitBhalla" src="https://github.com/arpitBhalla.png?size=48" width="48" height="48"></a></p></section><section><h3 id="excited-to-be-used-by">Excited to be used by:</h3><p><a href="https://github.com/Apocalypsor" target="_blank"><img title="Apocalypsor" src="https://github.com/Apocalypsor.png?size=48" width="48" height="48"></a><a href="https://github.com/brentvatne" target="_blank"><img title="brentvatne" src="https://github.com/brentvatne.png?size=48" width="48" height="48"></a><a href="https://github.com/circadian-risk" target="_blank"><img title="circadian-risk" src="https://github.com/circadian-risk.png?size=48" width="48" height="48"></a><a href="https://github.com/cubecull" target="_blank"><img title="cubecull" src="https://github.com/cubecull.png?size=48" width="48" height="48"></a><a href="https://github.com/erwinkn" target="_blank"><img title="erwinkn" src="https://github.com/erwinkn.png?size=48" width="48" height="48"></a><a href="https://github.com/flaming-codes" target="_blank"><img title="flaming-codes" src="https://github.com/flaming-codes.png?size=48" width="48" height="48"></a><a href="https://github.com/generates" target="_blank"><img title="generates" src="https://github.com/generates.png?size=48" width="48" height="48"></a><a href="https://github.com/Giulio987" target="_blank"><img title="Giulio987" src="https://github.com/Giulio987.png?size=48" width="48" height="48"></a><a href="https://github.com/jaysc" target="_blank"><img title="jaysc" src="https://github.com/jaysc.png?size=48" width="48" height="48"></a><a href="https://github.com/Kayoo-asso" target="_blank"><img title="Kayoo-asso" src="https://github.com/Kayoo-asso.png?size=48" width="48" height="48"></a><a href="https://github.com/kotofurumiya" target="_blank"><img title="kotofurumiya" src="https://github.com/kotofurumiya.png?size=48" width="48" height="48"></a><a href="https://github.com/learn-anything" target="_blank"><img title="learn-anything" src="https://github.com/learn-anything.png?size=48" width="48" height="48"></a><a href="https://github.com/miking-the-viking" target="_blank"><img title="miking-the-viking" src="https://github.com/miking-the-viking.png?size=48" width="48" height="48"></a><a href="https://github.com/shaneosullivan" target="_blank"><img title="shaneosullivan" src="https://github.com/shaneosullivan.png?size=48" width="48" height="48"></a><a href="https://github.com/SuperSonicHub1" target="_blank"><img title="SuperSonicHub1" src="https://github.com/SuperSonicHub1.png?size=48" width="48" height="48"></a><a href="https://github.com/threepointone" target="_blank"><img title="threepointone" src="https://github.com/threepointone.png?size=48" width="48" height="48"></a><a href="https://github.com/uptonking" target="_blank"><img title="uptonking" src="https://github.com/uptonking.png?size=48" width="48" height="48"></a><a href="https://github.com/WonderPanda" target="_blank"><img title="WonderPanda" src="https://github.com/WonderPanda.png?size=48" width="48" height="48"></a></p></section><hr><section><h2 id="start-with-a-simple-key-value-store">Start with a simple key-value store.</h2><p>Creating a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> requires just a simple call to the <a href="https://tinybase.org/api/store/functions/creation/createstore/"><code>createStore</code></a> function. Once you have one, you can easily set <a href="https://tinybase.org/api/store/type-aliases/store/values/"><code>Values</code></a> in it by unique <a href="https://tinybase.org/api/common/type-aliases/identity/id/"><code>Id</code></a>. And of course you can easily get them back out again.</p><p>Read more about using keyed value data in <a href="https://tinybase.org/guides/the-basics/">The Basics</a> guide.</p></section>
|
|
2
2
|
|
|
3
3
|
```js
|
|
4
4
|
const store = createStore()
|
|
@@ -52,7 +52,7 @@ console.log(app.innerHTML);
|
|
|
52
52
|
// -> 'Color: walnut'
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
<section><h2 id="use-components-for-reactive-apps">Use components for reactive apps.</h2><p>The react module provides simple React components with bindings that make it easy to create a fully reactive user interface based on a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>In this example, the library's <a href="https://tinybase.org/api/ui-react/functions/store-components/rowview/"><code>RowView</code></a> component just needs a reference to the <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>, the <code>tableId</code>, and the <code>rowId</code> in order to render the contents of that row. An optional <code>cellComponent</code> prop lets you override how you want each <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> rendered. Again, all the listeners and updates are taken care of for you.</p><p>The module also includes a context Provider that sets up default for an entire app to use, reducing the need to drill all your props down into your app's hierarchy.</p><p>Most of the demos showcase the use of these React hooks and components. Take a look at <a href="https://tinybase.org/demos/todo-app/todo-app-v1-the-basics/">Todo App v1 (the basics)</a> to see these user interface binding patterns in action.</p><p>Read more about the <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module in the <a href="https://tinybase.org/guides/building-uis/">Building UIs</a> guides.</p></section>
|
|
55
|
+
<section><h2 id="use-components-for-reactive-apps">Use components for reactive apps.</h2><p>The react module provides simple React components with bindings that make it easy to create a fully reactive user interface based on the content of a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>.</p><p>In this example, the library's <a href="https://tinybase.org/api/ui-react/functions/store-components/rowview/"><code>RowView</code></a> component just needs a reference to the <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a>, the <code>tableId</code>, and the <code>rowId</code> in order to render the contents of that row. An optional <code>cellComponent</code> prop lets you override how you want each <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> rendered. Again, all the listeners and updates are taken care of for you.</p><p>The module also includes a context Provider that sets up default for an entire app to use, reducing the need to drill all your props down into your app's hierarchy.</p><p>Most of the demos showcase the use of these React hooks and components. Take a look at <a href="https://tinybase.org/demos/todo-app/todo-app-v1-the-basics/">Todo App v1 (the basics)</a> to see these user interface binding patterns in action.</p><p>Read more about the <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module in the <a href="https://tinybase.org/guides/building-uis/">Building UIs</a> guides.</p></section>
|
|
56
56
|
|
|
57
57
|
```jsx
|
|
58
58
|
const MyCellView = (props) => (
|
|
@@ -82,7 +82,7 @@ console.log(app.innerHTML);
|
|
|
82
82
|
root.unmount();
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
<section><h2 id="apply-schemas-to-tables-
|
|
85
|
+
<section><h2 id="apply-schemas-to-tables-values">Apply schemas to tables & values.</h2><p>By default, a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/value/"><code>Value</code></a>, and a <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> can contain any arbitrary <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a>. But you can add a <a href="https://tinybase.org/api/store/type-aliases/schema/valuesschema/"><code>ValuesSchema</code></a> or a <a href="https://tinybase.org/api/store/type-aliases/schema/tablesschema/"><code>TablesSchema</code></a> to a <a href="https://tinybase.org/api/store/interfaces/store/store/"><code>Store</code></a> to ensure that the values are always what you expect: constraining their types, and providing defaults.</p><p>In this example, we set a second <a href="https://tinybase.org/api/store/type-aliases/store/row/"><code>Row</code></a> without the <code>sold</code> <a href="https://tinybase.org/api/store/type-aliases/store/cell/"><code>Cell</code></a> in it. The schema ensures it's present with default of <code>false</code>.</p><p>Read more about schemas in the <a href="https://tinybase.org/guides/schemas-and-persistence/using-schemas/">Using Schemas</a> guide.</p></section>
|
|
86
86
|
|
|
87
87
|
```js
|
|
88
88
|
store.setTablesSchema({
|
|
@@ -247,7 +247,7 @@ console.log(store.getCell('pets', 'felix', 'sold'));
|
|
|
247
247
|
// -> false
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
<section><h2 id="type-definitions-orm-like-apis">Type definitions & ORM-like APIs</h2><p>TinyBase has comprehensive type definitions, and even offers definitions that infer API types from the data schemas you apply.</p><p>Furthermore, you can easily create TypeScript <code>.d.ts</code> definitions that model your data and encourage type-safety when reading and writing data - as well as <code>.ts</code> implementations that provide ORM-like methods for your named tables.</p><p>Read more about
|
|
250
|
+
<section><h2 id="type-definitions-orm-like-apis">Type definitions & ORM-like APIs</h2><p>TinyBase has comprehensive type definitions, and even offers definitions that infer API types from the data schemas you apply.</p><p>Furthermore, you can easily create TypeScript <code>.d.ts</code> definitions that model your data and encourage type-safety when reading and writing data - as well as <code>.ts</code> implementations that provide ORM-like methods for your named tables.</p><p>Read more about type support in the <a href="https://tinybase.org/guides/the-basics/tinybase-and-typescript/">TinyBase and TypeScript</a> guide.</p></section>
|
|
251
251
|
|
|
252
252
|
```js yolo
|
|
253
253
|
const tools = createTools(store);
|
|
@@ -266,4 +266,4 @@ export const createShop: typeof createShopDecl = () => {
|
|
|
266
266
|
};
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>4.7kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>8.9kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.
|
|
269
|
+
<section><h2 id="did-we-say-tiny">Did we say tiny?</h2><p>If you use the basic <a href="https://tinybase.org/api/store/"><code>store</code></a> module alone, you'll only add a gzipped <em>4.7kB</em> to your app. Incrementally add the other modules as you need more functionality, or get it all for <em>8.9kB</em>.</p><p>The optional <a href="https://tinybase.org/api/ui-react/"><code>ui-react</code></a> module is just another <em>3.4kB</em>, the auxiliary <a href="https://tinybase.org/api/tools/"><code>tools</code></a> module is <em>10.2kB</em>, and everything is super fast. Life's easy when you have zero dependencies!</p><p>Read more about how TinyBase is structured and packaged in the <a href="https://tinybase.org/guides/how-tinybase-is-built/architecture/">Architecture</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>.js.gz</th><th>.js</th><th>debug.js</th><th>.d.ts</th></tr><tr><th class="right"><a href="https://tinybase.org/api/store/">store</a></th><td>4.7kB</td><td>11.1kB</td><td>47.6kB</td><td>212.9kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/metrics/">metrics</a></th><td>1.8kB</td><td>3.6kB</td><td>14.9kB</td><td>29.2kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/indexes/">indexes</a></th><td>1.9kB</td><td>3.7kB</td><td>16.7kB</td><td>33.8kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/relationships/">relationships</a></th><td>1.8kB</td><td>3.7kB</td><td>16.8kB</td><td>42.1kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/queries/">queries</a></th><td>2.7kB</td><td>5.5kB</td><td>25.0kB</td><td>112.7kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/checkpoints/">checkpoints</a></th><td>1.5kB</td><td>3.1kB</td><td>12.5kB</td><td>33.3kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/persisters/">persisters</a></th><td>0.6kB</td><td>1.2kB</td><td>3.9kB</td><td>42.4kB</td></tr><tr><th class="right"><a href="https://tinybase.org/api/common/">common</a></th><td>0.1kB</td><td>0.1kB</td><td>0.1kB</td><td>3.5kB</td></tr><tr><th class="right">tinybase (all)</th><td>8.9kB</td><td>21.9kB</td><td>94.8kB</td><td>0.3kB</td></tr></tbody></table></div><section><h2 id="well-tested-and-documented">Well tested and documented.</h2><p>TinyBase has <em>100.0%</em> test coverage, including the code throughout the documentation - even on this page! The guides, demos, and API examples are designed to make it as easy as possible for you to get your TinyBase-powered app up and running.</p><p>Read more about how TinyBase is tested in the Unit <a href="https://tinybase.org/guides/how-tinybase-is-built/testing/">Testing</a> guide.</p></section><div class="table"><table class="fixed"><tbody><tr><th width="30%"> </th><th>Total</th><th>Tested</th><th>Coverage</th></tr><tr><th class="right">Lines</th><td>1,815</td><td>1,815</td><td>100.0%</td></tr><tr><th class="right">Statements</th><td>1,957</td><td>1,957</td><td>100.0%</td></tr><tr><th class="right">Functions</th><td>776</td><td>776</td><td>100.0%</td></tr><tr><th class="right">Branches</th><td>669</td><td>669</td><td>100.0%</td></tr><tr><th class="right">Tests</th><td colspan="3">3,138</td></tr><tr><th class="right">Assertions</th><td colspan="3">14,445</td></tr></tbody></table></div><hr><p><a class="start" href="https://tinybase.org/guides/the-basics/getting-started/">Get started</a></p><p><a href="https://tinybase.org/demos/">Try the demos</a></p><p><a href="https://tinybase.org/api/store/interfaces/store/store/">Read the docs</a></p><hr><section><h2 id="follow">Follow</h2><ul><li>News and updates on <a href="https://twitter.com/tinybasejs">Twitter</a>, <a href="https://discord.com/invite/mGz3mevwP8">Discord</a>, and <a href="https://facebook.com/tinybasejs">Facebook</a>.</li><li><a href="https://github.com/tinyplex/tinybase/discussions">Discussions</a> and <a href="https://github.com/tinyplex/tinybase/issues">issues</a> on <a href="https://github.com/tinyplex/tinybase">GitHub</a>.</li><li><a href="https://tinybase.org/guides/releases/">Release notes</a> for each version.</li><li>Packages on <a href="https://www.npmjs.com/package/tinybase/v/4.0.2">NPM</a>.</li></ul></section><section><h2 id="about">About</h2><p>Building TinyBase was originally an interesting exercise for <a rel="me" href="https://hachyderm.io/@jamesgpearce">me</a> in API design, minification, and documentation. It could not have been built without these great <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#giants">projects</a> and <a href="https://tinybase.org/guides/how-tinybase-is-built/credits/#and-friends">friends</a>, and I hope you enjoy using it!</p></section>
|