@allternit/gizzi-code 1.0.0 → 1.0.1
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/bin/gizzi +4 -0
- package/bin/gizzi-ink +5 -0
- package/package.json +137 -31
- package/src/Tool.ts +26 -0
- package/src/bootstrap/state.ts +165 -322
- package/src/commands.ts +209 -0
- package/src/context/QueuedMessageContext.tsx +63 -0
- package/src/context/fpsMetrics.tsx +30 -0
- package/src/context/mailbox.tsx +38 -0
- package/src/context/modalContext.tsx +58 -0
- package/src/context/notifications.tsx +240 -0
- package/src/context/overlayContext.tsx +151 -0
- package/src/context/promptOverlayContext.tsx +125 -0
- package/src/context/stats.tsx +220 -0
- package/src/context/voice.tsx +88 -0
- package/src/hooks/useCanUseTool.ts +11 -0
- package/src/hooks/useExitOnCtrlCD.ts +40 -187
- package/src/hooks/useExitOnCtrlCDWithKeybindings.ts +68 -0
- package/src/hooks/useKeybinding.ts +68 -209
- package/src/hooks/useTerminalSize.ts +31 -99
- package/src/hooks.ts +37 -0
- package/src/ink.ts +204 -0
- package/src/main.ts +7 -0
- package/src/types/command.ts +216 -0
- package/src/types/connectorText.ts +39 -0
- package/src/types/fileSuggestion.ts +15 -0
- package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.ts +865 -0
- package/src/types/generated/events_mono/common/v1/auth.ts +100 -0
- package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.ts +223 -0
- package/src/types/generated/google/protobuf/timestamp.ts +187 -0
- package/src/types/hooks.ts +319 -0
- package/src/types/ids.ts +44 -0
- package/src/types/logs.ts +331 -0
- package/src/types/merged/index.ts +5 -0
- package/src/types/merged/message.ts +552 -0
- package/src/types/message.ts +927 -186
- package/src/types/messageQueueTypes.ts +21 -0
- package/src/types/notebook.ts +72 -0
- package/src/types/permissions.ts +447 -0
- package/src/types/plugin.ts +363 -0
- package/src/types/statusLine.ts +15 -0
- package/src/types/textInputTypes.ts +387 -0
- package/src/types/tools.ts +149 -0
- package/src/types/utils.ts +20 -0
- package/src/utils/advisor.ts +12 -0
- package/src/utils/api.ts +29 -0
- package/src/utils/array.ts +7 -0
- package/src/utils/attachments.ts +60 -0
- package/src/utils/auth.ts +3 -0
- package/src/utils/claudeInChrome/chromeNativeHost.ts +15 -0
- package/src/utils/claudeInChrome/common.ts +12 -0
- package/src/utils/claudeInChrome/mcpServer.ts +15 -0
- package/src/utils/computerUse/common.ts +19 -0
- package/src/utils/computerUse/mcpServer.ts +15 -0
- package/src/utils/config.ts +35 -0
- package/src/utils/context.ts +19 -0
- package/src/utils/cwd.ts +3 -0
- package/src/utils/debug.ts +3 -0
- package/src/utils/earlyInput.ts +7 -0
- package/src/utils/effort.ts +13 -0
- package/src/utils/embeddedTools.ts +12 -0
- package/src/utils/envUtils.ts +3 -0
- package/src/utils/errors.ts +3 -0
- package/src/utils/execFileNoThrow.ts +24 -0
- package/src/utils/feature-flags.ts +112 -0
- package/src/utils/file.ts +3 -0
- package/src/utils/fileHistory.ts +17 -0
- package/src/utils/fingerprint.ts +7 -0
- package/src/utils/format.ts +75 -305
- package/src/utils/frontmatterParser.ts +33 -0
- package/src/utils/fsOperations.ts +31 -0
- package/src/utils/fullscreen.ts +40 -350
- package/src/utils/git.ts +15 -0
- package/src/utils/imageResizer.ts +30 -0
- package/src/utils/lazySchema.ts +9 -0
- package/src/utils/log.ts +3 -0
- package/src/utils/markdownConfigLoader.ts +12 -0
- package/src/utils/messages.ts +13 -0
- package/src/utils/migration.ts +137 -0
- package/src/utils/model/providers.ts +15 -0
- package/src/utils/path.ts +3 -0
- package/src/utils/permissions/PermissionResult.ts +14 -0
- package/src/utils/permissions/autoModeState.ts +12 -0
- package/src/utils/permissions/filesystem.ts +12 -0
- package/src/utils/plugins/loadPluginOutputStyles.ts +12 -0
- package/src/utils/plugins/schemas.ts +25 -0
- package/src/utils/process.ts +16 -0
- package/src/utils/sandbox/sandbox-adapter.ts +19 -0
- package/src/utils/sessionStorage.ts +238 -472
- package/src/utils/settings/constants.ts +10 -0
- package/src/utils/settings/settings.ts +19 -0
- package/src/utils/settings/types.ts +18 -0
- package/src/utils/shell/shellToolUtils.ts +9 -0
- package/src/utils/sinks.ts +11 -0
- package/src/utils/sleep.ts +7 -0
- package/src/utils/sliceAnsi.ts +7 -0
- package/src/utils/slowOperations.ts +3 -0
- package/src/utils/startupProfiler.ts +11 -0
- package/src/utils/stringUtils.ts +106 -0
- package/src/utils/systemPromptType.ts +9 -0
- package/src/utils/teleport/api.ts +15 -0
- package/src/utils/textHighlighting.ts +16 -0
- package/src/utils/theme.ts +17 -0
- package/src/utils/thinking.ts +58 -0
- package/src/utils/tokens.ts +11 -0
- package/src/utils/toolResultStorage.ts +17 -0
- package/src/utils/worktreeModeEnabled.ts +7 -0
- package/WORKSPACE_INTEGRATION.md +0 -290
- package/chat-sessions/sessions-index.json +0 -98
- package/package.json.original +0 -31
- package/package.json.publish +0 -47
- package/src/bootstrap/state.d.ts +0 -169
- package/src/bootstrap/state.js +0 -261
- package/src/context/pack-builder.d.ts +0 -24
- package/src/context/pack-builder.js +0 -281
- package/src/hooks/useExitOnCtrlCD.d.ts +0 -86
- package/src/hooks/useExitOnCtrlCD.js +0 -130
- package/src/hooks/useKeybinding.d.ts +0 -89
- package/src/hooks/useKeybinding.js +0 -163
- package/src/hooks/useTerminalSize.d.ts +0 -41
- package/src/hooks/useTerminalSize.js +0 -90
- package/src/index.d.ts +0 -23
- package/src/index.js +0 -24
- package/src/runtime/brand/brand.d.ts +0 -488
- package/src/runtime/brand/brand.js +0 -464
- package/src/runtime/brand/brand.ts +0 -667
- package/src/runtime/services/tokenEstimation.d.ts +0 -187
- package/src/runtime/services/tokenEstimation.js +0 -423
- package/src/runtime/services/tokenEstimation.ts +0 -547
- package/src/runtime/tools/Tool.d.ts +0 -239
- package/src/runtime/tools/Tool.js +0 -285
- package/src/runtime/tools/Tool.ts +0 -524
- package/src/scheduler/TaskScheduler.d.ts +0 -98
- package/src/scheduler/TaskScheduler.js +0 -201
- package/src/scheduler/TaskScheduler.ts +0 -259
- package/src/state/AppStateStore.d.ts +0 -347
- package/src/state/AppStateStore.js +0 -439
- package/src/state/AppStateStore.ts +0 -658
- package/src/state/WorkspaceStateStore.d.ts +0 -43
- package/src/state/WorkspaceStateStore.js +0 -224
- package/src/state/WorkspaceStateStore.ts +0 -297
- package/src/types/message.d.ts +0 -190
- package/src/types/message.js +0 -77
- package/src/utils/format.d.ts +0 -126
- package/src/utils/format.js +0 -230
- package/src/utils/fullscreen.d.ts +0 -161
- package/src/utils/fullscreen.js +0 -277
- package/src/utils/sessionStorage.d.ts +0 -210
- package/src/utils/sessionStorage.js +0 -435
- package/src/watcher/WorkspaceWatcher.d.ts +0 -70
- package/src/watcher/WorkspaceWatcher.js +0 -191
- package/src/watcher/WorkspaceWatcher.ts +0 -251
- package/src/workspace/loader.d.ts +0 -30
- package/src/workspace/loader.js +0 -117
- package/src/workspace/types.d.ts +0 -91
- package/src/workspace/types.js +0 -7
- package/threads/thread_1775361175022.json +0 -9
- package/tsconfig.json +0 -14
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Application state store with React integration
|
|
3
|
-
* @module state/AppStateStore
|
|
4
|
-
*
|
|
5
|
-
* Centralized state management using the store pattern with subscription-based
|
|
6
|
-
* reactivity. Provides React hooks for component integration.
|
|
7
|
-
*/
|
|
8
|
-
import type { TypedMessage } from '../types/message';
|
|
9
|
-
/**
|
|
10
|
-
* User preferences and settings
|
|
11
|
-
* @interface UserPreferences
|
|
12
|
-
*/
|
|
13
|
-
export interface UserPreferences {
|
|
14
|
-
/** UI theme preference */
|
|
15
|
-
readonly theme: 'light' | 'dark' | 'system';
|
|
16
|
-
/** Language code */
|
|
17
|
-
readonly language: string;
|
|
18
|
-
/** Notification preferences */
|
|
19
|
-
readonly notifications: {
|
|
20
|
-
readonly enabled: boolean;
|
|
21
|
-
readonly sound: boolean;
|
|
22
|
-
readonly desktop: boolean;
|
|
23
|
-
};
|
|
24
|
-
/** Editor preferences */
|
|
25
|
-
readonly editor: {
|
|
26
|
-
readonly fontSize: number;
|
|
27
|
-
readonly fontFamily: string;
|
|
28
|
-
readonly wordWrap: boolean;
|
|
29
|
-
readonly lineNumbers: boolean;
|
|
30
|
-
readonly tabSize: number;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* User session information
|
|
35
|
-
* @interface UserSession
|
|
36
|
-
*/
|
|
37
|
-
export interface UserSession {
|
|
38
|
-
/** User identifier */
|
|
39
|
-
readonly userId: string;
|
|
40
|
-
/** User display name */
|
|
41
|
-
readonly displayName: string;
|
|
42
|
-
/** User email */
|
|
43
|
-
readonly email: string;
|
|
44
|
-
/** User type/role */
|
|
45
|
-
readonly userType: 'free' | 'pro' | 'enterprise' | 'admin';
|
|
46
|
-
/** Session token */
|
|
47
|
-
readonly token: string;
|
|
48
|
-
/** Session expiration timestamp */
|
|
49
|
-
readonly expiresAt: Date;
|
|
50
|
-
/** Authentication provider */
|
|
51
|
-
readonly provider: 'local' | 'oauth' | 'sso';
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Connection status types
|
|
55
|
-
* @typedef {'online' | 'offline' | 'connecting' | 'reconnecting'} ConnectionStatus
|
|
56
|
-
*/
|
|
57
|
-
export type ConnectionStatus = 'online' | 'offline' | 'connecting' | 'reconnecting';
|
|
58
|
-
/**
|
|
59
|
-
* Complete application state structure
|
|
60
|
-
* @interface AppState
|
|
61
|
-
*/
|
|
62
|
-
export interface AppState {
|
|
63
|
-
/** Current user session, null if not authenticated */
|
|
64
|
-
readonly session: UserSession | null;
|
|
65
|
-
/** User preferences */
|
|
66
|
-
readonly preferences: UserPreferences;
|
|
67
|
-
/** Active conversation messages */
|
|
68
|
-
readonly messages: readonly TypedMessage[];
|
|
69
|
-
/** Connection status to backend services */
|
|
70
|
-
readonly connectionStatus: ConnectionStatus;
|
|
71
|
-
/** Whether the application is currently loading */
|
|
72
|
-
readonly isLoading: boolean;
|
|
73
|
-
/** Current loading message or operation description */
|
|
74
|
-
readonly loadingMessage: string | null;
|
|
75
|
-
/** Active errors to display */
|
|
76
|
-
readonly errors: readonly AppError[];
|
|
77
|
-
/** Current view/route */
|
|
78
|
-
readonly currentView: string;
|
|
79
|
-
/** View-specific state data */
|
|
80
|
-
readonly viewState: Readonly<Record<string, unknown>>;
|
|
81
|
-
/** Timestamp of last state update */
|
|
82
|
-
readonly lastUpdated: Date;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Application error structure
|
|
86
|
-
* @interface AppError
|
|
87
|
-
*/
|
|
88
|
-
export interface AppError {
|
|
89
|
-
/** Unique error identifier */
|
|
90
|
-
readonly id: string;
|
|
91
|
-
/** Error severity level */
|
|
92
|
-
readonly severity: 'info' | 'warning' | 'error' | 'critical';
|
|
93
|
-
/** Error code for programmatic handling */
|
|
94
|
-
readonly code: string;
|
|
95
|
-
/** Human-readable error message */
|
|
96
|
-
readonly message: string;
|
|
97
|
-
/** Error timestamp */
|
|
98
|
-
readonly timestamp: Date;
|
|
99
|
-
/** Whether the error has been dismissed by the user */
|
|
100
|
-
readonly dismissed: boolean;
|
|
101
|
-
/** Additional error context */
|
|
102
|
-
readonly context?: Readonly<Record<string, unknown>>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* State change listener callback type
|
|
106
|
-
* @typedef {(state: AppState, prevState: AppState) => void} StateListener
|
|
107
|
-
*/
|
|
108
|
-
type StateListener = (state: AppState, prevState: AppState) => void;
|
|
109
|
-
/**
|
|
110
|
-
* Selector function type for deriving values from state
|
|
111
|
-
* @template T
|
|
112
|
-
* @typedef {(state: AppState) => T} StateSelector
|
|
113
|
-
*/
|
|
114
|
-
type StateSelector<T> = (state: AppState) => T;
|
|
115
|
-
/**
|
|
116
|
-
* Application state store class
|
|
117
|
-
* Implements the observable store pattern with subscription-based updates
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```typescript
|
|
121
|
-
* const store = new AppStateStore();
|
|
122
|
-
* const unsubscribe = store.subscribe((state, prevState) => {
|
|
123
|
-
* console.log('State updated:', state);
|
|
124
|
-
* });
|
|
125
|
-
* store.setState({ isLoading: true });
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
export declare class AppStateStore {
|
|
129
|
-
private state;
|
|
130
|
-
private listeners;
|
|
131
|
-
private isBatching;
|
|
132
|
-
private pendingUpdates;
|
|
133
|
-
constructor(initialState?: Partial<AppState>);
|
|
134
|
-
/**
|
|
135
|
-
* Gets the current state
|
|
136
|
-
* @returns {Readonly<AppState>} The current application state
|
|
137
|
-
*/
|
|
138
|
-
getState(): Readonly<AppState>;
|
|
139
|
-
/**
|
|
140
|
-
* Gets a derived value from state using a selector function
|
|
141
|
-
*
|
|
142
|
-
* @template T
|
|
143
|
-
* @param {StateSelector<T>} selector - Function to extract value from state
|
|
144
|
-
* @returns {T} The selected value
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const userName = store.select(state => state.session?.displayName);
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
select<T>(selector: StateSelector<T>): T;
|
|
151
|
-
/**
|
|
152
|
-
* Updates the state with partial changes
|
|
153
|
-
* Automatically notifies all subscribers
|
|
154
|
-
*
|
|
155
|
-
* @param {Partial<AppState>} updates - Partial state updates
|
|
156
|
-
* @param {Object} [options] - Update options
|
|
157
|
-
* @param {boolean} [options.silent=false] - If true, does not notify subscribers
|
|
158
|
-
* @returns {Readonly<AppState>} The updated state
|
|
159
|
-
*/
|
|
160
|
-
setState(updates: Partial<AppState>, options?: {
|
|
161
|
-
silent?: boolean;
|
|
162
|
-
}): Readonly<AppState>;
|
|
163
|
-
/**
|
|
164
|
-
* Batches multiple state updates into a single notification
|
|
165
|
-
*
|
|
166
|
-
* @param {() => void} callback - Function containing state updates to batch
|
|
167
|
-
* @returns {Readonly<AppState>} The final state after all updates
|
|
168
|
-
* @example
|
|
169
|
-
* ```typescript
|
|
170
|
-
* store.batch(() => {
|
|
171
|
-
* store.setState({ isLoading: true });
|
|
172
|
-
* store.setState({ loadingMessage: 'Fetching data...' });
|
|
173
|
-
* });
|
|
174
|
-
* // Subscribers are notified once after both updates
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
batch(callback: () => void): Readonly<AppState>;
|
|
178
|
-
/**
|
|
179
|
-
* Subscribes to state changes
|
|
180
|
-
*
|
|
181
|
-
* @param {StateListener} listener - Callback invoked on state changes
|
|
182
|
-
* @returns {() => void} Unsubscribe function
|
|
183
|
-
*/
|
|
184
|
-
subscribe(listener: StateListener): () => void;
|
|
185
|
-
/**
|
|
186
|
-
* Subscribes to a specific derived value using a selector
|
|
187
|
-
* Only notifies when the selected value changes
|
|
188
|
-
*
|
|
189
|
-
* @template T
|
|
190
|
-
* @param {StateSelector<T>} selector - Function to extract value
|
|
191
|
-
* @param {(value: T) => void} callback - Callback invoked when value changes
|
|
192
|
-
* @returns {() => void} Unsubscribe function
|
|
193
|
-
* @example
|
|
194
|
-
* ```typescript
|
|
195
|
-
* store.subscribeTo(
|
|
196
|
-
* state => state.connectionStatus,
|
|
197
|
-
* status => console.log('Connection:', status)
|
|
198
|
-
* );
|
|
199
|
-
* ```
|
|
200
|
-
*/
|
|
201
|
-
subscribeTo<T>(selector: StateSelector<T>, callback: (value: T) => void): () => void;
|
|
202
|
-
/**
|
|
203
|
-
* Resets the store to initial state
|
|
204
|
-
*
|
|
205
|
-
* @param {Partial<AppState>} [mergeState] - Optional state to merge after reset
|
|
206
|
-
* @returns {Readonly<AppState>} The reset state
|
|
207
|
-
*/
|
|
208
|
-
reset(mergeState?: Partial<AppState>): Readonly<AppState>;
|
|
209
|
-
/**
|
|
210
|
-
* Adds an error to the state
|
|
211
|
-
*
|
|
212
|
-
* @param {Omit<AppError, 'id' | 'timestamp' | 'dismissed'>} error - Error details
|
|
213
|
-
* @returns {Readonly<AppState>} The updated state
|
|
214
|
-
*/
|
|
215
|
-
addError(error: Omit<AppError, 'id' | 'timestamp' | 'dismissed'>): Readonly<AppState>;
|
|
216
|
-
/**
|
|
217
|
-
* Dismisses an error by ID
|
|
218
|
-
*
|
|
219
|
-
* @param {string} errorId - The error ID to dismiss
|
|
220
|
-
* @returns {Readonly<AppState>} The updated state
|
|
221
|
-
*/
|
|
222
|
-
dismissError(errorId: string): Readonly<AppState>;
|
|
223
|
-
/**
|
|
224
|
-
* Clears all dismissed errors
|
|
225
|
-
*
|
|
226
|
-
* @returns {Readonly<AppState>} The updated state
|
|
227
|
-
*/
|
|
228
|
-
clearDismissedErrors(): Readonly<AppState>;
|
|
229
|
-
/**
|
|
230
|
-
* Adds a message to the conversation
|
|
231
|
-
*
|
|
232
|
-
* @param {TypedMessage} message - The message to add
|
|
233
|
-
* @returns {Readonly<AppState>} The updated state
|
|
234
|
-
*/
|
|
235
|
-
addMessage(message: TypedMessage): Readonly<AppState>;
|
|
236
|
-
/**
|
|
237
|
-
* Clears all messages
|
|
238
|
-
*
|
|
239
|
-
* @returns {Readonly<AppState>} The updated state
|
|
240
|
-
*/
|
|
241
|
-
clearMessages(): Readonly<AppState>;
|
|
242
|
-
/**
|
|
243
|
-
* Sets the user session
|
|
244
|
-
*
|
|
245
|
-
* @param {UserSession | null} session - The session or null to logout
|
|
246
|
-
* @returns {Readonly<AppState>} The updated state
|
|
247
|
-
*/
|
|
248
|
-
setSession(session: UserSession | null): Readonly<AppState>;
|
|
249
|
-
/**
|
|
250
|
-
* Updates user preferences
|
|
251
|
-
*
|
|
252
|
-
* @param {Partial<UserPreferences>} prefs - Preference updates
|
|
253
|
-
* @returns {Readonly<AppState>} The updated state
|
|
254
|
-
*/
|
|
255
|
-
setPreferences(prefs: Partial<UserPreferences>): Readonly<AppState>;
|
|
256
|
-
/**
|
|
257
|
-
* Sets the loading state
|
|
258
|
-
*
|
|
259
|
-
* @param {boolean} isLoading - Whether loading is active
|
|
260
|
-
* @param {string} [message] - Optional loading message
|
|
261
|
-
* @returns {Readonly<AppState>} The updated state
|
|
262
|
-
*/
|
|
263
|
-
setLoading(isLoading: boolean, message?: string): Readonly<AppState>;
|
|
264
|
-
/**
|
|
265
|
-
* Updates view-specific state
|
|
266
|
-
*
|
|
267
|
-
* @param {string} view - View identifier
|
|
268
|
-
* @param {unknown} data - View state data
|
|
269
|
-
* @returns {Readonly<AppState>} The updated state
|
|
270
|
-
*/
|
|
271
|
-
setViewState(view: string, data: unknown): Readonly<AppState>;
|
|
272
|
-
private notifyListeners;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Gets or creates the global AppStateStore instance
|
|
276
|
-
*
|
|
277
|
-
* @returns {AppStateStore} The global store instance
|
|
278
|
-
*/
|
|
279
|
-
export declare function getGlobalStore(): AppStateStore;
|
|
280
|
-
/**
|
|
281
|
-
* Sets the global store instance (useful for testing)
|
|
282
|
-
*
|
|
283
|
-
* @param {AppStateStore | null} store - The store instance or null to reset
|
|
284
|
-
*/
|
|
285
|
-
export declare function setGlobalStore(store: AppStateStore | null): void;
|
|
286
|
-
/**
|
|
287
|
-
* React hook for accessing the app state store
|
|
288
|
-
* Provides reactive updates and selector support
|
|
289
|
-
*
|
|
290
|
-
* @template T
|
|
291
|
-
* @param {StateSelector<T>} [selector] - Optional selector function
|
|
292
|
-
* @returns {T | AppState} The selected state or full state
|
|
293
|
-
* @example
|
|
294
|
-
* ```typescript
|
|
295
|
-
* // Get full state
|
|
296
|
-
* const state = useAppStateStore();
|
|
297
|
-
*
|
|
298
|
-
* // Get specific value
|
|
299
|
-
* const isLoading = useAppStateStore(state => state.isLoading);
|
|
300
|
-
*
|
|
301
|
-
* // Get derived value
|
|
302
|
-
* const messageCount = useAppStateStore(state => state.messages.length);
|
|
303
|
-
* ```
|
|
304
|
-
*/
|
|
305
|
-
export declare function useAppStateStore<T>(selector?: StateSelector<T>): T | AppState;
|
|
306
|
-
/**
|
|
307
|
-
* React hook for accessing a specific slice of state with optional transformation
|
|
308
|
-
*
|
|
309
|
-
* @template T
|
|
310
|
-
* @param {StateSelector<T>} selector - Function to extract value from state
|
|
311
|
-
* @param {(left: T, right: T) => boolean} [isEqual] - Custom equality function
|
|
312
|
-
* @returns {T} The selected value
|
|
313
|
-
* @example
|
|
314
|
-
* ```typescript
|
|
315
|
-
* const userName = useAppStateSelector(state => state.session?.displayName);
|
|
316
|
-
* ```
|
|
317
|
-
*/
|
|
318
|
-
export declare function useAppStateSelector<T>(selector: StateSelector<T>, isEqual?: (left: T, right: T) => boolean): T;
|
|
319
|
-
/**
|
|
320
|
-
* React hook for state setters
|
|
321
|
-
* Returns stable callback functions for common state operations
|
|
322
|
-
*
|
|
323
|
-
* @returns {Object} Object containing state setter callbacks
|
|
324
|
-
* @example
|
|
325
|
-
* ```typescript
|
|
326
|
-
* const { setLoading, addMessage, setSession } = useAppStateActions();
|
|
327
|
-
* ```
|
|
328
|
-
*/
|
|
329
|
-
export declare function useAppStateActions(): {
|
|
330
|
-
setState: (updates: Partial<AppState>) => Readonly<AppState>;
|
|
331
|
-
setLoading: (isLoading: boolean, message?: string) => Readonly<AppState>;
|
|
332
|
-
addMessage: (message: TypedMessage) => Readonly<AppState>;
|
|
333
|
-
setSession: (session: UserSession | null) => Readonly<AppState>;
|
|
334
|
-
addError: (error: Omit<AppError, "id" | "timestamp" | "dismissed">) => Readonly<AppState>;
|
|
335
|
-
dismissError: (errorId: string) => Readonly<AppState>;
|
|
336
|
-
setPreferences: (prefs: Partial<UserPreferences>) => Readonly<AppState>;
|
|
337
|
-
clearMessages: () => Readonly<AppState>;
|
|
338
|
-
};
|
|
339
|
-
declare const _default: {
|
|
340
|
-
AppStateStore: typeof AppStateStore;
|
|
341
|
-
getGlobalStore: typeof getGlobalStore;
|
|
342
|
-
setGlobalStore: typeof setGlobalStore;
|
|
343
|
-
useAppStateStore: typeof useAppStateStore;
|
|
344
|
-
useAppStateSelector: typeof useAppStateSelector;
|
|
345
|
-
useAppStateActions: typeof useAppStateActions;
|
|
346
|
-
};
|
|
347
|
-
export default _default;
|