@almadar/ui 5.68.0 → 5.70.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.
@@ -7135,6 +7135,14 @@ var init_ControlButton = __esm({
7135
7135
  }
7136
7136
  });
7137
7137
 
7138
+ // components/game/organisms/utils/spriteSheetConstants.ts
7139
+ var SHEET_COLUMNS;
7140
+ var init_spriteSheetConstants = __esm({
7141
+ "components/game/organisms/utils/spriteSheetConstants.ts"() {
7142
+ SHEET_COLUMNS = 8;
7143
+ }
7144
+ });
7145
+
7138
7146
  // components/game/organisms/utils/spriteAnimation.ts
7139
7147
  function inferDirection(dx, dy) {
7140
7148
  if (dx === 0 && dy === 0) return "se";
@@ -11802,7 +11810,13 @@ function IsometricCanvas({
11802
11810
  const img = unitSpriteUrl ? getImage(unitSpriteUrl) : null;
11803
11811
  const unitDrawH = scaledFloorHeight * spriteHeightRatio * unitScale;
11804
11812
  const maxUnitW = scaledTileWidth * spriteMaxWidthRatio * unitScale;
11805
- const ar = img ? img.naturalWidth / img.naturalHeight : 0.5;
11813
+ const SHEET_ROWS = 5;
11814
+ const sheetFrameW = img ? img.naturalWidth / SHEET_COLUMNS : 0;
11815
+ const sheetFrameH = img ? img.naturalHeight / SHEET_ROWS : 0;
11816
+ const imgIsSheet = img ? img.naturalWidth % SHEET_COLUMNS === 0 && img.naturalHeight % SHEET_ROWS === 0 && Math.abs(sheetFrameW - sheetFrameH) < 2 : false;
11817
+ const frameW = imgIsSheet ? sheetFrameW : img?.naturalWidth ?? 1;
11818
+ const frameH = imgIsSheet ? sheetFrameH : img?.naturalHeight ?? 1;
11819
+ const ar = frameW / (frameH || 1);
11806
11820
  let drawH = unitDrawH;
11807
11821
  let drawW = unitDrawH * ar;
11808
11822
  if (drawW > maxUnitW) {
@@ -11816,7 +11830,11 @@ function IsometricCanvas({
11816
11830
  ctx.save();
11817
11831
  ctx.globalAlpha = 0.25;
11818
11832
  if (img) {
11819
- ctx.drawImage(img, ghostCenterX - drawW / 2, ghostGroundY - drawH, drawW, drawH);
11833
+ if (imgIsSheet) {
11834
+ ctx.drawImage(img, 0, 0, sheetFrameW, sheetFrameH, ghostCenterX - drawW / 2, ghostGroundY - drawH, drawW, drawH);
11835
+ } else {
11836
+ ctx.drawImage(img, ghostCenterX - drawW / 2, ghostGroundY - drawH, drawW, drawH);
11837
+ }
11820
11838
  } else {
11821
11839
  const color = unit.team === "player" ? "#3b82f6" : unit.team === "enemy" ? "#ef4444" : "#6b7280";
11822
11840
  ctx.beginPath();
@@ -11860,14 +11878,21 @@ function IsometricCanvas({
11860
11878
  ctx.restore();
11861
11879
  } else if (img) {
11862
11880
  const spriteY = groundY - drawH - breatheOffset;
11881
+ const drawUnit = (x) => {
11882
+ if (imgIsSheet) {
11883
+ ctx.drawImage(img, 0, 0, sheetFrameW, sheetFrameH, x, spriteY, drawW, drawH);
11884
+ } else {
11885
+ ctx.drawImage(img, x, spriteY, drawW, drawH);
11886
+ }
11887
+ };
11863
11888
  if (unit.team) {
11864
11889
  ctx.save();
11865
11890
  ctx.shadowColor = unit.team === "player" ? "rgba(0, 150, 255, 0.6)" : "rgba(255, 50, 50, 0.6)";
11866
11891
  ctx.shadowBlur = 12 * scale;
11867
- ctx.drawImage(img, centerX - drawW / 2, spriteY, drawW, drawH);
11892
+ drawUnit(centerX - drawW / 2);
11868
11893
  ctx.restore();
11869
11894
  } else {
11870
- ctx.drawImage(img, centerX - drawW / 2, spriteY, drawW, drawH);
11895
+ drawUnit(centerX - drawW / 2);
11871
11896
  }
11872
11897
  } else {
11873
11898
  const color = unit.team === "player" ? "#3b82f6" : unit.team === "enemy" ? "#ef4444" : "#6b7280";
@@ -12160,6 +12185,7 @@ var init_IsometricCanvas = __esm({
12160
12185
  init_useUnitSpriteAtlas();
12161
12186
  init_verificationRegistry();
12162
12187
  init_isometric();
12188
+ init_spriteSheetConstants();
12163
12189
  IsometricCanvas.displayName = "IsometricCanvas";
12164
12190
  IsometricCanvas_default = IsometricCanvas;
12165
12191
  }
@@ -45019,35 +45045,44 @@ var init_HexStrategyBoard = __esm({
45019
45045
  }
45020
45046
  });
45021
45047
  function HolidayRunnerBoard({
45022
- backgroundImage,
45048
+ tiles,
45049
+ units,
45050
+ features,
45051
+ assetManifest,
45023
45052
  assetBaseUrl,
45024
- width = 800,
45025
- height = 400,
45026
- fps = 60,
45053
+ scale = 0.45,
45054
+ showMinimap = false,
45055
+ enableCamera = true,
45056
+ tileClickEvent,
45057
+ unitClickEvent,
45027
45058
  isLoading,
45028
45059
  error,
45029
45060
  className
45030
45061
  }) {
45031
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("holiday-runner-board relative w-full h-full", className), children: [
45032
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40 z-10", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white text-sm", children: "Loading\u2026" }) }),
45033
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/60 z-10", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-400 text-sm", children: error.message }) }),
45034
- /* @__PURE__ */ jsxRuntime.jsx(
45035
- GameCanvas2D,
45036
- {
45037
- width,
45038
- height,
45039
- fps,
45040
- backgroundImage: backgroundImage ?? "",
45041
- assetBaseUrl
45042
- }
45043
- )
45044
- ] });
45062
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("holiday-runner-board relative w-full h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
45063
+ IsometricCanvas_default,
45064
+ {
45065
+ tileLayout: "flat",
45066
+ tiles,
45067
+ units,
45068
+ features,
45069
+ assetManifest,
45070
+ assetBaseUrl,
45071
+ scale,
45072
+ showMinimap,
45073
+ enableCamera,
45074
+ tileClickEvent,
45075
+ unitClickEvent,
45076
+ isLoading,
45077
+ error
45078
+ }
45079
+ ) });
45045
45080
  }
45046
45081
  var init_HolidayRunnerBoard = __esm({
45047
45082
  "components/game/organisms/HolidayRunnerBoard.tsx"() {
45048
45083
  "use client";
45049
45084
  init_cn();
45050
- init_GameCanvas2D();
45085
+ init_IsometricCanvas();
45051
45086
  HolidayRunnerBoard.displayName = "HolidayRunnerBoard";
45052
45087
  }
45053
45088
  });
@@ -46765,25 +46800,36 @@ var init_PricingPageTemplate = __esm({
46765
46800
  }
46766
46801
  });
46767
46802
  function RacingBoard({
46768
- backgroundImage,
46803
+ tiles,
46804
+ units,
46805
+ features,
46806
+ assetManifest,
46769
46807
  assetBaseUrl,
46770
- width = 800,
46771
- height = 600,
46772
- fps = 60,
46773
- tickEvent,
46774
- drawEvent,
46808
+ scale = 0.45,
46809
+ showMinimap = true,
46810
+ enableCamera = true,
46811
+ tileClickEvent,
46812
+ unitClickEvent,
46813
+ isLoading,
46814
+ error,
46775
46815
  className
46776
46816
  }) {
46777
46817
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("racing-board relative w-full h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
46778
- GameCanvas2D,
46818
+ IsometricCanvas_default,
46779
46819
  {
46780
- backgroundImage,
46820
+ tileLayout: "flat",
46821
+ tiles,
46822
+ units,
46823
+ features,
46824
+ assetManifest,
46781
46825
  assetBaseUrl,
46782
- width,
46783
- height,
46784
- fps,
46785
- tickEvent: typeof tickEvent === "string" ? tickEvent : void 0,
46786
- drawEvent: typeof drawEvent === "string" ? drawEvent : void 0
46826
+ scale,
46827
+ showMinimap,
46828
+ enableCamera,
46829
+ tileClickEvent,
46830
+ unitClickEvent,
46831
+ isLoading,
46832
+ error
46787
46833
  }
46788
46834
  ) });
46789
46835
  }
@@ -46791,7 +46837,7 @@ var init_RacingBoard = __esm({
46791
46837
  "components/game/organisms/RacingBoard.tsx"() {
46792
46838
  "use client";
46793
46839
  init_cn();
46794
- init_GameCanvas2D();
46840
+ init_IsometricCanvas();
46795
46841
  RacingBoard.displayName = "RacingBoard";
46796
46842
  }
46797
46843
  });
@@ -50024,35 +50070,44 @@ var init_SokobanBoard = __esm({
50024
50070
  }
50025
50071
  });
50026
50072
  function SpaceShmupBoard({
50027
- backgroundImage,
50073
+ tiles,
50074
+ units,
50075
+ features,
50076
+ assetManifest,
50028
50077
  assetBaseUrl,
50029
- width = 800,
50030
- height = 600,
50031
- fps = 60,
50078
+ scale = 0.45,
50079
+ showMinimap = false,
50080
+ enableCamera = true,
50081
+ tileClickEvent,
50082
+ unitClickEvent,
50032
50083
  isLoading,
50033
50084
  error,
50034
50085
  className
50035
50086
  }) {
50036
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-shmup-board relative w-full h-full", className), children: [
50037
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/60 z-10", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white text-sm", children: "Loading\u2026" }) }),
50038
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-red-900/60 z-10", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white text-sm", children: error.message }) }),
50039
- /* @__PURE__ */ jsxRuntime.jsx(
50040
- GameCanvas2D,
50041
- {
50042
- backgroundImage,
50043
- assetBaseUrl,
50044
- width,
50045
- height,
50046
- fps
50047
- }
50048
- )
50049
- ] });
50087
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-shmup-board relative w-full h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
50088
+ IsometricCanvas_default,
50089
+ {
50090
+ tileLayout: "flat",
50091
+ tiles,
50092
+ units,
50093
+ features,
50094
+ assetManifest,
50095
+ assetBaseUrl,
50096
+ scale,
50097
+ showMinimap,
50098
+ enableCamera,
50099
+ tileClickEvent,
50100
+ unitClickEvent,
50101
+ isLoading,
50102
+ error
50103
+ }
50104
+ ) });
50050
50105
  }
50051
50106
  var init_SpaceShmupBoard = __esm({
50052
50107
  "components/game/organisms/SpaceShmupBoard.tsx"() {
50053
50108
  "use client";
50054
50109
  init_cn();
50055
- init_GameCanvas2D();
50110
+ init_IsometricCanvas();
50056
50111
  SpaceShmupBoard.displayName = "SpaceShmupBoard";
50057
50112
  }
50058
50113
  });
@@ -7088,6 +7088,14 @@ var init_ControlButton = __esm({
7088
7088
  }
7089
7089
  });
7090
7090
 
7091
+ // components/game/organisms/utils/spriteSheetConstants.ts
7092
+ var SHEET_COLUMNS;
7093
+ var init_spriteSheetConstants = __esm({
7094
+ "components/game/organisms/utils/spriteSheetConstants.ts"() {
7095
+ SHEET_COLUMNS = 8;
7096
+ }
7097
+ });
7098
+
7091
7099
  // components/game/organisms/utils/spriteAnimation.ts
7092
7100
  function inferDirection(dx, dy) {
7093
7101
  if (dx === 0 && dy === 0) return "se";
@@ -11755,7 +11763,13 @@ function IsometricCanvas({
11755
11763
  const img = unitSpriteUrl ? getImage(unitSpriteUrl) : null;
11756
11764
  const unitDrawH = scaledFloorHeight * spriteHeightRatio * unitScale;
11757
11765
  const maxUnitW = scaledTileWidth * spriteMaxWidthRatio * unitScale;
11758
- const ar = img ? img.naturalWidth / img.naturalHeight : 0.5;
11766
+ const SHEET_ROWS = 5;
11767
+ const sheetFrameW = img ? img.naturalWidth / SHEET_COLUMNS : 0;
11768
+ const sheetFrameH = img ? img.naturalHeight / SHEET_ROWS : 0;
11769
+ const imgIsSheet = img ? img.naturalWidth % SHEET_COLUMNS === 0 && img.naturalHeight % SHEET_ROWS === 0 && Math.abs(sheetFrameW - sheetFrameH) < 2 : false;
11770
+ const frameW = imgIsSheet ? sheetFrameW : img?.naturalWidth ?? 1;
11771
+ const frameH = imgIsSheet ? sheetFrameH : img?.naturalHeight ?? 1;
11772
+ const ar = frameW / (frameH || 1);
11759
11773
  let drawH = unitDrawH;
11760
11774
  let drawW = unitDrawH * ar;
11761
11775
  if (drawW > maxUnitW) {
@@ -11769,7 +11783,11 @@ function IsometricCanvas({
11769
11783
  ctx.save();
11770
11784
  ctx.globalAlpha = 0.25;
11771
11785
  if (img) {
11772
- ctx.drawImage(img, ghostCenterX - drawW / 2, ghostGroundY - drawH, drawW, drawH);
11786
+ if (imgIsSheet) {
11787
+ ctx.drawImage(img, 0, 0, sheetFrameW, sheetFrameH, ghostCenterX - drawW / 2, ghostGroundY - drawH, drawW, drawH);
11788
+ } else {
11789
+ ctx.drawImage(img, ghostCenterX - drawW / 2, ghostGroundY - drawH, drawW, drawH);
11790
+ }
11773
11791
  } else {
11774
11792
  const color = unit.team === "player" ? "#3b82f6" : unit.team === "enemy" ? "#ef4444" : "#6b7280";
11775
11793
  ctx.beginPath();
@@ -11813,14 +11831,21 @@ function IsometricCanvas({
11813
11831
  ctx.restore();
11814
11832
  } else if (img) {
11815
11833
  const spriteY = groundY - drawH - breatheOffset;
11834
+ const drawUnit = (x) => {
11835
+ if (imgIsSheet) {
11836
+ ctx.drawImage(img, 0, 0, sheetFrameW, sheetFrameH, x, spriteY, drawW, drawH);
11837
+ } else {
11838
+ ctx.drawImage(img, x, spriteY, drawW, drawH);
11839
+ }
11840
+ };
11816
11841
  if (unit.team) {
11817
11842
  ctx.save();
11818
11843
  ctx.shadowColor = unit.team === "player" ? "rgba(0, 150, 255, 0.6)" : "rgba(255, 50, 50, 0.6)";
11819
11844
  ctx.shadowBlur = 12 * scale;
11820
- ctx.drawImage(img, centerX - drawW / 2, spriteY, drawW, drawH);
11845
+ drawUnit(centerX - drawW / 2);
11821
11846
  ctx.restore();
11822
11847
  } else {
11823
- ctx.drawImage(img, centerX - drawW / 2, spriteY, drawW, drawH);
11848
+ drawUnit(centerX - drawW / 2);
11824
11849
  }
11825
11850
  } else {
11826
11851
  const color = unit.team === "player" ? "#3b82f6" : unit.team === "enemy" ? "#ef4444" : "#6b7280";
@@ -12113,6 +12138,7 @@ var init_IsometricCanvas = __esm({
12113
12138
  init_useUnitSpriteAtlas();
12114
12139
  init_verificationRegistry();
12115
12140
  init_isometric();
12141
+ init_spriteSheetConstants();
12116
12142
  IsometricCanvas.displayName = "IsometricCanvas";
12117
12143
  IsometricCanvas_default = IsometricCanvas;
12118
12144
  }
@@ -44972,35 +44998,44 @@ var init_HexStrategyBoard = __esm({
44972
44998
  }
44973
44999
  });
44974
45000
  function HolidayRunnerBoard({
44975
- backgroundImage,
45001
+ tiles,
45002
+ units,
45003
+ features,
45004
+ assetManifest,
44976
45005
  assetBaseUrl,
44977
- width = 800,
44978
- height = 400,
44979
- fps = 60,
45006
+ scale = 0.45,
45007
+ showMinimap = false,
45008
+ enableCamera = true,
45009
+ tileClickEvent,
45010
+ unitClickEvent,
44980
45011
  isLoading,
44981
45012
  error,
44982
45013
  className
44983
45014
  }) {
44984
- return /* @__PURE__ */ jsxs("div", { className: cn("holiday-runner-board relative w-full h-full", className), children: [
44985
- isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40 z-10", children: /* @__PURE__ */ jsx("span", { className: "text-white text-sm", children: "Loading\u2026" }) }),
44986
- error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/60 z-10", children: /* @__PURE__ */ jsx("span", { className: "text-red-400 text-sm", children: error.message }) }),
44987
- /* @__PURE__ */ jsx(
44988
- GameCanvas2D,
44989
- {
44990
- width,
44991
- height,
44992
- fps,
44993
- backgroundImage: backgroundImage ?? "",
44994
- assetBaseUrl
44995
- }
44996
- )
44997
- ] });
45015
+ return /* @__PURE__ */ jsx("div", { className: cn("holiday-runner-board relative w-full h-full", className), children: /* @__PURE__ */ jsx(
45016
+ IsometricCanvas_default,
45017
+ {
45018
+ tileLayout: "flat",
45019
+ tiles,
45020
+ units,
45021
+ features,
45022
+ assetManifest,
45023
+ assetBaseUrl,
45024
+ scale,
45025
+ showMinimap,
45026
+ enableCamera,
45027
+ tileClickEvent,
45028
+ unitClickEvent,
45029
+ isLoading,
45030
+ error
45031
+ }
45032
+ ) });
44998
45033
  }
44999
45034
  var init_HolidayRunnerBoard = __esm({
45000
45035
  "components/game/organisms/HolidayRunnerBoard.tsx"() {
45001
45036
  "use client";
45002
45037
  init_cn();
45003
- init_GameCanvas2D();
45038
+ init_IsometricCanvas();
45004
45039
  HolidayRunnerBoard.displayName = "HolidayRunnerBoard";
45005
45040
  }
45006
45041
  });
@@ -46718,25 +46753,36 @@ var init_PricingPageTemplate = __esm({
46718
46753
  }
46719
46754
  });
46720
46755
  function RacingBoard({
46721
- backgroundImage,
46756
+ tiles,
46757
+ units,
46758
+ features,
46759
+ assetManifest,
46722
46760
  assetBaseUrl,
46723
- width = 800,
46724
- height = 600,
46725
- fps = 60,
46726
- tickEvent,
46727
- drawEvent,
46761
+ scale = 0.45,
46762
+ showMinimap = true,
46763
+ enableCamera = true,
46764
+ tileClickEvent,
46765
+ unitClickEvent,
46766
+ isLoading,
46767
+ error,
46728
46768
  className
46729
46769
  }) {
46730
46770
  return /* @__PURE__ */ jsx("div", { className: cn("racing-board relative w-full h-full", className), children: /* @__PURE__ */ jsx(
46731
- GameCanvas2D,
46771
+ IsometricCanvas_default,
46732
46772
  {
46733
- backgroundImage,
46773
+ tileLayout: "flat",
46774
+ tiles,
46775
+ units,
46776
+ features,
46777
+ assetManifest,
46734
46778
  assetBaseUrl,
46735
- width,
46736
- height,
46737
- fps,
46738
- tickEvent: typeof tickEvent === "string" ? tickEvent : void 0,
46739
- drawEvent: typeof drawEvent === "string" ? drawEvent : void 0
46779
+ scale,
46780
+ showMinimap,
46781
+ enableCamera,
46782
+ tileClickEvent,
46783
+ unitClickEvent,
46784
+ isLoading,
46785
+ error
46740
46786
  }
46741
46787
  ) });
46742
46788
  }
@@ -46744,7 +46790,7 @@ var init_RacingBoard = __esm({
46744
46790
  "components/game/organisms/RacingBoard.tsx"() {
46745
46791
  "use client";
46746
46792
  init_cn();
46747
- init_GameCanvas2D();
46793
+ init_IsometricCanvas();
46748
46794
  RacingBoard.displayName = "RacingBoard";
46749
46795
  }
46750
46796
  });
@@ -49977,35 +50023,44 @@ var init_SokobanBoard = __esm({
49977
50023
  }
49978
50024
  });
49979
50025
  function SpaceShmupBoard({
49980
- backgroundImage,
50026
+ tiles,
50027
+ units,
50028
+ features,
50029
+ assetManifest,
49981
50030
  assetBaseUrl,
49982
- width = 800,
49983
- height = 600,
49984
- fps = 60,
50031
+ scale = 0.45,
50032
+ showMinimap = false,
50033
+ enableCamera = true,
50034
+ tileClickEvent,
50035
+ unitClickEvent,
49985
50036
  isLoading,
49986
50037
  error,
49987
50038
  className
49988
50039
  }) {
49989
- return /* @__PURE__ */ jsxs("div", { className: cn("space-shmup-board relative w-full h-full", className), children: [
49990
- isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-black/60 z-10", children: /* @__PURE__ */ jsx("span", { className: "text-white text-sm", children: "Loading\u2026" }) }),
49991
- error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-red-900/60 z-10", children: /* @__PURE__ */ jsx("span", { className: "text-white text-sm", children: error.message }) }),
49992
- /* @__PURE__ */ jsx(
49993
- GameCanvas2D,
49994
- {
49995
- backgroundImage,
49996
- assetBaseUrl,
49997
- width,
49998
- height,
49999
- fps
50000
- }
50001
- )
50002
- ] });
50040
+ return /* @__PURE__ */ jsx("div", { className: cn("space-shmup-board relative w-full h-full", className), children: /* @__PURE__ */ jsx(
50041
+ IsometricCanvas_default,
50042
+ {
50043
+ tileLayout: "flat",
50044
+ tiles,
50045
+ units,
50046
+ features,
50047
+ assetManifest,
50048
+ assetBaseUrl,
50049
+ scale,
50050
+ showMinimap,
50051
+ enableCamera,
50052
+ tileClickEvent,
50053
+ unitClickEvent,
50054
+ isLoading,
50055
+ error
50056
+ }
50057
+ ) });
50003
50058
  }
50004
50059
  var init_SpaceShmupBoard = __esm({
50005
50060
  "components/game/organisms/SpaceShmupBoard.tsx"() {
50006
50061
  "use client";
50007
50062
  init_cn();
50008
- init_GameCanvas2D();
50063
+ init_IsometricCanvas();
50009
50064
  SpaceShmupBoard.displayName = "SpaceShmupBoard";
50010
50065
  }
50011
50066
  });