@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.
Files changed (241) hide show
  1. package/LICENSE +21 -72
  2. package/dist/components/atoms/Avatar.d.ts +58 -0
  3. package/dist/components/atoms/Badge.d.ts +8 -0
  4. package/dist/components/atoms/Box.d.ts +57 -0
  5. package/dist/components/atoms/Button.d.ts +24 -0
  6. package/dist/components/atoms/Card.d.ts +18 -0
  7. package/dist/components/atoms/Center.d.ts +33 -0
  8. package/dist/components/atoms/Checkbox.d.ts +5 -0
  9. package/dist/components/atoms/ConditionalWrapper.d.ts +68 -0
  10. package/dist/components/atoms/Divider.d.ts +29 -0
  11. package/dist/components/atoms/Icon.d.ts +38 -0
  12. package/dist/components/atoms/Input.d.ts +26 -0
  13. package/dist/components/atoms/Label.d.ts +5 -0
  14. package/dist/components/atoms/LawReferenceTooltip.d.ts +48 -0
  15. package/dist/components/atoms/Overlay.d.ts +16 -0
  16. package/dist/components/atoms/ProgressBar.d.ts +63 -0
  17. package/dist/components/atoms/Radio.d.ts +26 -0
  18. package/dist/components/atoms/Select.d.ts +12 -0
  19. package/dist/components/atoms/Spacer.d.ts +25 -0
  20. package/dist/components/atoms/Spinner.d.ts +6 -0
  21. package/dist/components/atoms/Stack.d.ts +64 -0
  22. package/dist/components/atoms/Switch.d.ts +12 -0
  23. package/dist/components/atoms/TextHighlight.d.ts +53 -0
  24. package/dist/components/atoms/Textarea.d.ts +5 -0
  25. package/dist/components/atoms/ThemeSelector.d.ts +21 -0
  26. package/dist/components/atoms/ThemeToggle.d.ts +33 -0
  27. package/dist/components/atoms/Typography.d.ts +57 -0
  28. package/dist/components/atoms/game/ControlButton.d.ts +31 -0
  29. package/dist/components/atoms/game/HealthBar.d.ts +18 -0
  30. package/dist/components/atoms/game/ScoreDisplay.d.ts +21 -0
  31. package/dist/components/atoms/game/Sprite.d.ts +63 -0
  32. package/dist/components/atoms/game/StateIndicator.d.ts +31 -0
  33. package/dist/components/atoms/game/index.d.ts +12 -0
  34. package/dist/components/atoms/index.d.ts +27 -0
  35. package/dist/components/index.css +11 -9
  36. package/dist/components/index.d.ts +6 -6951
  37. package/dist/components/index.js +5 -5
  38. package/dist/components/molecules/Accordion.d.ts +67 -0
  39. package/dist/components/molecules/Alert.d.ts +24 -0
  40. package/dist/components/molecules/Breadcrumb.d.ts +55 -0
  41. package/dist/components/molecules/ButtonGroup.d.ts +67 -0
  42. package/dist/components/molecules/Card.d.ts +44 -0
  43. package/dist/components/molecules/Container.d.ts +30 -0
  44. package/dist/components/molecules/Drawer.d.ts +46 -0
  45. package/dist/components/molecules/EmptyState.d.ts +25 -0
  46. package/dist/components/molecules/ErrorBoundary.d.ts +55 -0
  47. package/dist/components/molecules/ErrorState.d.ts +13 -0
  48. package/dist/components/molecules/FilterGroup.d.ts +54 -0
  49. package/dist/components/molecules/Flex.d.ts +43 -0
  50. package/dist/components/molecules/FloatingActionButton.d.ts +69 -0
  51. package/dist/components/molecules/FormField.d.ts +16 -0
  52. package/dist/components/molecules/FormSectionHeader.d.ts +30 -0
  53. package/dist/components/molecules/Grid.d.ts +54 -0
  54. package/dist/components/molecules/InputGroup.d.ts +24 -0
  55. package/dist/components/molecules/LoadingState.d.ts +7 -0
  56. package/dist/components/molecules/Menu.d.ts +40 -0
  57. package/dist/components/molecules/Modal.d.ts +26 -0
  58. package/dist/components/molecules/Pagination.d.ts +66 -0
  59. package/dist/components/molecules/Popover.d.ts +39 -0
  60. package/dist/components/molecules/QuizBlock.d.ts +20 -0
  61. package/dist/components/molecules/RelationSelect.d.ts +48 -0
  62. package/dist/components/molecules/RepeatableFormSection.d.ts +58 -0
  63. package/dist/components/molecules/ScaledDiagram.d.ts +20 -0
  64. package/dist/components/molecules/SearchInput.d.ts +60 -0
  65. package/dist/components/molecules/SidePanel.d.ts +47 -0
  66. package/dist/components/molecules/SimpleGrid.d.ts +27 -0
  67. package/dist/components/molecules/Skeleton.d.ts +35 -0
  68. package/dist/components/molecules/Tabs.d.ts +45 -0
  69. package/dist/components/molecules/Toast.d.ts +35 -0
  70. package/dist/components/molecules/Tooltip.d.ts +25 -0
  71. package/dist/components/molecules/ViolationAlert.d.ts +49 -0
  72. package/dist/components/molecules/WizardNavigation.d.ts +51 -0
  73. package/dist/components/molecules/WizardProgress.d.ts +42 -0
  74. package/dist/components/molecules/game/StatBadge.d.ts +27 -0
  75. package/dist/components/molecules/index.d.ts +38 -0
  76. package/dist/components/molecules/markdown/CodeBlock.d.ts +25 -0
  77. package/dist/components/molecules/markdown/MarkdownContent.d.ts +26 -0
  78. package/dist/components/organisms/CardGrid.d.ts +72 -0
  79. package/dist/components/organisms/Chart.d.ts +59 -0
  80. package/dist/components/organisms/CodeViewer.d.ts +67 -0
  81. package/dist/components/organisms/ComponentPatterns.d.ts +441 -0
  82. package/dist/components/organisms/ConfirmDialog.d.ts +50 -0
  83. package/dist/components/organisms/ContentRenderer.d.ts +23 -0
  84. package/dist/components/organisms/CustomPattern.d.ts +104 -0
  85. package/dist/components/organisms/DataTable.d.ts +63 -0
  86. package/dist/components/organisms/DetailPanel.d.ts +71 -0
  87. package/dist/components/organisms/DocumentViewer.d.ts +60 -0
  88. package/dist/components/organisms/DrawerSlot.d.ts +39 -0
  89. package/dist/components/organisms/Form.d.ts +203 -0
  90. package/dist/components/organisms/FormSection.d.ts +59 -0
  91. package/dist/components/organisms/GraphCanvas.d.ts +69 -0
  92. package/dist/components/organisms/Header.d.ts +110 -0
  93. package/dist/components/organisms/JazariStateMachine.d.ts +60 -0
  94. package/dist/components/organisms/LayoutPatterns.d.ts +181 -0
  95. package/dist/components/organisms/List.d.ts +76 -0
  96. package/dist/components/organisms/MasterDetail.d.ts +43 -0
  97. package/dist/components/organisms/MediaGallery.d.ts +66 -0
  98. package/dist/components/organisms/Meter.d.ts +58 -0
  99. package/dist/components/organisms/ModalSlot.d.ts +35 -0
  100. package/dist/components/organisms/Navigation.d.ts +68 -0
  101. package/dist/components/organisms/OrbitalVisualization.d.ts +48 -0
  102. package/dist/components/organisms/PageHeader.d.ts +59 -0
  103. package/dist/components/organisms/Section.d.ts +44 -0
  104. package/dist/components/organisms/Sidebar.d.ts +65 -0
  105. package/dist/components/organisms/SignaturePad.d.ts +44 -0
  106. package/dist/components/organisms/Split.d.ts +42 -0
  107. package/dist/components/organisms/StatCard.d.ts +66 -0
  108. package/dist/components/organisms/StateMachineView.d.ts +36 -0
  109. package/dist/components/organisms/Table.d.ts +99 -0
  110. package/dist/components/organisms/Timeline.d.ts +58 -0
  111. package/dist/components/organisms/ToastSlot.d.ts +38 -0
  112. package/dist/components/organisms/UISlotRenderer.d.ts +112 -0
  113. package/dist/components/organisms/WizardContainer.d.ts +160 -0
  114. package/dist/components/organisms/book/BookChapterView.d.ts +17 -0
  115. package/dist/components/organisms/book/BookCoverPage.d.ts +19 -0
  116. package/dist/components/organisms/book/BookNavBar.d.ts +18 -0
  117. package/dist/components/organisms/book/BookTableOfContents.d.ts +18 -0
  118. package/dist/components/organisms/book/BookViewer.d.ts +28 -0
  119. package/dist/components/organisms/book/index.d.ts +7 -0
  120. package/dist/components/organisms/book/types.d.ts +77 -0
  121. package/dist/components/organisms/game/BattleBoard.d.ts +167 -0
  122. package/dist/components/organisms/game/CanvasEffect.d.ts +68 -0
  123. package/dist/components/organisms/game/CastleBoard.d.ts +85 -0
  124. package/dist/components/organisms/game/DialogueBox.d.ts +73 -0
  125. package/dist/components/organisms/game/GameAudioProvider.d.ts +47 -0
  126. package/dist/components/organisms/game/GameAudioToggle.d.ts +28 -0
  127. package/dist/components/organisms/game/GameHud.d.ts +40 -0
  128. package/dist/components/organisms/game/GameMenu.d.ts +43 -0
  129. package/dist/components/organisms/game/GameOverScreen.d.ts +56 -0
  130. package/dist/components/organisms/game/InventoryPanel.d.ts +67 -0
  131. package/dist/components/organisms/game/IsometricCanvas.d.ts +123 -0
  132. package/dist/components/organisms/game/TraitSlot.d.ts +86 -0
  133. package/dist/components/organisms/game/TraitStateViewer.d.ts +53 -0
  134. package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +26 -0
  135. package/dist/components/organisms/game/WorldMapBoard.d.ts +147 -0
  136. package/dist/components/organisms/game/editor/editorUtils.d.ts +109 -0
  137. package/dist/components/organisms/game/editor/index.d.ts +9 -0
  138. package/dist/components/organisms/game/hooks/useBattleState.d.ts +35 -0
  139. package/dist/components/organisms/game/hooks/useCamera.d.ts +41 -0
  140. package/dist/components/organisms/game/hooks/useGameAudio.d.ts +47 -0
  141. package/dist/components/organisms/game/hooks/useImageCache.d.ts +16 -0
  142. package/dist/components/organisms/game/hooks/usePhysics2D.d.ts +45 -0
  143. package/dist/components/organisms/game/hooks/useSpriteAnimations.d.ts +43 -0
  144. package/dist/components/organisms/game/index.d.ts +36 -0
  145. package/dist/components/organisms/game/managers/PhysicsManager.d.ts +103 -0
  146. package/dist/components/organisms/game/types/effects.d.ts +253 -0
  147. package/dist/{isometric-ynNHVPZx.d.ts → components/organisms/game/types/isometric.d.ts} +4 -6
  148. package/dist/components/organisms/game/types/spriteAnimation.d.ts +73 -0
  149. package/dist/components/organisms/game/utils/canvasEffects.d.ts +50 -0
  150. package/dist/components/organisms/game/utils/combatPresets.d.ts +15 -0
  151. package/dist/components/organisms/game/utils/isometric.d.ts +61 -0
  152. package/dist/components/organisms/game/utils/spriteAnimation.d.ts +57 -0
  153. package/dist/components/organisms/game/utils/spriteSheetConstants.d.ts +16 -0
  154. package/dist/components/organisms/index.d.ts +37 -0
  155. package/dist/components/organisms/layout/DashboardGrid.d.ts +34 -0
  156. package/dist/components/organisms/layout/MasterDetail.d.ts +32 -0
  157. package/dist/components/organisms/layout/SplitPane.d.ts +34 -0
  158. package/dist/components/organisms/layout/TabbedContainer.d.ts +42 -0
  159. package/dist/components/organisms/layout/index.d.ts +9 -0
  160. package/dist/components/organisms/types.d.ts +65 -0
  161. package/dist/components/templates/AuthLayout.d.ts +14 -0
  162. package/dist/components/templates/BattleTemplate.d.ts +25 -0
  163. package/dist/components/templates/CastleTemplate.d.ts +23 -0
  164. package/dist/components/templates/CounterTemplate.d.ts +44 -0
  165. package/dist/components/templates/DashboardLayout.d.ts +32 -0
  166. package/dist/components/templates/GameShell.d.ts +33 -0
  167. package/dist/components/templates/GameTemplate.d.ts +36 -0
  168. package/dist/components/templates/GenericAppTemplate.d.ts +30 -0
  169. package/dist/components/templates/WorldMapTemplate.d.ts +29 -0
  170. package/dist/components/templates/index.d.ts +10 -0
  171. package/dist/components/templates/types.d.ts +17 -0
  172. package/dist/context/DesignThemeContext.d.ts +21 -0
  173. package/dist/{ThemeContext-D9xUORq5.d.ts → context/ThemeContext.d.ts} +15 -16
  174. package/dist/context/UISlotContext.d.ts +75 -0
  175. package/dist/context/UserContext.d.ts +111 -0
  176. package/dist/context/index.d.ts +6 -206
  177. package/dist/{event-bus-types-CjJduURa.d.ts → hooks/event-bus-types.d.ts} +4 -6
  178. package/dist/hooks/index.d.ts +24 -1090
  179. package/dist/hooks/useAgentChat.d.ts +104 -0
  180. package/dist/hooks/useAuthContext.d.ts +25 -0
  181. package/dist/hooks/useCompile.d.ts +22 -0
  182. package/dist/hooks/useDeepAgentGeneration.d.ts +46 -0
  183. package/dist/hooks/useEntities.d.ts +52 -0
  184. package/dist/hooks/useEntityData.d.ts +155 -0
  185. package/dist/hooks/useEntityMutations.d.ts +80 -0
  186. package/dist/hooks/useEventBus.d.ts +96 -0
  187. package/dist/hooks/useExtensions.d.ts +32 -0
  188. package/dist/hooks/useFileEditor.d.ts +32 -0
  189. package/dist/hooks/useFileSystem.d.ts +40 -0
  190. package/dist/hooks/useGitHub.d.ts +58 -0
  191. package/dist/hooks/useOrbitalHistory.d.ts +39 -0
  192. package/dist/hooks/useOrbitalMutations.d.ts +95 -0
  193. package/dist/hooks/usePreview.d.ts +57 -0
  194. package/dist/hooks/useQuerySingleton.d.ts +78 -0
  195. package/dist/hooks/useResolvedEntity.d.ts +32 -0
  196. package/dist/hooks/useTranslate.d.ts +35 -0
  197. package/dist/hooks/useUIEvents.d.ts +35 -0
  198. package/dist/{useUISlots-D0mttBSP.d.ts → hooks/useUISlots.d.ts} +8 -9
  199. package/dist/hooks/useValidation.d.ts +46 -0
  200. package/dist/lib/api-client.d.ts +42 -0
  201. package/dist/lib/cn.d.ts +6 -0
  202. package/dist/lib/debug.d.ts +43 -0
  203. package/dist/lib/debugRegistry.d.ts +29 -0
  204. package/dist/lib/debugUtils.d.ts +27 -0
  205. package/dist/lib/entityDebug.d.ts +38 -0
  206. package/dist/lib/getNestedValue.d.ts +33 -0
  207. package/dist/lib/guardRegistry.d.ts +32 -0
  208. package/dist/lib/index.d.ts +17 -426
  209. package/dist/lib/jazari/svg-paths.d.ts +61 -0
  210. package/dist/lib/parseContentSegments.d.ts +41 -0
  211. package/dist/lib/tickRegistry.d.ts +40 -0
  212. package/dist/lib/traitRegistry.d.ts +34 -0
  213. package/dist/lib/verificationRegistry.d.ts +107 -0
  214. package/dist/{cn-BoBXsxuX.d.ts → lib/visualizer/index.d.ts} +18 -69
  215. package/dist/locales/index.d.ts +5 -7
  216. package/dist/providers/EventBusProvider.d.ts +60 -0
  217. package/dist/providers/FetchedDataProvider.d.ts +105 -0
  218. package/dist/providers/OfflineModeProvider.d.ts +79 -0
  219. package/dist/providers/OrbitalProvider.d.ts +101 -0
  220. package/dist/providers/SelectionProvider.d.ts +81 -0
  221. package/dist/providers/VerificationProvider.d.ts +63 -0
  222. package/dist/providers/index.css +11 -9
  223. package/dist/providers/index.d.ts +16 -464
  224. package/dist/providers/index.js +3 -3
  225. package/dist/renderer/client-effect-executor.d.ts +68 -0
  226. package/dist/renderer/data-resolver.d.ts +68 -0
  227. package/dist/renderer/index.d.ts +22 -519
  228. package/dist/renderer/index.js +1 -1
  229. package/dist/renderer/init.d.ts +14 -0
  230. package/dist/renderer/navigation.d.ts +142 -0
  231. package/dist/{offline-executor-CHr4uAhf.d.ts → renderer/offline-executor.d.ts} +9 -172
  232. package/dist/renderer/pattern-resolver.d.ts +91 -0
  233. package/dist/renderer/slot-definitions.d.ts +45 -0
  234. package/dist/renderer/types.d.ts +160 -0
  235. package/dist/renderer/useClientEffects.d.ts +88 -0
  236. package/dist/stores/entityStore.d.ts +99 -0
  237. package/dist/stores/filtering.d.ts +51 -0
  238. package/dist/stores/index.d.ts +4 -148
  239. package/package.json +12 -10
  240. package/dist/components/organisms/game/three/index.d.ts +0 -1162
  241. package/dist/{chunk-FZJ73RDM.js → chunk-RIZ76XRF.js} +1 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Entity Debug - Provides entity state snapshots for debugging
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export interface EntityState {
7
+ id: string;
8
+ type: string;
9
+ fields: Record<string, unknown>;
10
+ lastUpdated: number;
11
+ }
12
+ export interface RuntimeEntity {
13
+ id: string;
14
+ type: string;
15
+ data: Record<string, unknown>;
16
+ }
17
+ export interface PersistentEntityInfo {
18
+ loaded: boolean;
19
+ count: number;
20
+ }
21
+ export interface EntitySnapshot {
22
+ entities: EntityState[];
23
+ timestamp: number;
24
+ totalCount: number;
25
+ /** Singleton entities by name */
26
+ singletons: Record<string, unknown>;
27
+ /** Runtime entities (in-memory) */
28
+ runtime: RuntimeEntity[];
29
+ /** Persistent entities info by type */
30
+ persistent: Record<string, PersistentEntityInfo>;
31
+ }
32
+ type EntityProvider = () => EntityState[];
33
+ export declare function setEntityProvider(provider: EntityProvider): void;
34
+ export declare function clearEntityProvider(): void;
35
+ export declare function getEntitySnapshot(): EntitySnapshot | null;
36
+ export declare function getEntityById(id: string): EntityState | undefined;
37
+ export declare function getEntitiesByType(type: string): EntityState[];
38
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Get Nested Value Utility
3
+ *
4
+ * Safely retrieves nested values from objects using dot-notation paths.
5
+ * Used by display components to support relation field access like "company.name".
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Get a nested value from an object using dot-notation path.
11
+ *
12
+ * @param obj - The object to traverse
13
+ * @param path - Dot-notation path (e.g., "company.name", "address.city")
14
+ * @returns The value at the path, or undefined if not found
15
+ *
16
+ * @example
17
+ * const data = { company: { name: "Acme Corp", address: { city: "NYC" } } };
18
+ * getNestedValue(data, "company.name"); // => "Acme Corp"
19
+ * getNestedValue(data, "company.address.city"); // => "NYC"
20
+ * getNestedValue(data, "company.missing"); // => undefined
21
+ */
22
+ export declare function getNestedValue(obj: Record<string, unknown> | null | undefined, path: string): unknown;
23
+ /**
24
+ * Format a nested field path as a human-readable label.
25
+ *
26
+ * @param path - Dot-notation path (e.g., "company.name")
27
+ * @returns Formatted label (e.g., "Company Name")
28
+ *
29
+ * @example
30
+ * formatFieldLabel("company.name"); // => "Company Name"
31
+ * formatFieldLabel("address.zipCode"); // => "Address Zip Code"
32
+ */
33
+ export declare function formatNestedFieldLabel(path: string): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Guard Registry - Tracks guard evaluations for debugging
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export interface GuardContext {
7
+ traitName?: string;
8
+ type?: "transition" | "tick";
9
+ transitionFrom?: string;
10
+ transitionTo?: string;
11
+ tickName?: string;
12
+ [key: string]: unknown;
13
+ }
14
+ export interface GuardEvaluation {
15
+ id: string;
16
+ traitName: string;
17
+ guardName: string;
18
+ expression: string;
19
+ result: boolean;
20
+ context: GuardContext;
21
+ timestamp: number;
22
+ /** Input values used in guard evaluation */
23
+ inputs: Record<string, unknown>;
24
+ }
25
+ type ChangeListener = () => void;
26
+ export declare function recordGuardEvaluation(evaluation: Omit<GuardEvaluation, "id" | "timestamp">): void;
27
+ export declare function getGuardHistory(): GuardEvaluation[];
28
+ export declare function getRecentGuardEvaluations(count: number): GuardEvaluation[];
29
+ export declare function getGuardEvaluationsForTrait(traitName: string): GuardEvaluation[];
30
+ export declare function subscribeToGuardChanges(listener: ChangeListener): () => void;
31
+ export declare function clearGuardHistory(): void;
32
+ export {};
@@ -1,427 +1,18 @@
1
- export { C as ContentSegment, D as DEFAULT_CONFIG, a as DomEntityBox, b as DomLayoutData, c as DomOutputsBox, d as DomStateNode, e as DomTransitionLabel, f as DomTransitionPath, E as EntityDefinition, R as RenderOptions, S as StateDefinition, g as StateMachineDefinition, T as TransitionDefinition, V as VisualizerConfig, h as cn, i as extractOutputsFromTransitions, j as extractStateMachine, k as formatGuard, l as getEffectSummary, p as parseContentSegments, m as parseMarkdownWithCodeBlocks, r as renderStateMachineToDomData, n as renderStateMachineToSvg } from '../cn-BoBXsxuX.js';
2
- import 'clsx';
3
-
4
1
  /**
5
- * API Client - HTTP client for backend API calls
6
- *
7
- * Provides typed methods for making API requests.
8
- * All requests go through the backend server, NOT directly to Firestore.
9
- *
10
- * @packageDocumentation
11
- */
12
- /**
13
- * API Error class for handling HTTP errors
14
- */
15
- declare class ApiError extends Error {
16
- status: number;
17
- statusText: string;
18
- constructor(status: number, statusText: string, message?: string);
19
- }
20
- /**
21
- * API client with typed methods
22
- */
23
- declare const apiClient: {
24
- /**
25
- * GET request
26
- */
27
- get<T>(endpoint: string): Promise<T>;
28
- /**
29
- * POST request
30
- */
31
- post<T>(endpoint: string, data?: unknown): Promise<T>;
32
- /**
33
- * PUT request
34
- */
35
- put<T>(endpoint: string, data?: unknown): Promise<T>;
36
- /**
37
- * PATCH request
38
- */
39
- patch<T>(endpoint: string, data?: unknown): Promise<T>;
40
- /**
41
- * DELETE request
42
- */
43
- delete<T = void>(endpoint: string): Promise<T>;
44
- };
45
-
46
- /**
47
- * Debug utilities for development
48
- */
49
- declare function isDebugEnabled(): boolean;
50
- declare function debug(...args: unknown[]): void;
51
- declare function debugGroup(label: string): void;
52
- declare function debugGroupEnd(): void;
53
- declare function debugWarn(...args: unknown[]): void;
54
- declare function debugError(...args: unknown[]): void;
55
- declare function debugTable(data: unknown): void;
56
- declare function debugTime(label: string): void;
57
- declare function debugTimeEnd(label: string): void;
58
- /**
59
- * Debug input events (keyboard, mouse, touch)
60
- * @param inputType - Type of input (e.g., 'keydown', 'keyup', 'mouse')
61
- * @param data - Input data to log
62
- */
63
- declare function debugInput(inputType: string, data: unknown): void;
64
- /**
65
- * Debug collision events between entities
66
- * @param entityA - First entity in collision
67
- * @param entityB - Second entity in collision
68
- * @param details - Additional collision details
69
- */
70
- declare function debugCollision(entityA: {
71
- id?: string;
72
- type?: string;
73
- }, entityB: {
74
- id?: string;
75
- type?: string;
76
- }, details?: unknown): void;
77
- /**
78
- * Debug physics updates (position, velocity)
79
- * @param entityId - Entity identifier
80
- * @param physics - Physics data to log
81
- */
82
- declare function debugPhysics(entityId: string, physics: unknown): void;
83
- /**
84
- * Debug game state changes
85
- * @param stateName - Name of the state that changed
86
- * @param value - New state value
87
- */
88
- declare function debugGameState(stateName: string, value: unknown): void;
89
-
90
- /**
91
- * Debug Utilities - Functions for toggling and checking debug mode
92
- *
93
- * @packageDocumentation
94
- */
95
- type DebugToggleListener = (enabled: boolean) => void;
96
- /**
97
- * Enable or disable debug mode
98
- */
99
- declare function setDebugEnabled(enabled: boolean): void;
100
- /**
101
- * Toggle debug mode
102
- */
103
- declare function toggleDebug(): boolean;
104
- /**
105
- * Subscribe to debug mode changes
106
- */
107
- declare function onDebugToggle(listener: DebugToggleListener): () => void;
108
- /**
109
- * Initialize debug mode from keyboard shortcut (Ctrl+Shift+D)
110
- */
111
- declare function initDebugShortcut(): () => void;
112
-
113
- /**
114
- * Entity Debug - Provides entity state snapshots for debugging
115
- *
116
- * @packageDocumentation
117
- */
118
- interface EntityState {
119
- id: string;
120
- type: string;
121
- fields: Record<string, unknown>;
122
- lastUpdated: number;
123
- }
124
- interface RuntimeEntity {
125
- id: string;
126
- type: string;
127
- data: Record<string, unknown>;
128
- }
129
- interface PersistentEntityInfo {
130
- loaded: boolean;
131
- count: number;
132
- }
133
- interface EntitySnapshot {
134
- entities: EntityState[];
135
- timestamp: number;
136
- totalCount: number;
137
- /** Singleton entities by name */
138
- singletons: Record<string, unknown>;
139
- /** Runtime entities (in-memory) */
140
- runtime: RuntimeEntity[];
141
- /** Persistent entities info by type */
142
- persistent: Record<string, PersistentEntityInfo>;
143
- }
144
- type EntityProvider = () => EntityState[];
145
- declare function setEntityProvider(provider: EntityProvider): void;
146
- declare function clearEntityProvider(): void;
147
- declare function getEntitySnapshot(): EntitySnapshot | null;
148
- declare function getEntityById(id: string): EntityState | undefined;
149
- declare function getEntitiesByType(type: string): EntityState[];
150
-
151
- /**
152
- * Debug Registry - Central event log for debugging
153
- *
154
- * @packageDocumentation
155
- */
156
- type DebugEventType = 'state-change' | 'event-fired' | 'effect-executed' | 'guard-evaluated' | 'error' | 'warning' | 'info';
157
- interface DebugEvent {
158
- id: string;
159
- type: DebugEventType;
160
- source: string;
161
- message: string;
162
- data?: Record<string, unknown>;
163
- timestamp: number;
164
- }
165
- type ChangeListener$4 = () => void;
166
- declare function logDebugEvent(type: DebugEventType, source: string, message: string, data?: Record<string, unknown>): void;
167
- declare function logStateChange(source: string, from: string, to: string, event?: string): void;
168
- declare function logEventFired(source: string, eventName: string, payload?: unknown): void;
169
- declare function logEffectExecuted(source: string, effectType: string, details?: unknown): void;
170
- declare function logError(source: string, message: string, error?: unknown): void;
171
- declare function logWarning(source: string, message: string, data?: Record<string, unknown>): void;
172
- declare function logInfo(source: string, message: string, data?: Record<string, unknown>): void;
173
- declare function getDebugEvents(): DebugEvent[];
174
- declare function getRecentEvents(count: number): DebugEvent[];
175
- declare function getEventsByType(type: DebugEventType): DebugEvent[];
176
- declare function getEventsBySource(source: string): DebugEvent[];
177
- declare function subscribeToDebugEvents(listener: ChangeListener$4): () => void;
178
- declare function clearDebugEvents(): void;
179
-
180
- /**
181
- * Guard Registry - Tracks guard evaluations for debugging
182
- *
183
- * @packageDocumentation
184
- */
185
- interface GuardContext {
186
- traitName?: string;
187
- type?: "transition" | "tick";
188
- transitionFrom?: string;
189
- transitionTo?: string;
190
- tickName?: string;
191
- [key: string]: unknown;
192
- }
193
- interface GuardEvaluation {
194
- id: string;
195
- traitName: string;
196
- guardName: string;
197
- expression: string;
198
- result: boolean;
199
- context: GuardContext;
200
- timestamp: number;
201
- /** Input values used in guard evaluation */
202
- inputs: Record<string, unknown>;
203
- }
204
- type ChangeListener$3 = () => void;
205
- declare function recordGuardEvaluation(evaluation: Omit<GuardEvaluation, "id" | "timestamp">): void;
206
- declare function getGuardHistory(): GuardEvaluation[];
207
- declare function getRecentGuardEvaluations(count: number): GuardEvaluation[];
208
- declare function getGuardEvaluationsForTrait(traitName: string): GuardEvaluation[];
209
- declare function subscribeToGuardChanges(listener: ChangeListener$3): () => void;
210
- declare function clearGuardHistory(): void;
211
-
212
- /**
213
- * Tick Registry - Tracks scheduled tick executions for debugging
214
- *
215
- * @packageDocumentation
216
- */
217
- interface TickExecution {
218
- id: string;
219
- traitName: string;
220
- /** Tick name (display name) */
221
- name: string;
222
- /** Tick identifier */
223
- tickName: string;
224
- interval: number;
225
- /** Last execution timestamp */
226
- lastRun: number;
227
- lastExecuted: number | null;
228
- nextExecution: number | null;
229
- /** Number of times this tick has run */
230
- runCount: number;
231
- executionCount: number;
232
- /** Average execution time in ms */
233
- executionTime: number;
234
- /** Whether the tick is currently active */
235
- active: boolean;
236
- isActive: boolean;
237
- /** Guard name if this tick has a guard */
238
- guardName?: string;
239
- /** Whether the guard passed on last evaluation */
240
- guardPassed?: boolean;
241
- }
242
- type ChangeListener$2 = () => void;
243
- declare function registerTick(tick: TickExecution): void;
244
- declare function updateTickExecution(id: string, timestamp: number): void;
245
- declare function setTickActive(id: string, isActive: boolean): void;
246
- declare function unregisterTick(id: string): void;
247
- declare function getAllTicks(): TickExecution[];
248
- declare function getTick(id: string): TickExecution | undefined;
249
- declare function subscribeToTickChanges(listener: ChangeListener$2): () => void;
250
- declare function clearTicks(): void;
251
-
252
- /**
253
- * Trait Registry - Tracks active traits and their state machines for debugging
254
- *
255
- * @packageDocumentation
256
- */
257
- interface TraitTransition {
258
- from: string;
259
- to: string;
260
- event: string;
261
- guard?: string;
262
- }
263
- interface TraitGuard {
264
- name: string;
265
- lastResult?: boolean;
266
- }
267
- interface TraitDebugInfo {
268
- id: string;
269
- name: string;
270
- currentState: string;
271
- states: string[];
272
- transitions: TraitTransition[];
273
- guards: TraitGuard[];
274
- transitionCount: number;
275
- }
276
- type ChangeListener$1 = () => void;
277
- declare function registerTrait(info: TraitDebugInfo): void;
278
- declare function updateTraitState(id: string, newState: string): void;
279
- declare function updateGuardResult(traitId: string, guardName: string, result: boolean): void;
280
- declare function unregisterTrait(id: string): void;
281
- declare function getAllTraits(): TraitDebugInfo[];
282
- declare function getTrait(id: string): TraitDebugInfo | undefined;
283
- declare function subscribeToTraitChanges(listener: ChangeListener$1): () => void;
284
- declare function clearTraits(): void;
285
-
286
- /**
287
- * Verification Registry - Tracks runtime verification checks and transition traces
288
- *
289
- * Provides:
290
- * 1. A checklist of pass/fail checks (INIT has fetch, bridge connected, etc.)
291
- * 2. A full transition timeline with effect execution results
292
- * 3. ServerBridge health snapshot
293
- * 4. window.__orbitalVerification for Playwright/automation
294
- *
295
- * @packageDocumentation
296
- */
297
- type CheckStatus = "pass" | "fail" | "pending" | "warn";
298
- interface VerificationCheck {
299
- id: string;
300
- label: string;
301
- status: CheckStatus;
302
- details?: string;
303
- /** Timestamp when status last changed */
304
- updatedAt: number;
305
- }
306
- interface EffectTrace {
307
- type: string;
308
- args: unknown[];
309
- status: "executed" | "failed" | "skipped";
310
- error?: string;
311
- durationMs?: number;
312
- }
313
- interface TransitionTrace {
314
- id: string;
315
- traitName: string;
316
- from: string;
317
- to: string;
318
- event: string;
319
- guardExpression?: string;
320
- guardResult?: boolean;
321
- effects: EffectTrace[];
322
- timestamp: number;
323
- }
324
- interface BridgeHealth {
325
- connected: boolean;
326
- eventsForwarded: number;
327
- eventsReceived: number;
328
- lastError?: string;
329
- lastHeartbeat: number;
330
- }
331
- interface VerificationSummary {
332
- totalChecks: number;
333
- passed: number;
334
- failed: number;
335
- warnings: number;
336
- pending: number;
337
- }
338
- interface VerificationSnapshot {
339
- checks: VerificationCheck[];
340
- transitions: TransitionTrace[];
341
- bridge: BridgeHealth | null;
342
- summary: VerificationSummary;
343
- }
344
- type ChangeListener = () => void;
345
- declare function registerCheck(id: string, label: string, status?: CheckStatus, details?: string): void;
346
- declare function updateCheck(id: string, status: CheckStatus, details?: string): void;
347
- declare function getAllChecks(): VerificationCheck[];
348
- declare function recordTransition(trace: Omit<TransitionTrace, "id">): void;
349
- declare function getTransitions(): TransitionTrace[];
350
- declare function getTransitionsForTrait(traitName: string): TransitionTrace[];
351
- declare function updateBridgeHealth(health: BridgeHealth): void;
352
- declare function getBridgeHealth(): BridgeHealth | null;
353
- declare function getSummary(): VerificationSummary;
354
- declare function getSnapshot(): VerificationSnapshot;
355
- declare function subscribeToVerification(listener: ChangeListener): () => void;
356
- /** Exposed on window for Playwright to query */
357
- interface OrbitalVerificationAPI {
358
- getSnapshot: () => VerificationSnapshot;
359
- getChecks: () => VerificationCheck[];
360
- getTransitions: () => TransitionTrace[];
361
- getBridge: () => BridgeHealth | null;
362
- getSummary: () => VerificationSummary;
363
- /** Wait for a specific event to be processed */
364
- waitForTransition: (event: string, timeoutMs?: number) => Promise<TransitionTrace | null>;
365
- /** Send an event into the runtime (requires eventBus binding) */
366
- sendEvent?: (event: string, payload?: Record<string, unknown>) => void;
367
- /** Get current trait state */
368
- getTraitState?: (traitName: string) => string | undefined;
369
- }
370
- declare global {
371
- interface Window {
372
- __orbitalVerification?: OrbitalVerificationAPI;
373
- }
374
- }
375
- /**
376
- * Wait for a transition matching the given event to appear.
377
- * Returns the trace or null on timeout.
378
- */
379
- declare function waitForTransition(event: string, timeoutMs?: number): Promise<TransitionTrace | null>;
380
- /**
381
- * Bind the EventBus so automation can send events.
382
- * Call this during app initialization.
383
- */
384
- declare function bindEventBus(eventBus: {
385
- emit: (type: string, payload?: Record<string, unknown>) => void;
386
- }): void;
387
- /**
388
- * Bind a trait state getter so automation can query current states.
389
- */
390
- declare function bindTraitStateGetter(getter: (traitName: string) => string | undefined): void;
391
- declare function clearVerification(): void;
392
-
393
- /**
394
- * Get Nested Value Utility
395
- *
396
- * Safely retrieves nested values from objects using dot-notation paths.
397
- * Used by display components to support relation field access like "company.name".
398
- *
399
- * @packageDocumentation
400
- */
401
- /**
402
- * Get a nested value from an object using dot-notation path.
403
- *
404
- * @param obj - The object to traverse
405
- * @param path - Dot-notation path (e.g., "company.name", "address.city")
406
- * @returns The value at the path, or undefined if not found
407
- *
408
- * @example
409
- * const data = { company: { name: "Acme Corp", address: { city: "NYC" } } };
410
- * getNestedValue(data, "company.name"); // => "Acme Corp"
411
- * getNestedValue(data, "company.address.city"); // => "NYC"
412
- * getNestedValue(data, "company.missing"); // => undefined
413
- */
414
- declare function getNestedValue(obj: Record<string, unknown> | null | undefined, path: string): unknown;
415
- /**
416
- * Format a nested field path as a human-readable label.
417
- *
418
- * @param path - Dot-notation path (e.g., "company.name")
419
- * @returns Formatted label (e.g., "Company Name")
420
- *
421
- * @example
422
- * formatFieldLabel("company.name"); // => "Company Name"
423
- * formatFieldLabel("address.zipCode"); // => "Address Zip Code"
424
- */
425
- declare function formatNestedFieldLabel(path: string): string;
426
-
427
- export { ApiError, type BridgeHealth, type CheckStatus, type DebugEvent, type DebugEventType, type EffectTrace, type EntitySnapshot, type EntityState, type GuardContext, type GuardEvaluation, type PersistentEntityInfo, type RuntimeEntity, type TickExecution, type TraitDebugInfo, type TraitGuard, type TraitTransition, type TransitionTrace, type VerificationCheck, type VerificationSnapshot, type VerificationSummary, apiClient, bindEventBus, bindTraitStateGetter, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, clearVerification, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getAllChecks, getAllTicks, getAllTraits, getBridgeHealth, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getNestedValue, getRecentEvents, getRecentGuardEvaluations, getSnapshot, getSummary, getTick, getTrait, getTransitions, getTransitionsForTrait, initDebugShortcut, isDebugEnabled, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, onDebugToggle, recordGuardEvaluation, recordTransition, registerCheck, registerTick, registerTrait, setDebugEnabled, setEntityProvider, setTickActive, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, subscribeToVerification, toggleDebug, unregisterTick, unregisterTrait, updateBridgeHealth, updateCheck, updateGuardResult, updateTickExecution, updateTraitState, waitForTransition };
2
+ * Lib - Utility functions and registries
3
+ *
4
+ * Core utilities for the Almadar UI library.
5
+ */
6
+ export { cn } from './cn';
7
+ export * from './api-client';
8
+ export * from './debug';
9
+ export { setDebugEnabled, toggleDebug, onDebugToggle, initDebugShortcut, } from './debugUtils';
10
+ export * from './entityDebug';
11
+ export * from './debugRegistry';
12
+ export * from './guardRegistry';
13
+ export * from './tickRegistry';
14
+ export * from './traitRegistry';
15
+ export * from './verificationRegistry';
16
+ export * from './getNestedValue';
17
+ export * from './visualizer';
18
+ export * from './parseContentSegments';
@@ -0,0 +1,61 @@
1
+ /**
2
+ * SVG path generators for the Al-Jazari state machine visualization.
3
+ * Pure TypeScript — zero React/DOM dependencies.
4
+ *
5
+ * Generates paths for gear teeth, arabesque borders, pipe shapes, and lock icons.
6
+ */
7
+ /**
8
+ * Generate an SVG path for gear teeth around a circle.
9
+ *
10
+ * @param cx - Center X
11
+ * @param cy - Center Y
12
+ * @param innerRadius - Inner radius (base circle)
13
+ * @param outerRadius - Outer radius (tip of teeth)
14
+ * @param numTeeth - Number of teeth around the gear
15
+ * @returns SVG path d attribute string
16
+ */
17
+ export declare function gearTeethPath(cx: number, cy: number, innerRadius: number, outerRadius: number, numTeeth: number): string;
18
+ /**
19
+ * Generate an SVG path for a small gear-shaped lock icon.
20
+ *
21
+ * @param cx - Center X
22
+ * @param cy - Center Y
23
+ * @param size - Overall size of the lock icon
24
+ * @returns SVG path d attribute for the lock body + shackle
25
+ */
26
+ export declare function lockIconPath(cx: number, cy: number, size: number): string;
27
+ /**
28
+ * Generate a simple brain-like icon path.
29
+ *
30
+ * @param cx - Center X
31
+ * @param cy - Center Y
32
+ * @param size - Overall size
33
+ * @returns SVG path d attribute
34
+ */
35
+ export declare function brainIconPath(cx: number, cy: number, size: number): string;
36
+ /**
37
+ * Generate a simple pipe/tube icon path.
38
+ *
39
+ * @param cx - Center X
40
+ * @param cy - Center Y
41
+ * @param size - Overall size
42
+ * @returns SVG path d attribute
43
+ */
44
+ export declare function pipeIconPath(cx: number, cy: number, size: number): string;
45
+ /**
46
+ * Generate a single 8-pointed star path for the arabesque border pattern.
47
+ *
48
+ * @param cx - Center X
49
+ * @param cy - Center Y
50
+ * @param outerR - Outer radius (star tips)
51
+ * @param innerR - Inner radius (star valleys)
52
+ * @returns SVG path d attribute
53
+ */
54
+ export declare function eightPointedStarPath(cx: number, cy: number, outerR: number, innerR: number): string;
55
+ /**
56
+ * Generate a simple arrowhead path for transition arm endpoints.
57
+ *
58
+ * @param size - Arrow size
59
+ * @returns SVG path d attribute
60
+ */
61
+ export declare function arrowheadPath(size: number): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Content Segment Parsing Utilities
3
+ *
4
+ * Parses rich content with code blocks and quiz tags into structured
5
+ * segments for rendering. Detects orbital schemas in JSON code blocks
6
+ * and marks them for JazariStateMachine rendering.
7
+ */
8
+ /** Segment types for content rendering */
9
+ export type ContentSegment = {
10
+ type: 'markdown';
11
+ content: string;
12
+ } | {
13
+ type: 'code';
14
+ language: string;
15
+ content: string;
16
+ } | {
17
+ type: 'orbital';
18
+ language: string;
19
+ content: string;
20
+ schema: unknown;
21
+ } | {
22
+ type: 'quiz';
23
+ question: string;
24
+ answer: string;
25
+ };
26
+ /**
27
+ * Parse markdown content to extract code blocks.
28
+ *
29
+ * Splits markdown into segments of plain markdown and fenced code blocks.
30
+ * JSON/orb code blocks containing orbital schemas are tagged as 'orbital'.
31
+ */
32
+ export declare function parseMarkdownWithCodeBlocks(content: string | undefined | null): ContentSegment[];
33
+ /**
34
+ * Parse content to extract all segments including quiz tags and code blocks.
35
+ *
36
+ * Supported tags:
37
+ * - <question>q</question><answer>a</answer> — Quiz Q&A
38
+ *
39
+ * Also handles fenced code blocks (```language...```) with orbital detection.
40
+ */
41
+ export declare function parseContentSegments(content: string | undefined | null): ContentSegment[];
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Tick Registry - Tracks scheduled tick executions for debugging
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export interface TickExecution {
7
+ id: string;
8
+ traitName: string;
9
+ /** Tick name (display name) */
10
+ name: string;
11
+ /** Tick identifier */
12
+ tickName: string;
13
+ interval: number;
14
+ /** Last execution timestamp */
15
+ lastRun: number;
16
+ lastExecuted: number | null;
17
+ nextExecution: number | null;
18
+ /** Number of times this tick has run */
19
+ runCount: number;
20
+ executionCount: number;
21
+ /** Average execution time in ms */
22
+ executionTime: number;
23
+ /** Whether the tick is currently active */
24
+ active: boolean;
25
+ isActive: boolean;
26
+ /** Guard name if this tick has a guard */
27
+ guardName?: string;
28
+ /** Whether the guard passed on last evaluation */
29
+ guardPassed?: boolean;
30
+ }
31
+ type ChangeListener = () => void;
32
+ export declare function registerTick(tick: TickExecution): void;
33
+ export declare function updateTickExecution(id: string, timestamp: number): void;
34
+ export declare function setTickActive(id: string, isActive: boolean): void;
35
+ export declare function unregisterTick(id: string): void;
36
+ export declare function getAllTicks(): TickExecution[];
37
+ export declare function getTick(id: string): TickExecution | undefined;
38
+ export declare function subscribeToTickChanges(listener: ChangeListener): () => void;
39
+ export declare function clearTicks(): void;
40
+ export {};