@almadar/ui 1.0.34 → 2.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/LICENSE +21 -72
- package/dist/components/atoms/Avatar.d.ts +58 -0
- package/dist/components/atoms/Badge.d.ts +8 -0
- package/dist/components/atoms/Box.d.ts +57 -0
- package/dist/components/atoms/Button.d.ts +24 -0
- package/dist/components/atoms/Card.d.ts +18 -0
- package/dist/components/atoms/Center.d.ts +33 -0
- package/dist/components/atoms/Checkbox.d.ts +5 -0
- package/dist/components/atoms/ConditionalWrapper.d.ts +68 -0
- package/dist/components/atoms/Divider.d.ts +29 -0
- package/dist/components/atoms/Icon.d.ts +38 -0
- package/dist/components/atoms/Input.d.ts +26 -0
- package/dist/components/atoms/Label.d.ts +5 -0
- package/dist/components/atoms/LawReferenceTooltip.d.ts +48 -0
- package/dist/components/atoms/Overlay.d.ts +16 -0
- package/dist/components/atoms/ProgressBar.d.ts +63 -0
- package/dist/components/atoms/Radio.d.ts +26 -0
- package/dist/components/atoms/Select.d.ts +12 -0
- package/dist/components/atoms/Spacer.d.ts +25 -0
- package/dist/components/atoms/Spinner.d.ts +6 -0
- package/dist/components/atoms/Stack.d.ts +64 -0
- package/dist/components/atoms/Switch.d.ts +12 -0
- package/dist/components/atoms/TextHighlight.d.ts +53 -0
- package/dist/components/atoms/Textarea.d.ts +5 -0
- package/dist/components/atoms/ThemeSelector.d.ts +21 -0
- package/dist/components/atoms/ThemeToggle.d.ts +33 -0
- package/dist/components/atoms/Typography.d.ts +57 -0
- package/dist/components/atoms/game/ControlButton.d.ts +31 -0
- package/dist/components/atoms/game/HealthBar.d.ts +18 -0
- package/dist/components/atoms/game/ScoreDisplay.d.ts +21 -0
- package/dist/components/atoms/game/Sprite.d.ts +63 -0
- package/dist/components/atoms/game/StateIndicator.d.ts +31 -0
- package/dist/components/atoms/game/index.d.ts +12 -0
- package/dist/components/atoms/index.d.ts +27 -0
- package/dist/components/index.css +11 -9
- package/dist/components/index.d.ts +6 -6951
- package/dist/components/index.js +5 -5
- package/dist/components/molecules/Accordion.d.ts +67 -0
- package/dist/components/molecules/Alert.d.ts +24 -0
- package/dist/components/molecules/Breadcrumb.d.ts +55 -0
- package/dist/components/molecules/ButtonGroup.d.ts +67 -0
- package/dist/components/molecules/Card.d.ts +44 -0
- package/dist/components/molecules/Container.d.ts +30 -0
- package/dist/components/molecules/Drawer.d.ts +46 -0
- package/dist/components/molecules/EmptyState.d.ts +25 -0
- package/dist/components/molecules/ErrorBoundary.d.ts +55 -0
- package/dist/components/molecules/ErrorState.d.ts +13 -0
- package/dist/components/molecules/FilterGroup.d.ts +54 -0
- package/dist/components/molecules/Flex.d.ts +43 -0
- package/dist/components/molecules/FloatingActionButton.d.ts +69 -0
- package/dist/components/molecules/FormField.d.ts +16 -0
- package/dist/components/molecules/FormSectionHeader.d.ts +30 -0
- package/dist/components/molecules/Grid.d.ts +54 -0
- package/dist/components/molecules/InputGroup.d.ts +24 -0
- package/dist/components/molecules/LoadingState.d.ts +7 -0
- package/dist/components/molecules/Menu.d.ts +40 -0
- package/dist/components/molecules/Modal.d.ts +26 -0
- package/dist/components/molecules/Pagination.d.ts +66 -0
- package/dist/components/molecules/Popover.d.ts +39 -0
- package/dist/components/molecules/QuizBlock.d.ts +20 -0
- package/dist/components/molecules/RelationSelect.d.ts +48 -0
- package/dist/components/molecules/RepeatableFormSection.d.ts +58 -0
- package/dist/components/molecules/ScaledDiagram.d.ts +20 -0
- package/dist/components/molecules/SearchInput.d.ts +60 -0
- package/dist/components/molecules/SidePanel.d.ts +47 -0
- package/dist/components/molecules/SimpleGrid.d.ts +27 -0
- package/dist/components/molecules/Skeleton.d.ts +35 -0
- package/dist/components/molecules/Tabs.d.ts +45 -0
- package/dist/components/molecules/Toast.d.ts +35 -0
- package/dist/components/molecules/Tooltip.d.ts +25 -0
- package/dist/components/molecules/ViolationAlert.d.ts +49 -0
- package/dist/components/molecules/WizardNavigation.d.ts +51 -0
- package/dist/components/molecules/WizardProgress.d.ts +42 -0
- package/dist/components/molecules/game/StatBadge.d.ts +27 -0
- package/dist/components/molecules/index.d.ts +38 -0
- package/dist/components/molecules/markdown/CodeBlock.d.ts +25 -0
- package/dist/components/molecules/markdown/MarkdownContent.d.ts +26 -0
- package/dist/components/organisms/CardGrid.d.ts +72 -0
- package/dist/components/organisms/Chart.d.ts +59 -0
- package/dist/components/organisms/CodeViewer.d.ts +67 -0
- package/dist/components/organisms/ComponentPatterns.d.ts +441 -0
- package/dist/components/organisms/ConfirmDialog.d.ts +50 -0
- package/dist/components/organisms/ContentRenderer.d.ts +23 -0
- package/dist/components/organisms/CustomPattern.d.ts +104 -0
- package/dist/components/organisms/DataTable.d.ts +63 -0
- package/dist/components/organisms/DetailPanel.d.ts +71 -0
- package/dist/components/organisms/DocumentViewer.d.ts +60 -0
- package/dist/components/organisms/DrawerSlot.d.ts +39 -0
- package/dist/components/organisms/Form.d.ts +203 -0
- package/dist/components/organisms/FormSection.d.ts +59 -0
- package/dist/components/organisms/GraphCanvas.d.ts +69 -0
- package/dist/components/organisms/Header.d.ts +110 -0
- package/dist/components/organisms/JazariStateMachine.d.ts +60 -0
- package/dist/components/organisms/LayoutPatterns.d.ts +181 -0
- package/dist/components/organisms/List.d.ts +76 -0
- package/dist/components/organisms/MasterDetail.d.ts +43 -0
- package/dist/components/organisms/MediaGallery.d.ts +66 -0
- package/dist/components/organisms/Meter.d.ts +58 -0
- package/dist/components/organisms/ModalSlot.d.ts +35 -0
- package/dist/components/organisms/Navigation.d.ts +68 -0
- package/dist/components/organisms/OrbitalVisualization.d.ts +48 -0
- package/dist/components/organisms/PageHeader.d.ts +59 -0
- package/dist/components/organisms/Section.d.ts +44 -0
- package/dist/components/organisms/Sidebar.d.ts +65 -0
- package/dist/components/organisms/SignaturePad.d.ts +44 -0
- package/dist/components/organisms/Split.d.ts +42 -0
- package/dist/components/organisms/StatCard.d.ts +66 -0
- package/dist/components/organisms/StateMachineView.d.ts +36 -0
- package/dist/components/organisms/Table.d.ts +99 -0
- package/dist/components/organisms/Timeline.d.ts +58 -0
- package/dist/components/organisms/ToastSlot.d.ts +38 -0
- package/dist/components/organisms/UISlotRenderer.d.ts +112 -0
- package/dist/components/organisms/WizardContainer.d.ts +160 -0
- package/dist/components/organisms/book/BookChapterView.d.ts +17 -0
- package/dist/components/organisms/book/BookCoverPage.d.ts +19 -0
- package/dist/components/organisms/book/BookNavBar.d.ts +18 -0
- package/dist/components/organisms/book/BookTableOfContents.d.ts +18 -0
- package/dist/components/organisms/book/BookViewer.d.ts +28 -0
- package/dist/components/organisms/book/index.d.ts +7 -0
- package/dist/components/organisms/book/types.d.ts +77 -0
- package/dist/components/organisms/game/BattleBoard.d.ts +167 -0
- package/dist/components/organisms/game/CanvasEffect.d.ts +68 -0
- package/dist/components/organisms/game/CastleBoard.d.ts +85 -0
- package/dist/components/organisms/game/DialogueBox.d.ts +73 -0
- package/dist/components/organisms/game/GameAudioProvider.d.ts +47 -0
- package/dist/components/organisms/game/GameAudioToggle.d.ts +28 -0
- package/dist/components/organisms/game/GameHud.d.ts +40 -0
- package/dist/components/organisms/game/GameMenu.d.ts +43 -0
- package/dist/components/organisms/game/GameOverScreen.d.ts +56 -0
- package/dist/components/organisms/game/InventoryPanel.d.ts +67 -0
- package/dist/components/organisms/game/IsometricCanvas.d.ts +123 -0
- package/dist/components/organisms/game/TraitSlot.d.ts +86 -0
- package/dist/components/organisms/game/TraitStateViewer.d.ts +53 -0
- package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +26 -0
- package/dist/components/organisms/game/WorldMapBoard.d.ts +147 -0
- package/dist/components/organisms/game/editor/editorUtils.d.ts +109 -0
- package/dist/components/organisms/game/editor/index.d.ts +9 -0
- package/dist/components/organisms/game/hooks/useBattleState.d.ts +35 -0
- package/dist/components/organisms/game/hooks/useCamera.d.ts +41 -0
- package/dist/components/organisms/game/hooks/useGameAudio.d.ts +47 -0
- package/dist/components/organisms/game/hooks/useImageCache.d.ts +16 -0
- package/dist/components/organisms/game/hooks/usePhysics2D.d.ts +45 -0
- package/dist/components/organisms/game/hooks/useSpriteAnimations.d.ts +43 -0
- package/dist/components/organisms/game/index.d.ts +36 -0
- package/dist/components/organisms/game/managers/PhysicsManager.d.ts +103 -0
- package/dist/components/organisms/game/types/effects.d.ts +253 -0
- package/dist/{isometric-ynNHVPZx.d.ts → components/organisms/game/types/isometric.d.ts} +4 -6
- package/dist/components/organisms/game/types/spriteAnimation.d.ts +73 -0
- package/dist/components/organisms/game/utils/canvasEffects.d.ts +50 -0
- package/dist/components/organisms/game/utils/combatPresets.d.ts +15 -0
- package/dist/components/organisms/game/utils/isometric.d.ts +61 -0
- package/dist/components/organisms/game/utils/spriteAnimation.d.ts +57 -0
- package/dist/components/organisms/game/utils/spriteSheetConstants.d.ts +16 -0
- package/dist/components/organisms/index.d.ts +37 -0
- package/dist/components/organisms/layout/DashboardGrid.d.ts +34 -0
- package/dist/components/organisms/layout/MasterDetail.d.ts +32 -0
- package/dist/components/organisms/layout/SplitPane.d.ts +34 -0
- package/dist/components/organisms/layout/TabbedContainer.d.ts +42 -0
- package/dist/components/organisms/layout/index.d.ts +9 -0
- package/dist/components/organisms/types.d.ts +65 -0
- package/dist/components/templates/AuthLayout.d.ts +14 -0
- package/dist/components/templates/BattleTemplate.d.ts +25 -0
- package/dist/components/templates/CastleTemplate.d.ts +23 -0
- package/dist/components/templates/CounterTemplate.d.ts +44 -0
- package/dist/components/templates/DashboardLayout.d.ts +32 -0
- package/dist/components/templates/GameShell.d.ts +33 -0
- package/dist/components/templates/GameTemplate.d.ts +36 -0
- package/dist/components/templates/GenericAppTemplate.d.ts +30 -0
- package/dist/components/templates/WorldMapTemplate.d.ts +29 -0
- package/dist/components/templates/index.d.ts +10 -0
- package/dist/components/templates/types.d.ts +17 -0
- package/dist/context/DesignThemeContext.d.ts +21 -0
- package/dist/{ThemeContext-D9xUORq5.d.ts → context/ThemeContext.d.ts} +15 -16
- package/dist/context/UISlotContext.d.ts +75 -0
- package/dist/context/UserContext.d.ts +111 -0
- package/dist/context/index.d.ts +6 -206
- package/dist/{event-bus-types-CjJduURa.d.ts → hooks/event-bus-types.d.ts} +4 -6
- package/dist/hooks/index.d.ts +24 -1090
- package/dist/hooks/useAgentChat.d.ts +104 -0
- package/dist/hooks/useAuthContext.d.ts +25 -0
- package/dist/hooks/useCompile.d.ts +22 -0
- package/dist/hooks/useDeepAgentGeneration.d.ts +46 -0
- package/dist/hooks/useEntities.d.ts +52 -0
- package/dist/hooks/useEntityData.d.ts +155 -0
- package/dist/hooks/useEntityMutations.d.ts +80 -0
- package/dist/hooks/useEventBus.d.ts +96 -0
- package/dist/hooks/useExtensions.d.ts +32 -0
- package/dist/hooks/useFileEditor.d.ts +32 -0
- package/dist/hooks/useFileSystem.d.ts +40 -0
- package/dist/hooks/useGitHub.d.ts +58 -0
- package/dist/hooks/useOrbitalHistory.d.ts +39 -0
- package/dist/hooks/useOrbitalMutations.d.ts +95 -0
- package/dist/hooks/usePreview.d.ts +57 -0
- package/dist/hooks/useQuerySingleton.d.ts +78 -0
- package/dist/hooks/useResolvedEntity.d.ts +32 -0
- package/dist/hooks/useTranslate.d.ts +35 -0
- package/dist/hooks/useUIEvents.d.ts +35 -0
- package/dist/{useUISlots-D0mttBSP.d.ts → hooks/useUISlots.d.ts} +8 -9
- package/dist/hooks/useValidation.d.ts +46 -0
- package/dist/lib/api-client.d.ts +42 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/debug.d.ts +43 -0
- package/dist/lib/debugRegistry.d.ts +29 -0
- package/dist/lib/debugUtils.d.ts +27 -0
- package/dist/lib/entityDebug.d.ts +38 -0
- package/dist/lib/getNestedValue.d.ts +33 -0
- package/dist/lib/guardRegistry.d.ts +32 -0
- package/dist/lib/index.d.ts +17 -426
- package/dist/lib/jazari/svg-paths.d.ts +61 -0
- package/dist/lib/parseContentSegments.d.ts +41 -0
- package/dist/lib/tickRegistry.d.ts +40 -0
- package/dist/lib/traitRegistry.d.ts +34 -0
- package/dist/lib/verificationRegistry.d.ts +107 -0
- package/dist/{cn-BoBXsxuX.d.ts → lib/visualizer/index.d.ts} +18 -69
- package/dist/locales/index.d.ts +5 -7
- package/dist/providers/EventBusProvider.d.ts +60 -0
- package/dist/providers/FetchedDataProvider.d.ts +105 -0
- package/dist/providers/OfflineModeProvider.d.ts +79 -0
- package/dist/providers/OrbitalProvider.d.ts +101 -0
- package/dist/providers/SelectionProvider.d.ts +81 -0
- package/dist/providers/VerificationProvider.d.ts +63 -0
- package/dist/providers/index.css +11 -9
- package/dist/providers/index.d.ts +16 -464
- package/dist/providers/index.js +3 -3
- package/dist/renderer/client-effect-executor.d.ts +68 -0
- package/dist/renderer/data-resolver.d.ts +68 -0
- package/dist/renderer/index.d.ts +22 -519
- package/dist/renderer/index.js +1 -1
- package/dist/renderer/init.d.ts +14 -0
- package/dist/renderer/navigation.d.ts +142 -0
- package/dist/{offline-executor-CHr4uAhf.d.ts → renderer/offline-executor.d.ts} +9 -172
- package/dist/renderer/pattern-resolver.d.ts +91 -0
- package/dist/renderer/slot-definitions.d.ts +45 -0
- package/dist/renderer/types.d.ts +160 -0
- package/dist/renderer/useClientEffects.d.ts +88 -0
- package/dist/stores/entityStore.d.ts +99 -0
- package/dist/stores/filtering.d.ts +51 -0
- package/dist/stores/index.d.ts +4 -148
- package/package.json +12 -10
- package/dist/components/organisms/game/three/index.d.ts +0 -1162
- package/dist/{chunk-FZJ73RDM.js → chunk-RIZ76XRF.js} +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UserContext
|
|
3
|
+
*
|
|
4
|
+
* React context for providing user data throughout the application.
|
|
5
|
+
* Enables @user bindings in S-expressions for role-based UI and permissions.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // In App.tsx or layout
|
|
10
|
+
* <UserProvider user={{ id: '123', role: 'admin', permissions: ['read', 'write'] }}>
|
|
11
|
+
* <App />
|
|
12
|
+
* </UserProvider>
|
|
13
|
+
*
|
|
14
|
+
* // In components - access via hook
|
|
15
|
+
* const { user, hasRole, hasPermission } = useUser();
|
|
16
|
+
* if (hasRole('admin')) { ... }
|
|
17
|
+
* if (hasPermission('delete')) { ... }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
import React from 'react';
|
|
23
|
+
/**
|
|
24
|
+
* User data for @user bindings.
|
|
25
|
+
* Matches UserContext type from evaluator/context.ts
|
|
26
|
+
*/
|
|
27
|
+
export interface UserData {
|
|
28
|
+
/** User's unique ID */
|
|
29
|
+
id: string;
|
|
30
|
+
/** User's email */
|
|
31
|
+
email?: string;
|
|
32
|
+
/** User's display name */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** User's role (for RBAC) */
|
|
35
|
+
role?: string;
|
|
36
|
+
/** User's permissions */
|
|
37
|
+
permissions?: string[];
|
|
38
|
+
/** Additional custom profile fields */
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* User context value.
|
|
43
|
+
*/
|
|
44
|
+
export interface UserContextValue {
|
|
45
|
+
/** Current user data (null if not logged in) */
|
|
46
|
+
user: UserData | null;
|
|
47
|
+
/** Check if user is logged in */
|
|
48
|
+
isLoggedIn: boolean;
|
|
49
|
+
/** Check if user has a specific role */
|
|
50
|
+
hasRole: (role: string) => boolean;
|
|
51
|
+
/** Check if user has a specific permission */
|
|
52
|
+
hasPermission: (permission: string) => boolean;
|
|
53
|
+
/** Check if user has any of the specified roles */
|
|
54
|
+
hasAnyRole: (roles: string[]) => boolean;
|
|
55
|
+
/** Check if user has all of the specified permissions */
|
|
56
|
+
hasAllPermissions: (permissions: string[]) => boolean;
|
|
57
|
+
/** Get a user field by path (for @user.field bindings) */
|
|
58
|
+
getUserField: (path: string) => unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Anonymous user for when no user is logged in.
|
|
62
|
+
*/
|
|
63
|
+
declare const ANONYMOUS_USER: UserData;
|
|
64
|
+
declare const UserContext: React.Context<UserContextValue | null>;
|
|
65
|
+
export interface UserProviderProps {
|
|
66
|
+
/** User data (null if not logged in) */
|
|
67
|
+
user?: UserData | null;
|
|
68
|
+
/** Children to render */
|
|
69
|
+
children: React.ReactNode;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Provider component that provides user context to the application.
|
|
73
|
+
*
|
|
74
|
+
* Provides RBAC helpers and field access for @user bindings.
|
|
75
|
+
*/
|
|
76
|
+
export declare function UserProvider({ user, children, }: UserProviderProps): React.ReactElement;
|
|
77
|
+
/**
|
|
78
|
+
* Hook to access the user context.
|
|
79
|
+
*
|
|
80
|
+
* Returns default values if used outside of UserProvider (for resilience).
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* function AdminPanel() {
|
|
85
|
+
* const { user, hasRole, hasPermission } = useUser();
|
|
86
|
+
*
|
|
87
|
+
* if (!hasRole('admin') && !hasPermission('admin:access')) {
|
|
88
|
+
* return <AccessDenied />;
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* return <div>Welcome, {user?.name}</div>;
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function useUser(): UserContextValue;
|
|
96
|
+
/**
|
|
97
|
+
* Hook to check if user has a specific role.
|
|
98
|
+
* Convenience wrapper around useUser().hasRole().
|
|
99
|
+
*/
|
|
100
|
+
export declare function useHasRole(role: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Hook to check if user has a specific permission.
|
|
103
|
+
* Convenience wrapper around useUser().hasPermission().
|
|
104
|
+
*/
|
|
105
|
+
export declare function useHasPermission(permission: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Hook to get user data for @user bindings in S-expressions.
|
|
108
|
+
* Returns the user data object compatible with EvaluationContext.user
|
|
109
|
+
*/
|
|
110
|
+
export declare function useUserForEvaluation(): UserData | undefined;
|
|
111
|
+
export { UserContext, ANONYMOUS_USER };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,208 +1,8 @@
|
|
|
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
1
|
/**
|
|
9
|
-
*
|
|
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
|
|
2
|
+
* Context barrel export
|
|
27
3
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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 };
|
|
4
|
+
export { UISlotProvider, useUISlots, useSlotContent, useSlotHasContent, UISlotContext, type UISlotManager, type UISlot, type SlotContent, type RenderUIConfig, type SlotAnimation, type SlotChangeCallback, } from "./UISlotContext";
|
|
5
|
+
export { ThemeProvider, useTheme, BUILT_IN_THEMES, type ThemeDefinition, type ThemeProviderProps, type ColorMode, type ResolvedMode, type DesignTheme, } from "./ThemeContext";
|
|
6
|
+
export { default as ThemeContext } from "./ThemeContext";
|
|
7
|
+
export { DesignThemeProvider, useDesignTheme } from "./DesignThemeContext";
|
|
8
|
+
export { UserProvider, UserContext, useUser, useHasRole, useHasPermission, useUserForEvaluation, ANONYMOUS_USER, type UserData, type UserContextValue, type UserProviderProps, } from "./UserContext";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* A KFlow event that can be emitted on the event bus.
|
|
10
10
|
*/
|
|
11
|
-
interface KFlowEvent {
|
|
11
|
+
export interface KFlowEvent {
|
|
12
12
|
/** Event type identifier (e.g., 'TASK_COMPLETED', 'VALIDATION_SUCCESS') */
|
|
13
13
|
type: string;
|
|
14
14
|
/** Optional payload data */
|
|
@@ -21,15 +21,15 @@ interface KFlowEvent {
|
|
|
21
21
|
/**
|
|
22
22
|
* Event listener callback function.
|
|
23
23
|
*/
|
|
24
|
-
type EventListener = (event: KFlowEvent) => void;
|
|
24
|
+
export type EventListener = (event: KFlowEvent) => void;
|
|
25
25
|
/**
|
|
26
26
|
* Function to unsubscribe from events.
|
|
27
27
|
*/
|
|
28
|
-
type Unsubscribe = () => void;
|
|
28
|
+
export type Unsubscribe = () => void;
|
|
29
29
|
/**
|
|
30
30
|
* Event bus context type.
|
|
31
31
|
*/
|
|
32
|
-
interface EventBusContextType {
|
|
32
|
+
export interface EventBusContextType {
|
|
33
33
|
/**
|
|
34
34
|
* Emit an event to all listeners.
|
|
35
35
|
*
|
|
@@ -69,5 +69,3 @@ interface EventBusContextType {
|
|
|
69
69
|
*/
|
|
70
70
|
onAny?: (listener: EventListener) => Unsubscribe;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
export type { EventBusContextType as E, KFlowEvent as K, Unsubscribe as U, EventListener as a };
|