@plyaz/types 1.34.1 → 1.35.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/dist/core/frontend/types.d.ts +15 -1
- package/dist/store/types.d.ts +23 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import type { ReactNode } from 'react';
|
|
|
7
7
|
import type { CoreBaseDomainServiceInterface } from '../domain';
|
|
8
8
|
import type { CoreAppEnvironment, CoreAppContext, CoreRuntimeEnvironment } from '../modules';
|
|
9
9
|
import type { FeatureFlagValue, FeatureFlagContext } from '../../features';
|
|
10
|
-
import type { RootStoreSlice } from '../../store';
|
|
10
|
+
import type { RootStoreSlice, RootStoreHook } from '../../store';
|
|
11
11
|
import type { CoreBaseDomainServiceConfig } from '../domain';
|
|
12
12
|
import type { CoreBaseServiceConfig, CoreBaseMapperInstance, CoreBaseValidatorInstance } from '../domain';
|
|
13
13
|
import type { CoreDomainServiceInstance, CoreObservabilityConfig, CoreServiceEntry } from '../init';
|
|
@@ -1148,6 +1148,20 @@ export interface CorePlyazContextValue extends CorePlyazServices {
|
|
|
1148
1148
|
export interface CorePlyazProviderProps {
|
|
1149
1149
|
/** Child components */
|
|
1150
1150
|
children: ReactNode;
|
|
1151
|
+
/**
|
|
1152
|
+
* Root store hook from @plyaz/store.
|
|
1153
|
+
*
|
|
1154
|
+
* This is required to inject the store into Core, preventing duplicate
|
|
1155
|
+
* store instances when Core and the app import from @plyaz/store separately.
|
|
1156
|
+
*
|
|
1157
|
+
* @example
|
|
1158
|
+
* ```typescript
|
|
1159
|
+
* import { useRootStore } from '@plyaz/store';
|
|
1160
|
+
*
|
|
1161
|
+
* <PlyazProvider store={useRootStore} config={...}>
|
|
1162
|
+
* ```
|
|
1163
|
+
*/
|
|
1164
|
+
store: RootStoreHook;
|
|
1151
1165
|
/** Configuration */
|
|
1152
1166
|
config: CorePlyazConfig;
|
|
1153
1167
|
/** Loading component to show while initializing */
|
package/dist/store/types.d.ts
CHANGED
|
@@ -120,3 +120,26 @@ export interface RootStoreConfig {
|
|
|
120
120
|
/** DevTools store name */
|
|
121
121
|
devtoolsName?: string;
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Type for the root store hook (useRootStore).
|
|
125
|
+
*
|
|
126
|
+
* This is a minimal interface capturing what Core needs from the store hook.
|
|
127
|
+
* The actual `useRootStore` from @plyaz/store is `UseBoundStore<StoreApi<RootStoreSlice>>`
|
|
128
|
+
* but we define a minimal type here to avoid depending on Zustand types.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* import { useRootStore } from '@plyaz/store';
|
|
133
|
+
*
|
|
134
|
+
* // Pass to PlyazProvider
|
|
135
|
+
* <PlyazProvider store={useRootStore} config={...}>
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export interface RootStoreHook {
|
|
139
|
+
/** Get current state snapshot */
|
|
140
|
+
getState: () => RootStoreSlice;
|
|
141
|
+
/** Subscribe to state changes */
|
|
142
|
+
subscribe: (listener: (state: RootStoreSlice) => void) => () => void;
|
|
143
|
+
/** Set state (optional, for store mutations) */
|
|
144
|
+
setState?: (partial: Partial<RootStoreSlice> | ((state: RootStoreSlice) => Partial<RootStoreSlice>)) => void;
|
|
145
|
+
}
|
package/package.json
CHANGED