@almadar/ui 2.0.0 → 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/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.d.ts +6 -0
- 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/components/organisms/game/types/isometric.d.ts +109 -0
- 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/context/ThemeContext.d.ts +104 -0
- package/dist/context/UISlotContext.d.ts +75 -0
- package/dist/context/UserContext.d.ts +111 -0
- package/dist/context/index.d.ts +8 -0
- package/dist/hooks/event-bus-types.d.ts +71 -0
- package/dist/hooks/index.d.ts +25 -0
- 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/hooks/useUISlots.d.ts +84 -0
- 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 +18 -0
- 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/lib/visualizer/index.d.ts +143 -0
- package/dist/locales/index.d.ts +20 -0
- 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.d.ts +17 -0
- 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 +28 -0
- 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/renderer/offline-executor.d.ts +238 -0
- 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 +7 -0
- package/package.json +4 -3
- package/dist/{chunk-YNP2OBK4.js → chunk-RIZ76XRF.js} +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WizardContainer Component
|
|
3
|
+
*
|
|
4
|
+
* Multi-step wizard pattern with progress indicator.
|
|
5
|
+
* Composes Box, Typography, and Button atoms.
|
|
6
|
+
*
|
|
7
|
+
* Uses wireframe theme styling (high contrast, sharp edges).
|
|
8
|
+
*/
|
|
9
|
+
import React from "react";
|
|
10
|
+
/** Form field definition for wizard sections */
|
|
11
|
+
export interface WizardField {
|
|
12
|
+
id: string;
|
|
13
|
+
type: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
repeatable?: boolean;
|
|
17
|
+
options?: Array<{
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
isDefault?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
defaultValue?: unknown;
|
|
23
|
+
condition?: unknown[];
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
entityField?: string;
|
|
26
|
+
minLength?: number;
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
dataSource?: Record<string, unknown>;
|
|
29
|
+
displayFields?: string[];
|
|
30
|
+
searchConfig?: Record<string, unknown>;
|
|
31
|
+
hiddenCalculations?: Array<{
|
|
32
|
+
variable: string;
|
|
33
|
+
expression: unknown;
|
|
34
|
+
scope?: string;
|
|
35
|
+
}>;
|
|
36
|
+
signatureConfig?: Record<string, unknown>;
|
|
37
|
+
displayTemplate?: Record<string, unknown>;
|
|
38
|
+
lawReference?: Record<string, unknown>;
|
|
39
|
+
contextMenu?: string[];
|
|
40
|
+
calculated?: Record<string, unknown>;
|
|
41
|
+
readOnly?: boolean;
|
|
42
|
+
minDate?: unknown;
|
|
43
|
+
stats?: Array<{
|
|
44
|
+
label: string;
|
|
45
|
+
value: unknown;
|
|
46
|
+
icon?: string;
|
|
47
|
+
}>;
|
|
48
|
+
items?: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
label: string;
|
|
51
|
+
autoCheck?: unknown;
|
|
52
|
+
}>;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
/** Section within a wizard step */
|
|
56
|
+
export interface WizardSection {
|
|
57
|
+
id: string;
|
|
58
|
+
title?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
fields?: WizardField[];
|
|
61
|
+
subsections?: WizardSection[];
|
|
62
|
+
condition?: unknown[];
|
|
63
|
+
repeatable?: boolean;
|
|
64
|
+
minItems?: number;
|
|
65
|
+
addButtonLabel?: string;
|
|
66
|
+
hiddenCalculations?: Array<{
|
|
67
|
+
variable: string;
|
|
68
|
+
expression: unknown;
|
|
69
|
+
scope?: string;
|
|
70
|
+
}>;
|
|
71
|
+
dataSource?: Record<string, unknown>;
|
|
72
|
+
readOnly?: boolean;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** Entity mapping configuration */
|
|
76
|
+
export interface WizardEntityMapping {
|
|
77
|
+
entity: string;
|
|
78
|
+
mode: "search_or_create" | "create_multiple" | "select_one" | "update" | string;
|
|
79
|
+
parentField?: string;
|
|
80
|
+
idField?: string;
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
/** Validation rule for wizard steps */
|
|
84
|
+
export interface WizardValidationRule {
|
|
85
|
+
condition: unknown[];
|
|
86
|
+
message: string;
|
|
87
|
+
}
|
|
88
|
+
/** Law reference for compliance */
|
|
89
|
+
export interface WizardLawReference {
|
|
90
|
+
law: string;
|
|
91
|
+
article: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface WizardStep {
|
|
95
|
+
/** Step identifier */
|
|
96
|
+
id?: string;
|
|
97
|
+
/** Tab identifier (schema-driven) */
|
|
98
|
+
tabId?: string;
|
|
99
|
+
/** Step title */
|
|
100
|
+
title?: string;
|
|
101
|
+
/** Step name (schema-driven, used as title if title not provided) */
|
|
102
|
+
name?: string;
|
|
103
|
+
/** Step description (optional) */
|
|
104
|
+
description?: string;
|
|
105
|
+
/** Step content (React component mode) */
|
|
106
|
+
content?: React.ReactNode;
|
|
107
|
+
/** Whether this step can be skipped */
|
|
108
|
+
optional?: boolean;
|
|
109
|
+
/** Custom validation for this step */
|
|
110
|
+
isValid?: () => boolean;
|
|
111
|
+
/** Form sections within this step */
|
|
112
|
+
sections?: WizardSection[];
|
|
113
|
+
/** Global variables required before entering this step */
|
|
114
|
+
globalVariablesRequired?: string[];
|
|
115
|
+
/** Global variables set by this step */
|
|
116
|
+
globalVariablesSet?: string[];
|
|
117
|
+
/** Local variables scoped to this step */
|
|
118
|
+
localVariables?: string[];
|
|
119
|
+
/** Entity mapping configuration */
|
|
120
|
+
entityMapping?: WizardEntityMapping;
|
|
121
|
+
/** Validation rules for this step */
|
|
122
|
+
validationRules?: WizardValidationRule[];
|
|
123
|
+
/** Law references for compliance */
|
|
124
|
+
lawReferences?: WizardLawReference[];
|
|
125
|
+
/** Phase of the inspection process */
|
|
126
|
+
phase?: string;
|
|
127
|
+
/** Context menu actions */
|
|
128
|
+
contextMenu?: string[];
|
|
129
|
+
/** Allow additional properties from schema */
|
|
130
|
+
[key: string]: unknown;
|
|
131
|
+
}
|
|
132
|
+
export interface WizardContainerProps {
|
|
133
|
+
/** Wizard steps */
|
|
134
|
+
steps: WizardStep[];
|
|
135
|
+
/** Current step index (controlled) - accepts unknown for generated code compatibility */
|
|
136
|
+
currentStep?: number | string | unknown;
|
|
137
|
+
/** Callback when step changes */
|
|
138
|
+
onStepChange?: (stepIndex: number) => void;
|
|
139
|
+
/** Callback when wizard is completed */
|
|
140
|
+
onComplete?: () => void;
|
|
141
|
+
/** Show progress indicator */
|
|
142
|
+
showProgress?: boolean;
|
|
143
|
+
/** Allow navigation to previous steps */
|
|
144
|
+
allowBack?: boolean;
|
|
145
|
+
/** Modal mode (compact header, no padding) */
|
|
146
|
+
compact?: boolean;
|
|
147
|
+
/** Additional CSS classes */
|
|
148
|
+
className?: string;
|
|
149
|
+
/** Loading state indicator */
|
|
150
|
+
isLoading?: boolean;
|
|
151
|
+
/** Error state */
|
|
152
|
+
error?: Error | null;
|
|
153
|
+
/** Entity type name (schema-driven) */
|
|
154
|
+
entity?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* WizardContainer - Multi-step wizard
|
|
158
|
+
*/
|
|
159
|
+
export declare const WizardContainer: React.FC<WizardContainerProps>;
|
|
160
|
+
export default WizardContainer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookChapterView Organism
|
|
3
|
+
*
|
|
4
|
+
* Renders a single chapter: title + optional orbital diagram +
|
|
5
|
+
* rich content via ContentRenderer.
|
|
6
|
+
*
|
|
7
|
+
* Event Contract:
|
|
8
|
+
* - Delegates to ContentRenderer children
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import type { EntityDisplayProps } from '../types';
|
|
12
|
+
import type { BookChapter } from './types';
|
|
13
|
+
export interface BookChapterViewProps extends EntityDisplayProps {
|
|
14
|
+
chapter: BookChapter;
|
|
15
|
+
direction?: 'rtl' | 'ltr';
|
|
16
|
+
}
|
|
17
|
+
export declare const BookChapterView: React.FC<BookChapterViewProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookCoverPage Molecule
|
|
3
|
+
*
|
|
4
|
+
* Renders a book cover with title, subtitle, author, and optional image.
|
|
5
|
+
* Centered layout suitable for the first "page" of a BookViewer.
|
|
6
|
+
*
|
|
7
|
+
* Event Contract:
|
|
8
|
+
* - Emits: UI:BOOK_START
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import type { EntityDisplayProps } from '../types';
|
|
12
|
+
export interface BookCoverPageProps extends EntityDisplayProps {
|
|
13
|
+
title: string;
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
author?: string;
|
|
16
|
+
coverImageUrl?: string;
|
|
17
|
+
direction?: 'rtl' | 'ltr';
|
|
18
|
+
}
|
|
19
|
+
export declare const BookCoverPage: React.FC<BookCoverPageProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookNavBar Molecule
|
|
3
|
+
*
|
|
4
|
+
* Navigation bar for the BookViewer with prev/next, page indicator,
|
|
5
|
+
* print button, and TOC toggle.
|
|
6
|
+
*
|
|
7
|
+
* Event Contract:
|
|
8
|
+
* - Emits: UI:BOOK_PAGE_PREV, UI:BOOK_PAGE_NEXT, UI:BOOK_PRINT, UI:BOOK_SHOW_TOC
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import type { EntityDisplayProps } from '../types';
|
|
12
|
+
export interface BookNavBarProps extends EntityDisplayProps {
|
|
13
|
+
currentPage: number;
|
|
14
|
+
totalPages: number;
|
|
15
|
+
chapterTitle?: string;
|
|
16
|
+
direction?: 'rtl' | 'ltr';
|
|
17
|
+
}
|
|
18
|
+
export declare const BookNavBar: React.FC<BookNavBarProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookTableOfContents Molecule
|
|
3
|
+
*
|
|
4
|
+
* Renders a clickable table of contents grouped by parts.
|
|
5
|
+
* Highlights the current chapter.
|
|
6
|
+
*
|
|
7
|
+
* Event Contract:
|
|
8
|
+
* - Emits: UI:BOOK_NAVIGATE { chapterId }
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import type { EntityDisplayProps } from '../types';
|
|
12
|
+
import type { BookPart } from './types';
|
|
13
|
+
export interface BookTableOfContentsProps extends EntityDisplayProps {
|
|
14
|
+
parts: BookPart[];
|
|
15
|
+
currentChapterId?: string;
|
|
16
|
+
direction?: 'rtl' | 'ltr';
|
|
17
|
+
}
|
|
18
|
+
export declare const BookTableOfContents: React.FC<BookTableOfContentsProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookViewer Organism
|
|
3
|
+
*
|
|
4
|
+
* Flippable book reader with cover, TOC, chapter views, and navigation.
|
|
5
|
+
* Supports RTL layout (Arabic), CSS slide transitions, and print mode.
|
|
6
|
+
*
|
|
7
|
+
* Page model:
|
|
8
|
+
* 0 = cover, 1 = TOC, 2+ = chapters (flattened from parts)
|
|
9
|
+
*
|
|
10
|
+
* Field mapping:
|
|
11
|
+
* Entity data may use non-English field names (e.g. Arabic .orb schemas).
|
|
12
|
+
* Pass a `fieldMap` prop to translate entity fields to canonical BookData.
|
|
13
|
+
* Default: IDENTITY_BOOK_FIELDS (English field names, no translation).
|
|
14
|
+
*
|
|
15
|
+
* Event Contract:
|
|
16
|
+
* - Emits: UI:BOOK_PAGE_CHANGE { pageIndex, chapterId? }
|
|
17
|
+
* - Listens: UI:BOOK_START, UI:BOOK_NAVIGATE, UI:BOOK_PAGE_PREV/NEXT, UI:BOOK_PRINT, UI:BOOK_SHOW_TOC
|
|
18
|
+
*/
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import type { EntityDisplayProps } from '../types';
|
|
21
|
+
import type { BookFieldMap } from './types';
|
|
22
|
+
export interface BookViewerProps extends EntityDisplayProps {
|
|
23
|
+
/** Initial page index (default: 0 = cover) */
|
|
24
|
+
initialPage?: number;
|
|
25
|
+
/** Field name translation map — a BookFieldMap object or locale key ("ar") */
|
|
26
|
+
fieldMap?: BookFieldMap | string;
|
|
27
|
+
}
|
|
28
|
+
export declare const BookViewer: React.FC<BookViewerProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BookViewer, type BookViewerProps } from './BookViewer';
|
|
2
|
+
export { BookChapterView, type BookChapterViewProps } from './BookChapterView';
|
|
3
|
+
export { BookCoverPage, type BookCoverPageProps } from './BookCoverPage';
|
|
4
|
+
export { BookTableOfContents, type BookTableOfContentsProps } from './BookTableOfContents';
|
|
5
|
+
export { BookNavBar, type BookNavBarProps } from './BookNavBar';
|
|
6
|
+
export type { BookData, BookPart, BookChapter, BookFieldMap } from './types';
|
|
7
|
+
export { mapBookData, resolveFieldMap, IDENTITY_BOOK_FIELDS, AR_BOOK_FIELDS } from './types';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookViewer shared types
|
|
3
|
+
*
|
|
4
|
+
* Field names are canonical English. When entity data arrives from a
|
|
5
|
+
* schema with non-English field names (e.g. Arabic .orb), a field map
|
|
6
|
+
* translates them before passing to BookViewer. See `mapBookData()`.
|
|
7
|
+
*/
|
|
8
|
+
export interface BookData {
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
author?: string;
|
|
12
|
+
coverImageUrl?: string;
|
|
13
|
+
direction?: 'rtl' | 'ltr';
|
|
14
|
+
parts: BookPart[];
|
|
15
|
+
}
|
|
16
|
+
export interface BookPart {
|
|
17
|
+
title: string;
|
|
18
|
+
chapters: BookChapter[];
|
|
19
|
+
}
|
|
20
|
+
export interface BookChapter {
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
content: string;
|
|
24
|
+
orbitalSchema?: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Maps raw entity field names to canonical BookData field names.
|
|
28
|
+
* Each key is a canonical field, each value is the entity field name.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* // Arabic schema
|
|
33
|
+
* const AR_BOOK_FIELDS: BookFieldMap = {
|
|
34
|
+
* title: 'العنوان',
|
|
35
|
+
* subtitle: 'العنوان_الفرعي',
|
|
36
|
+
* author: 'المؤلف',
|
|
37
|
+
* coverImageUrl: 'صورة_الغلاف',
|
|
38
|
+
* direction: 'الاتجاه',
|
|
39
|
+
* parts: 'الأجزاء',
|
|
40
|
+
* partTitle: 'العنوان',
|
|
41
|
+
* chapters: 'الفصول',
|
|
42
|
+
* chapterId: 'المعرف',
|
|
43
|
+
* chapterTitle: 'العنوان',
|
|
44
|
+
* chapterContent: 'المحتوى',
|
|
45
|
+
* chapterOrbitalSchema: 'المخطط_المداري',
|
|
46
|
+
* };
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export interface BookFieldMap {
|
|
50
|
+
title: string;
|
|
51
|
+
subtitle: string;
|
|
52
|
+
author: string;
|
|
53
|
+
coverImageUrl: string;
|
|
54
|
+
direction: string;
|
|
55
|
+
parts: string;
|
|
56
|
+
partTitle: string;
|
|
57
|
+
chapters: string;
|
|
58
|
+
chapterId: string;
|
|
59
|
+
chapterTitle: string;
|
|
60
|
+
chapterContent: string;
|
|
61
|
+
chapterOrbitalSchema: string;
|
|
62
|
+
}
|
|
63
|
+
/** Identity map — entity already uses canonical English field names */
|
|
64
|
+
export declare const IDENTITY_BOOK_FIELDS: BookFieldMap;
|
|
65
|
+
/** Arabic field map for الأمة_الرقمية schema */
|
|
66
|
+
export declare const AR_BOOK_FIELDS: BookFieldMap;
|
|
67
|
+
/**
|
|
68
|
+
* Resolves a fieldMap prop to a BookFieldMap object.
|
|
69
|
+
* Accepts a BookFieldMap object directly, a locale string key ("ar"),
|
|
70
|
+
* or undefined (defaults to identity/English).
|
|
71
|
+
*/
|
|
72
|
+
export declare function resolveFieldMap(fieldMap: BookFieldMap | string | undefined): BookFieldMap;
|
|
73
|
+
/**
|
|
74
|
+
* Maps a raw entity record to a typed BookData using a field map.
|
|
75
|
+
* Pass `IDENTITY_BOOK_FIELDS` for English schemas, `AR_BOOK_FIELDS` for Arabic, etc.
|
|
76
|
+
*/
|
|
77
|
+
export declare function mapBookData(raw: Record<string, unknown>, fields?: BookFieldMap): BookData;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BattleBoard
|
|
3
|
+
*
|
|
4
|
+
* Core rendering organism for turn-based battles.
|
|
5
|
+
*
|
|
6
|
+
* This is a **controlled-only** component: all game state (units, phase,
|
|
7
|
+
* turn, gameResult, selectedUnitId) must be provided via the `entity` prop.
|
|
8
|
+
* User interactions are communicated via event bus emissions so the parent
|
|
9
|
+
* (typically an Orbital trait or the `useBattleState` hook) can manage
|
|
10
|
+
* state transitions.
|
|
11
|
+
*
|
|
12
|
+
* For a self-managing version, use `UncontrolledBattleBoard` which
|
|
13
|
+
* composes this component with the `useBattleState` hook.
|
|
14
|
+
*
|
|
15
|
+
* Animation-only state (movement interpolation, screen shake, hover) is
|
|
16
|
+
* always managed locally.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
*/
|
|
20
|
+
import React from 'react';
|
|
21
|
+
import type { IsometricTile, IsometricFeature } from './types/isometric';
|
|
22
|
+
import type { ResolvedFrame } from './types/spriteAnimation';
|
|
23
|
+
/** Battle phases an encounter walks through */
|
|
24
|
+
export type BattlePhase = 'observation' | 'selection' | 'movement' | 'action' | 'enemy_turn' | 'game_over';
|
|
25
|
+
/** A unit participating in battle */
|
|
26
|
+
export interface BattleUnit {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
unitType?: string;
|
|
30
|
+
heroId?: string;
|
|
31
|
+
sprite?: string;
|
|
32
|
+
team: 'player' | 'enemy';
|
|
33
|
+
position: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
health: number;
|
|
38
|
+
maxHealth: number;
|
|
39
|
+
movement: number;
|
|
40
|
+
attack: number;
|
|
41
|
+
defense: number;
|
|
42
|
+
traits?: {
|
|
43
|
+
name: string;
|
|
44
|
+
currentState: string;
|
|
45
|
+
states: string[];
|
|
46
|
+
cooldown?: number;
|
|
47
|
+
}[];
|
|
48
|
+
}
|
|
49
|
+
/** Minimal tile for map generation */
|
|
50
|
+
export interface BattleTile {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
terrain: string;
|
|
54
|
+
terrainSprite?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Entity prop containing all board data.
|
|
57
|
+
*
|
|
58
|
+
* BattleBoard is **controlled-only**: all game-state fields (`units`, `phase`,
|
|
59
|
+
* `turn`, `gameResult`, `selectedUnitId`) must be provided. Mutations are
|
|
60
|
+
* communicated via event bus emissions — the component never calls `setState`
|
|
61
|
+
* for game-logic values.
|
|
62
|
+
*
|
|
63
|
+
* For a self-managing variant, use `UncontrolledBattleBoard`.
|
|
64
|
+
*
|
|
65
|
+
* Animation-only state (`movingPositions`, `isShaking`, `hoveredTile`) is
|
|
66
|
+
* always managed locally.
|
|
67
|
+
*/
|
|
68
|
+
export interface BattleEntity {
|
|
69
|
+
id: string;
|
|
70
|
+
tiles: IsometricTile[];
|
|
71
|
+
features?: IsometricFeature[];
|
|
72
|
+
boardWidth?: number;
|
|
73
|
+
boardHeight?: number;
|
|
74
|
+
assetManifest?: {
|
|
75
|
+
baseUrl: string;
|
|
76
|
+
terrains?: Record<string, string>;
|
|
77
|
+
units?: Record<string, string>;
|
|
78
|
+
features?: Record<string, string>;
|
|
79
|
+
effects?: Record<string, string>;
|
|
80
|
+
};
|
|
81
|
+
backgroundImage?: string;
|
|
82
|
+
/** Current unit state. */
|
|
83
|
+
units: BattleUnit[];
|
|
84
|
+
/** Current battle phase. */
|
|
85
|
+
phase: BattlePhase;
|
|
86
|
+
/** Current turn number. */
|
|
87
|
+
turn: number;
|
|
88
|
+
/** Game result. `null` = still in progress. */
|
|
89
|
+
gameResult: 'victory' | 'defeat' | null;
|
|
90
|
+
/** Currently selected unit ID. */
|
|
91
|
+
selectedUnitId: string | null;
|
|
92
|
+
}
|
|
93
|
+
/** Context exposed to render-prop slots */
|
|
94
|
+
export interface BattleSlotContext {
|
|
95
|
+
phase: BattlePhase;
|
|
96
|
+
turn: number;
|
|
97
|
+
selectedUnit: BattleUnit | null;
|
|
98
|
+
hoveredUnit: BattleUnit | null;
|
|
99
|
+
playerUnits: BattleUnit[];
|
|
100
|
+
enemyUnits: BattleUnit[];
|
|
101
|
+
gameResult: 'victory' | 'defeat' | null;
|
|
102
|
+
onEndTurn: () => void;
|
|
103
|
+
onCancel: () => void;
|
|
104
|
+
onReset: () => void;
|
|
105
|
+
attackTargets: Array<{
|
|
106
|
+
x: number;
|
|
107
|
+
y: number;
|
|
108
|
+
}>;
|
|
109
|
+
/** Resolve screen position of a tile for overlays */
|
|
110
|
+
tileToScreen: (x: number, y: number) => {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export interface BattleBoardProps {
|
|
116
|
+
/** Entity containing all board data */
|
|
117
|
+
entity: BattleEntity;
|
|
118
|
+
/** Canvas render scale */
|
|
119
|
+
scale?: number;
|
|
120
|
+
/** Unit draw-size multiplier */
|
|
121
|
+
unitScale?: number;
|
|
122
|
+
/** Header area -- receives battle context */
|
|
123
|
+
header?: (ctx: BattleSlotContext) => React.ReactNode;
|
|
124
|
+
/** Sidebar content (combat log, unit roster, etc.) */
|
|
125
|
+
sidebar?: (ctx: BattleSlotContext) => React.ReactNode;
|
|
126
|
+
/** Floating action buttons */
|
|
127
|
+
actions?: (ctx: BattleSlotContext) => React.ReactNode;
|
|
128
|
+
/** Floating overlays above the canvas (damage popups, tooltips) */
|
|
129
|
+
overlay?: (ctx: BattleSlotContext) => React.ReactNode;
|
|
130
|
+
/** Game-over screen overlay */
|
|
131
|
+
gameOverOverlay?: (ctx: BattleSlotContext) => React.ReactNode;
|
|
132
|
+
/** Called when a unit attacks another */
|
|
133
|
+
onAttack?: (attacker: BattleUnit, target: BattleUnit, damage: number) => void;
|
|
134
|
+
/** Called when battle ends */
|
|
135
|
+
onGameEnd?: (result: 'victory' | 'defeat') => void;
|
|
136
|
+
/** Called after a unit moves */
|
|
137
|
+
onUnitMove?: (unit: BattleUnit, to: {
|
|
138
|
+
x: number;
|
|
139
|
+
y: number;
|
|
140
|
+
}) => void;
|
|
141
|
+
/** Custom combat damage calculator */
|
|
142
|
+
calculateDamage?: (attacker: BattleUnit, target: BattleUnit) => number;
|
|
143
|
+
onDrawEffects?: (ctx: CanvasRenderingContext2D, timestamp: number) => void;
|
|
144
|
+
hasActiveEffects?: boolean;
|
|
145
|
+
effectSpriteUrls?: string[];
|
|
146
|
+
resolveUnitFrame?: (unitId: string) => ResolvedFrame | null;
|
|
147
|
+
/** Emits UI:{tileClickEvent} with { x, y } on tile click */
|
|
148
|
+
tileClickEvent?: string;
|
|
149
|
+
/** Emits UI:{unitClickEvent} with { unitId } on unit click */
|
|
150
|
+
unitClickEvent?: string;
|
|
151
|
+
/** Emits UI:{endTurnEvent} with {} on end turn */
|
|
152
|
+
endTurnEvent?: string;
|
|
153
|
+
/** Emits UI:{cancelEvent} with {} on cancel */
|
|
154
|
+
cancelEvent?: string;
|
|
155
|
+
/** Emits UI:{gameEndEvent} with { result } on game end */
|
|
156
|
+
gameEndEvent?: string;
|
|
157
|
+
/** Emits UI:{playAgainEvent} with {} on play again / reset */
|
|
158
|
+
playAgainEvent?: string;
|
|
159
|
+
/** Emits UI:{attackEvent} with { attackerId, targetId, damage } on attack */
|
|
160
|
+
attackEvent?: string;
|
|
161
|
+
className?: string;
|
|
162
|
+
}
|
|
163
|
+
export declare function BattleBoard({ entity, scale, unitScale, header, sidebar, actions, overlay, gameOverOverlay, onAttack, onGameEnd, onUnitMove, calculateDamage, onDrawEffects, hasActiveEffects, effectSpriteUrls, resolveUnitFrame, tileClickEvent, unitClickEvent, endTurnEvent, cancelEvent, gameEndEvent, playAgainEvent, attackEvent, className, }: BattleBoardProps): React.JSX.Element;
|
|
164
|
+
export declare namespace BattleBoard {
|
|
165
|
+
var displayName: string;
|
|
166
|
+
}
|
|
167
|
+
export default BattleBoard;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CanvasEffect Component
|
|
3
|
+
*
|
|
4
|
+
* Renders animated visual effects using a `<canvas>` element with
|
|
5
|
+
* sprite-based particles, frame-sequence animations, and overlays.
|
|
6
|
+
* This is a render-ui pattern that can be placed in any slot —
|
|
7
|
+
* it renders on top of whatever occupies that slot.
|
|
8
|
+
*
|
|
9
|
+
* Pattern: canvas-effect
|
|
10
|
+
*
|
|
11
|
+
* When an EffectAssetManifest is provided (via assetManifest prop),
|
|
12
|
+
* the component uses the full particle engine with tinted sprites.
|
|
13
|
+
* Without a manifest, it falls back to emoji-based rendering.
|
|
14
|
+
*
|
|
15
|
+
* **State categories (closed-circuit compliant):**
|
|
16
|
+
* - Configuration (actionType, position, duration, manifest) → received via props
|
|
17
|
+
* - Animation state (particles, shake, flash, RAF loop, phase timers) → local only
|
|
18
|
+
* - Completion event → emitted via `useEventBus()` for trait integration
|
|
19
|
+
*
|
|
20
|
+
* This is an **ephemeral fire-and-forget** animation component. All
|
|
21
|
+
* internal state is rendering-only (particle physics, screen shake decay,
|
|
22
|
+
* flash alpha, emoji phase timers). No game logic lives here.
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
*/
|
|
26
|
+
import * as React from 'react';
|
|
27
|
+
import type { CombatActionType, EffectAssetManifest } from './types/effects';
|
|
28
|
+
export type { CombatActionType } from './types/effects';
|
|
29
|
+
export type { EffectAssetManifest } from './types/effects';
|
|
30
|
+
export interface CanvasEffectProps {
|
|
31
|
+
/** The type of combat action to visualise */
|
|
32
|
+
actionType: CombatActionType;
|
|
33
|
+
/** Screen-space X position (center of the effect) */
|
|
34
|
+
x: number;
|
|
35
|
+
/** Screen-space Y position (center of the effect) */
|
|
36
|
+
y: number;
|
|
37
|
+
/** Duration in ms before auto-dismiss (default 2000 for canvas, 800 for emoji) */
|
|
38
|
+
duration?: number;
|
|
39
|
+
/** Optional intensity multiplier (1 = normal, 2 = double size/brightness) */
|
|
40
|
+
intensity?: number;
|
|
41
|
+
/** Callback when the effect animation completes */
|
|
42
|
+
onComplete?: () => void;
|
|
43
|
+
/** Declarative event: emits UI:{completeEvent} when the effect animation completes */
|
|
44
|
+
completeEvent?: string;
|
|
45
|
+
/** Additional CSS classes */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** Loading state indicator */
|
|
48
|
+
isLoading?: boolean;
|
|
49
|
+
/** Error state */
|
|
50
|
+
error?: Error | null;
|
|
51
|
+
/** Sprite URL for the effect (emoji fallback mode).
|
|
52
|
+
* When set without assetManifest, renders this image instead of emoji. */
|
|
53
|
+
effectSpriteUrl?: string;
|
|
54
|
+
/** Base URL for remote assets. Prepended to relative effectSpriteUrl paths. */
|
|
55
|
+
assetBaseUrl?: string;
|
|
56
|
+
/** Full effect asset manifest for the sprite particle engine.
|
|
57
|
+
* When provided, enables the canvas-based particle system. */
|
|
58
|
+
assetManifest?: EffectAssetManifest;
|
|
59
|
+
/** Canvas width (default 400) */
|
|
60
|
+
width?: number;
|
|
61
|
+
/** Canvas height (default 300) */
|
|
62
|
+
height?: number;
|
|
63
|
+
}
|
|
64
|
+
export declare function CanvasEffect(props: CanvasEffectProps): React.JSX.Element | null;
|
|
65
|
+
export declare namespace CanvasEffect {
|
|
66
|
+
var displayName: string;
|
|
67
|
+
}
|
|
68
|
+
export default CanvasEffect;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CastleBoard
|
|
3
|
+
*
|
|
4
|
+
* Self-contained castle / base-management game board organism. Encapsulates all
|
|
5
|
+
* isometric canvas rendering, hover/selection state, and slot-based layout.
|
|
6
|
+
* Designed to be consumed by CastleTemplate (thin wrapper) or embedded directly
|
|
7
|
+
* in any page that needs an isometric castle view.
|
|
8
|
+
*
|
|
9
|
+
* Accepts an `entity` prop conforming to `CastleEntity` and optional declarative
|
|
10
|
+
* event props (`featureClickEvent`, `unitClickEvent`, `tileClickEvent`) that
|
|
11
|
+
* emit through the Orbital event bus.
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import type { IsometricTile, IsometricUnit, IsometricFeature } from './types/isometric';
|
|
17
|
+
/** Entity shape consumed by CastleBoard */
|
|
18
|
+
export interface CastleEntity {
|
|
19
|
+
id: string;
|
|
20
|
+
tiles: IsometricTile[];
|
|
21
|
+
features?: IsometricFeature[];
|
|
22
|
+
units?: IsometricUnit[];
|
|
23
|
+
assetManifest?: {
|
|
24
|
+
baseUrl: string;
|
|
25
|
+
terrains?: Record<string, string>;
|
|
26
|
+
units?: Record<string, string>;
|
|
27
|
+
features?: Record<string, string>;
|
|
28
|
+
};
|
|
29
|
+
backgroundImage?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Context exposed to render-prop slots */
|
|
32
|
+
export interface CastleSlotContext {
|
|
33
|
+
/** Currently hovered tile coordinates (null when not hovering) */
|
|
34
|
+
hoveredTile: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} | null;
|
|
38
|
+
/** Feature that sits on the hovered tile, if any */
|
|
39
|
+
hoveredFeature: IsometricFeature | null;
|
|
40
|
+
/** Unit that sits on the hovered tile, if any */
|
|
41
|
+
hoveredUnit: IsometricUnit | null;
|
|
42
|
+
/** The clicked feature (e.g. building) for detail view */
|
|
43
|
+
selectedFeature: IsometricFeature | null;
|
|
44
|
+
/** Clear selected feature */
|
|
45
|
+
clearSelection: () => void;
|
|
46
|
+
/** Resolve screen position for overlay positioning */
|
|
47
|
+
tileToScreen: (x: number, y: number) => {
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
};
|
|
51
|
+
/** Canvas scale */
|
|
52
|
+
scale: number;
|
|
53
|
+
}
|
|
54
|
+
export interface CastleBoardProps {
|
|
55
|
+
/** Castle entity data */
|
|
56
|
+
entity: CastleEntity;
|
|
57
|
+
/** Canvas render scale */
|
|
58
|
+
scale?: number;
|
|
59
|
+
/** Top bar / header */
|
|
60
|
+
header?: (ctx: CastleSlotContext) => React.ReactNode;
|
|
61
|
+
/** Side panel content (buildings list, recruit tab, garrison tab) */
|
|
62
|
+
sidePanel?: (ctx: CastleSlotContext) => React.ReactNode;
|
|
63
|
+
/** Canvas overlay (hover tooltips, etc.) */
|
|
64
|
+
overlay?: (ctx: CastleSlotContext) => React.ReactNode;
|
|
65
|
+
/** Bottom bar (income summary, etc.) */
|
|
66
|
+
footer?: (ctx: CastleSlotContext) => React.ReactNode;
|
|
67
|
+
/** Called when a feature (building) is clicked */
|
|
68
|
+
onFeatureClick?: (feature: IsometricFeature) => void;
|
|
69
|
+
/** Called when a unit is clicked */
|
|
70
|
+
onUnitClick?: (unit: IsometricUnit) => void;
|
|
71
|
+
/** Called when any tile is clicked */
|
|
72
|
+
onTileClick?: (x: number, y: number) => void;
|
|
73
|
+
/** Event name to emit via event bus when a feature is clicked (emits UI:{featureClickEvent}) */
|
|
74
|
+
featureClickEvent?: string;
|
|
75
|
+
/** Event name to emit via event bus when a unit is clicked (emits UI:{unitClickEvent}) */
|
|
76
|
+
unitClickEvent?: string;
|
|
77
|
+
/** Event name to emit via event bus when a tile is clicked (emits UI:{tileClickEvent}) */
|
|
78
|
+
tileClickEvent?: string;
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
export declare function CastleBoard({ entity, scale, header, sidePanel, overlay, footer, onFeatureClick, onUnitClick, onTileClick, featureClickEvent, unitClickEvent, tileClickEvent, className, }: CastleBoardProps): React.JSX.Element;
|
|
82
|
+
export declare namespace CastleBoard {
|
|
83
|
+
var displayName: string;
|
|
84
|
+
}
|
|
85
|
+
export default CastleBoard;
|