@mgarlik/datastore 0.1.1 → 0.1.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/dist/index.cjs +939 -936
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -3
- package/dist/index.d.ts +30 -3
- package/dist/index.js +950 -937
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React, { ReactNode } from 'react';
|
|
3
2
|
import { D as DataStoreStorage } from './storage-D_xv8gFb.cjs';
|
|
4
3
|
|
|
@@ -251,10 +250,38 @@ declare const useProviderDocuments: (provider: ProviderTypes, settings?: {
|
|
|
251
250
|
declare const useProvider: (val: ProviderTypes) => any;
|
|
252
251
|
/** Kompletní DataStore - spojuje všechny sub-contexty. Komponenty s tímto hookem se přerenderují při jakékoliv změně stavu. */
|
|
253
252
|
declare const useDataStore: () => DataStore;
|
|
253
|
+
/**
|
|
254
|
+
* Imperativní API `DataStoreProvider` vystavené přes `ref`.
|
|
255
|
+
*
|
|
256
|
+
* Umožňuje volat akce DataStore přímo z rodiče (např. `App.tsx`)
|
|
257
|
+
* bez nutnosti použití `useDataStoreActions` hooku uvnitř stromové hierarchie.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* const dsRef = useRef<DataStoreRef>(null);
|
|
262
|
+
*
|
|
263
|
+
* <DataStoreProvider ref={dsRef} ...>
|
|
264
|
+
* <AppProvider
|
|
265
|
+
* onLogin={({ userId }) => {
|
|
266
|
+
* dsRef.current?.startSockets();
|
|
267
|
+
* dsRef.current?.registerProviderSockets(userId);
|
|
268
|
+
* }}
|
|
269
|
+
* onLogout={({ userId }) => {
|
|
270
|
+
* dsRef.current?.unregisterProviderSockets(userId);
|
|
271
|
+
* dsRef.current?.stopSockets();
|
|
272
|
+
* }}
|
|
273
|
+
* />
|
|
274
|
+
* </DataStoreProvider>
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
type DataStoreRef = DataStoreActionsType;
|
|
254
278
|
/**
|
|
255
279
|
* Kořenový provider, který propojuje DataStore contexty, REST načítání, sockety a volitelnou persistenci.
|
|
280
|
+
*
|
|
281
|
+
* Podporuje volitelný `ref` (`DataStoreRef`) pro imperativní přístup k akcím
|
|
282
|
+
* přímo z rodičovské komponenty bez použití kontextového hooku.
|
|
256
283
|
*/
|
|
257
|
-
declare const DataStoreProvider:
|
|
284
|
+
declare const DataStoreProvider: React.ForwardRefExoticComponent<DataStoreProps & React.RefAttributes<DataStoreActionsType>>;
|
|
258
285
|
|
|
259
286
|
interface UseDataProviderResult {
|
|
260
287
|
/** Materializované dokumenty providera po vyhodnocení šablon a filtraci. */
|
|
@@ -425,4 +452,4 @@ declare const COLOR_AXIOS = "\u001B[33m%s\u001B[0m";
|
|
|
425
452
|
declare const COLOR_APP = "\u001B[34m%s\u001B[0m";
|
|
426
453
|
declare const COLOR_DS = "\u001B[35m%s\u001B[0m";
|
|
427
454
|
|
|
428
|
-
export { COLOR_APP, COLOR_AXIOS, COLOR_BLUE, COLOR_CONTEXT, COLOR_CYAN, COLOR_DS, COLOR_ERROR, COLOR_FUNCTION, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PROVIDER, COLOR_RED, COLOR_RENDER, COLOR_SCREEN, COLOR_SOCKET, COLOR_SOCKETS, COLOR_WARNING, COLOR_WHITE, COLOR_YELLOW, type DataProvider, type DataProviders, type DataStore, DataStoreActionsContext, DataStoreContext, DataStoreDocumentsContext, type DataStoreProps, DataStoreProvider, DataStoreProvidersContext, DataStoreStableContext, DataStoreStorage, type DispatcherActionType, type DispatcherType, type FilterType, type JSONType, type ProductFiltersType, type ProviderDataSource, type ProviderTypes, type SchemaType, type SocketItem, type SocketServerType, type UseDataProviderResult, type UseProviderActionsResult, type Uuid, dataStoreFilterObject, doesObjectMatchFilter, doesValueMatchFilter, filterDocuments, filterDocumentsAsync, type filterItemType, getValueByRules, isUuid, recalculateObjectWithDocument, useDataProvider, useDataStore, useDataStoreActions, useDocument, useDocuments, useFilteredDocuments, useProvider, useProviderActions, useProviderDocuments, uuid };
|
|
455
|
+
export { COLOR_APP, COLOR_AXIOS, COLOR_BLUE, COLOR_CONTEXT, COLOR_CYAN, COLOR_DS, COLOR_ERROR, COLOR_FUNCTION, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PROVIDER, COLOR_RED, COLOR_RENDER, COLOR_SCREEN, COLOR_SOCKET, COLOR_SOCKETS, COLOR_WARNING, COLOR_WHITE, COLOR_YELLOW, type DataProvider, type DataProviders, type DataStore, DataStoreActionsContext, DataStoreContext, DataStoreDocumentsContext, type DataStoreProps, DataStoreProvider, DataStoreProvidersContext, type DataStoreRef, DataStoreStableContext, DataStoreStorage, type DispatcherActionType, type DispatcherType, type FilterType, type JSONType, type ProductFiltersType, type ProviderDataSource, type ProviderTypes, type SchemaType, type SocketItem, type SocketServerType, type UseDataProviderResult, type UseProviderActionsResult, type Uuid, dataStoreFilterObject, doesObjectMatchFilter, doesValueMatchFilter, filterDocuments, filterDocumentsAsync, type filterItemType, getValueByRules, isUuid, recalculateObjectWithDocument, useDataProvider, useDataStore, useDataStoreActions, useDocument, useDocuments, useFilteredDocuments, useProvider, useProviderActions, useProviderDocuments, uuid };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import React, { ReactNode } from 'react';
|
|
3
2
|
import { D as DataStoreStorage } from './storage-D_xv8gFb.js';
|
|
4
3
|
|
|
@@ -251,10 +250,38 @@ declare const useProviderDocuments: (provider: ProviderTypes, settings?: {
|
|
|
251
250
|
declare const useProvider: (val: ProviderTypes) => any;
|
|
252
251
|
/** Kompletní DataStore - spojuje všechny sub-contexty. Komponenty s tímto hookem se přerenderují při jakékoliv změně stavu. */
|
|
253
252
|
declare const useDataStore: () => DataStore;
|
|
253
|
+
/**
|
|
254
|
+
* Imperativní API `DataStoreProvider` vystavené přes `ref`.
|
|
255
|
+
*
|
|
256
|
+
* Umožňuje volat akce DataStore přímo z rodiče (např. `App.tsx`)
|
|
257
|
+
* bez nutnosti použití `useDataStoreActions` hooku uvnitř stromové hierarchie.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* const dsRef = useRef<DataStoreRef>(null);
|
|
262
|
+
*
|
|
263
|
+
* <DataStoreProvider ref={dsRef} ...>
|
|
264
|
+
* <AppProvider
|
|
265
|
+
* onLogin={({ userId }) => {
|
|
266
|
+
* dsRef.current?.startSockets();
|
|
267
|
+
* dsRef.current?.registerProviderSockets(userId);
|
|
268
|
+
* }}
|
|
269
|
+
* onLogout={({ userId }) => {
|
|
270
|
+
* dsRef.current?.unregisterProviderSockets(userId);
|
|
271
|
+
* dsRef.current?.stopSockets();
|
|
272
|
+
* }}
|
|
273
|
+
* />
|
|
274
|
+
* </DataStoreProvider>
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
type DataStoreRef = DataStoreActionsType;
|
|
254
278
|
/**
|
|
255
279
|
* Kořenový provider, který propojuje DataStore contexty, REST načítání, sockety a volitelnou persistenci.
|
|
280
|
+
*
|
|
281
|
+
* Podporuje volitelný `ref` (`DataStoreRef`) pro imperativní přístup k akcím
|
|
282
|
+
* přímo z rodičovské komponenty bez použití kontextového hooku.
|
|
256
283
|
*/
|
|
257
|
-
declare const DataStoreProvider:
|
|
284
|
+
declare const DataStoreProvider: React.ForwardRefExoticComponent<DataStoreProps & React.RefAttributes<DataStoreActionsType>>;
|
|
258
285
|
|
|
259
286
|
interface UseDataProviderResult {
|
|
260
287
|
/** Materializované dokumenty providera po vyhodnocení šablon a filtraci. */
|
|
@@ -425,4 +452,4 @@ declare const COLOR_AXIOS = "\u001B[33m%s\u001B[0m";
|
|
|
425
452
|
declare const COLOR_APP = "\u001B[34m%s\u001B[0m";
|
|
426
453
|
declare const COLOR_DS = "\u001B[35m%s\u001B[0m";
|
|
427
454
|
|
|
428
|
-
export { COLOR_APP, COLOR_AXIOS, COLOR_BLUE, COLOR_CONTEXT, COLOR_CYAN, COLOR_DS, COLOR_ERROR, COLOR_FUNCTION, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PROVIDER, COLOR_RED, COLOR_RENDER, COLOR_SCREEN, COLOR_SOCKET, COLOR_SOCKETS, COLOR_WARNING, COLOR_WHITE, COLOR_YELLOW, type DataProvider, type DataProviders, type DataStore, DataStoreActionsContext, DataStoreContext, DataStoreDocumentsContext, type DataStoreProps, DataStoreProvider, DataStoreProvidersContext, DataStoreStableContext, DataStoreStorage, type DispatcherActionType, type DispatcherType, type FilterType, type JSONType, type ProductFiltersType, type ProviderDataSource, type ProviderTypes, type SchemaType, type SocketItem, type SocketServerType, type UseDataProviderResult, type UseProviderActionsResult, type Uuid, dataStoreFilterObject, doesObjectMatchFilter, doesValueMatchFilter, filterDocuments, filterDocumentsAsync, type filterItemType, getValueByRules, isUuid, recalculateObjectWithDocument, useDataProvider, useDataStore, useDataStoreActions, useDocument, useDocuments, useFilteredDocuments, useProvider, useProviderActions, useProviderDocuments, uuid };
|
|
455
|
+
export { COLOR_APP, COLOR_AXIOS, COLOR_BLUE, COLOR_CONTEXT, COLOR_CYAN, COLOR_DS, COLOR_ERROR, COLOR_FUNCTION, COLOR_GREEN, COLOR_MAGENTA, COLOR_ORANGE, COLOR_PROVIDER, COLOR_RED, COLOR_RENDER, COLOR_SCREEN, COLOR_SOCKET, COLOR_SOCKETS, COLOR_WARNING, COLOR_WHITE, COLOR_YELLOW, type DataProvider, type DataProviders, type DataStore, DataStoreActionsContext, DataStoreContext, DataStoreDocumentsContext, type DataStoreProps, DataStoreProvider, DataStoreProvidersContext, type DataStoreRef, DataStoreStableContext, DataStoreStorage, type DispatcherActionType, type DispatcherType, type FilterType, type JSONType, type ProductFiltersType, type ProviderDataSource, type ProviderTypes, type SchemaType, type SocketItem, type SocketServerType, type UseDataProviderResult, type UseProviderActionsResult, type Uuid, dataStoreFilterObject, doesObjectMatchFilter, doesValueMatchFilter, filterDocuments, filterDocumentsAsync, type filterItemType, getValueByRules, isUuid, recalculateObjectWithDocument, useDataProvider, useDataStore, useDataStoreActions, useDocument, useDocuments, useFilteredDocuments, useProvider, useProviderActions, useProviderDocuments, uuid };
|