@almadar/ui 2.61.0 → 3.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 (37) hide show
  1. package/dist/avl/index.cjs +1328 -1505
  2. package/dist/avl/index.css +7 -2
  3. package/dist/avl/index.js +251 -428
  4. package/dist/components/index.cjs +35 -37
  5. package/dist/components/index.css +7 -2
  6. package/dist/components/index.js +36 -38
  7. package/dist/components/organisms/DataTable.d.ts +3 -2
  8. package/dist/components/organisms/JazariStateMachine.d.ts +10 -37
  9. package/dist/components/organisms/MasterDetail.d.ts +4 -3
  10. package/dist/components/organisms/MediaGallery.d.ts +3 -2
  11. package/dist/components/organisms/Sidebar.d.ts +7 -2
  12. package/dist/components/organisms/StateMachineView.d.ts +7 -2
  13. package/dist/components/organisms/Table.d.ts +2 -1
  14. package/dist/components/organisms/Timeline.d.ts +15 -2
  15. package/dist/components/organisms/book/BookChapterView.d.ts +3 -2
  16. package/dist/components/organisms/book/BookCoverPage.d.ts +3 -3
  17. package/dist/components/organisms/book/BookNavBar.d.ts +3 -3
  18. package/dist/components/organisms/book/BookTableOfContents.d.ts +3 -2
  19. package/dist/components/organisms/book/BookViewer.d.ts +2 -2
  20. package/dist/components/organisms/book/types.d.ts +9 -4
  21. package/dist/components/organisms/game/WorldMapBoard.d.ts +9 -3
  22. package/dist/components/organisms/marketing-types.d.ts +22 -12
  23. package/dist/components/organisms/types.d.ts +23 -17
  24. package/dist/components/templates/types.d.ts +7 -2
  25. package/dist/hooks/index.cjs +5 -2
  26. package/dist/hooks/index.js +5 -2
  27. package/dist/lib/index.cjs +5 -2
  28. package/dist/lib/index.js +5 -2
  29. package/dist/providers/index.cjs +987 -1166
  30. package/dist/providers/index.css +7 -2
  31. package/dist/providers/index.d.ts +0 -2
  32. package/dist/providers/index.js +230 -403
  33. package/dist/runtime/index.cjs +36 -69
  34. package/dist/runtime/index.css +7 -2
  35. package/dist/runtime/index.js +37 -70
  36. package/package.json +3 -3
  37. package/dist/providers/EntityStoreProvider.d.ts +0 -63
@@ -1,10 +1,15 @@
1
1
  /**
2
2
  * BookViewer shared types
3
3
  *
4
- * Field names are canonical English. When entity data arrives from a
5
- * schema with non-English field names (e.g. Arabic .orb), a field map
6
- * translates them before passing to BookViewer. See `mapBookData()`.
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.
7
11
  */
12
+ import type { OrbitalSchema } from '@almadar/core';
8
13
  export interface BookData {
9
14
  title: string;
10
15
  subtitle?: string;
@@ -21,7 +26,7 @@ export interface BookChapter {
21
26
  id: string;
22
27
  title: string;
23
28
  content: string;
24
- orbitalSchema?: unknown;
29
+ orbitalSchema?: OrbitalSchema;
25
30
  }
26
31
  /**
27
32
  * Maps raw entity field names to canonical BookData field names.
@@ -19,7 +19,6 @@
19
19
  * @packageDocumentation
20
20
  */
21
21
  import React from 'react';
22
- import type { EntityDisplayProps } from '../types';
23
22
  import type { IsometricFeature } from './types/isometric';
24
23
  import type { ResolvedFrame } from './types/spriteAnimation';
25
24
  /** A hero on the world map */
@@ -102,7 +101,15 @@ export interface WorldMapEntity {
102
101
  * Emits: UI:FEATURE_ENTER
103
102
  * Emits: UI:TILE_CLICK
104
103
  */
105
- export interface WorldMapBoardProps extends EntityDisplayProps<WorldMapEntity> {
104
+ export interface WorldMapBoardProps {
105
+ /** Additional CSS classes */
106
+ className?: string;
107
+ /** Loading state indicator */
108
+ isLoading?: boolean;
109
+ /** Error state */
110
+ error?: Error | null;
111
+ /** World map entity data */
112
+ entity?: WorldMapEntity | readonly WorldMapEntity[];
106
113
  /** Canvas render scale */
107
114
  scale?: number;
108
115
  /** Unit draw-size multiplier */
@@ -147,7 +154,6 @@ export interface WorldMapBoardProps extends EntityDisplayProps<WorldMapEntity> {
147
154
  enableCamera?: boolean;
148
155
  effectSpriteUrls?: string[];
149
156
  resolveUnitFrame?: (unitId: string) => ResolvedFrame | null;
150
- className?: string;
151
157
  }
152
158
  export 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.JSX.Element;
153
159
  export declare namespace WorldMapBoard {
@@ -1,21 +1,31 @@
1
1
  /**
2
2
  * Marketing Entity Types
3
3
  *
4
- * Shared entity interfaces for marketing/landing-page organisms.
5
- * These types define the data shapes consumed by HeroOrganism,
6
- * FeatureGridOrganism, PricingOrganism, StatsOrganism,
7
- * StepFlowOrganism, ShowcaseOrganism, TeamOrganism, and CaseStudyOrganism.
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`.
8
15
  */
16
+ import type { EntityRow, FieldValue } from '@almadar/core';
9
17
  export interface MarketingAction {
18
+ [key: string]: FieldValue | undefined;
10
19
  label: string;
11
20
  href: string;
12
21
  variant?: 'primary' | 'secondary' | 'ghost';
13
22
  }
14
23
  export interface MarketingImage {
24
+ [key: string]: FieldValue | undefined;
15
25
  src: string;
16
26
  alt: string;
17
27
  }
18
- export interface HeroEntity {
28
+ export interface HeroEntity extends EntityRow {
19
29
  id: string;
20
30
  tag?: string;
21
31
  title: string;
@@ -28,7 +38,7 @@ export interface HeroEntity {
28
38
  imagePosition?: 'below' | 'right' | 'background';
29
39
  background?: 'dark' | 'gradient' | 'subtle';
30
40
  }
31
- export interface FeatureEntity {
41
+ export interface FeatureEntity extends EntityRow {
32
42
  id: string;
33
43
  icon?: string;
34
44
  title: string;
@@ -36,7 +46,7 @@ export interface FeatureEntity {
36
46
  href?: string;
37
47
  linkLabel?: string;
38
48
  }
39
- export interface PricingPlanEntity {
49
+ export interface PricingPlanEntity extends EntityRow {
40
50
  id: string;
41
51
  name: string;
42
52
  price: string;
@@ -47,19 +57,19 @@ export interface PricingPlanEntity {
47
57
  highlighted?: boolean;
48
58
  badge?: string;
49
59
  }
50
- export interface StatEntity {
60
+ export interface StatEntity extends EntityRow {
51
61
  id: string;
52
62
  value: string;
53
63
  label: string;
54
64
  }
55
- export interface StepEntity {
65
+ export interface StepEntity extends EntityRow {
56
66
  id: string;
57
67
  number?: number;
58
68
  title: string;
59
69
  description: string;
60
70
  icon?: string;
61
71
  }
62
- export interface ShowcaseEntity {
72
+ export interface ShowcaseEntity extends EntityRow {
63
73
  id: string;
64
74
  title: string;
65
75
  description?: string;
@@ -68,7 +78,7 @@ export interface ShowcaseEntity {
68
78
  badge?: string;
69
79
  accentColor?: string;
70
80
  }
71
- export interface TeamMemberEntity {
81
+ export interface TeamMemberEntity extends EntityRow {
72
82
  id: string;
73
83
  name: string;
74
84
  nameAr?: string;
@@ -76,7 +86,7 @@ export interface TeamMemberEntity {
76
86
  bio: string;
77
87
  avatar?: string;
78
88
  }
79
- export interface CaseStudyEntity {
89
+ export interface CaseStudyEntity extends EntityRow {
80
90
  id: string;
81
91
  title: string;
82
92
  description: string;
@@ -7,6 +7,7 @@
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 } from '@almadar/core';
10
11
  export declare const EntityDisplayEvents: {
11
12
  readonly SORT: "SORT";
12
13
  readonly PAGINATE: "PAGINATE";
@@ -35,27 +36,32 @@ export interface FilterPayload {
35
36
  export interface SelectPayload {
36
37
  ids: (string | number)[];
37
38
  }
38
- export interface EntityDisplayProps<T = unknown> {
39
+ export interface EntityDisplayProps<T extends EntityRow = EntityRow> {
39
40
  /**
40
- * Entity data or a legacy entity-name string.
41
+ * Pre-resolved entity data, typed against `@almadar/core`'s `EntityRow`
42
+ * (`{ id?: string } & Record<string, FieldValue>`) so the single source of
43
+ * truth for runtime entity shape lives in core. Consumers narrow via the
44
+ * generic parameter; the constraint guarantees every organism receives
45
+ * something with an optional `id` and a Record of `FieldValue` fields.
41
46
  *
42
- * V2 Phase 2 accepts three shapes here (value-first is the canonical path):
43
- * - `readonly T[]`: pre-resolved array for list patterns.
44
- * - `T`: pre-resolved single record for detail patterns.
45
- * - `string`: legacy entity-type name resolved by the renderer via
46
- * `useEntityRef`. Emits a dev-mode deprecation warning; removal
47
- * scheduled for Phase 6 of docs/Almadar_Entity_V2_Plan.md.
47
+ * Two shapes accepted:
48
+ * - `readonly T[]`: array for list patterns (authoring: `entity: @payload.data`
49
+ * on the calling trait after a `fetch { emit: { success } }` listener).
50
+ * - `T`: single record for detail patterns.
48
51
  *
49
- * Prefer `items` for list shapes so organisms never depend on the
50
- * renderer's string resolution at all.
51
- */
52
- entity?: string | T | readonly T[];
53
- /**
54
- * Pre-resolved list of records. V2 Phase 2 addition. When set, organisms
55
- * should read data from here instead of `entity`. Resolving from the
56
- * calling trait's `@payload.data` is the authoring pattern.
52
+ * The legacy `string` (entity-name) branch was removed in V2 Phase 6. The
53
+ * EntityStore resolver is gone; components now receive pre-resolved data via
54
+ * the event bus.
55
+ *
56
+ * NOTE: Several legacy organisms (HeroOrganism, TeamOrganism, CaseStudyOrganism,
57
+ * MediaGallery, PricingOrganism, ShowcaseOrganism, StatsOrganism, Sidebar,
58
+ * Timeline, StepFlowOrganism, FeatureGridOrganism, book/*, WorldMapBoard,
59
+ * StateMachineView, JazariStateMachine, MasterDetail, DataTable, Table) define
60
+ * local entity types (HeroEntity, TeamMemberEntity, …) that don't formally
61
+ * extend `EntityRow`. They surface `EntityDisplayProps<T>` constraint errors.
62
+ * Tracked as a Phase 7 follow-up in `docs/Almadar_Entity_V2_Plan.md` §10.
57
63
  */
58
- items?: readonly T[];
64
+ entity?: T | readonly T[];
59
65
  /** Additional CSS classes */
60
66
  className?: string;
61
67
  /** Loading state indicator */
@@ -15,8 +15,13 @@ export interface TemplateProps<E extends {
15
15
  } = {
16
16
  id: string;
17
17
  }> {
18
- /** Entity data — single object, array from compiler, or string entity name */
19
- entity?: string | E | readonly E[];
18
+ /**
19
+ * Entity data single object or array (pre-resolved by the compiler
20
+ * from `@payload.data` on the calling trait). The legacy `string`
21
+ * entity-name branch was removed in V2 Phase 6 along with the
22
+ * EntityStore resolver.
23
+ */
24
+ entity?: E | readonly E[];
20
25
  /** External styling override */
21
26
  className?: string;
22
27
  }
@@ -8,6 +8,9 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
9
  var React__default = /*#__PURE__*/_interopDefault(React);
10
10
 
11
+ var __defProp = Object.defineProperty;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
14
  function useOrbitalHistory(options) {
12
15
  const { appId, authToken, userId, onHistoryChange, onRevertSuccess } = options;
13
16
  const getHeaders2 = React.useCallback(() => {
@@ -1585,8 +1588,8 @@ var API_BASE_URL = typeof process !== "undefined" && process.env?.VITE_API_URL ?
1585
1588
  var ApiError = class extends Error {
1586
1589
  constructor(status, statusText, message) {
1587
1590
  super(message || `API Error: ${status} ${statusText}`);
1588
- this.status = status;
1589
- this.statusText = statusText;
1591
+ __publicField(this, "status", status);
1592
+ __publicField(this, "statusText", statusText);
1590
1593
  this.name = "ApiError";
1591
1594
  }
1592
1595
  };
@@ -2,6 +2,9 @@ import React, { createContext, useCallback, useState, useEffect, useMemo, useCon
2
2
  import { EventBusContext, SelectionContext } from '@almadar/ui/providers';
3
3
  import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
4
4
 
5
+ var __defProp = Object.defineProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
8
  function useOrbitalHistory(options) {
6
9
  const { appId, authToken, userId, onHistoryChange, onRevertSuccess } = options;
7
10
  const getHeaders2 = useCallback(() => {
@@ -1579,8 +1582,8 @@ var API_BASE_URL = typeof process !== "undefined" && process.env?.VITE_API_URL ?
1579
1582
  var ApiError = class extends Error {
1580
1583
  constructor(status, statusText, message) {
1581
1584
  super(message || `API Error: ${status} ${statusText}`);
1582
- this.status = status;
1583
- this.statusText = statusText;
1585
+ __publicField(this, "status", status);
1586
+ __publicField(this, "statusText", statusText);
1584
1587
  this.name = "ApiError";
1585
1588
  }
1586
1589
  };
@@ -3,6 +3,9 @@
3
3
  var clsx = require('clsx');
4
4
  var tailwindMerge = require('tailwind-merge');
5
5
 
6
+ var __defProp = Object.defineProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
9
  function cn(...inputs) {
7
10
  return tailwindMerge.twMerge(clsx.clsx(inputs));
8
11
  }
@@ -12,8 +15,8 @@ var API_BASE_URL = typeof process !== "undefined" && process.env?.VITE_API_URL ?
12
15
  var ApiError = class extends Error {
13
16
  constructor(status, statusText, message) {
14
17
  super(message || `API Error: ${status} ${statusText}`);
15
- this.status = status;
16
- this.statusText = statusText;
18
+ __publicField(this, "status", status);
19
+ __publicField(this, "statusText", statusText);
17
20
  this.name = "ApiError";
18
21
  }
19
22
  };
package/dist/lib/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
3
 
4
+ var __defProp = Object.defineProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
7
  function cn(...inputs) {
5
8
  return twMerge(clsx(inputs));
6
9
  }
@@ -10,8 +13,8 @@ var API_BASE_URL = typeof process !== "undefined" && process.env?.VITE_API_URL ?
10
13
  var ApiError = class extends Error {
11
14
  constructor(status, statusText, message) {
12
15
  super(message || `API Error: ${status} ${statusText}`);
13
- this.status = status;
14
- this.statusText = statusText;
16
+ __publicField(this, "status", status);
17
+ __publicField(this, "statusText", statusText);
15
18
  this.name = "ApiError";
16
19
  }
17
20
  };