tinybase 9.5.0-beta.0 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/_internal/store/with-schemas/index.d.ts +43 -8
- package/@types/mergeable-store/with-schemas/index.d.ts +30 -11
- package/@types/queries/index.d.ts +11 -11
- package/@types/queries/with-schemas/index.d.ts +17 -3
- package/@types/schematizers/index.d.ts +6 -4
- package/@types/schematizers/schematizer-arktype/index.d.ts +6 -6
- package/@types/schematizers/schematizer-arktype/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/schematizer-effect/index.d.ts +9 -11
- package/@types/schematizers/schematizer-effect/with-schemas/index.d.ts +114 -1
- package/@types/schematizers/schematizer-typebox/index.d.ts +7 -7
- package/@types/schematizers/schematizer-typebox/with-schemas/index.d.ts +114 -1
- package/@types/schematizers/schematizer-valibot/index.d.ts +6 -6
- package/@types/schematizers/schematizer-valibot/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/schematizer-yup/index.d.ts +5 -4
- package/@types/schematizers/schematizer-yup/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/schematizer-zod/index.d.ts +6 -6
- package/@types/schematizers/schematizer-zod/with-schemas/index.d.ts +112 -1
- package/@types/schematizers/with-schemas/index.d.ts +113 -4
- package/@types/store/index.d.ts +175 -16
- package/@types/store/with-schemas/index.d.ts +238 -55
- package/@types/synchronizers/with-schemas/index.d.ts +12 -2
- package/@types/ui-react/with-schemas/index.d.ts +576 -7
- package/@types/ui-react-dom/index.d.ts +10 -10
- package/@types/ui-react-dom/with-schemas/index.d.ts +94 -10
- package/@types/ui-react-dom-charts/index.d.ts +7 -7
- package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -7
- package/@types/ui-react-inspector/index.d.ts +1 -1
- package/@types/ui-react-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-solid/with-schemas/index.d.ts +340 -7
- package/@types/ui-solid-dom/index.d.ts +10 -10
- package/@types/ui-solid-dom/with-schemas/index.d.ts +94 -10
- package/@types/ui-solid-inspector/index.d.ts +1 -1
- package/@types/ui-solid-inspector/with-schemas/index.d.ts +1 -1
- package/@types/ui-svelte/with-schemas/index.d.ts +30 -0
- package/@types/ui-svelte-dom/index.d.ts +10 -10
- package/@types/ui-svelte-dom/with-schemas/index.d.ts +94 -10
- package/@types/ui-svelte-inspector/index.d.ts +1 -1
- package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -1
- package/agents.md +4 -0
- package/index.js +76 -22
- package/mergeable-store/index.js +76 -22
- package/mergeable-store/with-schemas/index.js +76 -22
- package/min/index.js +1 -1
- package/min/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/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/schematizers/index.js +1 -1
- package/min/schematizers/index.js.gz +0 -0
- package/min/schematizers/schematizer-arktype/index.js +1 -1
- package/min/schematizers/schematizer-arktype/index.js.gz +0 -0
- package/min/schematizers/schematizer-arktype/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-arktype/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-effect/index.js +1 -1
- package/min/schematizers/schematizer-effect/index.js.gz +0 -0
- package/min/schematizers/schematizer-effect/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-effect/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-typebox/index.js +1 -1
- package/min/schematizers/schematizer-typebox/index.js.gz +0 -0
- package/min/schematizers/schematizer-typebox/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-typebox/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-valibot/index.js +1 -1
- package/min/schematizers/schematizer-valibot/index.js.gz +0 -0
- package/min/schematizers/schematizer-valibot/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-valibot/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-yup/index.js +1 -1
- package/min/schematizers/schematizer-yup/index.js.gz +0 -0
- package/min/schematizers/schematizer-yup/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-yup/with-schemas/index.js.gz +0 -0
- package/min/schematizers/schematizer-zod/index.js +1 -1
- package/min/schematizers/schematizer-zod/index.js.gz +0 -0
- package/min/schematizers/schematizer-zod/with-schemas/index.js +1 -1
- package/min/schematizers/schematizer-zod/with-schemas/index.js.gz +0 -0
- package/min/schematizers/with-schemas/index.js +1 -1
- package/min/schematizers/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/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/ui-solid-inspector/index.js +1 -1
- package/min/ui-solid-inspector/index.js.gz +0 -0
- package/min/ui-solid-inspector/with-schemas/index.js +1 -1
- package/min/ui-solid-inspector/with-schemas/index.js.gz +0 -0
- package/min/ui-svelte-inspector/index.js +1 -1
- package/min/ui-svelte-inspector/index.js.gz +0 -0
- package/min/ui-svelte-inspector/with-schemas/index.js +1 -1
- package/min/ui-svelte-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/omni/index.js +76 -22
- package/omni/with-schemas/index.js +76 -22
- package/package.json +5 -5
- package/readme.md +3 -3
- package/releases.md +32 -2
- package/schematizers/index.js +54 -6
- package/schematizers/schematizer-arktype/index.js +99 -19
- package/schematizers/schematizer-arktype/with-schemas/index.js +99 -19
- package/schematizers/schematizer-effect/index.js +101 -11
- package/schematizers/schematizer-effect/with-schemas/index.js +101 -11
- package/schematizers/schematizer-typebox/index.js +87 -11
- package/schematizers/schematizer-typebox/with-schemas/index.js +87 -11
- package/schematizers/schematizer-valibot/index.js +125 -21
- package/schematizers/schematizer-valibot/with-schemas/index.js +125 -21
- package/schematizers/schematizer-yup/index.js +58 -14
- package/schematizers/schematizer-yup/with-schemas/index.js +58 -14
- package/schematizers/schematizer-zod/index.js +131 -12
- package/schematizers/schematizer-zod/with-schemas/index.js +131 -12
- package/schematizers/with-schemas/index.js +54 -6
- package/store/index.js +76 -22
- package/store/with-schemas/index.js +76 -22
- package/ui-react-inspector/index.js +76 -22
- package/ui-react-inspector/with-schemas/index.js +76 -22
- package/ui-solid-inspector/index.js +76 -22
- package/ui-solid-inspector/with-schemas/index.js +76 -22
- package/ui-svelte/index.js +1 -1
- package/ui-svelte/with-schemas/index.js +1 -1
- package/ui-svelte-dom/index.js +2 -2
- package/ui-svelte-dom/with-schemas/index.js +2 -2
- package/ui-svelte-inspector/index.js +78 -24
- package/ui-svelte-inspector/with-schemas/index.js +78 -24
- package/with-schemas/index.js +76 -22
|
@@ -7098,7 +7098,52 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
7098
7098
|
metricsOrMetricsId?: MaybeAccessor<MetricsOrMetricsId<Schemas> | undefined>,
|
|
7099
7099
|
) => Accessor<Metrics<Schemas> | undefined>;
|
|
7100
7100
|
|
|
7101
|
-
|
|
7101
|
+
/**
|
|
7102
|
+
* The useProvideMetrics primitive is used to add a Metrics object by Id to a
|
|
7103
|
+
* Provider component, but imperatively from a component within it.
|
|
7104
|
+
*
|
|
7105
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
7106
|
+
*
|
|
7107
|
+
* ```ts override
|
|
7108
|
+
* useProvideMetrics(metricsId: Id, metrics: Metrics): void;
|
|
7109
|
+
* ```
|
|
7110
|
+
*
|
|
7111
|
+
* Normally you will register a Metrics object by Id in a context by using the
|
|
7112
|
+
* `metricsById` prop of the top-level Provider component. This primitive,
|
|
7113
|
+
* however, lets you dynamically add a new Metrics object to the context, from
|
|
7114
|
+
* within a descendent component. This is useful for applications where the set
|
|
7115
|
+
* of Metrics objects is not known at the time of the first render of the root
|
|
7116
|
+
* Provider.
|
|
7117
|
+
*
|
|
7118
|
+
* A Metrics object added to the Provider context in this way will be available
|
|
7119
|
+
* to other components within the context (using the useMetrics primitive and so
|
|
7120
|
+
* on). If you use the same Id as an existing Metrics object registration, the
|
|
7121
|
+
* new one will take priority over one provided by the `metricsById` prop.
|
|
7122
|
+
* @param metricsId The Id of the Metrics object to be registered with the
|
|
7123
|
+
* Provider.
|
|
7124
|
+
* @param metrics The Metrics object to be registered.
|
|
7125
|
+
* @example
|
|
7126
|
+
* ```js
|
|
7127
|
+
* import {createRoot} from 'solid-js';
|
|
7128
|
+
* import {createMetrics, createStore} from 'tinybase';
|
|
7129
|
+
* import {useProvideMetrics} from 'tinybase/ui-solid';
|
|
7130
|
+
*
|
|
7131
|
+
* createRoot((dispose) => {
|
|
7132
|
+
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
7133
|
+
* const metrics = createMetrics(store).setMetricDefinition(
|
|
7134
|
+
* 'petCount',
|
|
7135
|
+
* 'pets',
|
|
7136
|
+
* 'count',
|
|
7137
|
+
* );
|
|
7138
|
+
* useProvideMetrics('petMetrics', metrics);
|
|
7139
|
+
* console.log(metrics.getMetric('petCount'));
|
|
7140
|
+
* // -> 1
|
|
7141
|
+
* dispose();
|
|
7142
|
+
* });
|
|
7143
|
+
* ```
|
|
7144
|
+
* @category Metrics primitives
|
|
7145
|
+
* @since v8.3.0
|
|
7146
|
+
*/
|
|
7102
7147
|
useProvideMetrics: (metricsId: Id, metrics: Metrics<Schemas>) => void;
|
|
7103
7148
|
|
|
7104
7149
|
/**
|
|
@@ -7741,7 +7786,52 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
7741
7786
|
indexesOrIndexesId?: MaybeAccessor<IndexesOrIndexesId<Schemas> | undefined>,
|
|
7742
7787
|
) => Accessor<Indexes<Schemas> | undefined>;
|
|
7743
7788
|
|
|
7744
|
-
|
|
7789
|
+
/**
|
|
7790
|
+
* The useProvideIndexes primitive is used to add an Indexes object by Id to a
|
|
7791
|
+
* Provider component, but imperatively from a component within it.
|
|
7792
|
+
*
|
|
7793
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
7794
|
+
*
|
|
7795
|
+
* ```ts override
|
|
7796
|
+
* useProvideIndexes(indexesId: Id, indexes: Indexes): void;
|
|
7797
|
+
* ```
|
|
7798
|
+
*
|
|
7799
|
+
* Normally you will register an Indexes object by Id in a context by using the
|
|
7800
|
+
* `indexesById` prop of the top-level Provider component. This primitive,
|
|
7801
|
+
* however, lets you dynamically add a new Indexes object to the context, from
|
|
7802
|
+
* within a descendent component. This is useful for applications where the set
|
|
7803
|
+
* of Indexes objects is not known at the time of the first render of the root
|
|
7804
|
+
* Provider.
|
|
7805
|
+
*
|
|
7806
|
+
* An Indexes object added to the Provider context in this way will be available
|
|
7807
|
+
* to other components within the context (using the useIndexes primitive and so
|
|
7808
|
+
* on). If you use the same Id as an existing Indexes object registration, the
|
|
7809
|
+
* new one will take priority over one provided by the `indexesById` prop.
|
|
7810
|
+
* @param indexesId The Id of the Indexes object to be registered with the
|
|
7811
|
+
* Provider.
|
|
7812
|
+
* @param indexes The Indexes object to be registered.
|
|
7813
|
+
* @example
|
|
7814
|
+
* ```js
|
|
7815
|
+
* import {createRoot} from 'solid-js';
|
|
7816
|
+
* import {createIndexes, createStore} from 'tinybase';
|
|
7817
|
+
* import {useProvideIndexes} from 'tinybase/ui-solid';
|
|
7818
|
+
*
|
|
7819
|
+
* createRoot((dispose) => {
|
|
7820
|
+
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
7821
|
+
* const indexes = createIndexes(store).setIndexDefinition(
|
|
7822
|
+
* 'petsByColor',
|
|
7823
|
+
* 'pets',
|
|
7824
|
+
* 'color',
|
|
7825
|
+
* );
|
|
7826
|
+
* useProvideIndexes('petIndexes', indexes);
|
|
7827
|
+
* console.log(JSON.stringify(indexes.getSliceIds('petsByColor')));
|
|
7828
|
+
* // -> '["brown"]'
|
|
7829
|
+
* dispose();
|
|
7830
|
+
* });
|
|
7831
|
+
* ```
|
|
7832
|
+
* @category Indexes primitives
|
|
7833
|
+
* @since v8.3.0
|
|
7834
|
+
*/
|
|
7745
7835
|
useProvideIndexes: (indexesId: Id, indexes: Indexes<Schemas>) => void;
|
|
7746
7836
|
|
|
7747
7837
|
/**
|
|
@@ -8662,7 +8752,56 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
8662
8752
|
>,
|
|
8663
8753
|
) => Accessor<Relationships<Schemas> | undefined>;
|
|
8664
8754
|
|
|
8665
|
-
|
|
8755
|
+
/**
|
|
8756
|
+
* The useProvideRelationships primitive is used to add a Relationships object
|
|
8757
|
+
* by Id to a Provider component, but imperatively from a component within it.
|
|
8758
|
+
*
|
|
8759
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
8760
|
+
*
|
|
8761
|
+
* ```ts override
|
|
8762
|
+
* useProvideRelationships(
|
|
8763
|
+
* relationshipsId: Id,
|
|
8764
|
+
* relationships: Relationships,
|
|
8765
|
+
* ): void;
|
|
8766
|
+
* ```
|
|
8767
|
+
*
|
|
8768
|
+
* Normally you will register a Relationships object by Id in a context by using
|
|
8769
|
+
* the `relationshipsById` prop of the top-level Provider component. This
|
|
8770
|
+
* primitive, however, lets you dynamically add a new Relationships object to
|
|
8771
|
+
* the context, from within a component. This is useful for applications where
|
|
8772
|
+
* the set of Relationships objects is not known at the time of the first render
|
|
8773
|
+
* of the root Provider.
|
|
8774
|
+
*
|
|
8775
|
+
* A Relationships object added to the Provider context in this way will be
|
|
8776
|
+
* available to other components within the context (using the useRelationships
|
|
8777
|
+
* primitive and so on). If you use the same Id as an existing Relationships
|
|
8778
|
+
* object registration, the new one will take priority over one provided by the
|
|
8779
|
+
* `relationshipsById` prop.
|
|
8780
|
+
* @param relationshipsId The Id of the Relationships object to be registered
|
|
8781
|
+
* with the Provider.
|
|
8782
|
+
* @param relationships The Relationships object to be registered.
|
|
8783
|
+
* @example
|
|
8784
|
+
* ```js
|
|
8785
|
+
* import {createRoot} from 'solid-js';
|
|
8786
|
+
* import {createRelationships, createStore} from 'tinybase';
|
|
8787
|
+
* import {useProvideRelationships} from 'tinybase/ui-solid';
|
|
8788
|
+
*
|
|
8789
|
+
* createRoot((dispose) => {
|
|
8790
|
+
* const store = createStore()
|
|
8791
|
+
* .setTable('pets', {fido: {species: 'dog'}})
|
|
8792
|
+
* .setTable('species', {dog: {price: 5}});
|
|
8793
|
+
* const relationships = createRelationships(
|
|
8794
|
+
* store,
|
|
8795
|
+
* ).setRelationshipDefinition('petSpecies', 'pets', 'species', 'species');
|
|
8796
|
+
* useProvideRelationships('petRelationships', relationships);
|
|
8797
|
+
* console.log(relationships.getRemoteRowId('petSpecies', 'fido'));
|
|
8798
|
+
* // -> 'dog'
|
|
8799
|
+
* dispose();
|
|
8800
|
+
* });
|
|
8801
|
+
* ```
|
|
8802
|
+
* @category Relationships primitives
|
|
8803
|
+
* @since v8.3.0
|
|
8804
|
+
*/
|
|
8666
8805
|
useProvideRelationships: (
|
|
8667
8806
|
relationshipsId: Id,
|
|
8668
8807
|
relationships: Relationships<Schemas>,
|
|
@@ -9790,7 +9929,57 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
9790
9929
|
queriesOrQueriesId?: MaybeAccessor<QueriesOrQueriesId<Schemas> | undefined>,
|
|
9791
9930
|
) => Accessor<Queries<Schemas> | undefined>;
|
|
9792
9931
|
|
|
9793
|
-
|
|
9932
|
+
/**
|
|
9933
|
+
* The useProvideQueries primitive is used to add a Queries object by Id to a
|
|
9934
|
+
* Provider component, but imperatively from a component within it.
|
|
9935
|
+
*
|
|
9936
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
9937
|
+
*
|
|
9938
|
+
* ```ts override
|
|
9939
|
+
* useProvideQueries(queriesId: Id, queries: Queries): void;
|
|
9940
|
+
* ```
|
|
9941
|
+
*
|
|
9942
|
+
* Normally you will register a Queries object by Id in a context by using the
|
|
9943
|
+
* `queriesById` prop of the top-level Provider component. This primitive,
|
|
9944
|
+
* however, lets you dynamically add a new Queries object to the context, from
|
|
9945
|
+
* within a component. This is useful for applications where the set of Queries
|
|
9946
|
+
* objects is not known at the time of the first render of the root Provider.
|
|
9947
|
+
*
|
|
9948
|
+
* A Queries object added to the Provider context in this way will be available
|
|
9949
|
+
* to other components within the context (using the useQueries primitive and so
|
|
9950
|
+
* on). If you use the same Id as an existing Queries object registration, the
|
|
9951
|
+
* new one will take priority over one provided by the `queriesById` prop.
|
|
9952
|
+
* @param queriesId The Id of the Queries object to be registered with the
|
|
9953
|
+
* Provider.
|
|
9954
|
+
* @param queries The Queries object to be registered.
|
|
9955
|
+
* @example
|
|
9956
|
+
* ```js
|
|
9957
|
+
* import {createRoot} from 'solid-js';
|
|
9958
|
+
* import {createQueries, createStore} from 'tinybase';
|
|
9959
|
+
* import {useProvideQueries} from 'tinybase/ui-solid';
|
|
9960
|
+
*
|
|
9961
|
+
* createRoot((dispose) => {
|
|
9962
|
+
* const store = createStore().setRow('pets', 'fido', {
|
|
9963
|
+
* color: 'brown',
|
|
9964
|
+
* legs: 4,
|
|
9965
|
+
* });
|
|
9966
|
+
* const queries = createQueries(store).setQueryDefinition(
|
|
9967
|
+
* 'brownLegs',
|
|
9968
|
+
* 'pets',
|
|
9969
|
+
* ({select, where}) => {
|
|
9970
|
+
* select('legs');
|
|
9971
|
+
* where('color', 'brown');
|
|
9972
|
+
* },
|
|
9973
|
+
* );
|
|
9974
|
+
* useProvideQueries('petQueries', queries);
|
|
9975
|
+
* console.log(JSON.stringify(queries.getResultTable('brownLegs')));
|
|
9976
|
+
* // -> '{"fido":{"legs":4}}'
|
|
9977
|
+
* dispose();
|
|
9978
|
+
* });
|
|
9979
|
+
* ```
|
|
9980
|
+
* @category Queries primitives
|
|
9981
|
+
* @since v8.3.0
|
|
9982
|
+
*/
|
|
9794
9983
|
useProvideQueries: (queriesId: Id, queries: Queries<Schemas>) => void;
|
|
9795
9984
|
|
|
9796
9985
|
/**
|
|
@@ -12744,7 +12933,52 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
12744
12933
|
>,
|
|
12745
12934
|
) => Accessor<Checkpoints<Schemas> | undefined>;
|
|
12746
12935
|
|
|
12747
|
-
|
|
12936
|
+
/**
|
|
12937
|
+
* The useProvideCheckpoints primitive is used to add a Checkpoints object by Id
|
|
12938
|
+
* to a Provider component, but imperatively from a component within it.
|
|
12939
|
+
*
|
|
12940
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
12941
|
+
*
|
|
12942
|
+
* ```ts override
|
|
12943
|
+
* useProvideCheckpoints(
|
|
12944
|
+
* checkpointsId: Id,
|
|
12945
|
+
* checkpoints: Checkpoints,
|
|
12946
|
+
* ): void;
|
|
12947
|
+
* ```
|
|
12948
|
+
*
|
|
12949
|
+
* Normally you will register a Checkpoints object by Id in a context by using
|
|
12950
|
+
* the `checkpointsById` prop of the top-level Provider component. This
|
|
12951
|
+
* primitive, however, lets you dynamically add a new Checkpoints object to the
|
|
12952
|
+
* context, from within a component. This is useful for applications where the
|
|
12953
|
+
* set of Checkpoints objects is not known at the time of the first render of
|
|
12954
|
+
* the root Provider.
|
|
12955
|
+
*
|
|
12956
|
+
* A Checkpoints object added to the Provider context in this way will be
|
|
12957
|
+
* available to other components within the context (using the useCheckpoints
|
|
12958
|
+
* primitive and so on). If you use the same Id as an existing Checkpoints
|
|
12959
|
+
* object registration, the new one will take priority over one provided by the
|
|
12960
|
+
* `checkpointsById` prop.
|
|
12961
|
+
* @param checkpointsId The Id of the Checkpoints object to be registered with
|
|
12962
|
+
* the Provider.
|
|
12963
|
+
* @param checkpoints The Checkpoints object to be registered.
|
|
12964
|
+
* @example
|
|
12965
|
+
* ```js
|
|
12966
|
+
* import {createRoot} from 'solid-js';
|
|
12967
|
+
* import {createCheckpoints, createStore} from 'tinybase';
|
|
12968
|
+
* import {useProvideCheckpoints} from 'tinybase/ui-solid';
|
|
12969
|
+
*
|
|
12970
|
+
* createRoot((dispose) => {
|
|
12971
|
+
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
12972
|
+
* const checkpoints = createCheckpoints(store);
|
|
12973
|
+
* useProvideCheckpoints('petCheckpoints', checkpoints);
|
|
12974
|
+
* console.log(JSON.stringify(checkpoints.getCheckpointIds()));
|
|
12975
|
+
* // -> '[[],"0",[]]'
|
|
12976
|
+
* dispose();
|
|
12977
|
+
* });
|
|
12978
|
+
* ```
|
|
12979
|
+
* @category Checkpoints primitives
|
|
12980
|
+
* @since v8.3.0
|
|
12981
|
+
*/
|
|
12748
12982
|
useProvideCheckpoints: (
|
|
12749
12983
|
checkpointsId: Id,
|
|
12750
12984
|
checkpoints: Checkpoints<Schemas>,
|
|
@@ -14110,7 +14344,54 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
14110
14344
|
>,
|
|
14111
14345
|
) => Accessor<Persister<Schemas, Persists.StoreOrMergeableStore> | undefined>;
|
|
14112
14346
|
|
|
14113
|
-
|
|
14347
|
+
/**
|
|
14348
|
+
* The useProvidePersister primitive is used to add a Persister object by Id to
|
|
14349
|
+
* a Provider component, but imperatively from a component within it.
|
|
14350
|
+
*
|
|
14351
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
14352
|
+
*
|
|
14353
|
+
* ```ts override
|
|
14354
|
+
* useProvidePersister(
|
|
14355
|
+
* persisterId: Id,
|
|
14356
|
+
* persister: AnyPersister,
|
|
14357
|
+
* ): void;
|
|
14358
|
+
* ```
|
|
14359
|
+
*
|
|
14360
|
+
* Normally you will register a Persister object by Id in a context by using the
|
|
14361
|
+
* `persistersById` prop of the top-level Provider component. This primitive,
|
|
14362
|
+
* however, lets you dynamically add a new Persister object to the context, from
|
|
14363
|
+
* within a component. This is useful for applications where the set of
|
|
14364
|
+
* Persister objects is not known at the time of the first render of the root
|
|
14365
|
+
* Provider.
|
|
14366
|
+
*
|
|
14367
|
+
* A Persister object added to the Provider context in this way will be
|
|
14368
|
+
* available to other components within the context (using the usePersister
|
|
14369
|
+
* primitive and so on). If you use the same Id as an existing Persister object
|
|
14370
|
+
* registration, the new one will take priority over one provided by the
|
|
14371
|
+
* `persistersById` prop.
|
|
14372
|
+
* @param persisterId The Id of the Persister object to be registered with the
|
|
14373
|
+
* Provider.
|
|
14374
|
+
* @param persister The Persister object to be registered.
|
|
14375
|
+
* @example
|
|
14376
|
+
* ```js
|
|
14377
|
+
* import {createRoot} from 'solid-js';
|
|
14378
|
+
* import {createStore} from 'tinybase';
|
|
14379
|
+
* import {createSessionPersister} from 'tinybase/persisters/persister-browser';
|
|
14380
|
+
* import {useProvidePersister} from 'tinybase/ui-solid';
|
|
14381
|
+
*
|
|
14382
|
+
* createRoot((dispose) => {
|
|
14383
|
+
* const store = createStore().setCell('pets', 'fido', 'color', 'brown');
|
|
14384
|
+
* const persister = createSessionPersister(store, 'pets');
|
|
14385
|
+
* useProvidePersister('petPersister', persister);
|
|
14386
|
+
* console.log(persister.getStatus());
|
|
14387
|
+
* // -> 0
|
|
14388
|
+
* persister.destroy();
|
|
14389
|
+
* dispose();
|
|
14390
|
+
* });
|
|
14391
|
+
* ```
|
|
14392
|
+
* @category Persister primitives
|
|
14393
|
+
* @since v8.3.0
|
|
14394
|
+
*/
|
|
14114
14395
|
useProvidePersister: (
|
|
14115
14396
|
persisterId: Id,
|
|
14116
14397
|
persister: AnyPersister<Schemas> | undefined,
|
|
@@ -14681,7 +14962,59 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
|
|
|
14681
14962
|
>,
|
|
14682
14963
|
) => Accessor<Synchronizer<Schemas> | undefined>;
|
|
14683
14964
|
|
|
14684
|
-
|
|
14965
|
+
/**
|
|
14966
|
+
* The useProvideSynchronizer primitive is used to add a Synchronizer object by
|
|
14967
|
+
* Id to a Provider component, but imperatively from a component within it.
|
|
14968
|
+
*
|
|
14969
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
14970
|
+
*
|
|
14971
|
+
* ```ts override
|
|
14972
|
+
* useProvideSynchronizer(
|
|
14973
|
+
* synchronizerId: Id,
|
|
14974
|
+
* synchronizer: Synchronizer,
|
|
14975
|
+
* ): void;
|
|
14976
|
+
* ```
|
|
14977
|
+
*
|
|
14978
|
+
* Normally you will register a Synchronizer object by Id in a context by using
|
|
14979
|
+
* the `synchronizersById` prop of the top-level Provider component. This
|
|
14980
|
+
* primitive, however, lets you dynamically add a new Synchronizer object to the
|
|
14981
|
+
* context, from within a component. This is useful for applications where the
|
|
14982
|
+
* set of Synchronizer objects is not known at the time of the first render of
|
|
14983
|
+
* the root Provider.
|
|
14984
|
+
*
|
|
14985
|
+
* A Synchronizer object added to the Provider context in this way will be
|
|
14986
|
+
* available to other components within the context (using the useSynchronizer
|
|
14987
|
+
* primitive and so on). If you use the same Id as an existing Synchronizer
|
|
14988
|
+
* object registration, the new one will take priority over one provided by the
|
|
14989
|
+
* `synchronizersById` prop.
|
|
14990
|
+
* @param synchronizerId The Id of the Synchronizer object to be registered with
|
|
14991
|
+
* the Provider.
|
|
14992
|
+
* @param synchronizer The Synchronizer object to be registered.
|
|
14993
|
+
* @example
|
|
14994
|
+
* ```js
|
|
14995
|
+
* import {createRoot} from 'solid-js';
|
|
14996
|
+
* import {createMergeableStore} from 'tinybase';
|
|
14997
|
+
* import {createLocalSynchronizer} from 'tinybase/synchronizers/synchronizer-local';
|
|
14998
|
+
* import {useProvideSynchronizer} from 'tinybase/ui-solid';
|
|
14999
|
+
*
|
|
15000
|
+
* createRoot((dispose) => {
|
|
15001
|
+
* const store = createMergeableStore().setCell(
|
|
15002
|
+
* 'pets',
|
|
15003
|
+
* 'fido',
|
|
15004
|
+
* 'color',
|
|
15005
|
+
* 'brown',
|
|
15006
|
+
* );
|
|
15007
|
+
* const synchronizer = createLocalSynchronizer(store);
|
|
15008
|
+
* useProvideSynchronizer('petSynchronizer', synchronizer);
|
|
15009
|
+
* console.log(synchronizer.getStatus());
|
|
15010
|
+
* // -> 0
|
|
15011
|
+
* synchronizer.destroy();
|
|
15012
|
+
* dispose();
|
|
15013
|
+
* });
|
|
15014
|
+
* ```
|
|
15015
|
+
* @category Synchronizer primitives
|
|
15016
|
+
* @since v8.3.0
|
|
15017
|
+
*/
|
|
14685
15018
|
useProvideSynchronizer: (
|
|
14686
15019
|
synchronizerId: Id,
|
|
14687
15020
|
synchronizer: Synchronizer<Schemas> | undefined,
|
|
@@ -695,7 +695,7 @@ export type SortedTablePaginatorProps = {
|
|
|
695
695
|
*
|
|
696
696
|
* See the <TableInHtmlTable /> (Solid) demo for this component in action:
|
|
697
697
|
*
|
|
698
|
-
* 
|
|
700
700
|
*
|
|
701
701
|
* The component's props identify which Table to render based on Table Id, and
|
|
@@ -839,7 +839,7 @@ export function TableInHtmlTable(
|
|
|
839
839
|
* See the <SortedTableInHtmlTable /> (Solid) demo for this component in
|
|
840
840
|
* action:
|
|
841
841
|
*
|
|
842
|
-
* 
|
|
844
844
|
*
|
|
845
845
|
* The component's props identify which Table to render based on Table Id, and
|
|
@@ -1010,7 +1010,7 @@ export function SortedTableInHtmlTable(
|
|
|
1010
1010
|
*
|
|
1011
1011
|
* See the <ValuesInHtmlTable /> (Solid) demo for this component in action:
|
|
1012
1012
|
*
|
|
1013
|
-
* 
|
|
1015
1015
|
*
|
|
1016
1016
|
* The component's props identify which Row to render based on Table Id, Row Id,
|
|
@@ -1139,7 +1139,7 @@ export function ValuesInHtmlTable(
|
|
|
1139
1139
|
*
|
|
1140
1140
|
* See the <SliceInHtmlTable /> (Solid) demo for this component in action:
|
|
1141
1141
|
*
|
|
1142
|
-
* 
|
|
1144
1144
|
*
|
|
1145
1145
|
* The component's props identify which Slice to render based on Index Id, Slice
|
|
@@ -1295,7 +1295,7 @@ export function SliceInHtmlTable(
|
|
|
1295
1295
|
* See the <RelationshipInHtmlTable /> (Solid) demo for this component in
|
|
1296
1296
|
* action:
|
|
1297
1297
|
*
|
|
1298
|
-
* 
|
|
1300
1300
|
*
|
|
1301
1301
|
* The component's props identify which Relationship to render based on
|
|
@@ -1469,7 +1469,7 @@ export function RelationshipInHtmlTable(
|
|
|
1469
1469
|
* See the <ResultTableInHtmlTable /> (Solid) demo for this component in
|
|
1470
1470
|
* action:
|
|
1471
1471
|
*
|
|
1472
|
-
* 
|
|
1474
1474
|
*
|
|
1475
1475
|
* The component's props identify which ResultTable to render based on query Id,
|
|
@@ -1620,7 +1620,7 @@ export function ResultTableInHtmlTable(
|
|
|
1620
1620
|
* See the <ResultSortedTableInHtmlTable /> (Solid) demo for this component in
|
|
1621
1621
|
* action:
|
|
1622
1622
|
*
|
|
1623
|
-
* 
|
|
1625
1625
|
*
|
|
1626
1626
|
* The component's props identify which ResultTable to render based on query Id,
|
|
@@ -1792,7 +1792,7 @@ export function ResultSortedTableInHtmlTable(
|
|
|
1792
1792
|
*
|
|
1793
1793
|
* See the <EditableCellView /> (Solid) demo for this component in action:
|
|
1794
1794
|
*
|
|
1795
|
-
* 
|
|
1797
1797
|
*
|
|
1798
1798
|
* The component's props identify which Cell to render based on Table Id, Row
|
|
@@ -1862,7 +1862,7 @@ export function EditableCellView(
|
|
|
1862
1862
|
*
|
|
1863
1863
|
* See the <EditableValueView /> (Solid) demo for this component in action:
|
|
1864
1864
|
*
|
|
1865
|
-
* 
|
|
1867
1867
|
*
|
|
1868
1868
|
* The component's props identify which Value to render based on Table Id, Row
|
|
@@ -1932,7 +1932,7 @@ export function EditableValueView(
|
|
|
1932
1932
|
* See the <SortedTableInHtmlTable /> (Solid) demo for this component in
|
|
1933
1933
|
* action:
|
|
1934
1934
|
*
|
|
1935
|
-
* 
|
|
1937
1937
|
*
|
|
1938
1938
|
* The component displays 'previous' and 'next' buttons for paging through the
|