@almadar/ui 5.81.0 → 5.83.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.
Files changed (56) hide show
  1. package/dist/avl/index.cjs +1716 -5789
  2. package/dist/avl/index.js +684 -4757
  3. package/dist/components/core/atoms/Badge.d.ts +3 -0
  4. package/dist/components/core/atoms/Button.d.ts +3 -1
  5. package/dist/components/core/molecules/Tabs.d.ts +3 -1
  6. package/dist/components/core/templates/index.d.ts +0 -10
  7. package/dist/components/game/2d/atoms/GameCard.d.ts +3 -1
  8. package/dist/components/game/2d/molecules/Canvas2D.d.ts +6 -5
  9. package/dist/components/game/2d/molecules/ControlGrid.d.ts +6 -1
  10. package/dist/components/game/2d/molecules/index.d.ts +0 -34
  11. package/dist/components/game/3d/index.cjs +3 -1
  12. package/dist/components/game/3d/index.js +3 -1
  13. package/dist/components/index.cjs +8353 -12451
  14. package/dist/components/index.js +4667 -8731
  15. package/dist/marketing/index.cjs +6 -3
  16. package/dist/marketing/index.d.cts +5 -1
  17. package/dist/marketing/index.js +7 -4
  18. package/dist/providers/index.cjs +1583 -5656
  19. package/dist/providers/index.js +660 -4733
  20. package/dist/runtime/index.cjs +1577 -5650
  21. package/dist/runtime/index.js +664 -4737
  22. package/package.json +1 -1
  23. package/dist/components/game/2d/organisms/BattleBoard.d.ts +0 -132
  24. package/dist/components/game/2d/organisms/BoardgameBoard.d.ts +0 -37
  25. package/dist/components/game/2d/organisms/CastleBoard.d.ts +0 -107
  26. package/dist/components/game/2d/organisms/CityBuilderBoard.d.ts +0 -64
  27. package/dist/components/game/2d/organisms/FishingBoard.d.ts +0 -41
  28. package/dist/components/game/2d/organisms/HexStrategyBoard.d.ts +0 -44
  29. package/dist/components/game/2d/organisms/HolidayRunnerBoard.d.ts +0 -37
  30. package/dist/components/game/2d/organisms/MatchPuzzleBoard.d.ts +0 -37
  31. package/dist/components/game/2d/organisms/MinigolfBoard.d.ts +0 -37
  32. package/dist/components/game/2d/organisms/PinballBoard.d.ts +0 -43
  33. package/dist/components/game/2d/organisms/PirateBoard.d.ts +0 -44
  34. package/dist/components/game/2d/organisms/PlatformerBoard.d.ts +0 -48
  35. package/dist/components/game/2d/organisms/RacingBoard.d.ts +0 -44
  36. package/dist/components/game/2d/organisms/RoguelikeBoard.d.ts +0 -62
  37. package/dist/components/game/2d/organisms/SokobanBoard.d.ts +0 -37
  38. package/dist/components/game/2d/organisms/SpaceShmupBoard.d.ts +0 -44
  39. package/dist/components/game/2d/organisms/SpaceStationBoard.d.ts +0 -37
  40. package/dist/components/game/2d/organisms/SportsBoard.d.ts +0 -37
  41. package/dist/components/game/2d/organisms/TanksBoard.d.ts +0 -39
  42. package/dist/components/game/2d/organisms/TopDownShooterBoard.d.ts +0 -65
  43. package/dist/components/game/2d/organisms/TowerDefenseBoard.d.ts +0 -87
  44. package/dist/components/game/2d/organisms/UncontrolledBattleBoard.d.ts +0 -43
  45. package/dist/components/game/2d/organisms/WorldMapBoard.d.ts +0 -155
  46. package/dist/components/game/2d/templates/BattleTemplate.d.ts +0 -34
  47. package/dist/components/game/2d/templates/CardBattlerTemplate.d.ts +0 -35
  48. package/dist/components/game/2d/templates/CastleTemplate.d.ts +0 -32
  49. package/dist/components/game/2d/templates/CityBuilderTemplate.d.ts +0 -40
  50. package/dist/components/game/2d/templates/PlatformerTemplate.d.ts +0 -27
  51. package/dist/components/game/2d/templates/RoguelikeTemplate.d.ts +0 -23
  52. package/dist/components/game/2d/templates/TopDownShooterTemplate.d.ts +0 -42
  53. package/dist/components/game/2d/templates/TowerDefenseTemplate.d.ts +0 -43
  54. package/dist/components/game/2d/templates/VisualNovelTemplate.d.ts +0 -28
  55. package/dist/components/game/2d/templates/WorldMapTemplate.d.ts +0 -38
  56. package/dist/components/game/shared/hooks/useBattleState.d.ts +0 -47
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { type IconInput } from "./Icon";
3
+ import type { Asset } from "@almadar/core";
3
4
  export type BadgeVariant = "default" | "primary" | "secondary" | "success" | "warning" | "danger" | "error" | "info" | "neutral";
4
5
  export type BadgeSize = "sm" | "md" | "lg";
5
6
  export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
@@ -15,6 +16,8 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
15
16
  label?: string | number;
16
17
  /** Lucide icon component or canonical kebab-case icon name string */
17
18
  icon?: IconInput;
19
+ /** Asset image rendered as the badge icon; takes precedence over icon when provided. */
20
+ iconAsset?: Asset;
18
21
  /** When set, renders a small X button on the right of the badge that
19
22
  * invokes this handler — turns the badge into a removable chip.
20
23
  * Used by the TagInput molecule and other "list of removable values"
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EventKey, EventPayload } from "@almadar/core";
2
+ import type { Asset, EventKey, EventPayload } from "@almadar/core";
3
3
  import { type IconInput } from "./Icon";
4
4
  export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "success" | "warning" | "default";
5
5
  export type ButtonSize = "sm" | "md" | "lg";
@@ -17,6 +17,8 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
17
17
  icon?: IconInput;
18
18
  /** Alias for rightIcon */
19
19
  iconRight?: IconInput;
20
+ /** Asset image rendered as the leading icon; takes precedence over icon/leftIcon when provided. */
21
+ iconAsset?: Asset;
20
22
  /** Declarative event name — emits UI:{action} via eventBus on click */
21
23
  action?: EventKey;
22
24
  /** Payload to include with the action event */
@@ -5,7 +5,7 @@
5
5
  * Uses theme-aware CSS variables for styling.
6
6
  */
7
7
  import React from 'react';
8
- import type { EventEmit } from '@almadar/core';
8
+ import type { Asset, EventEmit } from '@almadar/core';
9
9
  import type { IconInput } from '../atoms/index';
10
10
  export interface TabItem {
11
11
  /**
@@ -24,6 +24,8 @@ export interface TabItem {
24
24
  content?: React.ReactNode;
25
25
  /** Tab icon — pass either a Lucide component or its registry name (e.g. "file-text") */
26
26
  icon?: IconInput;
27
+ /** Asset image rendered as the tab icon; takes precedence over icon when provided. */
28
+ iconAsset?: Asset;
27
29
  /** Tab badge */
28
30
  badge?: string | number;
29
31
  /** Disable tab */
@@ -5,16 +5,6 @@ export { CounterTemplate, type CounterTemplateProps, type CounterSize, type Coun
5
5
  export { GameTemplate, type GameTemplateProps } from '../../game/2d/templates/GameTemplate';
6
6
  export { GenericAppTemplate, type GenericAppTemplateProps } from './GenericAppTemplate';
7
7
  export { GameShell, type GameShellProps } from '../../game/2d/templates/GameShell';
8
- export { BattleTemplate, type BattleTemplateProps, type BattlePhase, type BattleSlotContext, } from '../../game/2d/templates/BattleTemplate';
9
- export { CastleTemplate, type CastleTemplateProps, type CastleSlotContext, } from '../../game/2d/templates/CastleTemplate';
10
- export { WorldMapTemplate, type WorldMapTemplateProps, type WorldMapSlotContext, } from '../../game/2d/templates/WorldMapTemplate';
11
- export { PlatformerTemplate, type PlatformerTemplateProps, } from '../../game/2d/templates/PlatformerTemplate';
12
- export { TowerDefenseTemplate, type TowerDefenseTemplateProps, } from '../../game/2d/templates/TowerDefenseTemplate';
13
- export { RoguelikeTemplate, type RoguelikeTemplateProps, } from '../../game/2d/templates/RoguelikeTemplate';
14
- export { TopDownShooterTemplate, type TopDownShooterTemplateProps, } from '../../game/2d/templates/TopDownShooterTemplate';
15
- export { CityBuilderTemplate, type CityBuilderTemplateProps, } from '../../game/2d/templates/CityBuilderTemplate';
16
- export { VisualNovelTemplate, type VisualNovelTemplateProps, } from '../../game/2d/templates/VisualNovelTemplate';
17
- export { CardBattlerTemplate, type CardBattlerTemplateProps, } from '../../game/2d/templates/CardBattlerTemplate';
18
8
  export { LandingPageTemplate, type LandingPageTemplateProps, type LandingPageEntity, } from '../../marketing/templates/LandingPageTemplate';
19
9
  export { PricingPageTemplate, type PricingPageTemplateProps, type PricingPageEntity, } from '../../marketing/templates/PricingPageTemplate';
20
10
  export { FeatureDetailPageTemplate, type FeatureDetailPageTemplateProps, type FeatureDetailPageEntity, type FeatureDetailSection, } from '../../marketing/templates/FeatureDetailPageTemplate';
@@ -5,6 +5,8 @@ export interface GameCardProps {
5
5
  cost?: number;
6
6
  /** Card art asset */
7
7
  art?: Asset;
8
+ /** Asset rendered as the card border/frame via backgroundImage; falls back to CSS border styling when absent. */
9
+ frameAsset?: Asset;
8
10
  attack?: number;
9
11
  defense?: number;
10
12
  name?: string;
@@ -20,7 +22,7 @@ export interface GameCardProps {
20
22
  }>;
21
23
  className?: string;
22
24
  }
23
- export declare function GameCard({ id, cost, art, attack, defense, name, selected, disabled, size, onClick, clickEvent, className, }: GameCardProps): React.JSX.Element;
25
+ export declare function GameCard({ id, cost, art, frameAsset, attack, defense, name, selected, disabled, size, onClick, clickEvent, className, }: GameCardProps): React.JSX.Element;
24
26
  export declare namespace GameCard {
25
27
  var displayName: string;
26
28
  }
@@ -101,10 +101,11 @@ export interface Canvas2DProps {
101
101
  }>;
102
102
  /** Emits UI:{tileLeaveEvent} with {} on tile leave */
103
103
  tileLeaveEvent?: EventEmit<Record<string, never>>;
104
- /** Emits UI:{keyEvent} with { key } on keydown for side/free keyboard control */
105
- keyEvent?: EventEmit<{
106
- key: string;
107
- }>;
104
+ /** Maps a keydown `e.code` the board's SEMANTIC event, e.g. `{ ArrowLeft: "LEFT", KeyA: "LEFT", Space: "JUMP" }`.
105
+ * The input layer emits `UI:<event>` so the FSM stays device-agnostic — keyboard and d-pad converge on the same events. */
106
+ keyMap?: Record<string, string>;
107
+ /** Maps a keyup `e.code` → the board's SEMANTIC event, e.g. `{ ArrowLeft: "STOP" }`. Omit a key to ignore its release (e.g. jump). */
108
+ keyUpMap?: Record<string, string>;
108
109
  /** Camera behavior (default 'pan-zoom'). */
109
110
  camera?: CameraMode;
110
111
  /** Render scale (0.4 = 40% zoom). */
@@ -154,7 +155,7 @@ export interface Canvas2DProps {
154
155
  effects?: Record<string, Asset>;
155
156
  };
156
157
  }
157
- export declare function Canvas2D({ className, isLoading, error, projection, tiles: _tilesPropRaw, units: _unitsPropRaw, features: _featuresPropRaw, effects: _effectsPropRaw, platforms, player, backgroundImage, selectedUnitId, validMoves, attackTargets, hoveredTile, tileClickEvent, unitClickEvent, tileHoverEvent, tileLeaveEvent, keyEvent, camera, scale, unitScale, showMinimap, animate, debug, spriteHeightRatio, spriteMaxWidthRatio, diamondTopY: diamondTopYProp, getTerrainSprite, getFeatureSprite, getUnitSprite, resolveUnitFrame, effectSpriteUrls, onDrawEffects, playerSprite, tileSprites, bgColor, worldWidth, worldHeight, assetManifest, }: Canvas2DProps): React.JSX.Element;
158
+ export declare function Canvas2D({ className, isLoading, error, projection, tiles: _tilesPropRaw, units: _unitsPropRaw, features: _featuresPropRaw, effects: _effectsPropRaw, platforms, player, backgroundImage, selectedUnitId, validMoves, attackTargets, hoveredTile, tileClickEvent, unitClickEvent, tileHoverEvent, tileLeaveEvent, keyMap, keyUpMap, camera, scale, unitScale, showMinimap, animate, debug, spriteHeightRatio, spriteMaxWidthRatio, diamondTopY: diamondTopYProp, getTerrainSprite, getFeatureSprite, getUnitSprite, resolveUnitFrame, effectSpriteUrls, onDrawEffects, playerSprite, tileSprites, bgColor, worldWidth, worldHeight, assetManifest, }: Canvas2DProps): React.JSX.Element;
158
159
  export declare namespace Canvas2D {
159
160
  var displayName: string;
160
161
  }
@@ -32,13 +32,18 @@ export interface ControlGridProps {
32
32
  direction: DPadDirection;
33
33
  pressed: boolean;
34
34
  }>;
35
+ /** Per-direction PRESS → the board's SEMANTIC event (kind="dpad"), e.g. `{ left: "LEFT", right: "RIGHT", up: "JUMP" }`.
36
+ * Lets the d-pad emit the SAME intent events as the keyboard so the FSM stays device-agnostic. */
37
+ directionEvents?: Partial<Record<DPadDirection, string>>;
38
+ /** Per-direction RELEASE → semantic event, e.g. `{ left: "STOP", right: "STOP" }`. Omit a direction to ignore its release. */
39
+ directionReleaseEvents?: Partial<Record<DPadDirection, string>>;
35
40
  /** Per-direction sprite assets for kind="dpad" buttons (e.g. Kenny arrow PNGs). Falls back to arrow emoji. */
36
41
  directionAssets?: Partial<Record<DPadDirection, Asset>>;
37
42
  size?: 'sm' | 'md' | 'lg';
38
43
  disabled?: boolean;
39
44
  className?: string;
40
45
  }
41
- export declare function ControlGrid({ kind, buttons, layout, includeDiagonals, onAction, actionEvent, onDirection, directionEvent, directionAssets, size, disabled, className, }: ControlGridProps): React.JSX.Element;
46
+ export declare function ControlGrid({ kind, buttons, layout, includeDiagonals, onAction, actionEvent, onDirection, directionEvent, directionEvents, directionReleaseEvents, directionAssets, size, disabled, className, }: ControlGridProps): React.JSX.Element;
42
47
  export declare namespace ControlGrid {
43
48
  var displayName: string;
44
49
  }
@@ -40,32 +40,8 @@ export { GameAudioProvider, GameAudioContext, useGameAudioContext, type GameAudi
40
40
  export { GameAudioToggle, type GameAudioToggleProps, } from '../atoms/GameAudioToggle';
41
41
  export { useGameAudio, type AudioManifest, type SoundEntry, type GameAudioControls, type UseGameAudioOptions, } from '../../shared/hooks/useGameAudio';
42
42
  export { useCamera } from '../../shared/hooks/useCamera';
43
- export { BattleBoard, type BattleBoardProps, type BattlePhase, type BattleSlotContext, } from '../organisms/BattleBoard';
44
- export { UncontrolledBattleBoard, type UncontrolledBattleBoardProps, } from '../organisms/UncontrolledBattleBoard';
45
- export { useBattleState, type BattleStateEventConfig, type BattleStateCallbacks, type BattleStateResult, } from '../../shared/hooks/useBattleState';
46
- export { WorldMapBoard, type WorldMapBoardProps, type WorldMapSlotContext, } from '../organisms/WorldMapBoard';
47
- export { CastleBoard, type CastleBoardProps, type CastleSlotContext, } from '../organisms/CastleBoard';
48
- export { PlatformerBoard, type PlatformerBoardProps, } from '../organisms/PlatformerBoard';
49
- export { TowerDefenseBoard, type TowerDefenseBoardProps, } from '../organisms/TowerDefenseBoard';
50
- export { RoguelikeBoard, type RoguelikeBoardProps, } from '../organisms/RoguelikeBoard';
51
- export { TopDownShooterBoard, type TopDownShooterBoardProps, } from '../organisms/TopDownShooterBoard';
52
- export { CityBuilderBoard, type CityBuilderBoardProps, } from '../organisms/CityBuilderBoard';
53
43
  export { VisualNovelBoard, type VisualNovelBoardProps, type VisualNovelNode, type VisualNovelChoice, } from '../organisms/VisualNovelBoard';
54
44
  export { CardBattlerBoard, type CardBattlerBoardProps, type CardBattlerCard, } from '../organisms/CardBattlerBoard';
55
- export { HexStrategyBoard, type HexStrategyBoardProps, } from '../organisms/HexStrategyBoard';
56
- export { RacingBoard, type RacingBoardProps } from '../organisms/RacingBoard';
57
- export { TanksBoard, type TanksBoardProps } from '../organisms/TanksBoard';
58
- export { SpaceShmupBoard, type SpaceShmupBoardProps } from '../organisms/SpaceShmupBoard';
59
- export { SportsBoard, type SportsBoardProps } from '../organisms/SportsBoard';
60
- export { SokobanBoard, type SokobanBoardProps } from '../organisms/SokobanBoard';
61
- export { BoardgameBoard, type BoardgameBoardProps } from '../organisms/BoardgameBoard';
62
- export { PirateBoard, type PirateBoardProps } from '../organisms/PirateBoard';
63
- export { PinballBoard, type PinballBoardProps } from '../organisms/PinballBoard';
64
- export { FishingBoard, type FishingBoardProps } from '../organisms/FishingBoard';
65
- export { MatchPuzzleBoard, type MatchPuzzleBoardProps } from '../organisms/MatchPuzzleBoard';
66
- export { HolidayRunnerBoard, type HolidayRunnerBoardProps } from '../organisms/HolidayRunnerBoard';
67
- export { MinigolfBoard, type MinigolfBoardProps } from '../organisms/MinigolfBoard';
68
- export { SpaceStationBoard, type SpaceStationBoardProps } from '../organisms/SpaceStationBoard';
69
45
  export { TraitStateViewer, type TraitStateViewerProps, type TraitStateMachineDefinition, type TraitTransition, } from '../organisms/TraitStateViewer';
70
46
  export { TraitSlot, type TraitSlotProps, type SlotItemData, } from '../organisms/TraitSlot';
71
47
  export { CollapsibleSection, EditorSlider, EditorSelect, EditorCheckbox, EditorTextInput, StatusBar, TerrainPalette, EditorToolbar, TERRAIN_COLORS, FEATURE_TYPES, type EditorMode, type CollapsibleSectionProps, type EditorSliderProps, type EditorSelectProps, type EditorCheckboxProps, type EditorTextInputProps, type StatusBarProps, type TerrainPaletteProps, type EditorToolbarProps, } from '../../shared/lib/editorUtils';
@@ -95,13 +71,3 @@ export type { PhysicsPreset, PhysicsBody, PhysicsConstraint } from '../../shared
95
71
  export { projectileMotion, pendulum, springOscillator, ALL_PRESETS } from '../../shared/lib/physicsPresets';
96
72
  export { GameTemplate, type GameTemplateProps } from '../templates/GameTemplate';
97
73
  export { GameShell, type GameShellProps } from '../templates/GameShell';
98
- export { BattleTemplate, type BattleTemplateProps } from '../templates/BattleTemplate';
99
- export { CastleTemplate, type CastleTemplateProps } from '../templates/CastleTemplate';
100
- export { WorldMapTemplate, type WorldMapTemplateProps } from '../templates/WorldMapTemplate';
101
- export { PlatformerTemplate, type PlatformerTemplateProps } from '../templates/PlatformerTemplate';
102
- export { TowerDefenseTemplate, type TowerDefenseTemplateProps } from '../templates/TowerDefenseTemplate';
103
- export { RoguelikeTemplate, type RoguelikeTemplateProps } from '../templates/RoguelikeTemplate';
104
- export { TopDownShooterTemplate, type TopDownShooterTemplateProps } from '../templates/TopDownShooterTemplate';
105
- export { CityBuilderTemplate, type CityBuilderTemplateProps } from '../templates/CityBuilderTemplate';
106
- export { VisualNovelTemplate, type VisualNovelTemplateProps } from '../templates/VisualNovelTemplate';
107
- export { CardBattlerTemplate, type CardBattlerTemplateProps } from '../templates/CardBattlerTemplate';
@@ -3196,6 +3196,7 @@ var Button = React6__default.default.forwardRef(
3196
3196
  rightIcon,
3197
3197
  icon: iconProp,
3198
3198
  iconRight: iconRightProp,
3199
+ iconAsset,
3199
3200
  action,
3200
3201
  actionPayload,
3201
3202
  label,
@@ -3207,7 +3208,8 @@ var Button = React6__default.default.forwardRef(
3207
3208
  const eventBus = useEventBus();
3208
3209
  const leftIconValue = leftIcon || iconProp;
3209
3210
  const rightIconValue = rightIcon || iconRightProp;
3210
- const resolvedLeftIcon = resolveIconProp(leftIconValue, iconSizeStyles[size]);
3211
+ const px = size === "sm" ? 16 : size === "lg" ? 20 : 16;
3212
+ const resolvedLeftIcon = iconAsset?.url ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: iconAsset.url, alt: iconAsset.name ?? iconAsset.category ?? "", width: px, height: px, style: { imageRendering: "pixelated", objectFit: "contain", width: px, height: px }, className: "flex-shrink-0" }) : resolveIconProp(leftIconValue, iconSizeStyles[size]);
3211
3213
  const resolvedRightIcon = resolveIconProp(rightIconValue, iconSizeStyles[size]);
3212
3214
  const handleClick = (e) => {
3213
3215
  if (action) {
@@ -3172,6 +3172,7 @@ var Button = React6.forwardRef(
3172
3172
  rightIcon,
3173
3173
  icon: iconProp,
3174
3174
  iconRight: iconRightProp,
3175
+ iconAsset,
3175
3176
  action,
3176
3177
  actionPayload,
3177
3178
  label,
@@ -3183,7 +3184,8 @@ var Button = React6.forwardRef(
3183
3184
  const eventBus = useEventBus();
3184
3185
  const leftIconValue = leftIcon || iconProp;
3185
3186
  const rightIconValue = rightIcon || iconRightProp;
3186
- const resolvedLeftIcon = resolveIconProp(leftIconValue, iconSizeStyles[size]);
3187
+ const px = size === "sm" ? 16 : size === "lg" ? 20 : 16;
3188
+ const resolvedLeftIcon = iconAsset?.url ? /* @__PURE__ */ jsx("img", { src: iconAsset.url, alt: iconAsset.name ?? iconAsset.category ?? "", width: px, height: px, style: { imageRendering: "pixelated", objectFit: "contain", width: px, height: px }, className: "flex-shrink-0" }) : resolveIconProp(leftIconValue, iconSizeStyles[size]);
3187
3189
  const resolvedRightIcon = resolveIconProp(rightIconValue, iconSizeStyles[size]);
3188
3190
  const handleClick = (e) => {
3189
3191
  if (action) {