@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.
@@ -48,7 +48,7 @@ import { GLTFLoader as GLTFLoader$1 } from 'three/examples/jsm/loaders/GLTFLoade
48
48
  import { clone } from 'three/examples/jsm/utils/SkeletonUtils';
49
49
  import { Canvas, useLoader, useFrame, useThree } from '@react-three/fiber';
50
50
  import { Billboard, Grid as Grid$1, OrbitControls } from '@react-three/drei';
51
- import { getPatternDefinition, getComponentForPattern as getComponentForPattern$1 } from '@almadar/patterns';
51
+ import { getPatternDefinition, getComponentForPattern } from '@almadar/patterns';
52
52
 
53
53
  var __defProp = Object.defineProperty;
54
54
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7974,6 +7974,8 @@ var init_DialogueBubble = __esm({
7974
7974
  function ChoiceButton({
7975
7975
  text = "Charge forward into the fray",
7976
7976
  index,
7977
+ assetUrl,
7978
+ icon,
7977
7979
  disabled = false,
7978
7980
  selected = false,
7979
7981
  onClick,
@@ -8006,6 +8008,23 @@ function ChoiceButton({
8006
8008
  ]
8007
8009
  }
8008
8010
  ),
8011
+ assetUrl ? /* @__PURE__ */ jsx(
8012
+ "img",
8013
+ {
8014
+ src: assetUrl,
8015
+ alt: "",
8016
+ width: 16,
8017
+ height: 16,
8018
+ style: { imageRendering: "pixelated", objectFit: "contain" },
8019
+ className: "flex-shrink-0"
8020
+ }
8021
+ ) : icon ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 text-sm", children: typeof icon === "string" ? (() => {
8022
+ const I = resolveIcon(icon);
8023
+ return I ? /* @__PURE__ */ jsx(I, { className: "w-4 h-4" }) : null;
8024
+ })() : /* @__PURE__ */ (() => {
8025
+ const I = icon;
8026
+ return /* @__PURE__ */ jsx(I, { className: "w-4 h-4" });
8027
+ })() }) : null,
8009
8028
  /* @__PURE__ */ jsx("span", { className: "text-sm leading-snug", children: text })
8010
8029
  ]
8011
8030
  }
@@ -8014,6 +8033,7 @@ function ChoiceButton({
8014
8033
  var init_ChoiceButton = __esm({
8015
8034
  "components/game/atoms/ChoiceButton.tsx"() {
8016
8035
  init_cn();
8036
+ init_Icon();
8017
8037
  ChoiceButton.displayName = "ChoiceButton";
8018
8038
  }
8019
8039
  });
@@ -11506,7 +11526,8 @@ function IsometricCanvas({
11506
11526
  const minX = Math.min(...allScreenPos.map((p2) => p2.x));
11507
11527
  const maxX = Math.max(...allScreenPos.map((p2) => p2.x + scaledTileWidth));
11508
11528
  const minY = Math.min(...allScreenPos.map((p2) => p2.y));
11509
- const maxY = Math.max(...allScreenPos.map((p2) => p2.y + scaledTileHeight));
11529
+ const tileBottomExtent = tileLayout === "hex" ? scaledTileWidth : scaledTileHeight;
11530
+ const maxY = Math.max(...allScreenPos.map((p2) => p2.y + tileBottomExtent));
11510
11531
  const worldW = maxX - minX;
11511
11532
  const worldH = maxY - minY;
11512
11533
  const scaleM = Math.min(mW / worldW, mH / worldH) * 0.9;
@@ -11598,7 +11619,7 @@ function IsometricCanvas({
11598
11619
  const drawW = scaledTileWidth;
11599
11620
  const drawH = scaledTileWidth * (img.naturalHeight / img.naturalWidth);
11600
11621
  const drawX = pos.x;
11601
- const drawY = pos.y + scaledTileHeight - drawH;
11622
+ const drawY = tileLayout === "hex" ? pos.y : pos.y + scaledTileHeight - drawH;
11602
11623
  ctx.drawImage(img, drawX, drawY, drawW, drawH);
11603
11624
  }
11604
11625
  } else {
@@ -28350,6 +28371,7 @@ function PowerupSlots({
28350
28371
  /* @__PURE__ */ jsx(
28351
28372
  ItemSlot,
28352
28373
  {
28374
+ assetUrl: powerup.assetUrl,
28353
28375
  icon: powerup.icon,
28354
28376
  label: powerup.label,
28355
28377
  rarity: "uncommon",
@@ -28599,13 +28621,26 @@ function HealthPanel({
28599
28621
  )
28600
28622
  }
28601
28623
  ),
28602
- effects && effects.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsx(
28624
+ effects && effects.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1 flex-wrap", children: effects.map((effect, i) => /* @__PURE__ */ jsxs(
28603
28625
  Badge,
28604
28626
  {
28605
28627
  variant: effectVariantMap[effect.variant ?? "neutral"],
28606
28628
  size: "sm",
28607
- icon: effect.icon,
28608
- children: effect.label
28629
+ icon: effect.assetUrl ? void 0 : effect.icon,
28630
+ children: [
28631
+ effect.assetUrl && /* @__PURE__ */ jsx(
28632
+ "img",
28633
+ {
28634
+ src: effect.assetUrl,
28635
+ alt: "",
28636
+ width: 12,
28637
+ height: 12,
28638
+ style: { imageRendering: "pixelated", objectFit: "contain" },
28639
+ className: "flex-shrink-0 inline-block"
28640
+ }
28641
+ ),
28642
+ effect.label
28643
+ ]
28609
28644
  },
28610
28645
  i
28611
28646
  )) })
@@ -28788,15 +28823,28 @@ function TurnPanel({
28788
28823
  activeTeam
28789
28824
  }
28790
28825
  ),
28791
- actions && actions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1.5 ml-auto", children: actions.map((action, i) => /* @__PURE__ */ jsx(
28826
+ actions && actions.length > 0 && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-1.5 ml-auto", children: actions.map((action, i) => /* @__PURE__ */ jsxs(
28792
28827
  Button,
28793
28828
  {
28794
28829
  variant: "ghost",
28795
28830
  size: "sm",
28796
28831
  disabled: action.disabled,
28797
- leftIcon: action.icon,
28832
+ leftIcon: action.assetUrl ? void 0 : action.icon,
28798
28833
  onClick: () => handleAction(action.event),
28799
- children: action.label
28834
+ children: [
28835
+ action.assetUrl && /* @__PURE__ */ jsx(
28836
+ "img",
28837
+ {
28838
+ src: action.assetUrl,
28839
+ alt: "",
28840
+ width: 14,
28841
+ height: 14,
28842
+ style: { imageRendering: "pixelated", objectFit: "contain" },
28843
+ className: "flex-shrink-0"
28844
+ }
28845
+ ),
28846
+ action.label
28847
+ ]
28800
28848
  },
28801
28849
  i
28802
28850
  )) })
@@ -43712,9 +43760,9 @@ var init_GameCanvas3D2 = __esm({
43712
43760
  const color = unit.faction === "player" ? 4491519 : unit.faction === "enemy" ? 16729156 : 16777028;
43713
43761
  const hasAtlas = unitAtlasUrl(unit) !== null;
43714
43762
  const initialFrame = hasAtlas ? resolveUnitFrame(unit.id) : null;
43715
- const modelScale = UNIT_BASE_MODEL_SCALE * unitScale;
43716
- const billboardHeight = UNIT_BASE_BILLBOARD_HEIGHT * unitScale;
43717
- const primitiveRadius = UNIT_BASE_PRIMITIVE_RADIUS * unitScale;
43763
+ const modelScale = UNIT_BASE_MODEL_SCALE * unitScale * gridConfig.cellSize;
43764
+ const billboardHeight = UNIT_BASE_BILLBOARD_HEIGHT * unitScale * gridConfig.cellSize;
43765
+ const primitiveRadius = UNIT_BASE_PRIMITIVE_RADIUS * unitScale * gridConfig.cellSize;
43718
43766
  return /* @__PURE__ */ jsxs(
43719
43767
  "group",
43720
43768
  {
@@ -43761,7 +43809,7 @@ var init_GameCanvas3D2 = __esm({
43761
43809
  /* @__PURE__ */ jsx("meshStandardMaterial", { color })
43762
43810
  ] })
43763
43811
  ] }),
43764
- unit.health !== void 0 && unit.maxHealth !== void 0 && /* @__PURE__ */ jsxs("group", { position: [0, 1.2, 0], children: [
43812
+ unit.health !== void 0 && unit.maxHealth !== void 0 && /* @__PURE__ */ jsxs("group", { position: [0, billboardHeight, 0], children: [
43765
43813
  /* @__PURE__ */ jsxs("mesh", { position: [-0.25, 0, 0], children: [
43766
43814
  /* @__PURE__ */ jsx("planeGeometry", { args: [0.5, 0.05] }),
43767
43815
  /* @__PURE__ */ jsx("meshBasicMaterial", { color: 3355443 })
@@ -43790,7 +43838,7 @@ var init_GameCanvas3D2 = __esm({
43790
43838
  }
43791
43839
  );
43792
43840
  },
43793
- [selectedUnitId, handleUnitClick, resolveUnitFrame, unitScale]
43841
+ [selectedUnitId, handleUnitClick, resolveUnitFrame, unitScale, gridConfig]
43794
43842
  );
43795
43843
  const DefaultFeatureRenderer = useCallback(
43796
43844
  ({
@@ -43878,7 +43926,7 @@ var init_GameCanvas3D2 = __esm({
43878
43926
  {
43879
43927
  ref: containerRef,
43880
43928
  className: cn("game-canvas-3d relative w-full overflow-hidden", className),
43881
- style: { height: "85vh" },
43929
+ style: { flex: "1 1 0", minHeight: "400px" },
43882
43930
  "data-orientation": orientation,
43883
43931
  "data-camera-mode": cameraMode,
43884
43932
  "data-overlay": overlay,
@@ -44178,13 +44226,39 @@ var init_GameBoard3D = __esm({
44178
44226
  GameBoard3D.displayName = "GameBoard3D";
44179
44227
  }
44180
44228
  });
44181
- var GameShell;
44229
+ function getSlotContentRenderer2() {
44230
+ if (_scr) return _scr;
44231
+ const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
44232
+ _scr = mod.SlotContentRenderer;
44233
+ return _scr;
44234
+ }
44235
+ function resolveDescriptor(value, idPrefix) {
44236
+ if (value === null || value === void 0) return value;
44237
+ if (React85__default.isValidElement(value)) return value;
44238
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
44239
+ if (Array.isArray(value)) {
44240
+ return value.map((item, i) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: resolveDescriptor(item, `${idPrefix}-${i}`) }, i));
44241
+ }
44242
+ if (typeof value === "object") {
44243
+ const rec = value;
44244
+ if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
44245
+ const { type, props: nestedProps, _id, ...flatProps } = rec;
44246
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
44247
+ const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
44248
+ const SCR = getSlotContentRenderer2();
44249
+ return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
44250
+ }
44251
+ }
44252
+ return null;
44253
+ }
44254
+ var _scr, GameShell;
44182
44255
  var init_GameShell = __esm({
44183
44256
  "components/game/templates/GameShell.tsx"() {
44184
44257
  init_cn();
44185
44258
  init_Box();
44186
44259
  init_Stack();
44187
44260
  init_Typography();
44261
+ _scr = null;
44188
44262
  GameShell = ({
44189
44263
  appName = "Game",
44190
44264
  hud,
@@ -44233,7 +44307,7 @@ var init_GameShell = __esm({
44233
44307
  children: appName
44234
44308
  }
44235
44309
  ),
44236
- hud && /* @__PURE__ */ jsx(Box, { className: "game-shell__hud", children: hud })
44310
+ hud && /* @__PURE__ */ jsx(Box, { className: "game-shell__hud", children: resolveDescriptor(hud, "gs-hud") })
44237
44311
  ]
44238
44312
  }
44239
44313
  ),
@@ -44246,7 +44320,7 @@ var init_GameShell = __esm({
44246
44320
  overflow: "hidden",
44247
44321
  position: "relative"
44248
44322
  },
44249
- children
44323
+ children: resolveDescriptor(children, "gs-children")
44250
44324
  }
44251
44325
  )
44252
44326
  ]
@@ -44256,7 +44330,32 @@ var init_GameShell = __esm({
44256
44330
  GameShell.displayName = "GameShell";
44257
44331
  }
44258
44332
  });
44259
- var GameTemplate;
44333
+ function getSlotContentRenderer3() {
44334
+ if (_scr2) return _scr2;
44335
+ const mod = (init_UISlotRenderer(), __toCommonJS(UISlotRenderer_exports));
44336
+ _scr2 = mod.SlotContentRenderer;
44337
+ return _scr2;
44338
+ }
44339
+ function resolveDescriptor2(value, idPrefix) {
44340
+ if (value === null || value === void 0) return value;
44341
+ if (React85__default.isValidElement(value)) return value;
44342
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
44343
+ if (Array.isArray(value)) {
44344
+ return value.map((item, i) => /* @__PURE__ */ jsx(React85__default.Fragment, { children: resolveDescriptor2(item, `${idPrefix}-${i}`) }, i));
44345
+ }
44346
+ if (typeof value === "object") {
44347
+ const rec = value;
44348
+ if (typeof rec.type === "string" && getComponentForPattern(rec.type) !== null) {
44349
+ const { type, props: nestedProps, _id, ...flatProps } = rec;
44350
+ const resolvedProps = nestedProps !== void 0 ? nestedProps : flatProps;
44351
+ const content = { id: _id ?? idPrefix, pattern: type, props: resolvedProps, priority: 0 };
44352
+ const SCR = getSlotContentRenderer3();
44353
+ return /* @__PURE__ */ jsx(SCR, { content, onDismiss: () => void 0 });
44354
+ }
44355
+ }
44356
+ return null;
44357
+ }
44358
+ var _scr2, GameTemplate;
44260
44359
  var init_GameTemplate = __esm({
44261
44360
  "components/game/templates/GameTemplate.tsx"() {
44262
44361
  init_cn();
@@ -44264,6 +44363,7 @@ var init_GameTemplate = __esm({
44264
44363
  init_Stack();
44265
44364
  init_Typography();
44266
44365
  init_Button();
44366
+ _scr2 = null;
44267
44367
  GameTemplate = ({
44268
44368
  entity,
44269
44369
  title = "Game",
@@ -44331,13 +44431,13 @@ var init_GameTemplate = __esm({
44331
44431
  fullWidth: true,
44332
44432
  className: "flex-1 bg-muted",
44333
44433
  children: [
44334
- children,
44434
+ resolveDescriptor2(children, "gt-children"),
44335
44435
  hud && /* @__PURE__ */ jsx(
44336
44436
  Box,
44337
44437
  {
44338
44438
  position: "absolute",
44339
44439
  className: "top-0 left-0 right-0 pointer-events-none",
44340
- children: /* @__PURE__ */ jsx(Box, { padding: "md", className: "pointer-events-auto w-fit", children: hud })
44440
+ children: /* @__PURE__ */ jsx(Box, { padding: "md", className: "pointer-events-auto w-fit", children: resolveDescriptor2(hud, "gt-hud") })
44341
44441
  }
44342
44442
  )
44343
44443
  ]
@@ -44362,7 +44462,7 @@ var init_GameTemplate = __esm({
44362
44462
  children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: "Debug Panel" })
44363
44463
  }
44364
44464
  ),
44365
- /* @__PURE__ */ jsx(Box, { padding: "md", children: debugPanel })
44465
+ /* @__PURE__ */ jsx(Box, { padding: "md", children: resolveDescriptor2(debugPanel, "gt-debug") })
44366
44466
  ]
44367
44467
  }
44368
44468
  )
@@ -52922,8 +53022,8 @@ function getSlotFallback(slot, config) {
52922
53022
  const variant = SLOT_SKELETON_MAP[slot] ?? "text";
52923
53023
  return /* @__PURE__ */ jsx(Skeleton, { variant });
52924
53024
  }
52925
- function getComponentForPattern(patternType) {
52926
- const mapping = getComponentForPattern$1(patternType);
53025
+ function getComponentForPattern3(patternType) {
53026
+ const mapping = getComponentForPattern(patternType);
52927
53027
  if (!mapping) {
52928
53028
  return null;
52929
53029
  }
@@ -53445,7 +53545,7 @@ function isPatternConfig(value) {
53445
53545
  if (value instanceof Date) return false;
53446
53546
  if (typeof value === "function") return false;
53447
53547
  const record = value;
53448
- return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
53548
+ return "type" in record && typeof record.type === "string" && getComponentForPattern(record.type) !== null;
53449
53549
  }
53450
53550
  function isPlainConfigObject(value) {
53451
53551
  if (React85__default.isValidElement(value)) return false;
@@ -53553,7 +53653,8 @@ function SlotContentRenderer({
53553
53653
  entityDef = schemaCtx.entities.get(linkedEntity);
53554
53654
  }
53555
53655
  }
53556
- const PatternComponent = getComponentForPattern(content.pattern);
53656
+ const orbitalName = schemaCtx && content.sourceTrait !== void 0 ? schemaCtx.orbitalsByTrait.get(content.sourceTrait) : void 0;
53657
+ const PatternComponent = getComponentForPattern3(content.pattern);
53557
53658
  if (PatternComponent) {
53558
53659
  const childrenConfig = content.props.children;
53559
53660
  const isSingleChild = typeof childrenConfig === "string" || typeof childrenConfig === "object" && childrenConfig !== null && !Array.isArray(childrenConfig) && "type" in childrenConfig;
@@ -53651,6 +53752,7 @@ function SlotContentRenderer({
53651
53752
  "data-orb-entity": content.entity,
53652
53753
  "data-orb-path": myPath,
53653
53754
  "data-orb-pattern": content.pattern,
53755
+ "data-orb-orbital": orbitalName,
53654
53756
  children: renderedChildren !== void 0 ? /* @__PURE__ */ jsx(PatternComponent, { ...finalProps, children: renderedChildren }) : /* @__PURE__ */ jsx(PatternComponent, { ...finalProps })
53655
53757
  }
53656
53758
  );
@@ -53670,6 +53772,7 @@ function SlotContentRenderer({
53670
53772
  "data-orb-entity": content.entity,
53671
53773
  "data-orb-path": patternPath ?? "root",
53672
53774
  "data-orb-pattern": content.pattern,
53775
+ "data-orb-orbital": orbitalName,
53673
53776
  children: content.props.children ?? /* @__PURE__ */ jsxs(Box, { className: "p-4 text-sm text-muted-foreground border border-dashed border-border rounded", children: [
53674
53777
  "Unknown pattern: ",
53675
53778
  content.pattern,