@almadar/ui 2.1.10 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,15 @@
1
1
  import { useEventBus } from './chunk-YXZM3WCF.js';
2
+ import { en_default } from './chunk-TSETXL2E.js';
2
3
  import React2, { createContext, useContext, useState, useMemo, useCallback, useEffect } from 'react';
3
4
  import { jsx } from 'react/jsx-runtime';
4
5
 
6
+ var { $meta: _meta, ...coreMessages } = en_default;
7
+ var coreLocale = coreMessages;
5
8
  var I18nContext = createContext({
6
9
  locale: "en",
7
10
  direction: "ltr",
8
- t: (key) => key
9
- // passthrough fallback
11
+ t: (key) => coreLocale[key] ?? key
12
+ // core locale fallback
10
13
  });
11
14
  I18nContext.displayName = "I18nContext";
12
15
  var I18nProvider = I18nContext.Provider;
@@ -15,7 +18,7 @@ function useTranslate() {
15
18
  }
16
19
  function createTranslate(messages) {
17
20
  return (key, params) => {
18
- let msg = messages[key] ?? key;
21
+ let msg = messages[key] ?? coreLocale[key] ?? key;
19
22
  if (params) {
20
23
  for (const [k, v] of Object.entries(params)) {
21
24
  msg = msg.split(`{{${k}}}`).join(String(v));
@@ -0,0 +1,103 @@
1
+ // locales/en.json
2
+ var en_default = {
3
+ $meta: { locale: "en", direction: "ltr" },
4
+ "common.save": "Save",
5
+ "common.cancel": "Cancel",
6
+ "common.delete": "Delete",
7
+ "common.close": "Close",
8
+ "common.confirm": "Are you sure?",
9
+ "common.create": "Create",
10
+ "common.edit": "Edit",
11
+ "common.view": "View",
12
+ "common.add": "Add",
13
+ "common.remove": "Remove",
14
+ "common.search": "Search...",
15
+ "common.filter": "Filter",
16
+ "common.actions": "Actions",
17
+ "common.yes": "Yes",
18
+ "common.no": "No",
19
+ "common.ok": "OK",
20
+ "common.done": "Done",
21
+ "common.apply": "Apply",
22
+ "common.reset": "Reset",
23
+ "common.refresh": "Refresh",
24
+ "common.export": "Export",
25
+ "common.import": "Import",
26
+ "common.copy": "Copy",
27
+ "common.settings": "Settings",
28
+ "nav.previous": "Previous",
29
+ "nav.next": "Next",
30
+ "nav.back": "Back",
31
+ "nav.home": "Home",
32
+ "form.submit": "Submit",
33
+ "form.saving": "Saving...",
34
+ "form.required": "This field is required",
35
+ "form.invalidEmail": "Enter a valid email address",
36
+ "form.selectPlaceholder": "Select {{label}}...",
37
+ "form.searchPlaceholder": "Search {{entity}}...",
38
+ "table.empty.title": "No items found",
39
+ "table.empty.description": "No items to display.",
40
+ "table.search.placeholder": "Search...",
41
+ "table.pagination.showing": "Showing {{start}} to {{end}} of {{total}} results",
42
+ "table.pagination.page": "Page {{page}} of {{totalPages}}",
43
+ "table.bulk.selected": "{{count}} selected",
44
+ "table.loading": "Loading...",
45
+ "status.loading": "Loading...",
46
+ "status.scheduled": "Scheduled",
47
+ "status.inProgress": "In Progress",
48
+ "status.completed": "Completed",
49
+ "status.cancelled": "Cancelled",
50
+ "status.pending": "Pending",
51
+ "status.active": "Active",
52
+ "status.inactive": "Inactive",
53
+ "status.draft": "Draft",
54
+ "status.archived": "Archived",
55
+ "error.generic": "Something went wrong",
56
+ "error.retry": "Try again",
57
+ "error.notFound": "Not found",
58
+ "error.loadFailed": "Failed to load: {{message}}",
59
+ "error.configMissing": "Configuration not found for: {{id}}",
60
+ "common.loading": "Loading...",
61
+ "common.saveChanges": "Save Changes",
62
+ "common.retry": "Retry",
63
+ "common.open": "Open",
64
+ "common.back": "Back",
65
+ "empty.noItems": "No items",
66
+ "empty.noData": "No data available",
67
+ "empty.noItemsYet": "No items yet",
68
+ "empty.noItemsAdded": "No items added yet",
69
+ "empty.noOptionsFound": "No options found",
70
+ "list.addItemPlaceholder": "Add new item...",
71
+ "error.occurred": "An error occurred",
72
+ "error.failedToLoad": "Failed to load data",
73
+ "wizard.back": "Back",
74
+ "wizard.next": "Next",
75
+ "wizard.complete": "Complete",
76
+ "wizard.stepOf": "Step {{current}} of {{total}}",
77
+ "pagination.previous": "Previous",
78
+ "pagination.next": "Next",
79
+ "pagination.total": "Total:",
80
+ "pagination.show": "Show:",
81
+ "pagination.goTo": "Go to:",
82
+ "pagination.go": "Go",
83
+ "auth.signIn": "Sign in",
84
+ "auth.signOut": "Sign out",
85
+ "dialog.confirm": "Confirm",
86
+ "dialog.cancel": "Cancel",
87
+ "dialog.loading": "Loading...",
88
+ "dialog.delete.title": "Delete {{item}}?",
89
+ "dialog.delete.message": "This action cannot be undone.",
90
+ "trait.availableActions": "Available Actions",
91
+ "trait.transitions": "Transitions",
92
+ "trait.availableNow": "Available now",
93
+ "book.startReading": "Start Reading",
94
+ "book.tableOfContents": "Table of Contents",
95
+ "book.partNumber": "Part {{number}}",
96
+ "book.print": "Print",
97
+ "book.previousPage": "Previous page",
98
+ "book.nextPage": "Next page",
99
+ "quiz.showAnswer": "Show answer",
100
+ "quiz.hideAnswer": "Hide answer"
101
+ };
102
+
103
+ export { en_default };
@@ -10,8 +10,8 @@ import { I as IsometricTile, a as IsometricUnit, b as IsometricFeature, C as Cam
10
10
  export { AuthContextValue, AuthUser, ChangeSummary, CompileResult, CompileStage, ENTITY_EVENTS, EntityDataAdapter, EntityDataProvider, EntityDataRecord, EntityMutationResult, Extension, ExtensionManifest, FileSystemFile, FileSystemStatus, GitHubRepo, GitHubStatus, HistoryTimelineItem, I18nContextValue, I18nProvider, OpenFile, OrbitalEventPayload, OrbitalEventResponse, QuerySingletonEntity, QuerySingletonResult, QuerySingletonState, QueryState, ResolvedEntity, RevertResult, SelectedFile, TranslateFunction, UseCompileResult, UseEntityDetailResult, UseEntityListOptions, UseEntityListResult, UseEntityMutationsOptions, UseExtensionsOptions, UseExtensionsResult, UseFileEditorOptions, UseFileEditorResult, UseFileSystemResult, UseOrbitalHistoryOptions, UseOrbitalHistoryResult, createTranslate, entityDataKeys, parseQueryBinding, useAgentChat, useAuthContext, useCompile, useConnectGitHub, useCreateEntity, useDeepAgentGeneration, useDeleteEntity, useDisconnectGitHub, useEmitEvent, useEntities, useEntitiesByType, useEntity, useEntityById, useEntityDataAdapter, useEntityDetail, useEntityList, useEntityListSuspense, useEntityMutations, useEntitySuspense, useEventBus, useEventListener, useExtensions, useFileEditor, useFileSystem, useGitHubBranches, useGitHubRepo, useGitHubRepos, useGitHubStatus, useInput, useOrbitalHistory, useOrbitalMutations, usePhysics, usePlayer, usePreview, useQuerySingleton, useResolvedEntity, useSelectedEntity, useSendOrbitalEvent, useSingletonEntity, useTranslate, useUIEvents, useUpdateEntity, useValidation } from '../hooks/index.js';
11
11
  import { E as EventBusContextType } from '../event-bus-types-CjJduURa.js';
12
12
  export { a as EventListener, K as KFlowEvent, U as Unsubscribe } from '../event-bus-types-CjJduURa.js';
13
- import { S as SlotContent, a as UISlot } from '../useUISlots-D0mttBSP.js';
14
- export { D as DEFAULT_SLOTS, R as RenderUIConfig, b as SlotAnimation, c as SlotChangeCallback, U as UISlotManager, u as useUISlotManager } from '../useUISlots-D0mttBSP.js';
13
+ import { S as SlotContent, a as UISlot } from '../useUISlots-BBjNvQtb.js';
14
+ export { D as DEFAULT_SLOTS, R as RenderUIConfig, b as SlotAnimation, c as SlotChangeCallback, U as UISlotManager, u as useUISlotManager } from '../useUISlots-BBjNvQtb.js';
15
15
  export { Entity, clearEntities, getAllEntities, getByType, getEntity, getSingleton, removeEntity, spawnEntity, updateEntity, updateSingleton } from '../stores/index.js';
16
16
  import 'clsx';
17
17
  import '@tanstack/react-query';
@@ -114,6 +114,8 @@ type BadgeSize = "sm" | "md" | "lg";
114
114
  interface BadgeProps extends React__default.HTMLAttributes<HTMLSpanElement> {
115
115
  variant?: BadgeVariant;
116
116
  size?: BadgeSize;
117
+ /** Numeric count or amount to display in badge */
118
+ amount?: number;
117
119
  }
118
120
  declare const Badge: React__default.ForwardRefExoticComponent<BadgeProps & React__default.RefAttributes<HTMLSpanElement>>;
119
121
 
@@ -1437,6 +1439,14 @@ interface CardProps {
1437
1439
  className?: string;
1438
1440
  /** Declarative event name — emits UI:{action} via eventBus on card click */
1439
1441
  action?: string;
1442
+ /** Whether the card is selected (highlighted state) */
1443
+ isSelected?: boolean;
1444
+ /** Card name (alias for title) */
1445
+ name?: string;
1446
+ /** Level indicator */
1447
+ level?: number;
1448
+ /** Maximum level */
1449
+ maxLevel?: number;
1440
1450
  }
1441
1451
  /**
1442
1452
  * Card component for displaying content in a contained box
@@ -2683,6 +2693,8 @@ interface StatCardProps extends EntityDisplayProps {
2683
2693
  };
2684
2694
  /** Metrics to display (schema format) - accepts readonly for compatibility with generated const arrays */
2685
2695
  metrics?: readonly MetricDefinition[];
2696
+ /** Compact display mode */
2697
+ compact?: boolean;
2686
2698
  }
2687
2699
  declare const StatCard: React__default.FC<StatCardProps>;
2688
2700
 
@@ -2990,7 +3002,7 @@ interface FormProps extends Omit<React__default.FormHTMLAttributes<HTMLFormEleme
2990
3002
  /** Additional CSS classes */
2991
3003
  className?: string;
2992
3004
  /** Entity type name or schema object. When OrbitalEntity, fields are auto-derived if not provided. */
2993
- entity?: string | OrbitalEntity;
3005
+ entity?: string | OrbitalEntity | readonly Record<string, unknown>[];
2994
3006
  /** Form mode - 'create' for new records, 'edit' for updating existing */
2995
3007
  mode?: "create" | "edit";
2996
3008
  /** Fields definition (schema format) - accepts readonly for generated const arrays */
@@ -3587,6 +3599,10 @@ interface CardGridProps extends EntityDisplayProps {
3587
3599
  itemActions?: readonly CardItemAction[];
3588
3600
  /** Show total count in pagination */
3589
3601
  showTotal?: boolean;
3602
+ /** Show avatar/image field on cards */
3603
+ showAvatar?: boolean;
3604
+ /** Visual variant for the card grid */
3605
+ variant?: string;
3590
3606
  }
3591
3607
  /**
3592
3608
  * CardGrid - Responsive card collection layout
@@ -4387,15 +4403,13 @@ interface SpriteSheetUrls {
4387
4403
  * @packageDocumentation
4388
4404
  */
4389
4405
 
4390
- interface IsometricCanvasProps {
4391
- /** Additional CSS classes */
4392
- className?: string;
4393
- /** Loading state indicator */
4394
- isLoading?: boolean;
4395
- /** Error state */
4396
- error?: Error | null;
4397
- /** Entity name for schema-driven auto-fetch */
4398
- entity?: string;
4406
+ /** Event Contract:
4407
+ * Emits: UI:TILE_CLICK
4408
+ * Emits: UI:UNIT_CLICK
4409
+ * Emits: UI:TILE_HOVER
4410
+ * Emits: UI:TILE_LEAVE
4411
+ */
4412
+ interface IsometricCanvasProps extends EntityDisplayProps {
4399
4413
  /** Array of tiles to render */
4400
4414
  tiles?: IsometricTile[];
4401
4415
  /** Array of units on the board */
@@ -4419,13 +4433,9 @@ interface IsometricCanvasProps {
4419
4433
  x: number;
4420
4434
  y: number;
4421
4435
  } | null;
4422
- /** Tile click handler */
4423
4436
  onTileClick?: (x: number, y: number) => void;
4424
- /** Unit click handler */
4425
4437
  onUnitClick?: (unitId: string) => void;
4426
- /** Tile hover handler */
4427
4438
  onTileHover?: (x: number, y: number) => void;
4428
- /** Tile leave handler */
4429
4439
  onTileLeave?: () => void;
4430
4440
  /** Declarative event: emits UI:{tileClickEvent} with { x, y } on tile click */
4431
4441
  tileClickEvent?: string;
@@ -4447,6 +4457,10 @@ interface IsometricCanvasProps {
4447
4457
  enableCamera?: boolean;
4448
4458
  /** Extra scale multiplier for unit draw size. 1 = default. */
4449
4459
  unitScale?: number;
4460
+ /** Board width in tiles (overrides tile-derived size) */
4461
+ boardWidth?: number;
4462
+ /** Board height in tiles (overrides tile-derived size) */
4463
+ boardHeight?: number;
4450
4464
  /** Override for the diamond-top Y offset within the tile sprite (default: 374).
4451
4465
  * This controls where the flat diamond face sits vertically inside the tile image. */
4452
4466
  diamondTopY?: number;
@@ -4460,7 +4474,7 @@ interface IsometricCanvasProps {
4460
4474
  resolveUnitFrame?: (unitId: string) => ResolvedFrame | null;
4461
4475
  /** Additional sprite URLs to preload (e.g., effect sprites) */
4462
4476
  effectSpriteUrls?: string[];
4463
- /** Callback to draw canvas effects after units */
4477
+ /** Callback to draw canvas effects after units (canvas-specific: cannot be declarative) */
4464
4478
  onDrawEffects?: (ctx: CanvasRenderingContext2D, animTime: number, getImage: (url: string) => HTMLImageElement | undefined) => void;
4465
4479
  /** Whether there are active effects — keeps RAF loop alive */
4466
4480
  hasActiveEffects?: boolean;
@@ -5350,6 +5364,11 @@ interface DialogueNode {
5350
5364
  choices?: DialogueChoice[];
5351
5365
  autoAdvance?: number;
5352
5366
  }
5367
+ /** Event Contract:
5368
+ * Emits: UI:COMPLETE
5369
+ * Emits: UI:CHOICE
5370
+ * Emits: UI:ADVANCE
5371
+ */
5353
5372
  interface DialogueBoxProps {
5354
5373
  /** Current dialogue node to display */
5355
5374
  dialogue: DialogueNode;
@@ -5706,9 +5725,14 @@ interface WorldMapEntity {
5706
5725
  };
5707
5726
  backgroundImage?: string;
5708
5727
  }
5709
- interface WorldMapBoardProps extends Omit<EntityDisplayProps, 'entity'> {
5710
- /** World map entity data */
5711
- entity: WorldMapEntity;
5728
+ /** Event Contract:
5729
+ * Emits: UI:HERO_SELECT
5730
+ * Emits: UI:HERO_MOVE
5731
+ * Emits: UI:BATTLE_ENCOUNTER
5732
+ * Emits: UI:FEATURE_ENTER
5733
+ * Emits: UI:TILE_CLICK
5734
+ */
5735
+ interface WorldMapBoardProps extends EntityDisplayProps<WorldMapEntity> {
5712
5736
  /** Canvas render scale */
5713
5737
  scale?: number;
5714
5738
  /** Unit draw-size multiplier */
@@ -5755,7 +5779,7 @@ interface WorldMapBoardProps extends Omit<EntityDisplayProps, 'entity'> {
5755
5779
  resolveUnitFrame?: (unitId: string) => ResolvedFrame | null;
5756
5780
  className?: string;
5757
5781
  }
5758
- declare function WorldMapBoard({ entity, scale, unitScale, allowMoveAllHeroes, isInRange, heroSelectEvent, heroMoveEvent, battleEncounterEvent, featureEnterEvent, tileClickEvent, header, sidePanel, overlay, footer, onHeroSelect, onHeroMove, onBattleEncounter, onFeatureEnter, diamondTopY, enableCamera, effectSpriteUrls, resolveUnitFrame, className, }: WorldMapBoardProps): React__default.JSX.Element;
5782
+ declare function WorldMapBoard({ entity, isLoading, scale, unitScale, allowMoveAllHeroes, isInRange, heroSelectEvent, heroMoveEvent, battleEncounterEvent, featureEnterEvent, tileClickEvent, header, sidePanel, overlay, footer, onHeroSelect, onHeroMove, onBattleEncounter, onFeatureEnter, diamondTopY, enableCamera, effectSpriteUrls, resolveUnitFrame, className, }: WorldMapBoardProps): React__default.JSX.Element;
5759
5783
  declare namespace WorldMapBoard {
5760
5784
  var displayName: string;
5761
5785
  }
@@ -5929,6 +5953,10 @@ interface SlotItemData {
5929
5953
  /** Optional state machine for tooltip display */
5930
5954
  stateMachine?: TraitStateMachineDefinition;
5931
5955
  }
5956
+ /** Event Contract:
5957
+ * Emits: UI:CLICK
5958
+ * Emits: UI:REMOVE
5959
+ */
5932
5960
  interface TraitSlotProps {
5933
5961
  /** Slot index (1-based) */
5934
5962
  slotNumber: number;
@@ -7826,14 +7854,19 @@ declare const CodeViewer: React__default.FC<CodeViewerProps>;
7826
7854
  * All templates MUST extend `TemplateProps<E>` to enforce entity-only data flow
7827
7855
  * and JSON round-trip compatibility with the flattener pipeline.
7828
7856
  *
7857
+ * The compiler passes `entity` as `E[]` (array from data store), so
7858
+ * TemplateProps accepts the same union as EntityDisplayProps.
7859
+ *
7829
7860
  * @see docs/Almadar_Templates.md
7830
7861
  */
7831
7862
  /** Base props for all templates — enforces entity-only data flow. */
7832
7863
  interface TemplateProps<E extends {
7833
7864
  id: string;
7865
+ } = {
7866
+ id: string;
7834
7867
  }> {
7835
- /** Entity data — the sole source of runtime state */
7836
- entity: E;
7868
+ /** Entity data — single object, array from compiler, or string entity name */
7869
+ entity?: string | E | readonly E[];
7837
7870
  /** External styling override */
7838
7871
  className?: string;
7839
7872
  }
@@ -7841,7 +7874,7 @@ interface TemplateProps<E extends {
7841
7874
  interface NavItem {
7842
7875
  label: string;
7843
7876
  href: string;
7844
- icon: LucideIcon;
7877
+ icon?: LucideIcon;
7845
7878
  badge?: string | number;
7846
7879
  children?: NavItem[];
7847
7880
  }
@@ -7866,6 +7899,8 @@ interface DashboardLayoutProps {
7866
7899
  sidebarFooter?: React__default.ReactNode;
7867
7900
  /** Callback when user clicks sign out (optional - uses auth context signOut if not provided) */
7868
7901
  onSignOut?: () => void;
7902
+ /** Page content rendered inside the main area */
7903
+ children?: React__default.ReactNode;
7869
7904
  }
7870
7905
  declare const DashboardLayout: React__default.FC<DashboardLayoutProps>;
7871
7906
 
@@ -7997,11 +8032,10 @@ declare const GenericAppTemplate: React__default.FC<GenericAppTemplateProps>;
7997
8032
  * Replaces DashboardLayout for game clients — no sidebar nav, just full-viewport
7998
8033
  * rendering with an optional HUD overlay bar.
7999
8034
  *
8000
- * Used as a React Router layout route element:
8001
- * <Route element={<GameShell appName="TraitWars" />}>
8002
- * <Route index element={<WorldMapPage />} />
8003
- * ...
8004
- * </Route>
8035
+ * Wrap game page content directly as children:
8036
+ * <GameShell appName="TraitWars">
8037
+ * <WorldMapPage />
8038
+ * </GameShell>
8005
8039
  *
8006
8040
  * @generated pattern — can be customised per-game via props
8007
8041
  */
@@ -8015,11 +8049,13 @@ interface GameShellProps {
8015
8049
  className?: string;
8016
8050
  /** Whether to show the minimal top bar (default: true) */
8017
8051
  showTopBar?: boolean;
8052
+ /** Game content rendered inside the full-screen area */
8053
+ children?: React__default.ReactNode;
8018
8054
  }
8019
8055
  /**
8020
8056
  * Full-viewport game shell layout.
8021
8057
  *
8022
- * Renders child routes via `<Outlet />` inside a full-height flex container.
8058
+ * Renders children inside a full-height flex container.
8023
8059
  * An optional top bar shows the game title and can host HUD widgets.
8024
8060
  */
8025
8061
  declare const GameShell: React__default.FC<GameShellProps>;
@@ -8041,7 +8077,7 @@ interface BattleTemplateProps extends TemplateProps<BattleEntity> {
8041
8077
  /** Unit draw-size multiplier */
8042
8078
  unitScale?: number;
8043
8079
  }
8044
- declare function BattleTemplate({ entity, scale, unitScale, className, }: BattleTemplateProps): React__default.JSX.Element;
8080
+ declare function BattleTemplate({ entity, scale, unitScale, className, }: BattleTemplateProps): React__default.JSX.Element | null;
8045
8081
  declare namespace BattleTemplate {
8046
8082
  var displayName: string;
8047
8083
  }
@@ -8061,7 +8097,7 @@ interface CastleTemplateProps extends TemplateProps<CastleEntity> {
8061
8097
  /** Canvas render scale */
8062
8098
  scale?: number;
8063
8099
  }
8064
- declare function CastleTemplate({ entity, scale, className, }: CastleTemplateProps): React__default.JSX.Element;
8100
+ declare function CastleTemplate({ entity, scale, className, }: CastleTemplateProps): React__default.JSX.Element | null;
8065
8101
  declare namespace CastleTemplate {
8066
8102
  var displayName: string;
8067
8103
  }