@almadar/ui 5.65.0 → 5.67.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.
@@ -8063,6 +8063,8 @@ var init_DialogueBubble = __esm({
8063
8063
  function ChoiceButton({
8064
8064
  text = "Charge forward into the fray",
8065
8065
  index,
8066
+ assetUrl,
8067
+ icon,
8066
8068
  disabled = false,
8067
8069
  selected = false,
8068
8070
  onClick,
@@ -8095,6 +8097,23 @@ function ChoiceButton({
8095
8097
  ]
8096
8098
  }
8097
8099
  ),
8100
+ assetUrl ? /* @__PURE__ */ jsxRuntime.jsx(
8101
+ "img",
8102
+ {
8103
+ src: assetUrl,
8104
+ alt: "",
8105
+ width: 16,
8106
+ height: 16,
8107
+ style: { imageRendering: "pixelated", objectFit: "contain" },
8108
+ className: "flex-shrink-0"
8109
+ }
8110
+ ) : icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0 text-sm", children: typeof icon === "string" ? (() => {
8111
+ const I = resolveIcon(icon);
8112
+ return I ? /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" }) : null;
8113
+ })() : /* @__PURE__ */ (() => {
8114
+ const I = icon;
8115
+ return /* @__PURE__ */ jsxRuntime.jsx(I, { className: "w-4 h-4" });
8116
+ })() }) : null,
8098
8117
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm leading-snug", children: text })
8099
8118
  ]
8100
8119
  }
@@ -8103,6 +8122,7 @@ function ChoiceButton({
8103
8122
  var init_ChoiceButton = __esm({
8104
8123
  "components/game/atoms/ChoiceButton.tsx"() {
8105
8124
  init_cn();
8125
+ init_Icon();
8106
8126
  ChoiceButton.displayName = "ChoiceButton";
8107
8127
  }
8108
8128
  });
@@ -11251,7 +11271,8 @@ function IsometricCanvas({
11251
11271
  const minX = Math.min(...allScreenPos.map((p2) => p2.x));
11252
11272
  const maxX = Math.max(...allScreenPos.map((p2) => p2.x + scaledTileWidth));
11253
11273
  const minY = Math.min(...allScreenPos.map((p2) => p2.y));
11254
- const maxY = Math.max(...allScreenPos.map((p2) => p2.y + scaledTileHeight));
11274
+ const tileBottomExtent = tileLayout === "hex" ? scaledTileWidth : scaledTileHeight;
11275
+ const maxY = Math.max(...allScreenPos.map((p2) => p2.y + tileBottomExtent));
11255
11276
  const worldW = maxX - minX;
11256
11277
  const worldH = maxY - minY;
11257
11278
  const scaleM = Math.min(mW / worldW, mH / worldH) * 0.9;
@@ -11343,7 +11364,7 @@ function IsometricCanvas({
11343
11364
  const drawW = scaledTileWidth;
11344
11365
  const drawH = scaledTileWidth * (img.naturalHeight / img.naturalWidth);
11345
11366
  const drawX = pos.x;
11346
- const drawY = pos.y + scaledTileHeight - drawH;
11367
+ const drawY = tileLayout === "hex" ? pos.y : pos.y + scaledTileHeight - drawH;
11347
11368
  ctx.drawImage(img, drawX, drawY, drawW, drawH);
11348
11369
  }
11349
11370
  } else {
@@ -28095,6 +28116,7 @@ function PowerupSlots({
28095
28116
  /* @__PURE__ */ jsxRuntime.jsx(
28096
28117
  ItemSlot,
28097
28118
  {
28119
+ assetUrl: powerup.assetUrl,
28098
28120
  icon: powerup.icon,
28099
28121
  label: powerup.label,
28100
28122
  rarity: "uncommon",
@@ -28344,13 +28366,26 @@ function HealthPanel({
28344
28366
  )
28345
28367
  }
28346
28368
  ),
28347
- effects && effects.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsxRuntime.jsx(
28369
+ effects && effects.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsxRuntime.jsxs(
28348
28370
  Badge,
28349
28371
  {
28350
28372
  variant: effectVariantMap[effect.variant ?? "neutral"],
28351
28373
  size: "sm",
28352
- icon: effect.icon,
28353
- children: effect.label
28374
+ icon: effect.assetUrl ? void 0 : effect.icon,
28375
+ children: [
28376
+ effect.assetUrl && /* @__PURE__ */ jsxRuntime.jsx(
28377
+ "img",
28378
+ {
28379
+ src: effect.assetUrl,
28380
+ alt: "",
28381
+ width: 12,
28382
+ height: 12,
28383
+ style: { imageRendering: "pixelated", objectFit: "contain" },
28384
+ className: "flex-shrink-0 inline-block"
28385
+ }
28386
+ ),
28387
+ effect.label
28388
+ ]
28354
28389
  },
28355
28390
  i
28356
28391
  )) })
@@ -28533,15 +28568,28 @@ function TurnPanel({
28533
28568
  activeTeam
28534
28569
  }
28535
28570
  ),
28536
- actions && actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center gap-1.5 ml-auto", children: actions.map((action, i) => /* @__PURE__ */ jsxRuntime.jsx(
28571
+ actions && actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "flex items-center gap-1.5 ml-auto", children: actions.map((action, i) => /* @__PURE__ */ jsxRuntime.jsxs(
28537
28572
  Button,
28538
28573
  {
28539
28574
  variant: "ghost",
28540
28575
  size: "sm",
28541
28576
  disabled: action.disabled,
28542
- leftIcon: action.icon,
28577
+ leftIcon: action.assetUrl ? void 0 : action.icon,
28543
28578
  onClick: () => handleAction(action.event),
28544
- children: action.label
28579
+ children: [
28580
+ action.assetUrl && /* @__PURE__ */ jsxRuntime.jsx(
28581
+ "img",
28582
+ {
28583
+ src: action.assetUrl,
28584
+ alt: "",
28585
+ width: 14,
28586
+ height: 14,
28587
+ style: { imageRendering: "pixelated", objectFit: "contain" },
28588
+ className: "flex-shrink-0"
28589
+ }
28590
+ ),
28591
+ action.label
28592
+ ]
28545
28593
  },
28546
28594
  i
28547
28595
  )) })
@@ -43457,9 +43505,9 @@ var init_GameCanvas3D2 = __esm({
43457
43505
  const color = unit.faction === "player" ? 4491519 : unit.faction === "enemy" ? 16729156 : 16777028;
43458
43506
  const hasAtlas = unitAtlasUrl(unit) !== null;
43459
43507
  const initialFrame = hasAtlas ? resolveUnitFrame(unit.id) : null;
43460
- const modelScale = UNIT_BASE_MODEL_SCALE * unitScale;
43461
- const billboardHeight = UNIT_BASE_BILLBOARD_HEIGHT * unitScale;
43462
- const primitiveRadius = UNIT_BASE_PRIMITIVE_RADIUS * unitScale;
43508
+ const modelScale = UNIT_BASE_MODEL_SCALE * unitScale * gridConfig.cellSize;
43509
+ const billboardHeight = UNIT_BASE_BILLBOARD_HEIGHT * unitScale * gridConfig.cellSize;
43510
+ const primitiveRadius = UNIT_BASE_PRIMITIVE_RADIUS * unitScale * gridConfig.cellSize;
43463
43511
  return /* @__PURE__ */ jsxRuntime.jsxs(
43464
43512
  "group",
43465
43513
  {
@@ -43506,7 +43554,7 @@ var init_GameCanvas3D2 = __esm({
43506
43554
  /* @__PURE__ */ jsxRuntime.jsx("meshStandardMaterial", { color })
43507
43555
  ] })
43508
43556
  ] }),
43509
- unit.health !== void 0 && unit.maxHealth !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("group", { position: [0, 1.2, 0], children: [
43557
+ unit.health !== void 0 && unit.maxHealth !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("group", { position: [0, billboardHeight, 0], children: [
43510
43558
  /* @__PURE__ */ jsxRuntime.jsxs("mesh", { position: [-0.25, 0, 0], children: [
43511
43559
  /* @__PURE__ */ jsxRuntime.jsx("planeGeometry", { args: [0.5, 0.05] }),
43512
43560
  /* @__PURE__ */ jsxRuntime.jsx("meshBasicMaterial", { color: 3355443 })
@@ -43535,7 +43583,7 @@ var init_GameCanvas3D2 = __esm({
43535
43583
  }
43536
43584
  );
43537
43585
  },
43538
- [selectedUnitId, handleUnitClick, resolveUnitFrame, unitScale]
43586
+ [selectedUnitId, handleUnitClick, resolveUnitFrame, unitScale, gridConfig]
43539
43587
  );
43540
43588
  const DefaultFeatureRenderer = React84.useCallback(
43541
43589
  ({
@@ -43623,7 +43671,7 @@ var init_GameCanvas3D2 = __esm({
43623
43671
  {
43624
43672
  ref: containerRef,
43625
43673
  className: cn("game-canvas-3d relative w-full overflow-hidden", className),
43626
- style: { height: "85vh" },
43674
+ style: { flex: "1 1 0", minHeight: "400px" },
43627
43675
  "data-orientation": orientation,
43628
43676
  "data-camera-mode": cameraMode,
43629
43677
  "data-overlay": overlay,
@@ -43923,13 +43971,39 @@ var init_GameBoard3D = __esm({
43923
43971
  GameBoard3D.displayName = "GameBoard3D";
43924
43972
  }
43925
43973
  });
43926
- var GameShell;
43974
+ function getSlotContentRenderer2() {
43975
+ if (_scr) return _scr;
43976
+ const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
43977
+ _scr = mod.SlotContentRenderer;
43978
+ return _scr;
43979
+ }
43980
+ function resolveDescriptor(value, idPrefix) {
43981
+ if (value === null || value === void 0) return value;
43982
+ if (React84__namespace.default.isValidElement(value)) return value;
43983
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
43984
+ if (Array.isArray(value)) {
43985
+ return value.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(React84__namespace.default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
43986
+ }
43987
+ if (typeof value === "object") {
43988
+ const rec = value;
43989
+ if (typeof rec.type === "string" && patterns.getComponentForPattern(rec.type) !== null) {
43990
+ const { type, props: nestedProps, _id, ...flatProps } = rec;
43991
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
43992
+ const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
43993
+ const SCR = getSlotContentRenderer2();
43994
+ return /* @__PURE__ */ jsxRuntime.jsx(SCR, { content, onDismiss: () => void 0 });
43995
+ }
43996
+ }
43997
+ return null;
43998
+ }
43999
+ var _scr, GameShell;
43927
44000
  var init_GameShell = __esm({
43928
44001
  "components/game/templates/GameShell.tsx"() {
43929
44002
  init_cn();
43930
44003
  init_Box();
43931
44004
  init_Stack();
43932
44005
  init_Typography();
44006
+ _scr = null;
43933
44007
  GameShell = ({
43934
44008
  appName = "Game",
43935
44009
  hud,
@@ -43978,7 +44052,7 @@ var init_GameShell = __esm({
43978
44052
  children: appName
43979
44053
  }
43980
44054
  ),
43981
- hud && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "game-shell__hud", children: hud })
44055
+ hud && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "game-shell__hud", children: resolveDescriptor(hud, "gs-hud") })
43982
44056
  ]
43983
44057
  }
43984
44058
  ),
@@ -43991,7 +44065,7 @@ var init_GameShell = __esm({
43991
44065
  overflow: "hidden",
43992
44066
  position: "relative"
43993
44067
  },
43994
- children
44068
+ children: resolveDescriptor(children, "gs-children")
43995
44069
  }
43996
44070
  )
43997
44071
  ]
@@ -44001,7 +44075,32 @@ var init_GameShell = __esm({
44001
44075
  GameShell.displayName = "GameShell";
44002
44076
  }
44003
44077
  });
44004
- var GameTemplate;
44078
+ function getSlotContentRenderer3() {
44079
+ if (_scr2) return _scr2;
44080
+ const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
44081
+ _scr2 = mod.SlotContentRenderer;
44082
+ return _scr2;
44083
+ }
44084
+ function resolveDescriptor2(value, idPrefix) {
44085
+ if (value === null || value === void 0) return value;
44086
+ if (React84__namespace.default.isValidElement(value)) return value;
44087
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
44088
+ if (Array.isArray(value)) {
44089
+ return value.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(React84__namespace.default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
44090
+ }
44091
+ if (typeof value === "object") {
44092
+ const rec = value;
44093
+ if (typeof rec.type === "string" && patterns.getComponentForPattern(rec.type) !== null) {
44094
+ const { type, props: nestedProps, _id, ...flatProps } = rec;
44095
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
44096
+ const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
44097
+ const SCR = getSlotContentRenderer3();
44098
+ return /* @__PURE__ */ jsxRuntime.jsx(SCR, { content, onDismiss: () => void 0 });
44099
+ }
44100
+ }
44101
+ return null;
44102
+ }
44103
+ var _scr2, GameTemplate;
44005
44104
  var init_GameTemplate = __esm({
44006
44105
  "components/game/templates/GameTemplate.tsx"() {
44007
44106
  init_cn();
@@ -44009,6 +44108,7 @@ var init_GameTemplate = __esm({
44009
44108
  init_Stack();
44010
44109
  init_Typography();
44011
44110
  init_Button();
44111
+ _scr2 = null;
44012
44112
  GameTemplate = ({
44013
44113
  entity,
44014
44114
  title = "Game",
@@ -44076,13 +44176,13 @@ var init_GameTemplate = __esm({
44076
44176
  fullWidth: true,
44077
44177
  className: "flex-1 bg-muted",
44078
44178
  children: [
44079
- children,
44179
+ resolveDescriptor2(children, "gt-children"),
44080
44180
  hud && /* @__PURE__ */ jsxRuntime.jsx(
44081
44181
  Box,
44082
44182
  {
44083
44183
  position: "absolute",
44084
44184
  className: "top-0 left-0 right-0 pointer-events-none",
44085
- children: /* @__PURE__ */ jsxRuntime.jsx(Box, { padding: "md", className: "pointer-events-auto w-fit", children: hud })
44185
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { padding: "md", className: "pointer-events-auto w-fit", children: resolveDescriptor2(hud, "gt-hud") })
44086
44186
  }
44087
44187
  )
44088
44188
  ]
@@ -44107,7 +44207,7 @@ var init_GameTemplate = __esm({
44107
44207
  children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h6", children: "Debug Panel" })
44108
44208
  }
44109
44209
  ),
44110
- /* @__PURE__ */ jsxRuntime.jsx(Box, { padding: "md", children: debugPanel })
44210
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { padding: "md", children: resolveDescriptor2(debugPanel, "gt-debug") })
44111
44211
  ]
44112
44212
  }
44113
44213
  )
@@ -52686,7 +52786,7 @@ function getSlotFallback(slot, config) {
52686
52786
  const variant = SLOT_SKELETON_MAP[slot] ?? "text";
52687
52787
  return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { variant });
52688
52788
  }
52689
- function getComponentForPattern(patternType) {
52789
+ function getComponentForPattern3(patternType) {
52690
52790
  const mapping = patterns.getComponentForPattern(patternType);
52691
52791
  if (!mapping) {
52692
52792
  return null;
@@ -53317,7 +53417,8 @@ function SlotContentRenderer({
53317
53417
  entityDef = schemaCtx.entities.get(linkedEntity);
53318
53418
  }
53319
53419
  }
53320
- const PatternComponent = getComponentForPattern(content.pattern);
53420
+ const orbitalName = schemaCtx && content.sourceTrait !== void 0 ? schemaCtx.orbitalsByTrait.get(content.sourceTrait) : void 0;
53421
+ const PatternComponent = getComponentForPattern3(content.pattern);
53321
53422
  if (PatternComponent) {
53322
53423
  const childrenConfig = content.props.children;
53323
53424
  const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
@@ -53415,6 +53516,7 @@ function SlotContentRenderer({
53415
53516
  "data-orb-entity": content.entity,
53416
53517
  "data-orb-path": myPath,
53417
53518
  "data-orb-pattern": content.pattern,
53519
+ "data-orb-orbital": orbitalName,
53418
53520
  children: renderedChildren !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsxRuntime.jsx(PatternComponent, { ...finalProps })
53419
53521
  }
53420
53522
  );
@@ -53434,6 +53536,7 @@ function SlotContentRenderer({
53434
53536
  "data-orb-entity": content.entity,
53435
53537
  "data-orb-path": patternPath ?? "root",
53436
53538
  "data-orb-pattern": content.pattern,
53539
+ "data-orb-orbital": orbitalName,
53437
53540
  children: content.props.children ?? /* @__PURE__ */ jsxRuntime.jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
53438
53541
  "Unknown pattern: ",
53439
53542
  content.pattern,
@@ -53683,7 +53786,7 @@ function resolveLambdaBindings(body, params, item, index) {
53683
53786
  return body;
53684
53787
  }
53685
53788
  var _slotContentRenderer2 = null;
53686
- function getSlotContentRenderer2() {
53789
+ function getSlotContentRenderer4() {
53687
53790
  if (_slotContentRenderer2) return _slotContentRenderer2;
53688
53791
  const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
53689
53792
  _slotContentRenderer2 = mod.SlotContentRenderer;
@@ -53699,7 +53802,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
53699
53802
  if (typeof record.type !== "string") {
53700
53803
  return null;
53701
53804
  }
53702
- const SlotContentRenderer2 = getSlotContentRenderer2();
53805
+ const SlotContentRenderer2 = getSlotContentRenderer4();
53703
53806
  const rawChildProps = {};
53704
53807
  for (const [k, v] of Object.entries(record)) {
53705
53808
  if (k !== "type") rawChildProps[k] = v;