@almadar/ui 1.0.34 → 2.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/LICENSE +21 -72
- package/dist/components/index.css +11 -9
- package/dist/components/index.js +2 -2
- package/dist/providers/index.css +11 -9
- package/dist/providers/index.js +1 -1
- package/package.json +9 -8
- package/dist/ThemeContext-D9xUORq5.d.ts +0 -105
- package/dist/cn-BoBXsxuX.d.ts +0 -194
- package/dist/components/index.d.ts +0 -6951
- package/dist/components/organisms/game/three/index.d.ts +0 -1162
- package/dist/context/index.d.ts +0 -208
- package/dist/event-bus-types-CjJduURa.d.ts +0 -73
- package/dist/hooks/index.d.ts +0 -1091
- package/dist/isometric-ynNHVPZx.d.ts +0 -111
- package/dist/lib/index.d.ts +0 -427
- package/dist/locales/index.d.ts +0 -22
- package/dist/offline-executor-CHr4uAhf.d.ts +0 -401
- package/dist/providers/index.d.ts +0 -465
- package/dist/renderer/index.d.ts +0 -525
- package/dist/stores/index.d.ts +0 -151
- package/dist/useUISlots-D0mttBSP.d.ts +0 -85
- /package/dist/{chunk-FZJ73RDM.js → chunk-YNP2OBK4.js} +0 -0
package/dist/context/index.d.ts
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { U as UISlotManager, a as UISlot, S as SlotContent } from '../useUISlots-D0mttBSP.js';
|
|
4
|
-
export { R as RenderUIConfig, b as SlotAnimation, c as SlotChangeCallback } from '../useUISlots-D0mttBSP.js';
|
|
5
|
-
import { T as ThemeProviderProps } from '../ThemeContext-D9xUORq5.js';
|
|
6
|
-
export { B as BUILT_IN_THEMES, C as ColorMode, D as DesignTheme, R as ResolvedMode, a as ThemeContext, b as ThemeDefinition, c as ThemeProvider, u as useTheme } from '../ThemeContext-D9xUORq5.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* UISlotContext
|
|
10
|
-
*
|
|
11
|
-
* React context for providing the UI Slot Manager throughout the application.
|
|
12
|
-
* Traits use this context to render content into slots via render_ui effects.
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* ```tsx
|
|
16
|
-
* // In App.tsx or layout
|
|
17
|
-
* <UISlotProvider>
|
|
18
|
-
* <App />
|
|
19
|
-
* </UISlotProvider>
|
|
20
|
-
*
|
|
21
|
-
* // In trait hooks or components
|
|
22
|
-
* const { render, clear } = useUISlots();
|
|
23
|
-
* render({ target: 'modal', pattern: 'form-section', props: {...} });
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @packageDocumentation
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Context for the UI Slot Manager
|
|
31
|
-
*/
|
|
32
|
-
declare const UISlotContext: React__default.Context<UISlotManager | null>;
|
|
33
|
-
interface UISlotProviderProps {
|
|
34
|
-
children: React__default.ReactNode;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Provider component that creates and provides the UI Slot Manager.
|
|
38
|
-
*
|
|
39
|
-
* Must wrap any components that use traits with render_ui effects.
|
|
40
|
-
*/
|
|
41
|
-
declare function UISlotProvider({ children }: UISlotProviderProps): React__default.ReactElement;
|
|
42
|
-
/**
|
|
43
|
-
* Hook to access the UI Slot Manager.
|
|
44
|
-
*
|
|
45
|
-
* Must be used within a UISlotProvider.
|
|
46
|
-
*
|
|
47
|
-
* @throws Error if used outside of UISlotProvider
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* function MyTraitHook() {
|
|
52
|
-
* const { render, clear } = useUISlots();
|
|
53
|
-
*
|
|
54
|
-
* const showModal = () => {
|
|
55
|
-
* render({
|
|
56
|
-
* target: 'modal',
|
|
57
|
-
* pattern: 'form-section',
|
|
58
|
-
* props: { title: 'Create Item' },
|
|
59
|
-
* });
|
|
60
|
-
* };
|
|
61
|
-
*
|
|
62
|
-
* const closeModal = () => {
|
|
63
|
-
* clear('modal');
|
|
64
|
-
* };
|
|
65
|
-
*
|
|
66
|
-
* return { showModal, closeModal };
|
|
67
|
-
* }
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
declare function useUISlots(): UISlotManager;
|
|
71
|
-
/**
|
|
72
|
-
* Hook to get content for a specific slot.
|
|
73
|
-
*
|
|
74
|
-
* Useful for components that only need to read slot state.
|
|
75
|
-
*/
|
|
76
|
-
declare function useSlotContent(slot: UISlot): SlotContent | null;
|
|
77
|
-
/**
|
|
78
|
-
* Hook to check if a slot has content.
|
|
79
|
-
*/
|
|
80
|
-
declare function useSlotHasContent(slot: UISlot): boolean;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated Use ThemeProvider from ThemeContext instead
|
|
84
|
-
*/
|
|
85
|
-
declare const DesignThemeProvider: React.FC<ThemeProviderProps>;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated Use useTheme from ThemeContext instead
|
|
88
|
-
*
|
|
89
|
-
* This wrapper provides backward compatibility with the old API.
|
|
90
|
-
*/
|
|
91
|
-
declare function useDesignTheme(): {
|
|
92
|
-
designTheme: string;
|
|
93
|
-
setDesignTheme: (theme: string) => void;
|
|
94
|
-
availableThemes: string[];
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* UserContext
|
|
99
|
-
*
|
|
100
|
-
* React context for providing user data throughout the application.
|
|
101
|
-
* Enables @user bindings in S-expressions for role-based UI and permissions.
|
|
102
|
-
*
|
|
103
|
-
* Usage:
|
|
104
|
-
* ```tsx
|
|
105
|
-
* // In App.tsx or layout
|
|
106
|
-
* <UserProvider user={{ id: '123', role: 'admin', permissions: ['read', 'write'] }}>
|
|
107
|
-
* <App />
|
|
108
|
-
* </UserProvider>
|
|
109
|
-
*
|
|
110
|
-
* // In components - access via hook
|
|
111
|
-
* const { user, hasRole, hasPermission } = useUser();
|
|
112
|
-
* if (hasRole('admin')) { ... }
|
|
113
|
-
* if (hasPermission('delete')) { ... }
|
|
114
|
-
* ```
|
|
115
|
-
*
|
|
116
|
-
* @packageDocumentation
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* User data for @user bindings.
|
|
121
|
-
* Matches UserContext type from evaluator/context.ts
|
|
122
|
-
*/
|
|
123
|
-
interface UserData {
|
|
124
|
-
/** User's unique ID */
|
|
125
|
-
id: string;
|
|
126
|
-
/** User's email */
|
|
127
|
-
email?: string;
|
|
128
|
-
/** User's display name */
|
|
129
|
-
name?: string;
|
|
130
|
-
/** User's role (for RBAC) */
|
|
131
|
-
role?: string;
|
|
132
|
-
/** User's permissions */
|
|
133
|
-
permissions?: string[];
|
|
134
|
-
/** Additional custom profile fields */
|
|
135
|
-
[key: string]: unknown;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* User context value.
|
|
139
|
-
*/
|
|
140
|
-
interface UserContextValue {
|
|
141
|
-
/** Current user data (null if not logged in) */
|
|
142
|
-
user: UserData | null;
|
|
143
|
-
/** Check if user is logged in */
|
|
144
|
-
isLoggedIn: boolean;
|
|
145
|
-
/** Check if user has a specific role */
|
|
146
|
-
hasRole: (role: string) => boolean;
|
|
147
|
-
/** Check if user has a specific permission */
|
|
148
|
-
hasPermission: (permission: string) => boolean;
|
|
149
|
-
/** Check if user has any of the specified roles */
|
|
150
|
-
hasAnyRole: (roles: string[]) => boolean;
|
|
151
|
-
/** Check if user has all of the specified permissions */
|
|
152
|
-
hasAllPermissions: (permissions: string[]) => boolean;
|
|
153
|
-
/** Get a user field by path (for @user.field bindings) */
|
|
154
|
-
getUserField: (path: string) => unknown;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Anonymous user for when no user is logged in.
|
|
158
|
-
*/
|
|
159
|
-
declare const ANONYMOUS_USER: UserData;
|
|
160
|
-
declare const UserContext: React__default.Context<UserContextValue | null>;
|
|
161
|
-
interface UserProviderProps {
|
|
162
|
-
/** User data (null if not logged in) */
|
|
163
|
-
user?: UserData | null;
|
|
164
|
-
/** Children to render */
|
|
165
|
-
children: React__default.ReactNode;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Provider component that provides user context to the application.
|
|
169
|
-
*
|
|
170
|
-
* Provides RBAC helpers and field access for @user bindings.
|
|
171
|
-
*/
|
|
172
|
-
declare function UserProvider({ user, children, }: UserProviderProps): React__default.ReactElement;
|
|
173
|
-
/**
|
|
174
|
-
* Hook to access the user context.
|
|
175
|
-
*
|
|
176
|
-
* Returns default values if used outside of UserProvider (for resilience).
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* ```tsx
|
|
180
|
-
* function AdminPanel() {
|
|
181
|
-
* const { user, hasRole, hasPermission } = useUser();
|
|
182
|
-
*
|
|
183
|
-
* if (!hasRole('admin') && !hasPermission('admin:access')) {
|
|
184
|
-
* return <AccessDenied />;
|
|
185
|
-
* }
|
|
186
|
-
*
|
|
187
|
-
* return <div>Welcome, {user?.name}</div>;
|
|
188
|
-
* }
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
declare function useUser(): UserContextValue;
|
|
192
|
-
/**
|
|
193
|
-
* Hook to check if user has a specific role.
|
|
194
|
-
* Convenience wrapper around useUser().hasRole().
|
|
195
|
-
*/
|
|
196
|
-
declare function useHasRole(role: string): boolean;
|
|
197
|
-
/**
|
|
198
|
-
* Hook to check if user has a specific permission.
|
|
199
|
-
* Convenience wrapper around useUser().hasPermission().
|
|
200
|
-
*/
|
|
201
|
-
declare function useHasPermission(permission: string): boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Hook to get user data for @user bindings in S-expressions.
|
|
204
|
-
* Returns the user data object compatible with EvaluationContext.user
|
|
205
|
-
*/
|
|
206
|
-
declare function useUserForEvaluation(): UserData | undefined;
|
|
207
|
-
|
|
208
|
-
export { ANONYMOUS_USER, DesignThemeProvider, SlotContent, ThemeProviderProps, UISlot, UISlotContext, UISlotManager, UISlotProvider, UserContext, type UserContextValue, type UserData, UserProvider, type UserProviderProps, useDesignTheme, useHasPermission, useHasRole, useSlotContent, useSlotHasContent, useUISlots, useUser, useUserForEvaluation };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event Bus Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for the page event bus system.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* A KFlow event that can be emitted on the event bus.
|
|
10
|
-
*/
|
|
11
|
-
interface KFlowEvent {
|
|
12
|
-
/** Event type identifier (e.g., 'TASK_COMPLETED', 'VALIDATION_SUCCESS') */
|
|
13
|
-
type: string;
|
|
14
|
-
/** Optional payload data */
|
|
15
|
-
payload?: Record<string, unknown>;
|
|
16
|
-
/** Timestamp when the event was emitted */
|
|
17
|
-
timestamp: number;
|
|
18
|
-
/** Source trait or component that emitted the event */
|
|
19
|
-
source?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Event listener callback function.
|
|
23
|
-
*/
|
|
24
|
-
type EventListener = (event: KFlowEvent) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Function to unsubscribe from events.
|
|
27
|
-
*/
|
|
28
|
-
type Unsubscribe = () => void;
|
|
29
|
-
/**
|
|
30
|
-
* Event bus context type.
|
|
31
|
-
*/
|
|
32
|
-
interface EventBusContextType {
|
|
33
|
-
/**
|
|
34
|
-
* Emit an event to all listeners.
|
|
35
|
-
*
|
|
36
|
-
* @param type - Event type identifier
|
|
37
|
-
* @param payload - Optional payload data
|
|
38
|
-
*/
|
|
39
|
-
emit: (type: string, payload?: Record<string, unknown>) => void;
|
|
40
|
-
/**
|
|
41
|
-
* Subscribe to an event type.
|
|
42
|
-
*
|
|
43
|
-
* @param type - Event type to listen for
|
|
44
|
-
* @param listener - Callback function
|
|
45
|
-
* @returns Unsubscribe function
|
|
46
|
-
*/
|
|
47
|
-
on: (type: string, listener: EventListener) => Unsubscribe;
|
|
48
|
-
/**
|
|
49
|
-
* Subscribe to an event type, but only fire once.
|
|
50
|
-
*
|
|
51
|
-
* @param type - Event type to listen for
|
|
52
|
-
* @param listener - Callback function
|
|
53
|
-
* @returns Unsubscribe function
|
|
54
|
-
*/
|
|
55
|
-
once: (type: string, listener: EventListener) => Unsubscribe;
|
|
56
|
-
/**
|
|
57
|
-
* Check if there are any listeners for an event type.
|
|
58
|
-
*
|
|
59
|
-
* @param type - Event type to check
|
|
60
|
-
* @returns True if there are listeners
|
|
61
|
-
*/
|
|
62
|
-
hasListeners: (type: string) => boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Subscribe to ALL events regardless of type.
|
|
65
|
-
* Useful for verification, debugging, and analytics.
|
|
66
|
-
*
|
|
67
|
-
* @param listener - Callback function invoked for every emitted event
|
|
68
|
-
* @returns Unsubscribe function
|
|
69
|
-
*/
|
|
70
|
-
onAny?: (listener: EventListener) => Unsubscribe;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export type { EventBusContextType as E, KFlowEvent as K, Unsubscribe as U, EventListener as a };
|