@almadar/ui 5.21.12 → 5.22.2

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 (87) hide show
  1. package/dist/avl/index.cjs +919 -631
  2. package/dist/avl/index.js +919 -631
  3. package/dist/components/core/molecules/CalendarGrid.d.ts +3 -10
  4. package/dist/components/core/molecules/ContentRenderer.d.ts +2 -2
  5. package/dist/components/core/molecules/DataGrid.d.ts +11 -20
  6. package/dist/components/core/molecules/DataList.d.ts +9 -15
  7. package/dist/components/core/molecules/FormSection.d.ts +4 -4
  8. package/dist/components/core/molecules/PositionedCanvas.d.ts +4 -17
  9. package/dist/components/core/molecules/ReplyTree.d.ts +2 -13
  10. package/dist/components/core/molecules/RichBlockEditor.d.ts +3 -6
  11. package/dist/components/core/molecules/SortableList.d.ts +7 -5
  12. package/dist/components/core/molecules/TableView.d.ts +7 -7
  13. package/dist/components/core/molecules/index.d.ts +3 -3
  14. package/dist/components/core/molecules/useDataDnd.d.ts +5 -5
  15. package/dist/components/core/organisms/CardGrid.d.ts +5 -2
  16. package/dist/components/core/organisms/CaseStudyOrganism.d.ts +4 -3
  17. package/dist/components/core/organisms/DataTable.d.ts +4 -2
  18. package/dist/components/core/organisms/DetailPanel.d.ts +6 -6
  19. package/dist/components/core/organisms/FeatureGridOrganism.d.ts +4 -3
  20. package/dist/components/core/organisms/HeroOrganism.d.ts +4 -5
  21. package/dist/components/core/organisms/List.d.ts +5 -2
  22. package/dist/components/core/organisms/MasterDetail.d.ts +4 -2
  23. package/dist/components/core/organisms/MediaGallery.d.ts +4 -2
  24. package/dist/components/core/organisms/ShowcaseOrganism.d.ts +4 -3
  25. package/dist/components/core/organisms/StatCard.d.ts +5 -2
  26. package/dist/components/core/organisms/StepFlowOrganism.d.ts +4 -3
  27. package/dist/components/core/organisms/Timeline.d.ts +2 -2
  28. package/dist/components/core/organisms/book/index.d.ts +1 -1
  29. package/dist/components/core/organisms/book/types.d.ts +28 -48
  30. package/dist/components/core/organisms/index.d.ts +1 -2
  31. package/dist/components/core/organisms/layout/DashboardGrid.d.ts +2 -2
  32. package/dist/components/core/organisms/marketing-types.d.ts +5 -94
  33. package/dist/components/core/organisms/types.d.ts +9 -27
  34. package/dist/components/core/templates/index.d.ts +6 -6
  35. package/dist/components/game/organisms/BattleBoard.d.ts +14 -90
  36. package/dist/components/game/organisms/CastleBoard.d.ts +7 -21
  37. package/dist/components/game/organisms/UncontrolledBattleBoard.d.ts +2 -7
  38. package/dist/components/game/organisms/WorldMapBoard.d.ts +13 -59
  39. package/dist/components/game/organisms/boardEntity.d.ts +44 -0
  40. package/dist/components/game/organisms/hooks/useBattleState.d.ts +7 -7
  41. package/dist/components/game/organisms/index.d.ts +3 -3
  42. package/dist/components/game/organisms/puzzles/builder/BuilderBoard.d.ts +7 -20
  43. package/dist/components/game/organisms/puzzles/builder/index.d.ts +1 -1
  44. package/dist/components/game/organisms/puzzles/classifier/ClassifierBoard.d.ts +7 -20
  45. package/dist/components/game/organisms/puzzles/classifier/index.d.ts +1 -1
  46. package/dist/components/game/organisms/puzzles/debugger/DebuggerBoard.d.ts +6 -22
  47. package/dist/components/game/organisms/puzzles/debugger/index.d.ts +1 -1
  48. package/dist/components/game/organisms/puzzles/event-handler/EventHandlerBoard.d.ts +6 -33
  49. package/dist/components/game/organisms/puzzles/event-handler/ObjectRulePanel.d.ts +3 -21
  50. package/dist/components/game/organisms/puzzles/event-handler/index.d.ts +2 -2
  51. package/dist/components/game/organisms/puzzles/event-handler/puzzleObject.d.ts +21 -0
  52. package/dist/components/game/organisms/puzzles/negotiator/NegotiatorBoard.d.ts +8 -24
  53. package/dist/components/game/organisms/puzzles/negotiator/index.d.ts +1 -1
  54. package/dist/components/game/organisms/puzzles/sequencer/ActionTile.d.ts +2 -2
  55. package/dist/components/game/organisms/puzzles/sequencer/SequencerBoard.d.ts +7 -36
  56. package/dist/components/game/organisms/puzzles/sequencer/index.d.ts +1 -1
  57. package/dist/components/game/organisms/puzzles/simulator/SimulatorBoard.d.ts +6 -25
  58. package/dist/components/game/organisms/puzzles/simulator/index.d.ts +1 -1
  59. package/dist/components/game/organisms/puzzles/state-architect/StateArchitectBoard.d.ts +7 -40
  60. package/dist/components/game/organisms/puzzles/state-architect/VariablePanel.d.ts +3 -9
  61. package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
  62. package/dist/components/game/organisms/three/index.cjs +35 -21
  63. package/dist/components/game/organisms/three/index.js +35 -21
  64. package/dist/components/game/templates/BattleTemplate.d.ts +2 -3
  65. package/dist/components/game/templates/CastleTemplate.d.ts +2 -3
  66. package/dist/components/game/templates/GameCanvas3DBattleTemplate.d.ts +1 -16
  67. package/dist/components/game/templates/GameCanvas3DCastleTemplate.d.ts +1 -18
  68. package/dist/components/game/templates/GameCanvas3DWorldMapTemplate.d.ts +1 -14
  69. package/dist/components/game/templates/GameTemplate.d.ts +1 -6
  70. package/dist/components/game/templates/WorldMapTemplate.d.ts +2 -3
  71. package/dist/components/index.cjs +2016 -1668
  72. package/dist/components/index.js +1128 -780
  73. package/dist/components/marketing/organisms/PricingOrganism.d.ts +4 -3
  74. package/dist/components/marketing/organisms/StatsOrganism.d.ts +4 -3
  75. package/dist/components/marketing/organisms/TeamOrganism.d.ts +4 -3
  76. package/dist/components/marketing/organisms/book/BookChapterView.d.ts +5 -2
  77. package/dist/components/marketing/organisms/book/BookTableOfContents.d.ts +3 -2
  78. package/dist/components/marketing/organisms/book/BookViewer.d.ts +4 -4
  79. package/dist/components/marketing/templates/AboutPageTemplate.d.ts +32 -6
  80. package/dist/components/marketing/templates/FeatureDetailPageTemplate.d.ts +14 -4
  81. package/dist/components/marketing/templates/LandingPageTemplate.d.ts +47 -9
  82. package/dist/components/marketing/templates/PricingPageTemplate.d.ts +23 -5
  83. package/dist/providers/index.cjs +912 -624
  84. package/dist/providers/index.js +912 -624
  85. package/dist/runtime/index.cjs +914 -626
  86. package/dist/runtime/index.js +914 -626
  87. package/package.json +2 -2
@@ -12,7 +12,7 @@
12
12
  */
13
13
  import React from "react";
14
14
  import type { EventKey } from "@almadar/core";
15
- import type { EntityCollection, EntityRow } from "@almadar/core";
15
+ import type { EntityRow } from "@almadar/core";
16
16
  import type { LucideIcon } from "lucide-react";
17
17
  import type { UiError } from '../atoms/types';
18
18
  export type TimelineItemStatus = "complete" | "active" | "pending" | "error";
@@ -56,7 +56,7 @@ export interface TimelineProps {
56
56
  * TimelineItem fields (`icon`, callbacks) cannot round-trip through the
57
57
  * event bus, so decorative stories that need them pass `items` directly.
58
58
  */
59
- entity?: EntityCollection<EntityRow>;
59
+ entity?: readonly EntityRow[];
60
60
  /** Timeline title */
61
61
  title?: string;
62
62
  /** Timeline items */
@@ -3,5 +3,5 @@ export { BookChapterView, type BookChapterViewProps } from '../../../marketing/o
3
3
  export { BookCoverPage, type BookCoverPageProps } from '../../../marketing/organisms/book/BookCoverPage';
4
4
  export { BookTableOfContents, type BookTableOfContentsProps } from '../../../marketing/organisms/book/BookTableOfContents';
5
5
  export { BookNavBar, type BookNavBarProps } from '../../../marketing/organisms/book/BookNavBar';
6
- export type { BookData, BookPart, BookChapter, BookFieldMap } from './types';
6
+ export type { BookFieldMap } from './types';
7
7
  export { mapBookData, resolveFieldMap, IDENTITY_BOOK_FIELDS, AR_BOOK_FIELDS } from './types';
@@ -1,55 +1,34 @@
1
1
  /**
2
- * BookViewer shared types
2
+ * BookViewer shared types + field-map normalisation.
3
3
  *
4
- * `BookData` / `BookPart` / `BookChapter` are rendering-layer content-model
5
- * types: they carry a typed `OrbitalSchema` (via `@almadar/core`) for the
6
- * embedded orbital-diagram feature, which is richer than `FieldValue` and
7
- * therefore cannot satisfy `EntityRow`'s primitive-field constraint. The
8
- * BookViewer organism's prop surface IS `EntityRow` — raw schema data bound
9
- * from `@payload.data`; `mapBookData()` normalises those records (English or
10
- * localised) into the typed `BookData` representation at render time.
4
+ * The BookViewer's entity boundary is `EntityRow` (raw schema data bound from
5
+ * `@payload.data`). Books may use non-English field names (e.g. Arabic `.orb`
6
+ * schemas), so `mapBookData()` normalises a raw record into canonical English
7
+ * field names while keeping every value as `EntityRow` no private entity
8
+ * content-model types.
9
+ *
10
+ * The embedded orbital-diagram (`OrbitalSchema`) is richer than `FieldValue`
11
+ * and therefore CANNOT live on an `EntityRow`. It is lifted OFF the entity
12
+ * boundary into a separate `schemaByChapterId` lookup; consumers fetch a
13
+ * chapter's schema by id and pass it as its own non-entity prop.
11
14
  */
12
- import type { OrbitalSchema } from '@almadar/core';
13
- export interface BookData {
14
- title: string;
15
- subtitle?: string;
16
- author?: string;
17
- coverImageUrl?: string;
18
- direction?: 'rtl' | 'ltr';
19
- parts: BookPart[];
20
- }
21
- export interface BookPart {
22
- title: string;
23
- chapters: BookChapter[];
15
+ import type { EntityRow, OrbitalSchema } from '@almadar/core';
16
+ /** A normalised book: cover fields + part rows + a chapter→schema side-table. */
17
+ export interface NormalizedBook {
18
+ /** Cover-level fields (title/subtitle/author/coverImageUrl/direction). */
19
+ cover: EntityRow;
20
+ /** Reading direction resolved from the cover record. */
21
+ direction: 'rtl' | 'ltr';
22
+ /** Parts, each an `EntityRow` carrying `title` + a `chapters: EntityRow[]`. */
23
+ parts: readonly EntityRow[];
24
+ /** Flattened chapter rows in reading order (each carries id/title/content). */
25
+ chapters: readonly EntityRow[];
26
+ /** Orbital diagram schemas keyed by chapter id — kept OFF the entity rows. */
27
+ schemaByChapterId: Record<string, OrbitalSchema>;
24
28
  }
25
- export type BookChapter = {
26
- id: string;
27
- title: string;
28
- content: string;
29
- orbitalSchema?: OrbitalSchema;
30
- };
31
29
  /**
32
30
  * Maps raw entity field names to canonical BookData field names.
33
31
  * Each key is a canonical field, each value is the entity field name.
34
- *
35
- * @example
36
- * ```ts
37
- * // Arabic schema
38
- * const AR_BOOK_FIELDS: BookFieldMap = {
39
- * title: 'العنوان',
40
- * subtitle: 'العنوان_الفرعي',
41
- * author: 'المؤلف',
42
- * coverImageUrl: 'صورة_الغلاف',
43
- * direction: 'الاتجاه',
44
- * parts: 'الأجزاء',
45
- * partTitle: 'العنوان',
46
- * chapters: 'الفصول',
47
- * chapterId: 'المعرف',
48
- * chapterTitle: 'العنوان',
49
- * chapterContent: 'المحتوى',
50
- * chapterOrbitalSchema: 'المخطط_المداري',
51
- * };
52
- * ```
53
32
  */
54
33
  export interface BookFieldMap {
55
34
  title: string;
@@ -76,7 +55,8 @@ export declare const AR_BOOK_FIELDS: BookFieldMap;
76
55
  */
77
56
  export declare function resolveFieldMap(fieldMap: BookFieldMap | string | undefined): BookFieldMap;
78
57
  /**
79
- * Maps a raw entity record to a typed BookData using a field map.
80
- * Pass `IDENTITY_BOOK_FIELDS` for English schemas, `AR_BOOK_FIELDS` for Arabic, etc.
58
+ * Maps a raw entity record to a `NormalizedBook` using a field map. Cover and
59
+ * chapter data come back as `EntityRow`s; the per-chapter `OrbitalSchema` is
60
+ * lifted off into `schemaByChapterId`.
81
61
  */
82
- export declare function mapBookData(raw: Record<string, unknown>, fields?: BookFieldMap): BookData;
62
+ export declare function mapBookData(raw: Record<string, unknown>, fields?: BookFieldMap): NormalizedBook;
@@ -1,4 +1,4 @@
1
- export { type EntityDisplayProps, type UiError, EntityDisplayEvents, type SortPayload, type PaginatePayload, type SearchPayload, type FilterPayload, type SelectPayload, } from "./types";
1
+ export { type DisplayStateProps, type UiError, EntityDisplayEvents, type SortPayload, type PaginatePayload, type SearchPayload, type FilterPayload, type SelectPayload, } from "./types";
2
2
  export { DataTable, type DataTableProps, type Column, type RowAction, } from "./DataTable";
3
3
  export { StatCard, type StatCardProps } from "./StatCard";
4
4
  export { DetailPanel, type DetailPanelProps, type DetailField, type DetailSection, } from "./DetailPanel";
@@ -18,7 +18,6 @@ export { NotifyListener } from "./NotifyListener";
18
18
  export { Timeline, type TimelineProps, type TimelineItem, type TimelineItemStatus, } from "./Timeline";
19
19
  export { MediaGallery, type MediaGalleryProps, type MediaItem, } from "./MediaGallery";
20
20
  export { RuntimeDebugger, type RuntimeDebuggerProps, } from "./debug";
21
- export type { MarketingAction, MarketingImage, HeroEntity, FeatureEntity, PricingPlanEntity, StatEntity, StepEntity, ShowcaseEntity, TeamMemberEntity, CaseStudyEntity, } from "./marketing-types";
22
21
  export { HeroOrganism, type HeroOrganismProps, } from "./HeroOrganism";
23
22
  export { FeatureGridOrganism, type FeatureGridOrganismProps, } from "./FeatureGridOrganism";
24
23
  export { PricingOrganism, type PricingOrganismProps, } from "../../marketing/organisms/PricingOrganism";
@@ -7,7 +7,7 @@
7
7
  * Uses wireframe theme styling (high contrast, sharp edges).
8
8
  */
9
9
  import React from "react";
10
- import type { EntityDisplayProps } from "../types";
10
+ import type { DisplayStateProps } from "../types";
11
11
  export interface DashboardGridCell {
12
12
  /** Optional unique cell ID */
13
13
  id?: string;
@@ -20,7 +20,7 @@ export interface DashboardGridCell {
20
20
  /** Allow additional schema-driven properties */
21
21
  [key: string]: unknown;
22
22
  }
23
- export interface DashboardGridProps extends EntityDisplayProps {
23
+ export interface DashboardGridProps extends DisplayStateProps {
24
24
  /** Number of columns */
25
25
  columns?: 2 | 3 | 4;
26
26
  /** Gap between cells */
@@ -1,97 +1,8 @@
1
1
  /**
2
- * Marketing Entity Types
2
+ * (stub) Marketing entity types removed in the entity-row clean slate.
3
3
  *
4
- * Shared entity interfaces for marketing/landing-page organisms (HeroOrganism,
5
- * FeatureGridOrganism, PricingOrganism, StatsOrganism, StepFlowOrganism,
6
- * ShowcaseOrganism, TeamOrganism, CaseStudyOrganism).
7
- *
8
- * Every marketing entity extends `@almadar/core`'s `EntityRow` so the
9
- * canonical runtime entity shape lives in core. Marketing data is pure
10
- * JSON-serialisable content (strings, numbers, nested records) with no
11
- * React nodes or callbacks, so the `EntityRow` index signature is satisfied
12
- * structurally. Nested `MarketingAction` / `MarketingImage` carry explicit
13
- * `[key: string]: FieldValue | undefined` signatures so they fit the
14
- * `{ [key: string]: FieldValue }` branch of `FieldValue`.
4
+ * Marketing organisms now consume `@almadar/core`'s `EntityRow` directly and
5
+ * coerce concrete fields at the read site; templates declare their nested
6
+ * content shapes inline. No bespoke per-organism entity interfaces live here.
15
7
  */
16
- import type { EntityRow, FieldValue } from '@almadar/core';
17
- export interface MarketingAction {
18
- [key: string]: FieldValue | undefined;
19
- label: string;
20
- href: string;
21
- variant?: 'primary' | 'secondary' | 'ghost';
22
- }
23
- export interface MarketingImage {
24
- [key: string]: FieldValue | undefined;
25
- src: string;
26
- alt: string;
27
- }
28
- export interface HeroEntity extends EntityRow {
29
- id: string;
30
- tag?: string;
31
- title: string;
32
- titleAccent?: string;
33
- subtitle: string;
34
- primaryAction?: MarketingAction;
35
- secondaryAction?: MarketingAction;
36
- installCommand?: string;
37
- image?: MarketingImage;
38
- imagePosition?: 'below' | 'right' | 'background';
39
- background?: 'dark' | 'gradient' | 'subtle';
40
- }
41
- export interface FeatureEntity extends EntityRow {
42
- id: string;
43
- icon?: string;
44
- title: string;
45
- description: string;
46
- href?: string;
47
- linkLabel?: string;
48
- }
49
- export interface PricingPlanEntity extends EntityRow {
50
- id: string;
51
- name: string;
52
- price: string;
53
- description?: string;
54
- features: string[];
55
- actionLabel: string;
56
- actionHref: string;
57
- highlighted?: boolean;
58
- badge?: string;
59
- }
60
- export interface StatEntity extends EntityRow {
61
- id: string;
62
- value: string;
63
- label: string;
64
- }
65
- export interface StepEntity extends EntityRow {
66
- id: string;
67
- number?: number;
68
- title: string;
69
- description: string;
70
- icon?: string;
71
- }
72
- export interface ShowcaseEntity extends EntityRow {
73
- id: string;
74
- title: string;
75
- description?: string;
76
- image: MarketingImage;
77
- href?: string;
78
- badge?: string;
79
- accentColor?: string;
80
- }
81
- export interface TeamMemberEntity extends EntityRow {
82
- id: string;
83
- name: string;
84
- nameAr?: string;
85
- role: string;
86
- bio: string;
87
- avatar?: string;
88
- }
89
- export interface CaseStudyEntity extends EntityRow {
90
- id: string;
91
- title: string;
92
- description: string;
93
- category: string;
94
- categoryColor?: string;
95
- href: string;
96
- linkLabel?: string;
97
- }
8
+ export {};
@@ -7,7 +7,6 @@
7
7
  * Exception: Form manages local `formData` state for field input tracking.
8
8
  * This is the ONE allowed exception — documented here.
9
9
  */
10
- import type { EntityRow, EntityInlet } from '@almadar/core';
11
10
  import type { UiError } from '../atoms/types';
12
11
  export type { UiError };
13
12
  export declare const EntityDisplayEvents: {
@@ -38,32 +37,15 @@ export interface FilterPayload {
38
37
  export interface SelectPayload {
39
38
  ids: (string | number)[];
40
39
  }
41
- export interface EntityDisplayProps<T extends EntityRow = EntityRow> {
42
- /**
43
- * Pre-resolved entity data, typed against `@almadar/core`'s `EntityRow`
44
- * (`{ id?: string } & Record<string, FieldValue>`) so the single source of
45
- * truth for runtime entity shape lives in core. Consumers narrow via the
46
- * generic parameter; the constraint guarantees every organism receives
47
- * something with an optional `id` and a Record of `FieldValue` fields.
48
- *
49
- * Two shapes accepted:
50
- * - `readonly T[]`: array for list patterns (authoring: `entity: @payload.data`
51
- * on the calling trait after a `fetch … { emit: { success } }` listener).
52
- * - `T`: single record for detail patterns.
53
- *
54
- * The legacy `string` (entity-name) branch was removed in V2 Phase 6. The
55
- * EntityStore resolver is gone; components now receive pre-resolved data via
56
- * the event bus.
57
- *
58
- * NOTE: Several legacy organisms (HeroOrganism, TeamOrganism, CaseStudyOrganism,
59
- * MediaGallery, PricingOrganism, ShowcaseOrganism, StatsOrganism, Sidebar,
60
- * Timeline, StepFlowOrganism, FeatureGridOrganism, book/*, WorldMapBoard,
61
- * StateMachineView, JazariStateMachine, MasterDetail, DataTable, Table) define
62
- * local entity types (HeroEntity, TeamMemberEntity, …) that don't formally
63
- * extend `EntityRow`. They surface `EntityDisplayProps<T>` constraint errors.
64
- * Tracked as a Phase 7 follow-up in `docs/Almadar_Entity_V2_Plan.md` §10.
65
- */
66
- entity?: EntityInlet<T>;
40
+ /**
41
+ * Common non-entity display state shared by every display organism — loading,
42
+ * error, and the render-ui display hints (sort/search/pagination/selection).
43
+ * Carries NO entity data and NO generic. Components that show entity data add
44
+ * their own `entity?: EntityRow | readonly EntityRow[]` field directly (the one
45
+ * unified entity type from `@almadar/core`); components that only need the
46
+ * loading/hint surface just extend this.
47
+ */
48
+ export interface DisplayStateProps {
67
49
  /** Additional CSS classes */
68
50
  className?: string;
69
51
  /** Loading state indicator */
@@ -5,10 +5,10 @@ export { CounterTemplate, type CounterTemplateProps, type CounterSize, type Coun
5
5
  export { GameTemplate, type GameTemplateProps } from '../../game/templates/GameTemplate';
6
6
  export { GenericAppTemplate, type GenericAppTemplateProps } from './GenericAppTemplate';
7
7
  export { GameShell, type GameShellProps } from '../../game/templates/GameShell';
8
- export { BattleTemplate, type BattleTemplateProps, type BattleEntity, type BattlePhase, type BattleUnit, type BattleTile, type BattleSlotContext, } from '../../game/templates/BattleTemplate';
9
- export { CastleTemplate, type CastleTemplateProps, type CastleEntity, type CastleSlotContext, } from '../../game/templates/CastleTemplate';
10
- export { WorldMapTemplate, type WorldMapTemplateProps, type WorldMapEntity, type MapHero, type MapHex, type WorldMapSlotContext, } from '../../game/templates/WorldMapTemplate';
11
- export { LandingPageTemplate, type LandingPageTemplateProps, type LandingPageEntity, type HeroEntity, type FeatureEntity, type StatEntity, type StepEntity, type ShowcaseEntity, } from '../../marketing/templates/LandingPageTemplate';
12
- export { PricingPageTemplate, type PricingPageTemplateProps, type PricingPageEntity, type PricingPlanEntity, } from '../../marketing/templates/PricingPageTemplate';
8
+ export { BattleTemplate, type BattleTemplateProps, type BattlePhase, type BattleSlotContext, } from '../../game/templates/BattleTemplate';
9
+ export { CastleTemplate, type CastleTemplateProps, type CastleSlotContext, } from '../../game/templates/CastleTemplate';
10
+ export { WorldMapTemplate, type WorldMapTemplateProps, type WorldMapSlotContext, } from '../../game/templates/WorldMapTemplate';
11
+ export { LandingPageTemplate, type LandingPageTemplateProps, type LandingPageEntity, } from '../../marketing/templates/LandingPageTemplate';
12
+ export { PricingPageTemplate, type PricingPageTemplateProps, type PricingPageEntity, } from '../../marketing/templates/PricingPageTemplate';
13
13
  export { FeatureDetailPageTemplate, type FeatureDetailPageTemplateProps, type FeatureDetailPageEntity, type FeatureDetailSection, } from '../../marketing/templates/FeatureDetailPageTemplate';
14
- export { AboutPageTemplate, type AboutPageTemplateProps, type AboutPageEntity, type TeamMemberEntity, type CaseStudyEntity, } from '../../marketing/templates/AboutPageTemplate';
14
+ export { AboutPageTemplate, type AboutPageTemplateProps, type AboutPageEntity, } from '../../marketing/templates/AboutPageTemplate';
@@ -18,95 +18,19 @@
18
18
  * @packageDocumentation
19
19
  */
20
20
  import React from 'react';
21
- import type { EventEmit } from '@almadar/core';
22
- import type { EntityDisplayProps } from '../../core/organisms/types';
23
- import type { IsometricTile, IsometricFeature } from './types/isometric';
21
+ import type { EventEmit, EntityRow } from '@almadar/core';
22
+ import type { DisplayStateProps } from '../../core/organisms/types';
24
23
  import type { ResolvedFrame } from './types/spriteAnimation';
25
- /** Battle phases an encounter walks through */
24
+ /** Battle phases an encounter walks through (UI value enum — not entity data). */
26
25
  export type BattlePhase = 'observation' | 'selection' | 'movement' | 'action' | 'enemy_turn' | 'game_over';
27
- /** A unit participating in battle */
28
- export type BattleUnit = {
29
- id: string;
30
- name: string;
31
- unitType?: string;
32
- heroId?: string;
33
- sprite?: string;
34
- /** Optional sprite sheet for animation (null = use static sprite) */
35
- spriteSheet?: {
36
- se: string;
37
- sw: string;
38
- frameWidth: number;
39
- frameHeight: number;
40
- } | null;
41
- team: 'player' | 'enemy';
42
- position: {
43
- x: number;
44
- y: number;
45
- };
46
- health: number;
47
- maxHealth: number;
48
- movement: number;
49
- attack: number;
50
- defense: number;
51
- traits?: {
52
- name: string;
53
- currentState: string;
54
- states: string[];
55
- cooldown?: number;
56
- }[];
57
- };
58
- /** Minimal tile for map generation */
59
- export interface BattleTile {
60
- x: number;
61
- y: number;
62
- terrain: string;
63
- terrainSprite?: string;
64
- }
65
- /** Entity prop containing all board data.
66
- *
67
- * BattleBoard is **controlled-only**: all game-state fields (`units`, `phase`,
68
- * `turn`, `gameResult`, `selectedUnitId`) must be provided. Mutations are
69
- * communicated via event bus emissions — the component never calls `setState`
70
- * for game-logic values.
71
- *
72
- * For a self-managing variant, use `UncontrolledBattleBoard`.
73
- *
74
- * Animation-only state (`movingPositions`, `isShaking`, `hoveredTile`) is
75
- * always managed locally.
76
- */
77
- export interface BattleEntity {
78
- id: string;
79
- tiles: IsometricTile[];
80
- features?: IsometricFeature[];
81
- boardWidth?: number;
82
- boardHeight?: number;
83
- assetManifest?: {
84
- baseUrl: string;
85
- terrains?: Record<string, string>;
86
- units?: Record<string, string>;
87
- features?: Record<string, string>;
88
- effects?: Record<string, string>;
89
- };
90
- backgroundImage?: string;
91
- /** Current unit state. */
92
- units: BattleUnit[];
93
- /** Current battle phase. */
94
- phase: BattlePhase;
95
- /** Current turn number. */
96
- turn: number;
97
- /** Game result. `null` = still in progress. */
98
- gameResult: 'victory' | 'defeat' | null;
99
- /** Currently selected unit ID. */
100
- selectedUnitId: string | null;
101
- }
102
- /** Context exposed to render-prop slots */
26
+ /** Context exposed to render-prop slots. Carries coerced entity rows + UI helpers. */
103
27
  export type BattleSlotContext = {
104
28
  phase: BattlePhase;
105
29
  turn: number;
106
- selectedUnit: BattleUnit | null;
107
- hoveredUnit: BattleUnit | null;
108
- playerUnits: BattleUnit[];
109
- enemyUnits: BattleUnit[];
30
+ selectedUnit: EntityRow | null;
31
+ hoveredUnit: EntityRow | null;
32
+ playerUnits: readonly EntityRow[];
33
+ enemyUnits: readonly EntityRow[];
110
34
  gameResult: 'victory' | 'defeat' | null;
111
35
  onEndTurn: () => void;
112
36
  onCancel: () => void;
@@ -121,9 +45,9 @@ export type BattleSlotContext = {
121
45
  y: number;
122
46
  };
123
47
  };
124
- export interface BattleBoardProps extends Omit<EntityDisplayProps, 'entity'> {
125
- /** Entity containing all board data */
126
- entity: BattleEntity;
48
+ export interface BattleBoardProps extends DisplayStateProps {
49
+ /** Entity (single board state) containing all board data */
50
+ entity?: EntityRow | readonly EntityRow[];
127
51
  /** Canvas render scale */
128
52
  scale?: number;
129
53
  /** Unit draw-size multiplier */
@@ -139,16 +63,16 @@ export interface BattleBoardProps extends Omit<EntityDisplayProps, 'entity'> {
139
63
  /** Game-over screen overlay */
140
64
  gameOverOverlay?: (ctx: BattleSlotContext) => React.ReactNode;
141
65
  /** Called when a unit attacks another */
142
- onAttack?: (attacker: BattleUnit, target: BattleUnit, damage: number) => void;
66
+ onAttack?: (attacker: EntityRow, target: EntityRow, damage: number) => void;
143
67
  /** Called when battle ends */
144
68
  onGameEnd?: (result: 'victory' | 'defeat') => void;
145
69
  /** Called after a unit moves */
146
- onUnitMove?: (unit: BattleUnit, to: {
70
+ onUnitMove?: (unit: EntityRow, to: {
147
71
  x: number;
148
72
  y: number;
149
73
  }) => void;
150
74
  /** Custom combat damage calculator */
151
- calculateDamage?: (attacker: BattleUnit, target: BattleUnit) => number;
75
+ calculateDamage?: (attacker: EntityRow, target: EntityRow) => number;
152
76
  onDrawEffects?: (ctx: CanvasRenderingContext2D, timestamp: number) => void;
153
77
  hasActiveEffects?: boolean;
154
78
  effectSpriteUrls?: string[];
@@ -6,29 +6,15 @@
6
6
  * Designed to be consumed by CastleTemplate (thin wrapper) or embedded directly
7
7
  * in any page that needs an isometric castle view.
8
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.
9
+ * Accepts an `entity` prop (`EntityRow`) and optional declarative event props
10
+ * (`featureClickEvent`, `unitClickEvent`, `tileClickEvent`) that emit through
11
+ * the Orbital event bus.
12
12
  *
13
13
  * @packageDocumentation
14
14
  */
15
15
  import React from 'react';
16
16
  import type { EventEmit, EntityRow } from '@almadar/core';
17
- import type { IsometricTile, IsometricUnit, IsometricFeature } from './types/isometric';
18
- /** Entity shape consumed by CastleBoard */
19
- export interface CastleEntity {
20
- id: string;
21
- tiles: IsometricTile[];
22
- features?: IsometricFeature[];
23
- units?: IsometricUnit[];
24
- assetManifest?: {
25
- baseUrl: string;
26
- terrains?: Record<string, string>;
27
- units?: Record<string, string>;
28
- features?: Record<string, string>;
29
- };
30
- backgroundImage?: string;
31
- }
17
+ import type { IsometricUnit, IsometricFeature } from './types/isometric';
32
18
  /** Context exposed to render-prop slots */
33
19
  export type CastleSlotContext = {
34
20
  /** Currently hovered tile coordinates (null when not hovering) */
@@ -53,9 +39,9 @@ export type CastleSlotContext = {
53
39
  scale: number;
54
40
  };
55
41
  export interface CastleBoardProps {
56
- /** Castle entity data. Also accepts the canonical `EntityRow` the compiler
57
- * binds (and arrays); narrowed to `CastleEntity` internally. */
58
- entity?: CastleEntity | EntityRow | readonly (CastleEntity | EntityRow)[];
42
+ /** Castle board-state entity (single row or array). The board reads
43
+ * `tiles` / `features` / `units` arrays plus an `assetManifest` off it. */
44
+ entity?: EntityRow | readonly EntityRow[];
59
45
  /** Canvas render scale */
60
46
  scale?: number;
61
47
  /** Top bar / header */
@@ -15,14 +15,9 @@
15
15
  */
16
16
  import * as React from 'react';
17
17
  import type { EntityRow } from '@almadar/core';
18
- import { type BattleBoardProps, type BattleUnit } from './BattleBoard';
19
- /** Uncontrolled entity read-shape: controlled game-state fields are dropped in
20
- * favor of `initialUnits`, which the internal `useBattleState` hook manages. */
21
- export type UncontrolledBattleEntity = Omit<BattleBoardProps['entity'], 'units' | 'phase' | 'turn' | 'gameResult' | 'selectedUnitId'> & {
22
- initialUnits: BattleUnit[];
23
- };
18
+ import { type BattleBoardProps } from './BattleBoard';
24
19
  export interface UncontrolledBattleBoardProps extends Omit<BattleBoardProps, 'entity'> {
25
- entity?: UncontrolledBattleEntity | EntityRow | readonly (UncontrolledBattleEntity | EntityRow)[];
20
+ entity?: EntityRow | readonly EntityRow[];
26
21
  }
27
22
  export declare function UncontrolledBattleBoard({ entity, ...rest }: UncontrolledBattleBoardProps): React.JSX.Element | null;
28
23
  export declare namespace UncontrolledBattleBoard {
@@ -19,53 +19,22 @@
19
19
  * @packageDocumentation
20
20
  */
21
21
  import React from 'react';
22
- import type { EventEmit, EntityRow, FieldValue } from '@almadar/core';
23
- import type { IsometricFeature } from './types/isometric';
22
+ import type { EventEmit, EntityRow } from '@almadar/core';
24
23
  import type { ResolvedFrame } from './types/spriteAnimation';
25
24
  import type { UiError } from '../../core/atoms/types';
26
- /** A hero on the world map */
27
- export interface MapHero {
28
- id: string;
29
- name: string;
30
- owner: 'player' | 'enemy' | string;
31
- position: {
32
- x: number;
33
- y: number;
34
- };
35
- movement: number;
36
- sprite?: string;
37
- /** Optional sprite sheet for animation (null = use static sprite) */
38
- spriteSheet?: {
39
- se: string;
40
- sw: string;
41
- frameWidth: number;
42
- frameHeight: number;
43
- } | null;
44
- level?: number;
45
- }
46
- /** A hex on the map */
47
- export type MapHex = {
48
- x: number;
49
- y: number;
50
- terrain: string;
51
- terrainSprite?: string;
52
- feature?: string;
53
- featureData?: Record<string, FieldValue | undefined>;
54
- passable?: boolean;
55
- };
56
- /** Context exposed to render-prop slots */
25
+ /** Context exposed to render-prop slots. Hex / hero rows are `EntityRow`. */
57
26
  export type WorldMapSlotContext = {
58
27
  /** Currently hovered tile */
59
28
  hoveredTile: {
60
29
  x: number;
61
30
  y: number;
62
31
  } | null;
63
- /** Hex at the hovered tile */
64
- hoveredHex: MapHex | null;
65
- /** Hero at the hovered tile */
66
- hoveredHero: MapHero | null;
67
- /** Currently selected hero */
68
- selectedHero: MapHero | null;
32
+ /** Hex row at the hovered tile */
33
+ hoveredHex: EntityRow | null;
34
+ /** Hero row at the hovered tile */
35
+ hoveredHero: EntityRow | null;
36
+ /** Currently selected hero row */
37
+ selectedHero: EntityRow | null;
69
38
  /** Valid move tiles for selected hero */
70
39
  validMoves: Array<{
71
40
  x: number;
@@ -81,21 +50,6 @@ export type WorldMapSlotContext = {
81
50
  /** Canvas scale */
82
51
  scale: number;
83
52
  };
84
- /** Entity shape for the WorldMapBoard */
85
- export interface WorldMapEntity {
86
- id: string;
87
- hexes: MapHex[];
88
- heroes: MapHero[];
89
- features?: IsometricFeature[];
90
- selectedHeroId?: string | null;
91
- assetManifest?: {
92
- baseUrl: string;
93
- terrains?: Record<string, string>;
94
- units?: Record<string, string>;
95
- features?: Record<string, string>;
96
- };
97
- backgroundImage?: string;
98
- }
99
53
  /** Event Contract:
100
54
  * Emits: UI:HERO_SELECT
101
55
  * Emits: UI:HERO_MOVE
@@ -110,9 +64,9 @@ export interface WorldMapBoardProps {
110
64
  isLoading?: boolean;
111
65
  /** Error state */
112
66
  error?: UiError | null;
113
- /** World map entity data. Also accepts the canonical `EntityRow` the
114
- * compiler binds; the component narrows to `WorldMapEntity` below. */
115
- entity?: WorldMapEntity | EntityRow | readonly (WorldMapEntity | EntityRow)[];
67
+ /** World-map board-state entity (single row or array). The board reads
68
+ * `hexes` / `heroes` / `features` arrays + `selectedHeroId` off it. */
69
+ entity?: EntityRow | readonly EntityRow[];
116
70
  /** Canvas render scale */
117
71
  scale?: number;
118
72
  /** Unit draw-size multiplier */
@@ -146,7 +100,7 @@ export interface WorldMapBoardProps {
146
100
  featureEnterEvent?: EventEmit<{
147
101
  heroId: string;
148
102
  feature: string;
149
- hex: MapHex;
103
+ hex: EntityRow;
150
104
  }>;
151
105
  /** Emits UI:{tileClickEvent} with { x, y } */
152
106
  tileClickEvent?: EventEmit<{
@@ -166,7 +120,7 @@ export interface WorldMapBoardProps {
166
120
  /** Called when hero clicks an enemy hero tile */
167
121
  onBattleEncounter?: (attackerId: string, defenderId: string) => void;
168
122
  /** Called when hero enters a feature hex (castle, resource, etc.) */
169
- onFeatureEnter?: (heroId: string, hex: MapHex) => void;
123
+ onFeatureEnter?: (heroId: string, hex: EntityRow) => void;
170
124
  /** Override for the diamond-top Y offset within tile sprites (default: 374). */
171
125
  diamondTopY?: number;
172
126
  /** Disable pan/zoom camera (default: true). Set false for fixed maps where overlay labels need stable positions. */