storion 0.2.3 → 0.3.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 +705 -573
- package/dist/async/async.d.ts +87 -0
- package/dist/async/async.d.ts.map +1 -0
- package/dist/async/index.d.ts +13 -0
- package/dist/async/index.d.ts.map +1 -0
- package/dist/async/index.js +451 -0
- package/dist/async/types.d.ts +275 -0
- package/dist/async/types.d.ts.map +1 -0
- package/dist/collection.d.ts +42 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/core/container.d.ts +33 -2
- package/dist/core/container.d.ts.map +1 -1
- package/dist/core/createResolver.d.ts +47 -0
- package/dist/core/createResolver.d.ts.map +1 -0
- package/dist/core/equality.d.ts +23 -3
- package/dist/core/equality.d.ts.map +1 -1
- package/dist/core/fnWrapper.d.ts +54 -0
- package/dist/core/fnWrapper.d.ts.map +1 -0
- package/dist/core/pick.d.ts +6 -6
- package/dist/core/pick.d.ts.map +1 -1
- package/dist/core/store.d.ts +8 -8
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/storeContext.d.ts +63 -0
- package/dist/core/storeContext.d.ts.map +1 -0
- package/dist/devtools/controller.d.ts +4 -0
- package/dist/devtools/controller.d.ts.map +1 -0
- package/dist/devtools/index.d.ts +16 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +229 -0
- package/dist/devtools/middleware.d.ts +22 -0
- package/dist/devtools/middleware.d.ts.map +1 -0
- package/dist/devtools/types.d.ts +116 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools-panel/DevtoolsPanel.d.ts +17 -0
- package/dist/devtools-panel/DevtoolsPanel.d.ts.map +1 -0
- package/dist/devtools-panel/components/CompareModal.d.ts +10 -0
- package/dist/devtools-panel/components/CompareModal.d.ts.map +1 -0
- package/dist/devtools-panel/components/EventEntry.d.ts +14 -0
- package/dist/devtools-panel/components/EventEntry.d.ts.map +1 -0
- package/dist/devtools-panel/components/EventFilterBar.d.ts +10 -0
- package/dist/devtools-panel/components/EventFilterBar.d.ts.map +1 -0
- package/dist/devtools-panel/components/EventsTab.d.ts +15 -0
- package/dist/devtools-panel/components/EventsTab.d.ts.map +1 -0
- package/dist/devtools-panel/components/ResizeHandle.d.ts +8 -0
- package/dist/devtools-panel/components/ResizeHandle.d.ts.map +1 -0
- package/dist/devtools-panel/components/StoreEntry.d.ts +13 -0
- package/dist/devtools-panel/components/StoreEntry.d.ts.map +1 -0
- package/dist/devtools-panel/components/StoresTab.d.ts +12 -0
- package/dist/devtools-panel/components/StoresTab.d.ts.map +1 -0
- package/dist/devtools-panel/components/TabLayout.d.ts +48 -0
- package/dist/devtools-panel/components/TabLayout.d.ts.map +1 -0
- package/dist/devtools-panel/components/icons.d.ts +27 -0
- package/dist/devtools-panel/components/icons.d.ts.map +1 -0
- package/dist/devtools-panel/components/index.d.ts +15 -0
- package/dist/devtools-panel/components/index.d.ts.map +1 -0
- package/dist/devtools-panel/hooks.d.ts +23 -0
- package/dist/devtools-panel/hooks.d.ts.map +1 -0
- package/dist/devtools-panel/index.d.ts +25 -0
- package/dist/devtools-panel/index.d.ts.map +1 -0
- package/dist/devtools-panel/index.js +3326 -0
- package/dist/devtools-panel/mount.d.ts +41 -0
- package/dist/devtools-panel/mount.d.ts.map +1 -0
- package/dist/devtools-panel/styles.d.ts +50 -0
- package/dist/devtools-panel/styles.d.ts.map +1 -0
- package/dist/devtools-panel/types.d.ts +15 -0
- package/dist/devtools-panel/types.d.ts.map +1 -0
- package/dist/devtools-panel/utils.d.ts +21 -0
- package/dist/devtools-panel/utils.d.ts.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/is.d.ts +69 -0
- package/dist/is.d.ts.map +1 -0
- package/dist/react/create.d.ts +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +209 -33
- package/dist/react/useLocalStore.d.ts.map +1 -1
- package/dist/react/useStore.d.ts +2 -2
- package/dist/react/useStore.d.ts.map +1 -1
- package/dist/react/withStore.d.ts +140 -0
- package/dist/react/withStore.d.ts.map +1 -0
- package/dist/{index-rLf6DusB.js → store-XP2pujaJ.js} +537 -740
- package/dist/storion.js +740 -9
- package/dist/trigger.d.ts +40 -0
- package/dist/trigger.d.ts.map +1 -0
- package/dist/types.d.ts +516 -50
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PanelPosition } from './DevtoolsPanel';
|
|
2
|
+
|
|
3
|
+
export interface MountOptions {
|
|
4
|
+
/** Container element to mount into. If string, will query for element. */
|
|
5
|
+
container?: HTMLElement | string;
|
|
6
|
+
/** Position when creating default container */
|
|
7
|
+
position?: PanelPosition;
|
|
8
|
+
/** Initial height/width depending on position */
|
|
9
|
+
size?: number;
|
|
10
|
+
/** Z-index for the panel */
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
/** Start collapsed */
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Mount the devtools panel.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { mountDevtoolsPanel } from "storion/devtools-panel";
|
|
21
|
+
*
|
|
22
|
+
* // Mount with default left panel
|
|
23
|
+
* mountDevtoolsPanel();
|
|
24
|
+
*
|
|
25
|
+
* // Mount at bottom
|
|
26
|
+
* mountDevtoolsPanel({ position: "bottom", size: 300 });
|
|
27
|
+
*
|
|
28
|
+
* // Mount at left
|
|
29
|
+
* mountDevtoolsPanel({ position: "left", size: 400 });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function mountDevtoolsPanel(options?: MountOptions): () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Unmount the devtools panel.
|
|
35
|
+
*/
|
|
36
|
+
export declare function unmountDevtoolsPanel(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Toggle the devtools panel visibility.
|
|
39
|
+
*/
|
|
40
|
+
export declare function toggleDevtoolsPanel(options?: MountOptions): void;
|
|
41
|
+
//# sourceMappingURL=mount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/devtools-panel/mount.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA2BpE,MAAM,WAAW,YAAY;IAC3B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AA8ID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,IAAI,CA6LzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAU3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAMhE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS styles for devtools panel.
|
|
3
|
+
* shadcn UI inspired theme with clean, minimal design.
|
|
4
|
+
*
|
|
5
|
+
* Font strategy:
|
|
6
|
+
* - Sans-serif (Inter/system) for UI labels, buttons, headings
|
|
7
|
+
* - Monospace for data values, timestamps, code, inputs
|
|
8
|
+
*/
|
|
9
|
+
export declare const colors: {
|
|
10
|
+
bg: {
|
|
11
|
+
base: string;
|
|
12
|
+
card: string;
|
|
13
|
+
panel: string;
|
|
14
|
+
elevated: string;
|
|
15
|
+
hover: string;
|
|
16
|
+
muted: string;
|
|
17
|
+
};
|
|
18
|
+
text: {
|
|
19
|
+
primary: string;
|
|
20
|
+
secondary: string;
|
|
21
|
+
muted: string;
|
|
22
|
+
dim: string;
|
|
23
|
+
};
|
|
24
|
+
border: {
|
|
25
|
+
default: string;
|
|
26
|
+
subtle: string;
|
|
27
|
+
focus: string;
|
|
28
|
+
};
|
|
29
|
+
syntax: {
|
|
30
|
+
key: string;
|
|
31
|
+
string: string;
|
|
32
|
+
number: string;
|
|
33
|
+
boolean: string;
|
|
34
|
+
null: string;
|
|
35
|
+
};
|
|
36
|
+
accent: {
|
|
37
|
+
primary: string;
|
|
38
|
+
success: string;
|
|
39
|
+
warning: string;
|
|
40
|
+
danger: string;
|
|
41
|
+
info: string;
|
|
42
|
+
blue: string;
|
|
43
|
+
purple: string;
|
|
44
|
+
green: string;
|
|
45
|
+
red: string;
|
|
46
|
+
yellow: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const panelStyles: string;
|
|
50
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/devtools-panel/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ClB,CAAC;AAQF,eAAO,MAAM,WAAW,QAm1CvB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for devtools panel.
|
|
3
|
+
*/
|
|
4
|
+
export type Tab = "stores" | "history" | "graph";
|
|
5
|
+
export interface PanelState {
|
|
6
|
+
/** Currently active tab */
|
|
7
|
+
activeTab: Tab;
|
|
8
|
+
/** Search query */
|
|
9
|
+
searchQuery: string;
|
|
10
|
+
/** Selected store ID */
|
|
11
|
+
selectedStoreId: string | null;
|
|
12
|
+
/** Whether panel is collapsed */
|
|
13
|
+
collapsed: boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/devtools-panel/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,GAAG,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjD,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,SAAS,EAAE,GAAG,CAAC;IACf,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Devtools Utility Functions
|
|
3
|
+
*
|
|
4
|
+
* Shared utility functions for the devtools panel.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format a timestamp to time string with milliseconds (HH:MM:SS.mmm)
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatTime(timestamp: number): string;
|
|
10
|
+
/**
|
|
11
|
+
* Format a timestamp to time string with milliseconds (HH:MM:SS.mmm)
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatDateTime(timestamp: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format a value for display with type information
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatValue(value: unknown): {
|
|
18
|
+
text: string;
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/devtools-panel/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAiB1E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export { STORION_TYPE, type StorionKind, type StorionObject, type StateBase, type ActionsBase, type Equality, type EqualityMap, type Lifetime, type DispatchEvent, type ActionDispatchEvent, type ReactiveAction, type ReactiveActions, type StoreMeta, type StoreSpec, type StoreContext, type StoreMixin, type StoreOptions, type StoreInstance, type StoreContainer, type ContainerOptions, type StoreMiddleware, type SelectorContext, type SelectorMixin, type Selector, type StoreTuple, type StableResult, type PickEquality, type StatePath, type PathValue, type Focus, type FocusOptions, type FocusChangeEvent, type NonNullish, type Factory, type Middleware, type MiddlewareContext, type Resolver, type ResolverOptions, } from './types';
|
|
7
|
+
export { is, isStorion, getKind, isSpec, isContainer, isStore, isFocus, isAction, isStoreContext, isSelectorContext, } from './is';
|
|
7
8
|
export { store } from './core/store';
|
|
8
9
|
export { container } from './core/container';
|
|
9
10
|
export { batch, untrack } from './core/tracking';
|
|
11
|
+
export { createResolver, when, createLoggingMiddleware, createValidationMiddleware, } from './core/createResolver';
|
|
10
12
|
export { pick } from './core/pick';
|
|
11
13
|
export { effect, type EffectFn, type EffectContext, type EffectOptions, type EffectErrorStrategy, type EffectErrorContext, type EffectRetryConfig, } from './core/effect';
|
|
12
14
|
export { applyFor, applyExcept, compose, type SpecPattern, } from './core/middleware';
|
|
15
|
+
export { equality, shallowEqual, deepEqual, strictEqual, } from './core/equality';
|
|
16
|
+
export { trigger, type TriggerOptions } from './trigger';
|
|
17
|
+
export { wrapFn as wrapFn, unwrapFn, isWrappedFn } from './core/fnWrapper';
|
|
13
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAEjB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,EAAE,EACF,SAAS,EACT,OAAO,EACP,MAAM,EACN,WAAW,EACX,OAAO,EACP,OAAO,EACP,QAAQ,EACR,cAAc,EACd,iBAAiB,GAClB,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,EACL,cAAc,EACd,IAAI,EACJ,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EACL,MAAM,EACN,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,QAAQ,EACR,WAAW,EACX,OAAO,EACP,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAGzD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/is.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { StorionKind, StorionObject, StoreSpec, StoreContainer, StoreInstance, StoreContext, SelectorContext, Focus, StateBase, ActionsBase } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if a value is a Storion object of a specific kind.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* if (is(value, "store.spec")) {
|
|
8
|
+
* // value is StoreSpec
|
|
9
|
+
* }
|
|
10
|
+
*
|
|
11
|
+
* if (is(value, "store")) {
|
|
12
|
+
* // value is StoreInstance
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* if (is(value, "focus")) {
|
|
16
|
+
* // value is Focus
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export declare function is<K extends StorionKind>(value: unknown, kind: K): value is StorionObjectForKind<K>;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a value is any Storion object.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* if (isStorion(value)) {
|
|
25
|
+
* console.log(value[STORION_SYMBOL]); // "spec" | "store" | ...
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
export declare function isStorion(value: unknown): value is StorionObject;
|
|
29
|
+
/**
|
|
30
|
+
* Get the kind of a Storion object.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const kind = getKind(myStore); // "store"
|
|
34
|
+
*/
|
|
35
|
+
export declare function getKind(value: StorionObject): StorionKind;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a value is a StoreSpec.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isSpec<TState extends StateBase = StateBase, TActions extends ActionsBase = ActionsBase>(value: unknown): value is StoreSpec<TState, TActions>;
|
|
40
|
+
/**
|
|
41
|
+
* Check if a value is a StoreContainer.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isContainer(value: unknown): value is StoreContainer;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a value is a StoreInstance.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isStore<TState extends StateBase = StateBase, TActions extends ActionsBase = ActionsBase>(value: unknown): value is StoreInstance<TState, TActions>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a value is a Focus.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isFocus<TValue = unknown>(value: unknown): value is Focus<TValue>;
|
|
52
|
+
/**
|
|
53
|
+
* Check if a value is a StoreContext.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isStoreContext<TState extends StateBase = StateBase>(value: unknown): value is StoreContext<TState>;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a value is a SelectorContext.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isSelectorContext(value: unknown): value is SelectorContext;
|
|
60
|
+
/**
|
|
61
|
+
* Check if a value is a store Action.
|
|
62
|
+
*/
|
|
63
|
+
export declare function isAction(value: unknown): value is StorionObject<"store.action">;
|
|
64
|
+
/**
|
|
65
|
+
* Maps StorionKind to the corresponding type.
|
|
66
|
+
*/
|
|
67
|
+
type StorionObjectForKind<K extends StorionKind> = K extends "store.spec" ? StoreSpec<any, any> : K extends "container" ? StoreContainer : K extends "store" ? StoreInstance<any, any> : K extends "focus" ? Focus<any> : K extends "store.action" ? StorionObject<"store.action"> : K extends "store.context" ? StoreContext<any> : K extends "selector.context" ? SelectorContext : K extends "async.meta" ? StorionObject<"async.meta"> : never;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=is.d.ts.map
|
package/dist/is.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../src/is.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,WAAW,EACX,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,KAAK,EACL,SAAS,EACT,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,EAAE,CAAC,CAAC,SAAS,WAAW,EACtC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,CAAC,GACN,KAAK,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAOlC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAOhE;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,WAAW,CAEzD;AAMD;;GAEG;AACH,wBAAgB,MAAM,CACpB,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAEtD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAEnE;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,SAAS,SAAS,GAAG,SAAS,EACpC,QAAQ,SAAS,WAAW,GAAG,WAAW,EAC1C,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAE1D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,MAAM,GAAG,OAAO,EACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAExB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,SAAS,SAAS,GAAG,SAAS,EACjE,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAE/B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAExC;AAMD;;GAEG;AACH,KAAK,oBAAoB,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,YAAY,GACrE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GACnB,CAAC,SAAS,WAAW,GACrB,cAAc,GACd,CAAC,SAAS,OAAO,GACjB,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,GACvB,CAAC,SAAS,OAAO,GACjB,KAAK,CAAC,GAAG,CAAC,GACV,CAAC,SAAS,cAAc,GACxB,aAAa,CAAC,cAAc,CAAC,GAC7B,CAAC,SAAS,eAAe,GACzB,YAAY,CAAC,GAAG,CAAC,GACjB,CAAC,SAAS,kBAAkB,GAC5B,eAAe,GACf,CAAC,SAAS,YAAY,GACtB,aAAa,CAAC,YAAY,CAAC,GAC3B,KAAK,CAAC"}
|
package/dist/react/create.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { StateBase, ActionsBase, StoreOptions, StoreInstance, StableResult } fro
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Selector for create() hook.
|
|
5
|
-
* Receives state and actions directly (no
|
|
5
|
+
* Receives state and actions directly (no get needed).
|
|
6
6
|
*/
|
|
7
7
|
export type CreateSelector<TState extends StateBase, TActions extends ActionsBase, T> = (state: Readonly<TState>, actions: TActions) => T;
|
|
8
8
|
/**
|
package/dist/react/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { StoreProvider, useContainer } from './context';
|
|
7
7
|
export { useStore } from './useStore';
|
|
8
8
|
export { type LocalStoreResult } from './useLocalStore';
|
|
9
|
+
export { withStore, type WithStoreHook, type WithStoreRender, type WithStoreRenderWithRef, type WithStoreOptions, } from './withStore';
|
|
9
10
|
export { create, type CreateSelector, type UseCreatedStore, type CreateResult, } from './create';
|
|
10
11
|
export * from '../index';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EACL,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,MAAM,EACN,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,UAAU,CAAC;AAGlB,cAAc,UAAU,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { memo, useMemo, createElement, createContext, useContext, useReducer, useRef, useLayoutEffect, useState,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { memo, useMemo, createElement, createContext, useContext, useReducer, useRef, useEffect, useLayoutEffect, useState, forwardRef } from "react";
|
|
5
|
+
import { container } from "../storion.js";
|
|
6
|
+
import { applyExcept, applyFor, compose, createLoggingMiddleware, createResolver, createValidationMiddleware, effect, pick, trigger, when } from "../storion.js";
|
|
7
|
+
import { w as withHooks, i as isSpec, S as STORION_TYPE, r as resolveEquality, s as store } from "../store-XP2pujaJ.js";
|
|
8
|
+
import { m, p, n, g, a, j, d, h, l, f, k, b, x, o, q, u, v, t } from "../store-XP2pujaJ.js";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
10
|
const StoreContext = createContext(null);
|
|
8
11
|
const StoreProvider = memo(
|
|
9
12
|
({ container: value, children }) => {
|
|
@@ -22,9 +25,60 @@ function useContainer() {
|
|
|
22
25
|
}
|
|
23
26
|
return ctx;
|
|
24
27
|
}
|
|
28
|
+
function checkIsDev() {
|
|
29
|
+
if (typeof __DEV__ !== "undefined") {
|
|
30
|
+
return __DEV__;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return process.env.NODE_ENV !== "production";
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function dev(fn) {
|
|
39
|
+
const isDev = checkIsDev();
|
|
40
|
+
if (fn) {
|
|
41
|
+
if (isDev) {
|
|
42
|
+
fn();
|
|
43
|
+
}
|
|
44
|
+
return isDev;
|
|
45
|
+
}
|
|
46
|
+
return isDev;
|
|
47
|
+
}
|
|
48
|
+
((dev2) => {
|
|
49
|
+
function log(message, ...args) {
|
|
50
|
+
if (checkIsDev()) {
|
|
51
|
+
console.log(`[rextive] ${message}`, ...args);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
dev2.log = log;
|
|
55
|
+
function warn(message, ...args) {
|
|
56
|
+
if (checkIsDev()) {
|
|
57
|
+
console.warn(`[rextive] ${message}`, ...args);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
dev2.warn = warn;
|
|
61
|
+
function error(message, ...args) {
|
|
62
|
+
if (checkIsDev()) {
|
|
63
|
+
console.error(`[rextive] ${message}`, ...args);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
dev2.error = error;
|
|
67
|
+
function assert(condition, message) {
|
|
68
|
+
if (checkIsDev()) {
|
|
69
|
+
if (!condition) {
|
|
70
|
+
throw new Error(`[rextive] Assertion failed: ${message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
dev2.assert = assert;
|
|
75
|
+
})(dev || (dev = {}));
|
|
76
|
+
const isServer = typeof window === "undefined";
|
|
77
|
+
const useIsomorphicLayoutEffect = isServer ? useEffect : useLayoutEffect;
|
|
78
|
+
const shouldScheduleDispose = !isServer && typeof useLayoutEffect === "function" && dev();
|
|
25
79
|
function useLocalStore(spec) {
|
|
26
80
|
var _a;
|
|
27
|
-
const [, forceUpdate] = useReducer((
|
|
81
|
+
const [, forceUpdate] = useReducer((x2) => x2 + 1, 0);
|
|
28
82
|
const prevControllerRef = useRef(null);
|
|
29
83
|
const controller = useMemo(() => new LocalStoreController(spec), [spec]);
|
|
30
84
|
if (prevControllerRef.current !== controller) {
|
|
@@ -32,7 +86,7 @@ function useLocalStore(spec) {
|
|
|
32
86
|
prevControllerRef.current = controller;
|
|
33
87
|
}
|
|
34
88
|
const store2 = controller.getStore();
|
|
35
|
-
|
|
89
|
+
useIsomorphicLayoutEffect(() => {
|
|
36
90
|
controller.commit();
|
|
37
91
|
const unsubscribe = store2.subscribe(() => forceUpdate());
|
|
38
92
|
return () => {
|
|
@@ -82,11 +136,15 @@ class LocalStoreController {
|
|
|
82
136
|
*/
|
|
83
137
|
__publicField(this, "_disposeIfUnused", () => {
|
|
84
138
|
if (this._committed || this._disposed) return;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
139
|
+
if (shouldScheduleDispose) {
|
|
140
|
+
Promise.resolve().then(() => {
|
|
141
|
+
if (!this._committed) {
|
|
142
|
+
this.dispose();
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
this.dispose();
|
|
147
|
+
}
|
|
90
148
|
});
|
|
91
149
|
/**
|
|
92
150
|
* Get or create the store instance.
|
|
@@ -106,7 +164,9 @@ class LocalStoreController {
|
|
|
106
164
|
`Local store must not have dependencies, but "${this.spec.name}" has ${depsCount} dependencies. Use useStore() with a global container for stores with dependencies.`
|
|
107
165
|
);
|
|
108
166
|
}
|
|
109
|
-
|
|
167
|
+
if (shouldScheduleDispose) {
|
|
168
|
+
this._disposeIfUnused();
|
|
169
|
+
}
|
|
110
170
|
return this._store;
|
|
111
171
|
});
|
|
112
172
|
/**
|
|
@@ -128,27 +188,44 @@ class LocalStoreController {
|
|
|
128
188
|
}
|
|
129
189
|
}
|
|
130
190
|
function useStoreWithContainer(selector, container2) {
|
|
131
|
-
const [, forceUpdate] = useReducer((
|
|
191
|
+
const [, forceUpdate] = useReducer((x2) => x2 + 1, 0);
|
|
132
192
|
const [refs] = useState(() => ({
|
|
133
|
-
|
|
193
|
+
fresh: void 0,
|
|
134
194
|
stableFns: /* @__PURE__ */ new Map(),
|
|
135
195
|
trackedDeps: /* @__PURE__ */ new Map(),
|
|
136
|
-
subscriptions: /* @__PURE__ */ new Map()
|
|
196
|
+
subscriptions: /* @__PURE__ */ new Map(),
|
|
197
|
+
id: {},
|
|
198
|
+
onceRan: false
|
|
137
199
|
}));
|
|
138
|
-
refs.selector = selector;
|
|
139
200
|
refs.trackedDeps.clear();
|
|
201
|
+
const shouldRunOnce = !refs.onceRan;
|
|
140
202
|
const selectorContext = useMemo(() => {
|
|
141
203
|
const ctx = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
204
|
+
[STORION_TYPE]: "selector.context",
|
|
205
|
+
id: refs.id,
|
|
206
|
+
// Implementation handles both StoreSpec and Factory overloads
|
|
207
|
+
get(specOrFactory) {
|
|
208
|
+
if (!isSpec(specOrFactory)) {
|
|
209
|
+
return container2.get(specOrFactory);
|
|
210
|
+
}
|
|
211
|
+
const instance = container2.get(specOrFactory);
|
|
212
|
+
const tuple = [instance.state, instance.actions];
|
|
213
|
+
return Object.assign(tuple, {
|
|
214
|
+
state: instance.state,
|
|
215
|
+
actions: instance.actions
|
|
216
|
+
});
|
|
145
217
|
},
|
|
146
|
-
|
|
218
|
+
mixin(mixin, ...args) {
|
|
147
219
|
return mixin(ctx, ...args);
|
|
220
|
+
},
|
|
221
|
+
once(callback) {
|
|
222
|
+
if (shouldRunOnce) {
|
|
223
|
+
callback();
|
|
224
|
+
}
|
|
148
225
|
}
|
|
149
226
|
};
|
|
150
227
|
return ctx;
|
|
151
|
-
}, [container2]);
|
|
228
|
+
}, [container2, shouldRunOnce]);
|
|
152
229
|
const result = withHooks(
|
|
153
230
|
{
|
|
154
231
|
onRead: (event) => {
|
|
@@ -157,18 +234,22 @@ function useStoreWithContainer(selector, container2) {
|
|
|
157
234
|
},
|
|
158
235
|
() => selector(selectorContext)
|
|
159
236
|
);
|
|
237
|
+
if (shouldRunOnce) {
|
|
238
|
+
refs.onceRan = true;
|
|
239
|
+
}
|
|
160
240
|
if (result && typeof result.then === "function") {
|
|
161
241
|
throw new Error(
|
|
162
242
|
"useStore selector must be synchronous. Do not return a Promise from the selector function."
|
|
163
243
|
);
|
|
164
244
|
}
|
|
245
|
+
refs.fresh = result;
|
|
165
246
|
const output = Array.isArray(result) ? [] : {};
|
|
166
247
|
for (const [key, value] of Object.entries(result)) {
|
|
167
248
|
if (typeof value === "function") {
|
|
168
249
|
if (!refs.stableFns.has(key)) {
|
|
169
250
|
refs.stableFns.set(key, (...args) => {
|
|
170
|
-
|
|
171
|
-
return fresh[key](...args);
|
|
251
|
+
var _a, _b;
|
|
252
|
+
return (_b = (_a = refs.fresh) == null ? void 0 : _a[key]) == null ? void 0 : _b.call(_a, ...args);
|
|
172
253
|
});
|
|
173
254
|
}
|
|
174
255
|
output[key] = refs.stableFns.get(key);
|
|
@@ -203,21 +284,92 @@ function useStoreWithContainer(selector, container2) {
|
|
|
203
284
|
return output;
|
|
204
285
|
}
|
|
205
286
|
function useStore(selectorOrSpec) {
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
287
|
+
const isSpec2 = typeof selectorOrSpec === "object" && selectorOrSpec !== null && "options" in selectorOrSpec;
|
|
288
|
+
if (isSpec2) {
|
|
208
289
|
return useLocalStore(selectorOrSpec);
|
|
209
290
|
}
|
|
210
291
|
const container2 = useContainer();
|
|
211
292
|
return useStoreWithContainer(selectorOrSpec, container2);
|
|
212
293
|
}
|
|
294
|
+
function withStore(hook, renderOrOptions, maybeOptions) {
|
|
295
|
+
const render = typeof renderOrOptions === "function" ? renderOrOptions : void 0;
|
|
296
|
+
const options = render ? maybeOptions : renderOrOptions;
|
|
297
|
+
const equalityFn = (options == null ? void 0 : options.equality) ? resolveEquality(options.equality) : void 0;
|
|
298
|
+
const customDisplayName = options == null ? void 0 : options.displayName;
|
|
299
|
+
if (render) {
|
|
300
|
+
if (render.length >= 2) {
|
|
301
|
+
const WrappedComponent2 = forwardRef((props, ref) => {
|
|
302
|
+
const output = useStore((ctx) => hook(ctx, props));
|
|
303
|
+
return render(output, ref);
|
|
304
|
+
});
|
|
305
|
+
const MemoizedComponent = equalityFn ? memo(
|
|
306
|
+
WrappedComponent2,
|
|
307
|
+
(prev, next) => equalityFn(prev, next)
|
|
308
|
+
) : memo(WrappedComponent2);
|
|
309
|
+
if (customDisplayName) {
|
|
310
|
+
MemoizedComponent.displayName = customDisplayName;
|
|
311
|
+
}
|
|
312
|
+
MemoizedComponent.use = hook;
|
|
313
|
+
MemoizedComponent.render = (props) => render(props, null);
|
|
314
|
+
return MemoizedComponent;
|
|
315
|
+
}
|
|
316
|
+
const MemoizedRender = equalityFn ? memo(
|
|
317
|
+
render,
|
|
318
|
+
(prev, next) => equalityFn(prev, next)
|
|
319
|
+
) : memo(render);
|
|
320
|
+
const WrappedComponent = (props) => {
|
|
321
|
+
const output = useStore((ctx) => hook(ctx, props));
|
|
322
|
+
return /* @__PURE__ */ jsx(MemoizedRender, { ...output });
|
|
323
|
+
};
|
|
324
|
+
if (customDisplayName) {
|
|
325
|
+
WrappedComponent.displayName = customDisplayName;
|
|
326
|
+
}
|
|
327
|
+
WrappedComponent.use = hook;
|
|
328
|
+
WrappedComponent.render = render;
|
|
329
|
+
return WrappedComponent;
|
|
330
|
+
}
|
|
331
|
+
const hoc = (Component) => {
|
|
332
|
+
const isForwardRef = Component.$$typeof === Symbol.for("react.forward_ref");
|
|
333
|
+
const componentDisplayName = Component.displayName || Component.name;
|
|
334
|
+
const finalDisplayName = customDisplayName || (componentDisplayName ? `withStore(${componentDisplayName})` : void 0);
|
|
335
|
+
if (isForwardRef || Component.length >= 2) {
|
|
336
|
+
const WrappedComponent2 = forwardRef((props, ref) => {
|
|
337
|
+
const output = useStore((ctx) => hook(ctx, props));
|
|
338
|
+
return isForwardRef ? /* @__PURE__ */ jsx(Component, { ...output, ref }) : Component(output, ref);
|
|
339
|
+
});
|
|
340
|
+
const MemoizedComponent2 = equalityFn ? memo(
|
|
341
|
+
WrappedComponent2,
|
|
342
|
+
(prev, next) => equalityFn(prev, next)
|
|
343
|
+
) : memo(WrappedComponent2);
|
|
344
|
+
if (finalDisplayName) {
|
|
345
|
+
MemoizedComponent2.displayName = finalDisplayName;
|
|
346
|
+
}
|
|
347
|
+
return MemoizedComponent2;
|
|
348
|
+
}
|
|
349
|
+
const MemoizedComponent = equalityFn ? memo(
|
|
350
|
+
Component,
|
|
351
|
+
(prev, next) => equalityFn(prev, next)
|
|
352
|
+
) : memo(Component);
|
|
353
|
+
const WrappedComponent = (props) => {
|
|
354
|
+
const output = useStore((ctx) => hook(ctx, props));
|
|
355
|
+
return /* @__PURE__ */ jsx(MemoizedComponent, { ...output });
|
|
356
|
+
};
|
|
357
|
+
if (finalDisplayName) {
|
|
358
|
+
WrappedComponent.displayName = finalDisplayName;
|
|
359
|
+
}
|
|
360
|
+
return WrappedComponent;
|
|
361
|
+
};
|
|
362
|
+
hoc.use = hook;
|
|
363
|
+
return hoc;
|
|
364
|
+
}
|
|
213
365
|
function create(options) {
|
|
214
366
|
const spec = store(options);
|
|
215
367
|
const dedicatedContainer = container();
|
|
216
368
|
const instance = dedicatedContainer.get(spec);
|
|
217
369
|
const useCreatedStore = (selector) => {
|
|
218
370
|
return useStoreWithContainer(
|
|
219
|
-
({
|
|
220
|
-
const [state, actions] =
|
|
371
|
+
({ get }) => {
|
|
372
|
+
const [state, actions] = get(spec);
|
|
221
373
|
return selector(state, actions);
|
|
222
374
|
},
|
|
223
375
|
dedicatedContainer
|
|
@@ -226,17 +378,41 @@ function create(options) {
|
|
|
226
378
|
return [instance, useCreatedStore];
|
|
227
379
|
}
|
|
228
380
|
export {
|
|
381
|
+
STORION_TYPE,
|
|
229
382
|
StoreProvider,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
383
|
+
applyExcept,
|
|
384
|
+
applyFor,
|
|
385
|
+
m as batch,
|
|
386
|
+
compose,
|
|
234
387
|
container,
|
|
235
388
|
create,
|
|
236
|
-
|
|
237
|
-
|
|
389
|
+
createLoggingMiddleware,
|
|
390
|
+
createResolver,
|
|
391
|
+
createValidationMiddleware,
|
|
392
|
+
p as deepEqual,
|
|
393
|
+
effect,
|
|
394
|
+
n as equality,
|
|
395
|
+
g as getKind,
|
|
396
|
+
a as is,
|
|
397
|
+
j as isAction,
|
|
398
|
+
d as isContainer,
|
|
399
|
+
h as isFocus,
|
|
400
|
+
l as isSelectorContext,
|
|
401
|
+
isSpec,
|
|
402
|
+
f as isStore,
|
|
403
|
+
k as isStoreContext,
|
|
404
|
+
b as isStorion,
|
|
405
|
+
x as isWrappedFn,
|
|
406
|
+
pick,
|
|
407
|
+
o as shallowEqual,
|
|
238
408
|
store,
|
|
409
|
+
q as strictEqual,
|
|
410
|
+
trigger,
|
|
239
411
|
u as untrack,
|
|
412
|
+
v as unwrapFn,
|
|
240
413
|
useContainer,
|
|
241
|
-
useStore
|
|
414
|
+
useStore,
|
|
415
|
+
when,
|
|
416
|
+
withStore,
|
|
417
|
+
t as wrapFn
|
|
242
418
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalStore.d.ts","sourceRoot":"","sources":["../../src/react/useLocalStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,WAAW,EACX,SAAS,EAET,aAAa,EACb,SAAS,EACV,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useLocalStore.d.ts","sourceRoot":"","sources":["../../src/react/useLocalStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,WAAW,EACX,SAAS,EAET,aAAa,EACb,SAAS,EACV,MAAM,UAAU,CAAC;AAGlB;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAC1B,MAAM,SAAS,SAAS,EACxB,QAAQ,SAAS,WAAW,IAC1B,SAAS;IACX,QAAQ,CAAC,MAAM,CAAC;IAChB,QAAQ;IACR,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CACzD,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAC3B,MAAM,SAAS,SAAS,EACxB,QAAQ,SAAS,WAAW,EAC5B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CA8CvE"}
|
package/dist/react/useStore.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare function useStoreWithContainer<T extends object>(selector: Select
|
|
|
18
18
|
* @example
|
|
19
19
|
* ```tsx
|
|
20
20
|
* // With selector - access global stores
|
|
21
|
-
* const { count, increment } = useStore(({
|
|
22
|
-
* const [state, actions] =
|
|
21
|
+
* const { count, increment } = useStore(({ get }) => {
|
|
22
|
+
* const [state, actions] = get(counterSpec);
|
|
23
23
|
* return { count: state.count, increment: actions.increment };
|
|
24
24
|
* });
|
|
25
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/react/useStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/react/useStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAuBvE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,SAAS,EAAE,cAAc,GACxB,YAAY,CAAC,CAAC,CAAC,CA8IjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GACpB,YAAY,CAAC,CAAC,CAAC,CAAC;AACnB,wBAAgB,QAAQ,CACtB,MAAM,SAAS,SAAS,EACxB,QAAQ,SAAS,WAAW,EAC5B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|