@oimdb/react 2.1.2 → 3.0.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/README.md +267 -127
- package/dist/index.cjs +343 -466
- package/dist/index.d.cts +56 -34
- package/dist/index.d.ts +56 -34
- package/dist/index.js +328 -447
- package/llms.txt +4156 -0
- package/package.json +46 -36
package/dist/index.d.cts
CHANGED
|
@@ -1,35 +1,57 @@
|
|
|
1
|
-
import { TOIMPk, OIMReactiveCollection, OIMIndexArrayBased, OIMReactiveIndexArrayBased, OIMIndexSetBased, OIMReactiveIndexSetBased, OIMReactiveObject } from '@oimdb/core';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
1
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
declare function
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
import { DependencyList } from 'react';
|
|
3
|
+
import { OIMDB, TOIMSlot, TOIMComputedSlot, TOIMStoreKey, OIMSlotCollectionService, TOIMEntitySlot, TOIMStoreSlot, OIMSingleSlotService, TOIMSingleSlotStore, TOIMBucketSlot, OIMSlotContentBucketService, TOIMEntityColumnName, TOIMColumnSlot, TOIMEntityColumnValue, TOIMIndexableSlot, OIMComputedService, TOIMComputedSources, TOIMComputedStoreSlot } from '@oimdb/core';
|
|
4
|
+
|
|
5
|
+
declare const OIMDBContext: React.Context<OIMDB | undefined>;
|
|
6
|
+
|
|
7
|
+
declare function OIMDBProvider({ db, children }: {
|
|
8
|
+
db: OIMDB;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): React.ReactElement;
|
|
11
|
+
|
|
12
|
+
declare function useOIMDB(): OIMDB;
|
|
13
|
+
|
|
14
|
+
type TOIMBinding<TValue> = {
|
|
15
|
+
readonly sourceSlots?: readonly TOIMSlot[] | undefined;
|
|
16
|
+
readonly sourceComputeds?: readonly TOIMComputedSlot[] | undefined;
|
|
17
|
+
readonly derive: () => TValue;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Applies a binding: one `OIMEffectService.INSTANCE.subscribeEffect` over its roots, its derivations settled before
|
|
22
|
+
* every read. THE BINDING MUST KEEP ITS IDENTITY ACROSS RENDERS — a fresh one per render
|
|
23
|
+
* resubscribes on every commit and never converges, freezing the screen rather than
|
|
24
|
+
* throwing. That, and why the snapshot is a counter bumped on subscribing, are in
|
|
25
|
+
* ../README.md.
|
|
26
|
+
*/
|
|
27
|
+
declare function useOIMValue<TValue>(binding: TOIMBinding<TValue>): TValue;
|
|
28
|
+
|
|
29
|
+
declare function useOIMComputedValue<TValue>(computedSlot: TOIMComputedSlot<TValue>): TValue;
|
|
30
|
+
|
|
31
|
+
declare function useOIMEntity<TEntity extends object, TKey = TOIMStoreKey, TStore = unknown>(entityCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, entityStoreSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, key: TKey): TEntity | undefined;
|
|
32
|
+
|
|
33
|
+
declare function useOIMSingleEntity<TEntity extends object>(singleSlotService: Pick<OIMSingleSlotService<TOIMEntitySlot<TEntity, void>, unknown>, 'getSingleSlot' | 'holdSingleSlot'>, singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMEntitySlot<TEntity, void>>, TOIMEntitySlot<TEntity, void>>): TEntity | undefined;
|
|
34
|
+
|
|
35
|
+
declare function useOIMSingleBucketSlots<TEntity extends object, TSlots = unknown>(singleSlotService: Pick<OIMSingleSlotService<TOIMBucketSlot<TSlots, void>, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSingleSlot' | 'holdSingleSlot' | 'slotContentService'>, singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMBucketSlot<TSlots, void>>, TOIMBucketSlot<TSlots, void>>): readonly TOIMEntitySlot<TEntity>[];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One field of one identity. It cannot go through {@link useOIMValue}: a column identity is
|
|
39
|
+
* minted INSIDE the subscription, so there is no root slot a binding could name. `slot` is an
|
|
40
|
+
* ENTITY SLOT because an entity slot is what can be taken out from under this component — ../README.md.
|
|
41
|
+
*/
|
|
42
|
+
declare function useOIMField<TEntity extends object, TName extends TOIMEntityColumnName<TEntity>, TKey = TOIMStoreKey>(entityCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, unknown, unknown, TName, TOIMColumnSlot>, 'getColumn'>, slot: TOIMEntitySlot<TEntity, TKey>, name: TName): TOIMEntityColumnValue<TEntity, TName> | undefined;
|
|
43
|
+
|
|
44
|
+
/** A bucket's slots, copied out of the service's LIVE container, in the collection's order. */
|
|
45
|
+
declare function useOIMBucketSlots<TEntity extends object, TSlots = unknown>(bucketCollectionService: Pick<OIMSlotCollectionService<unknown, TOIMBucketSlot<TSlots>, unknown, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'slotContentService'>, bucketSlot: TOIMBucketSlot<TSlots>): readonly TOIMEntitySlot<TEntity>[];
|
|
46
|
+
|
|
47
|
+
declare function useOIMBucketSlotsByKey<TEntity extends object, TSlots = unknown, TKey = TOIMStoreKey, TStore = unknown>(bucketCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSlotByKey' | 'holdSlotByKey' | 'slotContentService'>, bucketStoreSlot: TOIMStoreSlot<TStore, TOIMBucketSlot<TSlots, TKey>>, key: TKey): readonly TOIMEntitySlot<TEntity>[];
|
|
48
|
+
|
|
49
|
+
declare function useOIMSlotsByKeys<TKey, TSlot extends TOIMIndexableSlot<TKey>, TStore = unknown>(slotCollectionService: Pick<OIMSlotCollectionService<TKey, TSlot, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, storeSlot: TOIMStoreSlot<TStore, TSlot>, keys: readonly TKey[]): readonly TSlot[];
|
|
50
|
+
|
|
51
|
+
declare function useOIMComputedValueByKey<TValue, TKey = TOIMStoreKey, TStore = unknown>(computedCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMComputedSlot<TValue, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, computedStoreSlot: TOIMStoreSlot<TStore, TOIMComputedSlot<TValue, TKey>>, key: TKey): TValue;
|
|
52
|
+
|
|
53
|
+
declare function useOIMSingleComputedValue<TValue>(computedService: OIMComputedService<void, TValue, TOIMSingleSlotStore<TOIMComputedSlot<TValue, void>>>, derive: ((computedSlot: TOIMComputedSlot<TValue, void>) => TValue) | undefined, createSources: ((key: void, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TValue;
|
|
54
|
+
|
|
55
|
+
declare function useOIMComputedCollection<TKey, TValue, TStore>(computedService: OIMComputedService<TKey, TValue, TStore>, derive: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined, createSources: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TOIMComputedStoreSlot<TStore, TValue, TKey>;
|
|
56
|
+
|
|
57
|
+
export { OIMDBContext, OIMDBProvider, type TOIMBinding, useOIMBucketSlots, useOIMBucketSlotsByKey, useOIMComputedCollection, useOIMComputedValue, useOIMComputedValueByKey, useOIMDB, useOIMEntity, useOIMField, useOIMSingleBucketSlots, useOIMSingleComputedValue, useOIMSingleEntity, useOIMSlotsByKeys, useOIMValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,57 @@
|
|
|
1
|
-
import { TOIMPk, OIMReactiveCollection, OIMIndexArrayBased, OIMReactiveIndexArrayBased, OIMIndexSetBased, OIMReactiveIndexSetBased, OIMReactiveObject } from '@oimdb/core';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
1
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
declare function
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
import { DependencyList } from 'react';
|
|
3
|
+
import { OIMDB, TOIMSlot, TOIMComputedSlot, TOIMStoreKey, OIMSlotCollectionService, TOIMEntitySlot, TOIMStoreSlot, OIMSingleSlotService, TOIMSingleSlotStore, TOIMBucketSlot, OIMSlotContentBucketService, TOIMEntityColumnName, TOIMColumnSlot, TOIMEntityColumnValue, TOIMIndexableSlot, OIMComputedService, TOIMComputedSources, TOIMComputedStoreSlot } from '@oimdb/core';
|
|
4
|
+
|
|
5
|
+
declare const OIMDBContext: React.Context<OIMDB | undefined>;
|
|
6
|
+
|
|
7
|
+
declare function OIMDBProvider({ db, children }: {
|
|
8
|
+
db: OIMDB;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): React.ReactElement;
|
|
11
|
+
|
|
12
|
+
declare function useOIMDB(): OIMDB;
|
|
13
|
+
|
|
14
|
+
type TOIMBinding<TValue> = {
|
|
15
|
+
readonly sourceSlots?: readonly TOIMSlot[] | undefined;
|
|
16
|
+
readonly sourceComputeds?: readonly TOIMComputedSlot[] | undefined;
|
|
17
|
+
readonly derive: () => TValue;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Applies a binding: one `OIMEffectService.INSTANCE.subscribeEffect` over its roots, its derivations settled before
|
|
22
|
+
* every read. THE BINDING MUST KEEP ITS IDENTITY ACROSS RENDERS — a fresh one per render
|
|
23
|
+
* resubscribes on every commit and never converges, freezing the screen rather than
|
|
24
|
+
* throwing. That, and why the snapshot is a counter bumped on subscribing, are in
|
|
25
|
+
* ../README.md.
|
|
26
|
+
*/
|
|
27
|
+
declare function useOIMValue<TValue>(binding: TOIMBinding<TValue>): TValue;
|
|
28
|
+
|
|
29
|
+
declare function useOIMComputedValue<TValue>(computedSlot: TOIMComputedSlot<TValue>): TValue;
|
|
30
|
+
|
|
31
|
+
declare function useOIMEntity<TEntity extends object, TKey = TOIMStoreKey, TStore = unknown>(entityCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, entityStoreSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, key: TKey): TEntity | undefined;
|
|
32
|
+
|
|
33
|
+
declare function useOIMSingleEntity<TEntity extends object>(singleSlotService: Pick<OIMSingleSlotService<TOIMEntitySlot<TEntity, void>, unknown>, 'getSingleSlot' | 'holdSingleSlot'>, singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMEntitySlot<TEntity, void>>, TOIMEntitySlot<TEntity, void>>): TEntity | undefined;
|
|
34
|
+
|
|
35
|
+
declare function useOIMSingleBucketSlots<TEntity extends object, TSlots = unknown>(singleSlotService: Pick<OIMSingleSlotService<TOIMBucketSlot<TSlots, void>, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSingleSlot' | 'holdSingleSlot' | 'slotContentService'>, singleSlotStoreSlot: TOIMStoreSlot<TOIMSingleSlotStore<TOIMBucketSlot<TSlots, void>>, TOIMBucketSlot<TSlots, void>>): readonly TOIMEntitySlot<TEntity>[];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One field of one identity. It cannot go through {@link useOIMValue}: a column identity is
|
|
39
|
+
* minted INSIDE the subscription, so there is no root slot a binding could name. `slot` is an
|
|
40
|
+
* ENTITY SLOT because an entity slot is what can be taken out from under this component — ../README.md.
|
|
41
|
+
*/
|
|
42
|
+
declare function useOIMField<TEntity extends object, TName extends TOIMEntityColumnName<TEntity>, TKey = TOIMStoreKey>(entityCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, unknown, unknown, TName, TOIMColumnSlot>, 'getColumn'>, slot: TOIMEntitySlot<TEntity, TKey>, name: TName): TOIMEntityColumnValue<TEntity, TName> | undefined;
|
|
43
|
+
|
|
44
|
+
/** A bucket's slots, copied out of the service's LIVE container, in the collection's order. */
|
|
45
|
+
declare function useOIMBucketSlots<TEntity extends object, TSlots = unknown>(bucketCollectionService: Pick<OIMSlotCollectionService<unknown, TOIMBucketSlot<TSlots>, unknown, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'slotContentService'>, bucketSlot: TOIMBucketSlot<TSlots>): readonly TOIMEntitySlot<TEntity>[];
|
|
46
|
+
|
|
47
|
+
declare function useOIMBucketSlotsByKey<TEntity extends object, TSlots = unknown, TKey = TOIMStoreKey, TStore = unknown>(bucketCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, Pick<OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, 'getBucketMemberSlots'>>, 'getSlotByKey' | 'holdSlotByKey' | 'slotContentService'>, bucketStoreSlot: TOIMStoreSlot<TStore, TOIMBucketSlot<TSlots, TKey>>, key: TKey): readonly TOIMEntitySlot<TEntity>[];
|
|
48
|
+
|
|
49
|
+
declare function useOIMSlotsByKeys<TKey, TSlot extends TOIMIndexableSlot<TKey>, TStore = unknown>(slotCollectionService: Pick<OIMSlotCollectionService<TKey, TSlot, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, storeSlot: TOIMStoreSlot<TStore, TSlot>, keys: readonly TKey[]): readonly TSlot[];
|
|
50
|
+
|
|
51
|
+
declare function useOIMComputedValueByKey<TValue, TKey = TOIMStoreKey, TStore = unknown>(computedCollectionService: Pick<OIMSlotCollectionService<TKey, TOIMComputedSlot<TValue, TKey>, TStore, unknown>, 'getSlotByKey' | 'holdSlotByKey'>, computedStoreSlot: TOIMStoreSlot<TStore, TOIMComputedSlot<TValue, TKey>>, key: TKey): TValue;
|
|
52
|
+
|
|
53
|
+
declare function useOIMSingleComputedValue<TValue>(computedService: OIMComputedService<void, TValue, TOIMSingleSlotStore<TOIMComputedSlot<TValue, void>>>, derive: ((computedSlot: TOIMComputedSlot<TValue, void>) => TValue) | undefined, createSources: ((key: void, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TValue;
|
|
54
|
+
|
|
55
|
+
declare function useOIMComputedCollection<TKey, TValue, TStore>(computedService: OIMComputedService<TKey, TValue, TStore>, derive: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined, createSources: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined, dependencyList: DependencyList): TOIMComputedStoreSlot<TStore, TValue, TKey>;
|
|
56
|
+
|
|
57
|
+
export { OIMDBContext, OIMDBProvider, type TOIMBinding, useOIMBucketSlots, useOIMBucketSlotsByKey, useOIMComputedCollection, useOIMComputedValue, useOIMComputedValueByKey, useOIMDB, useOIMEntity, useOIMField, useOIMSingleBucketSlots, useOIMSingleComputedValue, useOIMSingleEntity, useOIMSlotsByKeys, useOIMValue };
|