@industry-theme/repository-composition-panels 0.2.57 → 0.2.59

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 (43) hide show
  1. package/dist/{BufferResource-DEjDe1s8.js → BufferResource-BCBfCsT6.js} +5 -80
  2. package/dist/BufferResource-BCBfCsT6.js.map +1 -0
  3. package/dist/{CanvasRenderer-D2eDumWy.js → CanvasRenderer-2yEMbusr.js} +3 -339
  4. package/dist/CanvasRenderer-2yEMbusr.js.map +1 -0
  5. package/dist/{Filter-BSpiVWUN.js → Filter-CdzQNTtc.js} +2 -2
  6. package/dist/{Filter-BSpiVWUN.js.map → Filter-CdzQNTtc.js.map} +1 -1
  7. package/dist/{RenderTargetSystem-3-YKfxPi.js → RenderTargetSystem-CvocGhAO.js} +3 -3
  8. package/dist/{RenderTargetSystem-3-YKfxPi.js.map → RenderTargetSystem-CvocGhAO.js.map} +1 -1
  9. package/dist/{WebGLRenderer-BKhoAof0.js → WebGLRenderer-CsAZzI7W.js} +4 -4
  10. package/dist/{WebGLRenderer-BKhoAof0.js.map → WebGLRenderer-CsAZzI7W.js.map} +1 -1
  11. package/dist/{WebGPURenderer-BMMCBjut.js → WebGPURenderer-D2GRpSb3.js} +4 -4
  12. package/dist/{WebGPURenderer-BMMCBjut.js.map → WebGPURenderer-D2GRpSb3.js.map} +1 -1
  13. package/dist/{browserAll-BaiHieOj.js → browserAll-BG2Mm9Lt.js} +3 -3
  14. package/dist/{browserAll-BaiHieOj.js.map → browserAll-BG2Mm9Lt.js.map} +1 -1
  15. package/dist/{index-72-eqzyq.js → index-L48T6UlC.js} +2096 -467
  16. package/dist/index-L48T6UlC.js.map +1 -0
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/{init-CZ5jJ8OJ.js → init-DWPvbIZ9.js} +3 -3
  20. package/dist/{init-CZ5jJ8OJ.js.map → init-DWPvbIZ9.js.map} +1 -1
  21. package/dist/panels/CollectionMapPanel.d.ts +3 -0
  22. package/dist/panels/CollectionMapPanel.d.ts.map +1 -1
  23. package/dist/panels/GitProjectsMapPanel.d.ts +3 -0
  24. package/dist/panels/GitProjectsMapPanel.d.ts.map +1 -1
  25. package/dist/panels/overworld-map/OverworldMapPanel.d.ts +3 -0
  26. package/dist/panels/overworld-map/OverworldMapPanel.d.ts.map +1 -1
  27. package/dist/panels/overworld-map/dataConverter.d.ts +2 -0
  28. package/dist/panels/overworld-map/dataConverter.d.ts.map +1 -1
  29. package/dist/panels/overworld-map/genericMapper.d.ts +12 -0
  30. package/dist/panels/overworld-map/genericMapper.d.ts.map +1 -1
  31. package/dist/panels/overworld-map/spriteGenerator.d.ts +8 -0
  32. package/dist/panels/overworld-map/spriteGenerator.d.ts.map +1 -1
  33. package/dist/panels/overworld-map/types.d.ts +4 -0
  34. package/dist/panels/overworld-map/types.d.ts.map +1 -1
  35. package/dist/panels.bundle.js +35 -39
  36. package/dist/webworkerAll-MEZKzuuk.js +3 -0
  37. package/dist/webworkerAll-MEZKzuuk.js.map +1 -0
  38. package/package.json +1 -1
  39. package/dist/BufferResource-DEjDe1s8.js.map +0 -1
  40. package/dist/CanvasRenderer-D2eDumWy.js.map +0 -1
  41. package/dist/index-72-eqzyq.js.map +0 -1
  42. package/dist/webworkerAll-Ccu7Tp4h.js +0 -3
  43. package/dist/webworkerAll-Ccu7Tp4h.js.map +0 -1
@@ -6715,18 +6715,18 @@ function ZoomEvent(type2, {
6715
6715
  _: { value: dispatch2 }
6716
6716
  });
6717
6717
  }
6718
- function Transform(k2, x2, y2) {
6718
+ function Transform$1(k2, x2, y2) {
6719
6719
  this.k = k2;
6720
6720
  this.x = x2;
6721
6721
  this.y = y2;
6722
6722
  }
6723
- Transform.prototype = {
6724
- constructor: Transform,
6723
+ Transform$1.prototype = {
6724
+ constructor: Transform$1,
6725
6725
  scale: function(k2) {
6726
- return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
6726
+ return k2 === 1 ? this : new Transform$1(this.k * k2, this.x, this.y);
6727
6727
  },
6728
6728
  translate: function(x2, y2) {
6729
- return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
6729
+ return x2 === 0 & y2 === 0 ? this : new Transform$1(this.k, this.x + this.k * x2, this.y + this.k * y2);
6730
6730
  },
6731
6731
  apply: function(point) {
6732
6732
  return [point[0] * this.k + this.x, point[1] * this.k + this.y];
@@ -6756,8 +6756,8 @@ Transform.prototype = {
6756
6756
  return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
6757
6757
  }
6758
6758
  };
6759
- var identity$1 = new Transform(1, 0, 0);
6760
- transform.prototype = Transform.prototype;
6759
+ var identity$1 = new Transform$1(1, 0, 0);
6760
+ transform.prototype = Transform$1.prototype;
6761
6761
  function transform(node) {
6762
6762
  while (!node.__zoom) if (!(node = node.parentNode)) return identity$1;
6763
6763
  return node.__zoom;
@@ -6847,11 +6847,11 @@ function zoom() {
6847
6847
  };
6848
6848
  function scale(transform2, k2) {
6849
6849
  k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
6850
- return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
6850
+ return k2 === transform2.k ? transform2 : new Transform$1(k2, transform2.x, transform2.y);
6851
6851
  }
6852
6852
  function translate(transform2, p0, p1) {
6853
6853
  var x2 = p0[0] - p1[0] * transform2.k, y2 = p0[1] - p1[1] * transform2.k;
6854
- return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
6854
+ return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform$1(transform2.k, x2, y2);
6855
6855
  }
6856
6856
  function centroid(extent2) {
6857
6857
  return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
@@ -6867,7 +6867,7 @@ function zoom() {
6867
6867
  if (t2 === 1) t2 = b2;
6868
6868
  else {
6869
6869
  var l2 = i2(t2), k2 = w2 / l2[2];
6870
- t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
6870
+ t2 = new Transform$1(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
6871
6871
  }
6872
6872
  g2.zoom(null, t2);
6873
6873
  };
@@ -60179,7 +60179,7 @@ const browserExt = {
60179
60179
  },
60180
60180
  test: () => true,
60181
60181
  load: async () => {
60182
- await import("./browserAll-BaiHieOj.js");
60182
+ await import("./browserAll-BG2Mm9Lt.js");
60183
60183
  }
60184
60184
  };
60185
60185
  const webworkerExt = {
@@ -60190,7 +60190,7 @@ const webworkerExt = {
60190
60190
  },
60191
60191
  test: () => typeof self !== "undefined" && self.WorkerGlobalScope !== void 0,
60192
60192
  load: async () => {
60193
- await import("./webworkerAll-Ccu7Tp4h.js");
60193
+ await import("./webworkerAll-MEZKzuuk.js");
60194
60194
  }
60195
60195
  };
60196
60196
  class ObservablePoint {
@@ -71179,19 +71179,19 @@ class Shader extends EventEmitter {
71179
71179
  this._ownedBindGroups = [];
71180
71180
  this._destroyed = false;
71181
71181
  let {
71182
- gpuProgram,
71183
- glProgram,
71182
+ gpuProgram: gpuProgram2,
71183
+ glProgram: glProgram2,
71184
71184
  groups,
71185
71185
  resources,
71186
71186
  compatibleRenderers,
71187
71187
  groupMap
71188
71188
  } = options;
71189
- this.gpuProgram = gpuProgram;
71190
- this.glProgram = glProgram;
71189
+ this.gpuProgram = gpuProgram2;
71190
+ this.glProgram = glProgram2;
71191
71191
  if (compatibleRenderers === void 0) {
71192
71192
  compatibleRenderers = 0;
71193
- if (gpuProgram) compatibleRenderers |= RendererType.WEBGPU;
71194
- if (glProgram) compatibleRenderers |= RendererType.WEBGL;
71193
+ if (gpuProgram2) compatibleRenderers |= RendererType.WEBGPU;
71194
+ if (glProgram2) compatibleRenderers |= RendererType.WEBGL;
71195
71195
  }
71196
71196
  this.compatibleRenderers = compatibleRenderers;
71197
71197
  const nameHash = {};
@@ -71200,9 +71200,9 @@ class Shader extends EventEmitter {
71200
71200
  }
71201
71201
  if (resources && groups) {
71202
71202
  throw new Error("[Shader] Cannot have both resources and groups");
71203
- } else if (!gpuProgram && groups && !groupMap) {
71203
+ } else if (!gpuProgram2 && groups && !groupMap) {
71204
71204
  throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");
71205
- } else if (!gpuProgram && groups && groupMap) {
71205
+ } else if (!gpuProgram2 && groups && groupMap) {
71206
71206
  for (const i2 in groupMap) {
71207
71207
  for (const j2 in groupMap[i2]) {
71208
71208
  const uniformName = groupMap[i2][j2];
@@ -71213,8 +71213,8 @@ class Shader extends EventEmitter {
71213
71213
  };
71214
71214
  }
71215
71215
  }
71216
- } else if (gpuProgram && groups && !groupMap) {
71217
- const groupData = gpuProgram.structsAndGroups.groups;
71216
+ } else if (gpuProgram2 && groups && !groupMap) {
71217
+ const groupData = gpuProgram2.structsAndGroups.groups;
71218
71218
  groupMap = {};
71219
71219
  groupData.forEach((data) => {
71220
71220
  groupMap[data.group] = groupMap[data.group] || {};
@@ -71224,8 +71224,8 @@ class Shader extends EventEmitter {
71224
71224
  } else if (resources) {
71225
71225
  groups = {};
71226
71226
  groupMap = {};
71227
- if (gpuProgram) {
71228
- const groupData = gpuProgram.structsAndGroups.groups;
71227
+ if (gpuProgram2) {
71228
+ const groupData = gpuProgram2.structsAndGroups.groups;
71229
71229
  groupData.forEach((data) => {
71230
71230
  groupMap[data.group] = groupMap[data.group] || {};
71231
71231
  groupMap[data.group][data.binding] = data.name;
@@ -71323,17 +71323,17 @@ class Shader extends EventEmitter {
71323
71323
  }
71324
71324
  static from(options) {
71325
71325
  const { gpu, gl, ...rest } = options;
71326
- let gpuProgram;
71327
- let glProgram;
71326
+ let gpuProgram2;
71327
+ let glProgram2;
71328
71328
  if (gpu) {
71329
- gpuProgram = GpuProgram.from(gpu);
71329
+ gpuProgram2 = GpuProgram.from(gpu);
71330
71330
  }
71331
71331
  if (gl) {
71332
- glProgram = GlProgram.from(gl);
71332
+ glProgram2 = GlProgram.from(gl);
71333
71333
  }
71334
71334
  return new Shader({
71335
- gpuProgram,
71336
- glProgram,
71335
+ gpuProgram: gpuProgram2,
71336
+ glProgram: glProgram2,
71337
71337
  ...rest
71338
71338
  });
71339
71339
  }
@@ -72433,19 +72433,19 @@ async function autoDetectRenderer(options) {
72433
72433
  for (let i2 = 0; i2 < preferredOrder.length; i2++) {
72434
72434
  const rendererType = preferredOrder[i2];
72435
72435
  if (rendererType === "webgpu" && await isWebGPUSupported()) {
72436
- const { WebGPURenderer } = await import("./WebGPURenderer-BMMCBjut.js");
72436
+ const { WebGPURenderer } = await import("./WebGPURenderer-D2GRpSb3.js");
72437
72437
  RendererClass = WebGPURenderer;
72438
72438
  finalOptions = { ...options, ...options.webgpu };
72439
72439
  break;
72440
72440
  } else if (rendererType === "webgl" && isWebGLSupported(
72441
72441
  options.failIfMajorPerformanceCaveat ?? AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat
72442
72442
  )) {
72443
- const { WebGLRenderer } = await import("./WebGLRenderer-BKhoAof0.js");
72443
+ const { WebGLRenderer } = await import("./WebGLRenderer-CsAZzI7W.js");
72444
72444
  RendererClass = WebGLRenderer;
72445
72445
  finalOptions = { ...options, ...options.webgl };
72446
72446
  break;
72447
72447
  } else if (rendererType === "canvas") {
72448
- const { CanvasRenderer } = await import("./CanvasRenderer-D2eDumWy.js");
72448
+ const { CanvasRenderer } = await import("./CanvasRenderer-2yEMbusr.js");
72449
72449
  RendererClass = CanvasRenderer;
72450
72450
  finalOptions = { ...options, ...options.canvasOptions };
72451
72451
  break;
@@ -75554,7 +75554,7 @@ function getBatchSamplersUniformGroup(maxTextures) {
75554
75554
  }
75555
75555
  class DefaultShader extends Shader {
75556
75556
  constructor(maxTextures) {
75557
- const glProgram = compileHighShaderGlProgram({
75557
+ const glProgram2 = compileHighShaderGlProgram({
75558
75558
  name: "batch",
75559
75559
  bits: [
75560
75560
  colorBitGl,
@@ -75562,7 +75562,7 @@ class DefaultShader extends Shader {
75562
75562
  roundPixelsBitGl
75563
75563
  ]
75564
75564
  });
75565
- const gpuProgram = compileHighShaderGpuProgram({
75565
+ const gpuProgram2 = compileHighShaderGpuProgram({
75566
75566
  name: "batch",
75567
75567
  bits: [
75568
75568
  colorBit,
@@ -75571,8 +75571,8 @@ class DefaultShader extends Shader {
75571
75571
  ]
75572
75572
  });
75573
75573
  super({
75574
- glProgram,
75575
- gpuProgram,
75574
+ glProgram: glProgram2,
75575
+ gpuProgram: gpuProgram2,
75576
75576
  resources: {
75577
75577
  batchSamplers: getBatchSamplersUniformGroup(maxTextures)
75578
75578
  }
@@ -80961,6 +80961,1646 @@ class Graphics extends ViewContainer {
80961
80961
  return this._callContextMethod("star", args);
80962
80962
  }
80963
80963
  }
80964
+ const _MeshGeometry = class _MeshGeometry2 extends Geometry {
80965
+ constructor(...args) {
80966
+ let options = args[0] ?? {};
80967
+ if (options instanceof Float32Array) {
80968
+ deprecation(v8_0_0, "use new MeshGeometry({ positions, uvs, indices }) instead");
80969
+ options = {
80970
+ positions: options,
80971
+ uvs: args[1],
80972
+ indices: args[2]
80973
+ };
80974
+ }
80975
+ options = { ..._MeshGeometry2.defaultOptions, ...options };
80976
+ const positions = options.positions || new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
80977
+ let uvs = options.uvs;
80978
+ if (!uvs) {
80979
+ if (options.positions) {
80980
+ uvs = new Float32Array(positions.length);
80981
+ } else {
80982
+ uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
80983
+ }
80984
+ }
80985
+ const indices = options.indices || new Uint32Array([0, 1, 2, 0, 2, 3]);
80986
+ const shrinkToFit = options.shrinkBuffersToFit;
80987
+ const positionBuffer = new Buffer({
80988
+ data: positions,
80989
+ label: "attribute-mesh-positions",
80990
+ shrinkToFit,
80991
+ usage: BufferUsage.VERTEX | BufferUsage.COPY_DST
80992
+ });
80993
+ const uvBuffer = new Buffer({
80994
+ data: uvs,
80995
+ label: "attribute-mesh-uvs",
80996
+ shrinkToFit,
80997
+ usage: BufferUsage.VERTEX | BufferUsage.COPY_DST
80998
+ });
80999
+ const indexBuffer = new Buffer({
81000
+ data: indices,
81001
+ label: "index-mesh-buffer",
81002
+ shrinkToFit,
81003
+ usage: BufferUsage.INDEX | BufferUsage.COPY_DST
81004
+ });
81005
+ super({
81006
+ attributes: {
81007
+ aPosition: {
81008
+ buffer: positionBuffer,
81009
+ format: "float32x2",
81010
+ stride: 2 * 4,
81011
+ offset: 0
81012
+ },
81013
+ aUV: {
81014
+ buffer: uvBuffer,
81015
+ format: "float32x2",
81016
+ stride: 2 * 4,
81017
+ offset: 0
81018
+ }
81019
+ },
81020
+ indexBuffer,
81021
+ topology: options.topology
81022
+ });
81023
+ this.batchMode = "auto";
81024
+ }
81025
+ /** The positions of the mesh. */
81026
+ get positions() {
81027
+ return this.attributes.aPosition.buffer.data;
81028
+ }
81029
+ /**
81030
+ * Set the positions of the mesh.
81031
+ * When setting the positions, its important that the uvs array is at least as long as the positions array.
81032
+ * otherwise the geometry will not be valid.
81033
+ * @param {Float32Array} value - The positions of the mesh.
81034
+ */
81035
+ set positions(value) {
81036
+ this.attributes.aPosition.buffer.data = value;
81037
+ }
81038
+ /** The UVs of the mesh. */
81039
+ get uvs() {
81040
+ return this.attributes.aUV.buffer.data;
81041
+ }
81042
+ /**
81043
+ * Set the UVs of the mesh.
81044
+ * Its important that the uvs array you set is at least as long as the positions array.
81045
+ * otherwise the geometry will not be valid.
81046
+ * @param {Float32Array} value - The UVs of the mesh.
81047
+ */
81048
+ set uvs(value) {
81049
+ this.attributes.aUV.buffer.data = value;
81050
+ }
81051
+ /** The indices of the mesh. */
81052
+ get indices() {
81053
+ return this.indexBuffer.data;
81054
+ }
81055
+ set indices(value) {
81056
+ this.indexBuffer.data = value;
81057
+ }
81058
+ };
81059
+ _MeshGeometry.defaultOptions = {
81060
+ topology: "triangle-list",
81061
+ shrinkBuffersToFit: false
81062
+ };
81063
+ let MeshGeometry = _MeshGeometry;
81064
+ class BatchableMesh {
81065
+ constructor() {
81066
+ this.batcherName = "default";
81067
+ this.packAsQuad = false;
81068
+ this.indexOffset = 0;
81069
+ this.attributeOffset = 0;
81070
+ this.roundPixels = 0;
81071
+ this._batcher = null;
81072
+ this._batch = null;
81073
+ this._textureMatrixUpdateId = -1;
81074
+ this._uvUpdateId = -1;
81075
+ }
81076
+ get blendMode() {
81077
+ return this.renderable.groupBlendMode;
81078
+ }
81079
+ get topology() {
81080
+ return this._topology || this.geometry.topology;
81081
+ }
81082
+ set topology(value) {
81083
+ this._topology = value;
81084
+ }
81085
+ reset() {
81086
+ this.renderable = null;
81087
+ this.texture = null;
81088
+ this._batcher = null;
81089
+ this._batch = null;
81090
+ this.geometry = null;
81091
+ this._uvUpdateId = -1;
81092
+ this._textureMatrixUpdateId = -1;
81093
+ }
81094
+ /**
81095
+ * Sets the texture for the batchable mesh.
81096
+ * As it does so, it resets the texture matrix update ID.
81097
+ * this is to ensure that the texture matrix is recalculated when the uvs are referenced
81098
+ * @param value - The texture to set.
81099
+ */
81100
+ setTexture(value) {
81101
+ if (this.texture === value) return;
81102
+ this.texture = value;
81103
+ this._textureMatrixUpdateId = -1;
81104
+ }
81105
+ get uvs() {
81106
+ const geometry = this.geometry;
81107
+ const uvBuffer = geometry.getBuffer("aUV");
81108
+ const uvs = uvBuffer.data;
81109
+ let transformedUvs = uvs;
81110
+ const textureMatrix = this.texture.textureMatrix;
81111
+ if (!textureMatrix.isSimple) {
81112
+ transformedUvs = this._transformedUvs;
81113
+ if (this._textureMatrixUpdateId !== textureMatrix._updateID || this._uvUpdateId !== uvBuffer._updateID) {
81114
+ if (!transformedUvs || transformedUvs.length < uvs.length) {
81115
+ transformedUvs = this._transformedUvs = new Float32Array(uvs.length);
81116
+ }
81117
+ this._textureMatrixUpdateId = textureMatrix._updateID;
81118
+ this._uvUpdateId = uvBuffer._updateID;
81119
+ textureMatrix.multiplyUvs(uvs, transformedUvs);
81120
+ }
81121
+ }
81122
+ return transformedUvs;
81123
+ }
81124
+ get positions() {
81125
+ return this.geometry.positions;
81126
+ }
81127
+ get indices() {
81128
+ return this.geometry.indices;
81129
+ }
81130
+ get color() {
81131
+ return this.renderable.groupColorAlpha;
81132
+ }
81133
+ get groupTransform() {
81134
+ return this.renderable.groupTransform;
81135
+ }
81136
+ get attributeSize() {
81137
+ return this.geometry.positions.length / 2;
81138
+ }
81139
+ get indexSize() {
81140
+ return this.geometry.indices.length;
81141
+ }
81142
+ }
81143
+ class Transform {
81144
+ /**
81145
+ * @param options - Options for the transform.
81146
+ * @param options.matrix - The matrix to use.
81147
+ * @param options.observer - The observer to use.
81148
+ */
81149
+ constructor({ matrix, observer } = {}) {
81150
+ this.dirty = true;
81151
+ this._matrix = matrix ?? new Matrix();
81152
+ this.observer = observer;
81153
+ this.position = new ObservablePoint(this, 0, 0);
81154
+ this.scale = new ObservablePoint(this, 1, 1);
81155
+ this.pivot = new ObservablePoint(this, 0, 0);
81156
+ this.skew = new ObservablePoint(this, 0, 0);
81157
+ this._rotation = 0;
81158
+ this._cx = 1;
81159
+ this._sx = 0;
81160
+ this._cy = 0;
81161
+ this._sy = 1;
81162
+ }
81163
+ /**
81164
+ * The transformation matrix computed from the transform's properties.
81165
+ * Combines position, scale, rotation, skew, and pivot into a single matrix.
81166
+ * @example
81167
+ * ```ts
81168
+ * // Get current matrix
81169
+ * const matrix = transform.matrix;
81170
+ * console.log(matrix.toString());
81171
+ * ```
81172
+ * @readonly
81173
+ * @see {@link Matrix} For matrix operations
81174
+ * @see {@link Transform.setFromMatrix} For setting transform from matrix
81175
+ */
81176
+ get matrix() {
81177
+ const lt2 = this._matrix;
81178
+ if (!this.dirty) return lt2;
81179
+ lt2.a = this._cx * this.scale.x;
81180
+ lt2.b = this._sx * this.scale.x;
81181
+ lt2.c = this._cy * this.scale.y;
81182
+ lt2.d = this._sy * this.scale.y;
81183
+ lt2.tx = this.position.x - (this.pivot.x * lt2.a + this.pivot.y * lt2.c);
81184
+ lt2.ty = this.position.y - (this.pivot.x * lt2.b + this.pivot.y * lt2.d);
81185
+ this.dirty = false;
81186
+ return lt2;
81187
+ }
81188
+ /**
81189
+ * Called when a value changes.
81190
+ * @param point
81191
+ * @internal
81192
+ */
81193
+ _onUpdate(point) {
81194
+ var _a;
81195
+ this.dirty = true;
81196
+ if (point === this.skew) {
81197
+ this.updateSkew();
81198
+ }
81199
+ (_a = this.observer) == null ? void 0 : _a._onUpdate(this);
81200
+ }
81201
+ /** Called when the skew or the rotation changes. */
81202
+ updateSkew() {
81203
+ this._cx = Math.cos(this._rotation + this.skew.y);
81204
+ this._sx = Math.sin(this._rotation + this.skew.y);
81205
+ this._cy = -Math.sin(this._rotation - this.skew.x);
81206
+ this._sy = Math.cos(this._rotation - this.skew.x);
81207
+ this.dirty = true;
81208
+ }
81209
+ toString() {
81210
+ return `[pixi.js/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`;
81211
+ }
81212
+ /**
81213
+ * Decomposes a matrix and sets the transforms properties based on it.
81214
+ * @example
81215
+ * ```ts
81216
+ * // Basic matrix decomposition
81217
+ * const transform = new Transform();
81218
+ * const matrix = new Matrix()
81219
+ * .translate(100, 100)
81220
+ * .rotate(Math.PI / 4)
81221
+ * .scale(2, 2);
81222
+ *
81223
+ * transform.setFromMatrix(matrix);
81224
+ * console.log(transform.position.x); // 100
81225
+ * console.log(transform.rotation); // ~0.785 (π/4)
81226
+ * ```
81227
+ * @param matrix - The matrix to decompose
81228
+ * @see {@link Matrix#decompose} For the decomposition logic
81229
+ * @see {@link Transform#matrix} For getting the current matrix
81230
+ */
81231
+ setFromMatrix(matrix) {
81232
+ matrix.decompose(this);
81233
+ this.dirty = true;
81234
+ }
81235
+ /**
81236
+ * The rotation of the object in radians.
81237
+ * @example
81238
+ * ```ts
81239
+ * // Basic rotation
81240
+ * transform.rotation = Math.PI / 4; // 45 degrees
81241
+ *
81242
+ * // Rotate around pivot point
81243
+ * transform.pivot.set(50, 50);
81244
+ * transform.rotation = Math.PI; // 180 degrees around pivot
81245
+ *
81246
+ * // Animate rotation
81247
+ * app.ticker.add(() => {
81248
+ * transform.rotation += 0.1;
81249
+ * });
81250
+ * ```
81251
+ * @see {@link Transform#pivot} For rotation point
81252
+ * @see {@link Transform#skew} For skew effects
81253
+ */
81254
+ get rotation() {
81255
+ return this._rotation;
81256
+ }
81257
+ set rotation(value) {
81258
+ if (this._rotation !== value) {
81259
+ this._rotation = value;
81260
+ this._onUpdate(this.skew);
81261
+ }
81262
+ }
81263
+ }
81264
+ let canUseNewCanvasBlendModesValue;
81265
+ function createColoredCanvas(color2) {
81266
+ const canvas = DOMAdapter.get().createCanvas(6, 1);
81267
+ const context2 = canvas.getContext("2d");
81268
+ context2.fillStyle = color2;
81269
+ context2.fillRect(0, 0, 6, 1);
81270
+ return canvas;
81271
+ }
81272
+ function canUseNewCanvasBlendModes() {
81273
+ if (canUseNewCanvasBlendModesValue !== void 0) {
81274
+ return canUseNewCanvasBlendModesValue;
81275
+ }
81276
+ try {
81277
+ const magenta = createColoredCanvas("#ff00ff");
81278
+ const yellow = createColoredCanvas("#ffff00");
81279
+ const canvas = DOMAdapter.get().createCanvas(6, 1);
81280
+ const context2 = canvas.getContext("2d");
81281
+ context2.globalCompositeOperation = "multiply";
81282
+ context2.drawImage(magenta, 0, 0);
81283
+ context2.drawImage(yellow, 2, 0);
81284
+ const imageData = context2.getImageData(2, 0, 1, 1);
81285
+ if (!imageData) {
81286
+ canUseNewCanvasBlendModesValue = false;
81287
+ } else {
81288
+ const data = imageData.data;
81289
+ canUseNewCanvasBlendModesValue = data[0] === 255 && data[1] === 0 && data[2] === 0;
81290
+ }
81291
+ } catch (_error) {
81292
+ canUseNewCanvasBlendModesValue = false;
81293
+ }
81294
+ return canUseNewCanvasBlendModesValue;
81295
+ }
81296
+ const canvasUtils = {
81297
+ canvas: null,
81298
+ convertTintToImage: false,
81299
+ cacheStepsPerColorChannel: 8,
81300
+ canUseMultiply: canUseNewCanvasBlendModes(),
81301
+ tintMethod: null,
81302
+ _canvasSourceCache: /* @__PURE__ */ new WeakMap(),
81303
+ _unpremultipliedCache: /* @__PURE__ */ new WeakMap(),
81304
+ getCanvasSource: (texture) => {
81305
+ const source = texture.source;
81306
+ const resource = source == null ? void 0 : source.resource;
81307
+ if (!resource) {
81308
+ return null;
81309
+ }
81310
+ const isPMA = source.alphaMode === "premultiplied-alpha";
81311
+ const resourceWidth = source.resourceWidth ?? source.pixelWidth;
81312
+ const resourceHeight = source.resourceHeight ?? source.pixelHeight;
81313
+ const needsResize = resourceWidth !== source.pixelWidth || resourceHeight !== source.pixelHeight;
81314
+ if (isPMA) {
81315
+ if (resource instanceof HTMLCanvasElement || typeof OffscreenCanvas !== "undefined" && resource instanceof OffscreenCanvas) {
81316
+ if (!needsResize) {
81317
+ return resource;
81318
+ }
81319
+ }
81320
+ const cached = canvasUtils._unpremultipliedCache.get(source);
81321
+ if ((cached == null ? void 0 : cached.resourceId) === source._resourceId) {
81322
+ return cached.canvas;
81323
+ }
81324
+ }
81325
+ if (resource instanceof Uint8Array || resource instanceof Uint8ClampedArray || resource instanceof Int8Array || resource instanceof Uint16Array || resource instanceof Int16Array || resource instanceof Uint32Array || resource instanceof Int32Array || resource instanceof Float32Array || resource instanceof ArrayBuffer) {
81326
+ const cached = canvasUtils._canvasSourceCache.get(source);
81327
+ if ((cached == null ? void 0 : cached.resourceId) === source._resourceId) {
81328
+ return cached.canvas;
81329
+ }
81330
+ const canvas = DOMAdapter.get().createCanvas(source.pixelWidth, source.pixelHeight);
81331
+ const context2 = canvas.getContext("2d");
81332
+ const imageData = context2.createImageData(source.pixelWidth, source.pixelHeight);
81333
+ const data = imageData.data;
81334
+ const bytes = resource instanceof ArrayBuffer ? new Uint8Array(resource) : new Uint8Array(resource.buffer, resource.byteOffset, resource.byteLength);
81335
+ if (source.format === "bgra8unorm") {
81336
+ for (let i2 = 0; i2 < data.length && i2 + 3 < bytes.length; i2 += 4) {
81337
+ data[i2] = bytes[i2 + 2];
81338
+ data[i2 + 1] = bytes[i2 + 1];
81339
+ data[i2 + 2] = bytes[i2];
81340
+ data[i2 + 3] = bytes[i2 + 3];
81341
+ }
81342
+ } else {
81343
+ data.set(bytes.subarray(0, data.length));
81344
+ }
81345
+ context2.putImageData(imageData, 0, 0);
81346
+ canvasUtils._canvasSourceCache.set(source, { canvas, resourceId: source._resourceId });
81347
+ return canvas;
81348
+ }
81349
+ if (isPMA) {
81350
+ const canvas = DOMAdapter.get().createCanvas(source.pixelWidth, source.pixelHeight);
81351
+ const context2 = canvas.getContext("2d", { willReadFrequently: true });
81352
+ canvas.width = source.pixelWidth;
81353
+ canvas.height = source.pixelHeight;
81354
+ context2.drawImage(resource, 0, 0);
81355
+ const imageData = context2.getImageData(0, 0, canvas.width, canvas.height);
81356
+ const data = imageData.data;
81357
+ for (let i2 = 0; i2 < data.length; i2 += 4) {
81358
+ const a2 = data[i2 + 3];
81359
+ if (a2 > 0) {
81360
+ const alphaInv = 255 / a2;
81361
+ data[i2] = Math.min(255, data[i2] * alphaInv + 0.5);
81362
+ data[i2 + 1] = Math.min(255, data[i2 + 1] * alphaInv + 0.5);
81363
+ data[i2 + 2] = Math.min(255, data[i2 + 2] * alphaInv + 0.5);
81364
+ }
81365
+ }
81366
+ context2.putImageData(imageData, 0, 0);
81367
+ canvasUtils._unpremultipliedCache.set(source, { canvas, resourceId: source._resourceId });
81368
+ return canvas;
81369
+ }
81370
+ if (needsResize) {
81371
+ const cached = canvasUtils._canvasSourceCache.get(source);
81372
+ if ((cached == null ? void 0 : cached.resourceId) === source._resourceId) {
81373
+ return cached.canvas;
81374
+ }
81375
+ const canvas = DOMAdapter.get().createCanvas(source.pixelWidth, source.pixelHeight);
81376
+ const context2 = canvas.getContext("2d");
81377
+ canvas.width = source.pixelWidth;
81378
+ canvas.height = source.pixelHeight;
81379
+ context2.drawImage(resource, 0, 0);
81380
+ canvasUtils._canvasSourceCache.set(source, { canvas, resourceId: source._resourceId });
81381
+ return canvas;
81382
+ }
81383
+ return resource;
81384
+ },
81385
+ getTintedCanvas: (sprite, color2) => {
81386
+ const texture = sprite.texture;
81387
+ const stringColor = Color.shared.setValue(color2).toHex();
81388
+ const cache = texture.tintCache || (texture.tintCache = {});
81389
+ const cachedCanvas = cache[stringColor];
81390
+ const resourceId = texture.source._resourceId;
81391
+ if ((cachedCanvas == null ? void 0 : cachedCanvas.tintId) === resourceId) {
81392
+ return cachedCanvas;
81393
+ }
81394
+ const canvas = cachedCanvas && "getContext" in cachedCanvas ? cachedCanvas : DOMAdapter.get().createCanvas();
81395
+ canvasUtils.tintMethod(texture, color2, canvas);
81396
+ canvas.tintId = resourceId;
81397
+ {
81398
+ cache[stringColor] = canvas;
81399
+ }
81400
+ return cache[stringColor];
81401
+ },
81402
+ getTintedPattern: (texture, color2) => {
81403
+ const stringColor = Color.shared.setValue(color2).toHex();
81404
+ const cache = texture.patternCache || (texture.patternCache = {});
81405
+ const resourceId = texture.source._resourceId;
81406
+ let pattern = cache[stringColor];
81407
+ if ((pattern == null ? void 0 : pattern.tintId) === resourceId) {
81408
+ return pattern;
81409
+ }
81410
+ if (!canvasUtils.canvas) {
81411
+ canvasUtils.canvas = DOMAdapter.get().createCanvas();
81412
+ }
81413
+ canvasUtils.tintMethod(texture, color2, canvasUtils.canvas);
81414
+ const context2 = canvasUtils.canvas.getContext("2d");
81415
+ pattern = context2.createPattern(canvasUtils.canvas, "repeat");
81416
+ pattern.tintId = resourceId;
81417
+ cache[stringColor] = pattern;
81418
+ return pattern;
81419
+ },
81420
+ /**
81421
+ * Applies a transform to a CanvasPattern.
81422
+ * @param pattern - The pattern to apply the transform to.
81423
+ * @param matrix - The matrix to apply.
81424
+ * @param matrix.a
81425
+ * @param matrix.b
81426
+ * @param matrix.c
81427
+ * @param matrix.d
81428
+ * @param matrix.tx
81429
+ * @param matrix.ty
81430
+ * @param invert
81431
+ */
81432
+ applyPatternTransform: (pattern, matrix, invert = true) => {
81433
+ if (!matrix) return;
81434
+ const patternAny = pattern;
81435
+ if (!patternAny.setTransform) return;
81436
+ const DOMMatrixCtor = globalThis.DOMMatrix;
81437
+ if (!DOMMatrixCtor) return;
81438
+ const domMatrix = new DOMMatrixCtor([matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty]);
81439
+ patternAny.setTransform(invert ? domMatrix.inverse() : domMatrix);
81440
+ },
81441
+ tintWithMultiply: (texture, color2, canvas) => {
81442
+ const context2 = canvas.getContext("2d");
81443
+ const crop = texture.frame.clone();
81444
+ const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
81445
+ const rotate = texture.rotate;
81446
+ crop.x *= resolution;
81447
+ crop.y *= resolution;
81448
+ crop.width *= resolution;
81449
+ crop.height *= resolution;
81450
+ const isVertical = groupD8.isVertical(rotate);
81451
+ const outWidth = isVertical ? crop.height : crop.width;
81452
+ const outHeight = isVertical ? crop.width : crop.height;
81453
+ canvas.width = Math.ceil(outWidth);
81454
+ canvas.height = Math.ceil(outHeight);
81455
+ context2.save();
81456
+ context2.fillStyle = Color.shared.setValue(color2).toHex();
81457
+ context2.fillRect(0, 0, outWidth, outHeight);
81458
+ context2.globalCompositeOperation = "multiply";
81459
+ const source = canvasUtils.getCanvasSource(texture);
81460
+ if (!source) {
81461
+ context2.restore();
81462
+ return;
81463
+ }
81464
+ if (rotate) {
81465
+ canvasUtils._applyInverseRotation(context2, rotate, crop.width, crop.height);
81466
+ }
81467
+ context2.drawImage(
81468
+ source,
81469
+ crop.x,
81470
+ crop.y,
81471
+ crop.width,
81472
+ crop.height,
81473
+ 0,
81474
+ 0,
81475
+ crop.width,
81476
+ crop.height
81477
+ );
81478
+ context2.globalCompositeOperation = "destination-atop";
81479
+ context2.drawImage(
81480
+ source,
81481
+ crop.x,
81482
+ crop.y,
81483
+ crop.width,
81484
+ crop.height,
81485
+ 0,
81486
+ 0,
81487
+ crop.width,
81488
+ crop.height
81489
+ );
81490
+ context2.restore();
81491
+ },
81492
+ tintWithOverlay: (texture, color2, canvas) => {
81493
+ const context2 = canvas.getContext("2d");
81494
+ const crop = texture.frame.clone();
81495
+ const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
81496
+ const rotate = texture.rotate;
81497
+ crop.x *= resolution;
81498
+ crop.y *= resolution;
81499
+ crop.width *= resolution;
81500
+ crop.height *= resolution;
81501
+ const isVertical = groupD8.isVertical(rotate);
81502
+ const outWidth = isVertical ? crop.height : crop.width;
81503
+ const outHeight = isVertical ? crop.width : crop.height;
81504
+ canvas.width = Math.ceil(outWidth);
81505
+ canvas.height = Math.ceil(outHeight);
81506
+ context2.save();
81507
+ context2.globalCompositeOperation = "copy";
81508
+ context2.fillStyle = Color.shared.setValue(color2).toHex();
81509
+ context2.fillRect(0, 0, outWidth, outHeight);
81510
+ context2.globalCompositeOperation = "destination-atop";
81511
+ const source = canvasUtils.getCanvasSource(texture);
81512
+ if (!source) {
81513
+ context2.restore();
81514
+ return;
81515
+ }
81516
+ if (rotate) {
81517
+ canvasUtils._applyInverseRotation(context2, rotate, crop.width, crop.height);
81518
+ }
81519
+ context2.drawImage(
81520
+ source,
81521
+ crop.x,
81522
+ crop.y,
81523
+ crop.width,
81524
+ crop.height,
81525
+ 0,
81526
+ 0,
81527
+ crop.width,
81528
+ crop.height
81529
+ );
81530
+ context2.restore();
81531
+ },
81532
+ tintWithPerPixel: (texture, color2, canvas) => {
81533
+ const context2 = canvas.getContext("2d");
81534
+ const crop = texture.frame.clone();
81535
+ const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
81536
+ const rotate = texture.rotate;
81537
+ crop.x *= resolution;
81538
+ crop.y *= resolution;
81539
+ crop.width *= resolution;
81540
+ crop.height *= resolution;
81541
+ const isVertical = groupD8.isVertical(rotate);
81542
+ const outWidth = isVertical ? crop.height : crop.width;
81543
+ const outHeight = isVertical ? crop.width : crop.height;
81544
+ canvas.width = Math.ceil(outWidth);
81545
+ canvas.height = Math.ceil(outHeight);
81546
+ context2.save();
81547
+ context2.globalCompositeOperation = "copy";
81548
+ const source = canvasUtils.getCanvasSource(texture);
81549
+ if (!source) {
81550
+ context2.restore();
81551
+ return;
81552
+ }
81553
+ if (rotate) {
81554
+ canvasUtils._applyInverseRotation(context2, rotate, crop.width, crop.height);
81555
+ }
81556
+ context2.drawImage(
81557
+ source,
81558
+ crop.x,
81559
+ crop.y,
81560
+ crop.width,
81561
+ crop.height,
81562
+ 0,
81563
+ 0,
81564
+ crop.width,
81565
+ crop.height
81566
+ );
81567
+ context2.restore();
81568
+ const r2 = color2 >> 16 & 255;
81569
+ const g2 = color2 >> 8 & 255;
81570
+ const b2 = color2 & 255;
81571
+ const imageData = context2.getImageData(0, 0, outWidth, outHeight);
81572
+ const data = imageData.data;
81573
+ for (let i2 = 0; i2 < data.length; i2 += 4) {
81574
+ data[i2] = data[i2] * r2 / 255;
81575
+ data[i2 + 1] = data[i2 + 1] * g2 / 255;
81576
+ data[i2 + 2] = data[i2 + 2] * b2 / 255;
81577
+ }
81578
+ context2.putImageData(imageData, 0, 0);
81579
+ },
81580
+ /**
81581
+ * Applies inverse rotation transform to context for texture packer rotation compensation.
81582
+ * Supports all 16 groupD8 symmetries (rotations and reflections).
81583
+ * @param context - Canvas 2D context
81584
+ * @param rotate - The groupD8 rotation value
81585
+ * @param srcWidth - Source crop width (before rotation)
81586
+ * @param srcHeight - Source crop height (before rotation)
81587
+ */
81588
+ _applyInverseRotation: (context2, rotate, srcWidth, srcHeight) => {
81589
+ const inv = groupD8.inv(rotate);
81590
+ const a2 = groupD8.uX(inv);
81591
+ const b2 = groupD8.uY(inv);
81592
+ const c2 = groupD8.vX(inv);
81593
+ const d2 = groupD8.vY(inv);
81594
+ const tx = -Math.min(0, a2 * srcWidth, c2 * srcHeight, a2 * srcWidth + c2 * srcHeight);
81595
+ const ty = -Math.min(0, b2 * srcWidth, d2 * srcHeight, b2 * srcWidth + d2 * srcHeight);
81596
+ context2.transform(a2, b2, c2, d2, tx, ty);
81597
+ }
81598
+ };
81599
+ canvasUtils.tintMethod = canvasUtils.canUseMultiply ? canvasUtils.tintWithMultiply : canvasUtils.tintWithPerPixel;
81600
+ const worldMatrix = new Matrix();
81601
+ const patternMatrix = new Matrix();
81602
+ const patternRect = [new Point(), new Point(), new Point(), new Point()];
81603
+ class CanvasTilingSpritePipe {
81604
+ constructor(renderer) {
81605
+ this._renderer = renderer;
81606
+ }
81607
+ validateRenderable(_renderable) {
81608
+ return false;
81609
+ }
81610
+ addRenderable(tilingSprite, instructionSet) {
81611
+ this._renderer.renderPipes.batch.break(instructionSet);
81612
+ instructionSet.add(tilingSprite);
81613
+ }
81614
+ updateRenderable(_tilingSprite) {
81615
+ }
81616
+ execute(tilingSprite) {
81617
+ var _a, _b;
81618
+ const renderer = this._renderer;
81619
+ const contextSystem = renderer.canvasContext;
81620
+ const context2 = contextSystem.activeContext;
81621
+ context2.save();
81622
+ contextSystem.setBlendMode(tilingSprite.groupBlendMode);
81623
+ const globalColor = ((_a = renderer.globalUniforms.globalUniformData) == null ? void 0 : _a.worldColor) ?? 4294967295;
81624
+ const groupColorAlpha = tilingSprite.groupColorAlpha;
81625
+ const globalAlpha = (globalColor >>> 24 & 255) / 255;
81626
+ const groupAlphaValue = (groupColorAlpha >>> 24 & 255) / 255;
81627
+ const filterAlpha = ((_b = renderer.filter) == null ? void 0 : _b.alphaMultiplier) ?? 1;
81628
+ const alpha = globalAlpha * groupAlphaValue * filterAlpha;
81629
+ if (alpha <= 0) {
81630
+ context2.restore();
81631
+ return;
81632
+ }
81633
+ context2.globalAlpha = alpha;
81634
+ const globalTint = globalColor & 16777215;
81635
+ const groupTintBGR = groupColorAlpha & 16777215;
81636
+ const tint = bgr2rgb(multiplyHexColors(groupTintBGR, globalTint));
81637
+ const texture = tilingSprite.texture;
81638
+ const pattern = canvasUtils.getTintedPattern(texture, tint);
81639
+ const width = tilingSprite.width;
81640
+ const height = tilingSprite.height;
81641
+ const transform2 = tilingSprite.groupTransform;
81642
+ const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
81643
+ patternMatrix.copyFrom(tilingSprite._tileTransform.matrix);
81644
+ if (!tilingSprite.applyAnchorToTexture) {
81645
+ patternMatrix.translate(-tilingSprite.anchor.x * width, -tilingSprite.anchor.y * height);
81646
+ }
81647
+ patternMatrix.scale(1 / resolution, 1 / resolution);
81648
+ worldMatrix.identity();
81649
+ worldMatrix.prepend(patternMatrix);
81650
+ worldMatrix.prepend(transform2);
81651
+ const roundPixels = renderer._roundPixels | tilingSprite._roundPixels;
81652
+ contextSystem.setContextTransform(worldMatrix, roundPixels === 1);
81653
+ context2.fillStyle = pattern;
81654
+ const lx = tilingSprite.anchor.x * -width;
81655
+ const ly = tilingSprite.anchor.y * -height;
81656
+ patternRect[0].set(lx, ly);
81657
+ patternRect[1].set(lx + width, ly);
81658
+ patternRect[2].set(lx + width, ly + height);
81659
+ patternRect[3].set(lx, ly + height);
81660
+ for (let i2 = 0; i2 < 4; i2++) {
81661
+ patternMatrix.applyInverse(patternRect[i2], patternRect[i2]);
81662
+ }
81663
+ context2.beginPath();
81664
+ context2.moveTo(patternRect[0].x, patternRect[0].y);
81665
+ for (let i2 = 1; i2 < 4; i2++) {
81666
+ context2.lineTo(patternRect[i2].x, patternRect[i2].y);
81667
+ }
81668
+ context2.closePath();
81669
+ context2.fill();
81670
+ context2.restore();
81671
+ }
81672
+ destroy() {
81673
+ this._renderer = null;
81674
+ }
81675
+ }
81676
+ CanvasTilingSpritePipe.extension = {
81677
+ type: [
81678
+ ExtensionType.CanvasPipes
81679
+ ],
81680
+ name: "tilingSprite"
81681
+ };
81682
+ const localUniformBit = {
81683
+ name: "local-uniform-bit",
81684
+ vertex: {
81685
+ header: (
81686
+ /* wgsl */
81687
+ `
81688
+
81689
+ struct LocalUniforms {
81690
+ uTransformMatrix:mat3x3<f32>,
81691
+ uColor:vec4<f32>,
81692
+ uRound:f32,
81693
+ }
81694
+
81695
+ @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
81696
+ `
81697
+ ),
81698
+ main: (
81699
+ /* wgsl */
81700
+ `
81701
+ vColor *= localUniforms.uColor;
81702
+ modelMatrix *= localUniforms.uTransformMatrix;
81703
+ `
81704
+ ),
81705
+ end: (
81706
+ /* wgsl */
81707
+ `
81708
+ if(localUniforms.uRound == 1)
81709
+ {
81710
+ vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
81711
+ }
81712
+ `
81713
+ )
81714
+ }
81715
+ };
81716
+ const localUniformBitGroup2 = {
81717
+ ...localUniformBit,
81718
+ vertex: {
81719
+ ...localUniformBit.vertex,
81720
+ // replace the group!
81721
+ header: localUniformBit.vertex.header.replace("group(1)", "group(2)")
81722
+ }
81723
+ };
81724
+ const localUniformBitGl = {
81725
+ name: "local-uniform-bit",
81726
+ vertex: {
81727
+ header: (
81728
+ /* glsl */
81729
+ `
81730
+
81731
+ uniform mat3 uTransformMatrix;
81732
+ uniform vec4 uColor;
81733
+ uniform float uRound;
81734
+ `
81735
+ ),
81736
+ main: (
81737
+ /* glsl */
81738
+ `
81739
+ vColor *= uColor;
81740
+ modelMatrix = uTransformMatrix;
81741
+ `
81742
+ ),
81743
+ end: (
81744
+ /* glsl */
81745
+ `
81746
+ if(uRound == 1.)
81747
+ {
81748
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
81749
+ }
81750
+ `
81751
+ )
81752
+ }
81753
+ };
81754
+ const tilingBit = {
81755
+ name: "tiling-bit",
81756
+ vertex: {
81757
+ header: (
81758
+ /* wgsl */
81759
+ `
81760
+ struct TilingUniforms {
81761
+ uMapCoord:mat3x3<f32>,
81762
+ uClampFrame:vec4<f32>,
81763
+ uClampOffset:vec2<f32>,
81764
+ uTextureTransform:mat3x3<f32>,
81765
+ uSizeAnchor:vec4<f32>
81766
+ };
81767
+
81768
+ @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
81769
+ @group(2) @binding(1) var uTexture: texture_2d<f32>;
81770
+ @group(2) @binding(2) var uSampler: sampler;
81771
+ `
81772
+ ),
81773
+ main: (
81774
+ /* wgsl */
81775
+ `
81776
+ uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
81777
+
81778
+ position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
81779
+ `
81780
+ )
81781
+ },
81782
+ fragment: {
81783
+ header: (
81784
+ /* wgsl */
81785
+ `
81786
+ struct TilingUniforms {
81787
+ uMapCoord:mat3x3<f32>,
81788
+ uClampFrame:vec4<f32>,
81789
+ uClampOffset:vec2<f32>,
81790
+ uTextureTransform:mat3x3<f32>,
81791
+ uSizeAnchor:vec4<f32>
81792
+ };
81793
+
81794
+ @group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
81795
+ @group(2) @binding(1) var uTexture: texture_2d<f32>;
81796
+ @group(2) @binding(2) var uSampler: sampler;
81797
+ `
81798
+ ),
81799
+ main: (
81800
+ /* wgsl */
81801
+ `
81802
+
81803
+ var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
81804
+ coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
81805
+ var unclamped = coord;
81806
+ coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
81807
+
81808
+ var bias = 0.;
81809
+
81810
+ if(unclamped.x == coord.x && unclamped.y == coord.y)
81811
+ {
81812
+ bias = -32.;
81813
+ }
81814
+
81815
+ outColor = textureSampleBias(uTexture, uSampler, coord, bias);
81816
+ `
81817
+ )
81818
+ }
81819
+ };
81820
+ const tilingBitGl = {
81821
+ name: "tiling-bit",
81822
+ vertex: {
81823
+ header: (
81824
+ /* glsl */
81825
+ `
81826
+ uniform mat3 uTextureTransform;
81827
+ uniform vec4 uSizeAnchor;
81828
+
81829
+ `
81830
+ ),
81831
+ main: (
81832
+ /* glsl */
81833
+ `
81834
+ uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
81835
+
81836
+ position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
81837
+ `
81838
+ )
81839
+ },
81840
+ fragment: {
81841
+ header: (
81842
+ /* glsl */
81843
+ `
81844
+ uniform sampler2D uTexture;
81845
+ uniform mat3 uMapCoord;
81846
+ uniform vec4 uClampFrame;
81847
+ uniform vec2 uClampOffset;
81848
+ `
81849
+ ),
81850
+ main: (
81851
+ /* glsl */
81852
+ `
81853
+
81854
+ vec2 coord = vUV + ceil(uClampOffset - vUV);
81855
+ coord = (uMapCoord * vec3(coord, 1.0)).xy;
81856
+ vec2 unclamped = coord;
81857
+ coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
81858
+
81859
+ outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
81860
+
81861
+ `
81862
+ )
81863
+ }
81864
+ };
81865
+ let gpuProgram;
81866
+ let glProgram;
81867
+ class TilingSpriteShader extends Shader {
81868
+ constructor() {
81869
+ gpuProgram ?? (gpuProgram = compileHighShaderGpuProgram({
81870
+ name: "tiling-sprite-shader",
81871
+ bits: [
81872
+ localUniformBit,
81873
+ tilingBit,
81874
+ roundPixelsBit
81875
+ ]
81876
+ }));
81877
+ glProgram ?? (glProgram = compileHighShaderGlProgram({
81878
+ name: "tiling-sprite-shader",
81879
+ bits: [
81880
+ localUniformBitGl,
81881
+ tilingBitGl,
81882
+ roundPixelsBitGl
81883
+ ]
81884
+ }));
81885
+ const tilingUniforms = new UniformGroup({
81886
+ uMapCoord: { value: new Matrix(), type: "mat3x3<f32>" },
81887
+ uClampFrame: { value: new Float32Array([0, 0, 1, 1]), type: "vec4<f32>" },
81888
+ uClampOffset: { value: new Float32Array([0, 0]), type: "vec2<f32>" },
81889
+ uTextureTransform: { value: new Matrix(), type: "mat3x3<f32>" },
81890
+ uSizeAnchor: { value: new Float32Array([100, 100, 0.5, 0.5]), type: "vec4<f32>" }
81891
+ });
81892
+ super({
81893
+ glProgram,
81894
+ gpuProgram,
81895
+ resources: {
81896
+ localUniforms: new UniformGroup({
81897
+ uTransformMatrix: { value: new Matrix(), type: "mat3x3<f32>" },
81898
+ uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
81899
+ uRound: { value: 0, type: "f32" }
81900
+ }),
81901
+ tilingUniforms,
81902
+ uTexture: Texture.EMPTY.source,
81903
+ uSampler: Texture.EMPTY.source.style
81904
+ }
81905
+ });
81906
+ }
81907
+ updateUniforms(width, height, matrix, anchorX, anchorY, texture) {
81908
+ const tilingUniforms = this.resources.tilingUniforms;
81909
+ const textureWidth = texture.width;
81910
+ const textureHeight = texture.height;
81911
+ const textureMatrix = texture.textureMatrix;
81912
+ const uTextureTransform = tilingUniforms.uniforms.uTextureTransform;
81913
+ uTextureTransform.set(
81914
+ matrix.a * textureWidth / width,
81915
+ matrix.b * textureWidth / height,
81916
+ matrix.c * textureHeight / width,
81917
+ matrix.d * textureHeight / height,
81918
+ matrix.tx / width,
81919
+ matrix.ty / height
81920
+ );
81921
+ uTextureTransform.invert();
81922
+ tilingUniforms.uniforms.uMapCoord = textureMatrix.mapCoord;
81923
+ tilingUniforms.uniforms.uClampFrame = textureMatrix.uClampFrame;
81924
+ tilingUniforms.uniforms.uClampOffset = textureMatrix.uClampOffset;
81925
+ tilingUniforms.uniforms.uTextureTransform = uTextureTransform;
81926
+ tilingUniforms.uniforms.uSizeAnchor[0] = width;
81927
+ tilingUniforms.uniforms.uSizeAnchor[1] = height;
81928
+ tilingUniforms.uniforms.uSizeAnchor[2] = anchorX;
81929
+ tilingUniforms.uniforms.uSizeAnchor[3] = anchorY;
81930
+ if (texture) {
81931
+ this.resources.uTexture = texture.source;
81932
+ this.resources.uSampler = texture.source.style;
81933
+ }
81934
+ }
81935
+ }
81936
+ class QuadGeometry extends MeshGeometry {
81937
+ constructor() {
81938
+ super({
81939
+ positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
81940
+ uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
81941
+ indices: new Uint32Array([0, 1, 2, 0, 2, 3])
81942
+ });
81943
+ }
81944
+ }
81945
+ function setPositions(tilingSprite, positions) {
81946
+ const anchorX = tilingSprite.anchor.x;
81947
+ const anchorY = tilingSprite.anchor.y;
81948
+ positions[0] = -anchorX * tilingSprite.width;
81949
+ positions[1] = -anchorY * tilingSprite.height;
81950
+ positions[2] = (1 - anchorX) * tilingSprite.width;
81951
+ positions[3] = -anchorY * tilingSprite.height;
81952
+ positions[4] = (1 - anchorX) * tilingSprite.width;
81953
+ positions[5] = (1 - anchorY) * tilingSprite.height;
81954
+ positions[6] = -anchorX * tilingSprite.width;
81955
+ positions[7] = (1 - anchorY) * tilingSprite.height;
81956
+ }
81957
+ function applyMatrix(array2, stride, offset, matrix) {
81958
+ let index2 = 0;
81959
+ const size = array2.length / stride;
81960
+ const a2 = matrix.a;
81961
+ const b2 = matrix.b;
81962
+ const c2 = matrix.c;
81963
+ const d2 = matrix.d;
81964
+ const tx = matrix.tx;
81965
+ const ty = matrix.ty;
81966
+ offset *= stride;
81967
+ while (index2 < size) {
81968
+ const x2 = array2[offset];
81969
+ const y2 = array2[offset + 1];
81970
+ array2[offset] = a2 * x2 + c2 * y2 + tx;
81971
+ array2[offset + 1] = b2 * x2 + d2 * y2 + ty;
81972
+ offset += stride;
81973
+ index2++;
81974
+ }
81975
+ }
81976
+ function setUvs(tilingSprite, uvs) {
81977
+ const texture = tilingSprite.texture;
81978
+ const width = texture.frame.width;
81979
+ const height = texture.frame.height;
81980
+ let anchorX = 0;
81981
+ let anchorY = 0;
81982
+ if (tilingSprite.applyAnchorToTexture) {
81983
+ anchorX = tilingSprite.anchor.x;
81984
+ anchorY = tilingSprite.anchor.y;
81985
+ }
81986
+ uvs[0] = uvs[6] = -anchorX;
81987
+ uvs[2] = uvs[4] = 1 - anchorX;
81988
+ uvs[1] = uvs[3] = -anchorY;
81989
+ uvs[5] = uvs[7] = 1 - anchorY;
81990
+ const textureMatrix = Matrix.shared;
81991
+ textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);
81992
+ textureMatrix.tx /= tilingSprite.width;
81993
+ textureMatrix.ty /= tilingSprite.height;
81994
+ textureMatrix.invert();
81995
+ textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);
81996
+ applyMatrix(uvs, 2, 0, textureMatrix);
81997
+ }
81998
+ const sharedQuad = new QuadGeometry();
81999
+ class TilingSpriteGpuData {
82000
+ constructor() {
82001
+ this.canBatch = true;
82002
+ this.geometry = new MeshGeometry({
82003
+ indices: sharedQuad.indices.slice(),
82004
+ positions: sharedQuad.positions.slice(),
82005
+ uvs: sharedQuad.uvs.slice()
82006
+ });
82007
+ }
82008
+ destroy() {
82009
+ var _a;
82010
+ this.geometry.destroy();
82011
+ (_a = this.shader) == null ? void 0 : _a.destroy();
82012
+ }
82013
+ }
82014
+ class TilingSpritePipe {
82015
+ constructor(renderer) {
82016
+ this._state = State.default2d;
82017
+ this._renderer = renderer;
82018
+ this._managedTilingSprites = new GCManagedHash({ renderer, type: "renderable", name: "tilingSprite" });
82019
+ }
82020
+ validateRenderable(renderable) {
82021
+ const tilingSpriteData = this._getTilingSpriteData(renderable);
82022
+ const couldBatch = tilingSpriteData.canBatch;
82023
+ this._updateCanBatch(renderable);
82024
+ const canBatch = tilingSpriteData.canBatch;
82025
+ if (canBatch && canBatch === couldBatch) {
82026
+ const { batchableMesh } = tilingSpriteData;
82027
+ return !batchableMesh._batcher.checkAndUpdateTexture(
82028
+ batchableMesh,
82029
+ renderable.texture
82030
+ );
82031
+ }
82032
+ return couldBatch !== canBatch;
82033
+ }
82034
+ addRenderable(tilingSprite, instructionSet) {
82035
+ const batcher = this._renderer.renderPipes.batch;
82036
+ this._updateCanBatch(tilingSprite);
82037
+ const tilingSpriteData = this._getTilingSpriteData(tilingSprite);
82038
+ const { geometry, canBatch } = tilingSpriteData;
82039
+ if (canBatch) {
82040
+ tilingSpriteData.batchableMesh || (tilingSpriteData.batchableMesh = new BatchableMesh());
82041
+ const batchableMesh = tilingSpriteData.batchableMesh;
82042
+ if (tilingSprite.didViewUpdate) {
82043
+ this._updateBatchableMesh(tilingSprite);
82044
+ batchableMesh.geometry = geometry;
82045
+ batchableMesh.renderable = tilingSprite;
82046
+ batchableMesh.transform = tilingSprite.groupTransform;
82047
+ batchableMesh.setTexture(tilingSprite._texture);
82048
+ }
82049
+ batchableMesh.roundPixels = this._renderer._roundPixels | tilingSprite._roundPixels;
82050
+ batcher.addToBatch(batchableMesh, instructionSet);
82051
+ } else {
82052
+ batcher.break(instructionSet);
82053
+ tilingSpriteData.shader || (tilingSpriteData.shader = new TilingSpriteShader());
82054
+ this.updateRenderable(tilingSprite);
82055
+ instructionSet.add(tilingSprite);
82056
+ }
82057
+ }
82058
+ execute(tilingSprite) {
82059
+ const renderer = this._renderer;
82060
+ const { shader } = this._getTilingSpriteData(tilingSprite);
82061
+ shader.groups[0] = renderer.globalUniforms.bindGroup;
82062
+ const localUniforms = shader.resources.localUniforms.uniforms;
82063
+ localUniforms.uTransformMatrix = tilingSprite.groupTransform;
82064
+ localUniforms.uRound = renderer._roundPixels | tilingSprite._roundPixels;
82065
+ color32BitToUniform(
82066
+ tilingSprite.groupColorAlpha,
82067
+ localUniforms.uColor,
82068
+ 0
82069
+ );
82070
+ this._state.blendMode = getAdjustedBlendModeBlend(tilingSprite.groupBlendMode, tilingSprite.texture._source);
82071
+ renderer.encoder.draw({
82072
+ geometry: sharedQuad,
82073
+ shader,
82074
+ state: this._state
82075
+ });
82076
+ }
82077
+ updateRenderable(tilingSprite) {
82078
+ const tilingSpriteData = this._getTilingSpriteData(tilingSprite);
82079
+ const { canBatch } = tilingSpriteData;
82080
+ if (canBatch) {
82081
+ const { batchableMesh } = tilingSpriteData;
82082
+ if (tilingSprite.didViewUpdate) this._updateBatchableMesh(tilingSprite);
82083
+ batchableMesh._batcher.updateElement(batchableMesh);
82084
+ } else if (tilingSprite.didViewUpdate) {
82085
+ const { shader } = tilingSpriteData;
82086
+ shader.updateUniforms(
82087
+ tilingSprite.width,
82088
+ tilingSprite.height,
82089
+ tilingSprite._tileTransform.matrix,
82090
+ tilingSprite.anchor.x,
82091
+ tilingSprite.anchor.y,
82092
+ tilingSprite.texture
82093
+ );
82094
+ }
82095
+ }
82096
+ _getTilingSpriteData(renderable) {
82097
+ return renderable._gpuData[this._renderer.uid] || this._initTilingSpriteData(renderable);
82098
+ }
82099
+ _initTilingSpriteData(tilingSprite) {
82100
+ const gpuData = new TilingSpriteGpuData();
82101
+ gpuData.renderable = tilingSprite;
82102
+ tilingSprite._gpuData[this._renderer.uid] = gpuData;
82103
+ this._managedTilingSprites.add(tilingSprite);
82104
+ return gpuData;
82105
+ }
82106
+ _updateBatchableMesh(tilingSprite) {
82107
+ const renderableData = this._getTilingSpriteData(tilingSprite);
82108
+ const { geometry } = renderableData;
82109
+ const style2 = tilingSprite.texture.source.style;
82110
+ if (style2.addressMode !== "repeat") {
82111
+ style2.addressMode = "repeat";
82112
+ style2.update();
82113
+ }
82114
+ setUvs(tilingSprite, geometry.uvs);
82115
+ setPositions(tilingSprite, geometry.positions);
82116
+ }
82117
+ destroy() {
82118
+ this._managedTilingSprites.destroy();
82119
+ this._renderer = null;
82120
+ }
82121
+ _updateCanBatch(tilingSprite) {
82122
+ const renderableData = this._getTilingSpriteData(tilingSprite);
82123
+ const texture = tilingSprite.texture;
82124
+ let _nonPowOf2wrapping = true;
82125
+ if (this._renderer.type === RendererType.WEBGL) {
82126
+ _nonPowOf2wrapping = this._renderer.context.supports.nonPowOf2wrapping;
82127
+ }
82128
+ renderableData.canBatch = texture.textureMatrix.isSimple && (_nonPowOf2wrapping || texture.source.isPowerOfTwo);
82129
+ return renderableData.canBatch;
82130
+ }
82131
+ }
82132
+ TilingSpritePipe.extension = {
82133
+ type: [
82134
+ ExtensionType.WebGLPipes,
82135
+ ExtensionType.WebGPUPipes
82136
+ ],
82137
+ name: "tilingSprite"
82138
+ };
82139
+ extensions.add(CanvasTilingSpritePipe);
82140
+ extensions.add(TilingSpritePipe);
82141
+ const _TilingSprite = class _TilingSprite2 extends ViewContainer {
82142
+ constructor(...args) {
82143
+ let options = args[0] || {};
82144
+ if (options instanceof Texture) {
82145
+ options = { texture: options };
82146
+ }
82147
+ if (args.length > 1) {
82148
+ deprecation(v8_0_0, "use new TilingSprite({ texture, width:100, height:100 }) instead");
82149
+ options.width = args[1];
82150
+ options.height = args[2];
82151
+ }
82152
+ options = { ..._TilingSprite2.defaultOptions, ...options };
82153
+ const {
82154
+ texture,
82155
+ anchor,
82156
+ tilePosition,
82157
+ tileScale,
82158
+ tileRotation,
82159
+ width,
82160
+ height,
82161
+ applyAnchorToTexture,
82162
+ roundPixels,
82163
+ ...rest
82164
+ } = options ?? {};
82165
+ super({
82166
+ label: "TilingSprite",
82167
+ ...rest
82168
+ });
82169
+ this.renderPipeId = "tilingSprite";
82170
+ this.batched = true;
82171
+ this.allowChildren = false;
82172
+ this._anchor = new ObservablePoint(
82173
+ {
82174
+ _onUpdate: () => {
82175
+ this.onViewUpdate();
82176
+ }
82177
+ }
82178
+ );
82179
+ this.applyAnchorToTexture = applyAnchorToTexture;
82180
+ this.texture = texture;
82181
+ this._width = width ?? texture.width;
82182
+ this._height = height ?? texture.height;
82183
+ this._tileTransform = new Transform({
82184
+ observer: {
82185
+ _onUpdate: () => this.onViewUpdate()
82186
+ }
82187
+ });
82188
+ if (anchor) this.anchor = anchor;
82189
+ this.tilePosition = tilePosition;
82190
+ this.tileScale = tileScale;
82191
+ this.tileRotation = tileRotation;
82192
+ this.roundPixels = roundPixels ?? false;
82193
+ }
82194
+ /**
82195
+ * Creates a new tiling sprite based on a source texture or image path.
82196
+ * This is a convenience method that automatically creates and manages textures.
82197
+ * @example
82198
+ * ```ts
82199
+ * // Create a new tiling sprite from an image path
82200
+ * const pattern = TilingSprite.from('pattern.png');
82201
+ * pattern.width = 300; // Set the width of the tiling area
82202
+ * pattern.height = 200; // Set the height of the tiling area
82203
+ *
82204
+ * // Create from options
82205
+ * const texture = Texture.from('pattern.png');
82206
+ * const pattern = TilingSprite.from(texture, {
82207
+ * width: 300,
82208
+ * height: 200,
82209
+ * tileScale: { x: 0.5, y: 0.5 }
82210
+ * });
82211
+ * ```
82212
+ * @param source - The source to create the sprite from. Can be a path to an image or a texture
82213
+ * @param options - Additional options for the tiling sprite
82214
+ * @returns A new tiling sprite based on the source
82215
+ * @see {@link Texture.from} For texture creation details
82216
+ * @see {@link Assets} For asset loading and management
82217
+ */
82218
+ static from(source, options = {}) {
82219
+ if (typeof source === "string") {
82220
+ return new _TilingSprite2({
82221
+ texture: Cache.get(source),
82222
+ ...options
82223
+ });
82224
+ }
82225
+ return new _TilingSprite2({
82226
+ texture: source,
82227
+ ...options
82228
+ });
82229
+ }
82230
+ /**
82231
+ * @see {@link TilingSpriteOptions.applyAnchorToTexture}
82232
+ * @deprecated since 8.0.0
82233
+ * @advanced
82234
+ */
82235
+ get uvRespectAnchor() {
82236
+ deprecation(v8_0_0, "uvRespectAnchor is deprecated, please use applyAnchorToTexture instead");
82237
+ return this.applyAnchorToTexture;
82238
+ }
82239
+ /** @advanced */
82240
+ set uvRespectAnchor(value) {
82241
+ deprecation(v8_0_0, "uvRespectAnchor is deprecated, please use applyAnchorToTexture instead");
82242
+ this.applyAnchorToTexture = value;
82243
+ }
82244
+ /**
82245
+ * Changes frame clamping in corresponding textureMatrix
82246
+ * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
82247
+ * @default 0.5
82248
+ * @type {number}
82249
+ * @advanced
82250
+ */
82251
+ get clampMargin() {
82252
+ return this._texture.textureMatrix.clampMargin;
82253
+ }
82254
+ /** @advanced */
82255
+ set clampMargin(value) {
82256
+ this._texture.textureMatrix.clampMargin = value;
82257
+ }
82258
+ /**
82259
+ * The anchor sets the origin point of the sprite. The default value is taken from the {@link Texture}
82260
+ * and passed to the constructor.
82261
+ *
82262
+ * - The default is `(0,0)`, this means the sprite's origin is the top left.
82263
+ * - Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.
82264
+ * - Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.
82265
+ *
82266
+ * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
82267
+ * @example
82268
+ * ```ts
82269
+ * // Center the anchor point
82270
+ * sprite.anchor = 0.5; // Sets both x and y to 0.5
82271
+ * sprite.position.set(400, 300); // Sprite will be centered at this position
82272
+ *
82273
+ * // Set specific x/y anchor points
82274
+ * sprite.anchor = {
82275
+ * x: 1, // Right edge
82276
+ * y: 0 // Top edge
82277
+ * };
82278
+ *
82279
+ * // Using individual coordinates
82280
+ * sprite.anchor.set(0.5, 1); // Center-bottom
82281
+ *
82282
+ * // For rotation around center
82283
+ * sprite.anchor.set(0.5);
82284
+ * sprite.rotation = Math.PI / 4; // 45 degrees around center
82285
+ *
82286
+ * // For scaling from center
82287
+ * sprite.anchor.set(0.5);
82288
+ * sprite.scale.set(2); // Scales from center point
82289
+ * ```
82290
+ */
82291
+ get anchor() {
82292
+ return this._anchor;
82293
+ }
82294
+ set anchor(value) {
82295
+ typeof value === "number" ? this._anchor.set(value) : this._anchor.copyFrom(value);
82296
+ }
82297
+ /**
82298
+ * The offset of the tiling texture.
82299
+ * Used to scroll or position the repeated pattern.
82300
+ * @example
82301
+ * ```ts
82302
+ * // Offset the tiling pattern by 100 pixels in both x and y directions
82303
+ * tilingSprite.tilePosition = { x: 100, y: 100 };
82304
+ * ```
82305
+ * @default {x: 0, y: 0}
82306
+ */
82307
+ get tilePosition() {
82308
+ return this._tileTransform.position;
82309
+ }
82310
+ set tilePosition(value) {
82311
+ this._tileTransform.position.copyFrom(value);
82312
+ }
82313
+ /**
82314
+ * Scale of the tiling texture.
82315
+ * Affects the size of each repeated instance of the texture.
82316
+ * @example
82317
+ * ```ts
82318
+ * // Scale the texture by 1.5 in both x and y directions
82319
+ * tilingSprite.tileScale = { x: 1.5, y: 1.5 };
82320
+ * ```
82321
+ * @default {x: 1, y: 1}
82322
+ */
82323
+ get tileScale() {
82324
+ return this._tileTransform.scale;
82325
+ }
82326
+ set tileScale(value) {
82327
+ typeof value === "number" ? this._tileTransform.scale.set(value) : this._tileTransform.scale.copyFrom(value);
82328
+ }
82329
+ set tileRotation(value) {
82330
+ this._tileTransform.rotation = value;
82331
+ }
82332
+ /**
82333
+ * Rotation of the tiling texture in radians.
82334
+ * This controls the rotation applied to the texture before tiling.
82335
+ * @example
82336
+ * ```ts
82337
+ * // Rotate the texture by 45 degrees (in radians)
82338
+ * tilingSprite.tileRotation = Math.PI / 4; // 45 degrees
82339
+ * ```
82340
+ * @default 0
82341
+ */
82342
+ get tileRotation() {
82343
+ return this._tileTransform.rotation;
82344
+ }
82345
+ /**
82346
+ * The transform object that controls the tiling texture's position, scale, and rotation.
82347
+ * This transform is independent of the sprite's own transform properties.
82348
+ * @example
82349
+ * ```ts
82350
+ * // Access transform properties directly
82351
+ * sprite.tileTransform.position.set(100, 50);
82352
+ * sprite.tileTransform.scale.set(2);
82353
+ * sprite.tileTransform.rotation = Math.PI / 4;
82354
+ *
82355
+ * // Create smooth scrolling animation
82356
+ * app.ticker.add(() => {
82357
+ * sprite.tileTransform.position.x += 1;
82358
+ * sprite.tileTransform.rotation += 0.01;
82359
+ * });
82360
+ *
82361
+ * // Reset transform
82362
+ * sprite.tileTransform.position.set(0);
82363
+ * sprite.tileTransform.scale.set(1);
82364
+ * sprite.tileTransform.rotation = 0;
82365
+ * ```
82366
+ * @returns {Transform} The transform object for the tiling texture
82367
+ * @see {@link Transform} For transform operations
82368
+ * @see {@link TilingSprite#tilePosition} For position control
82369
+ * @see {@link TilingSprite#tileScale} For scale control
82370
+ * @see {@link TilingSprite#tileRotation} For rotation control
82371
+ * @advanced
82372
+ */
82373
+ get tileTransform() {
82374
+ return this._tileTransform;
82375
+ }
82376
+ set texture(value) {
82377
+ value || (value = Texture.EMPTY);
82378
+ const currentTexture = this._texture;
82379
+ if (currentTexture === value) return;
82380
+ if (currentTexture && currentTexture.dynamic) currentTexture.off("update", this.onViewUpdate, this);
82381
+ if (value.dynamic) value.on("update", this.onViewUpdate, this);
82382
+ this._texture = value;
82383
+ this.onViewUpdate();
82384
+ }
82385
+ /**
82386
+ * The texture to use for tiling.
82387
+ * This is the image that will be repeated across the sprite.
82388
+ * @example
82389
+ * ```ts
82390
+ * // Use a texture from the asset cache
82391
+ * tilingSprite.texture = Texture.from('assets/pattern.png');
82392
+ * ```
82393
+ * @default Texture.WHITE
82394
+ */
82395
+ get texture() {
82396
+ return this._texture;
82397
+ }
82398
+ /**
82399
+ * The width of the tiling area. This defines how wide the area is that the texture will be tiled across.
82400
+ * @example
82401
+ * ```ts
82402
+ * // Create a tiling sprite
82403
+ * const sprite = new TilingSprite({
82404
+ * texture: Texture.from('pattern.png'),
82405
+ * width: 500,
82406
+ * height: 300
82407
+ * });
82408
+ *
82409
+ * // Adjust width dynamically
82410
+ * sprite.width = 800; // Expands tiling area
82411
+ *
82412
+ * // Update on resize
82413
+ * window.addEventListener('resize', () => {
82414
+ * sprite.width = app.screen.width;
82415
+ * });
82416
+ * ```
82417
+ * @see {@link TilingSprite#setSize} For setting both width and height efficiently
82418
+ * @see {@link TilingSprite#height} For setting height
82419
+ */
82420
+ set width(value) {
82421
+ this._width = value;
82422
+ this.onViewUpdate();
82423
+ }
82424
+ get width() {
82425
+ return this._width;
82426
+ }
82427
+ set height(value) {
82428
+ this._height = value;
82429
+ this.onViewUpdate();
82430
+ }
82431
+ /**
82432
+ * The height of the tiling area. This defines how tall the area is that the texture will be tiled across.
82433
+ * @example
82434
+ * ```ts
82435
+ * // Create a tiling sprite
82436
+ * const sprite = new TilingSprite({
82437
+ * texture: Texture.from('pattern.png'),
82438
+ * width: 500,
82439
+ * height: 300
82440
+ * });
82441
+ *
82442
+ * // Adjust width dynamically
82443
+ * sprite.height = 800; // Expands tiling area
82444
+ *
82445
+ * // Update on resize
82446
+ * window.addEventListener('resize', () => {
82447
+ * sprite.height = app.screen.height;
82448
+ * });
82449
+ * ```
82450
+ * @see {@link TilingSprite#setSize} For setting both width and height efficiently
82451
+ * @see {@link TilingSprite#width} For setting width
82452
+ */
82453
+ get height() {
82454
+ return this._height;
82455
+ }
82456
+ /**
82457
+ * Sets the size of the TilingSprite to the specified width and height.
82458
+ * This is faster than setting width and height separately as it only triggers one update.
82459
+ * @example
82460
+ * ```ts
82461
+ * // Set specific dimensions
82462
+ * sprite.setSize(300, 200); // Width: 300, Height: 200
82463
+ *
82464
+ * // Set uniform size (square)
82465
+ * sprite.setSize(400); // Width: 400, Height: 400
82466
+ *
82467
+ * // Set size using object
82468
+ * sprite.setSize({
82469
+ * width: 500,
82470
+ * height: 300
82471
+ * });
82472
+ * ```
82473
+ * @param value - This can be either a number for uniform sizing or a Size object with width/height properties
82474
+ * @param height - The height to set. Defaults to the value of `width` if not provided
82475
+ * @see {@link TilingSprite#width} For setting width only
82476
+ * @see {@link TilingSprite#height} For setting height only
82477
+ */
82478
+ setSize(value, height) {
82479
+ if (typeof value === "object") {
82480
+ height = value.height ?? value.width;
82481
+ value = value.width;
82482
+ }
82483
+ this._width = value;
82484
+ this._height = height ?? value;
82485
+ this.onViewUpdate();
82486
+ }
82487
+ /**
82488
+ * Retrieves the size of the TilingSprite as a {@link Size} object.
82489
+ * This method is more efficient than getting width and height separately as it only allocates one object.
82490
+ * @example
82491
+ * ```ts
82492
+ * // Get basic size
82493
+ * const size = sprite.getSize();
82494
+ * console.log(`Size: ${size.width}x${size.height}`);
82495
+ *
82496
+ * // Reuse existing size object
82497
+ * const reuseSize = { width: 0, height: 0 };
82498
+ * sprite.getSize(reuseSize);
82499
+ * ```
82500
+ * @param out - Optional object to store the size in, to avoid allocating a new object
82501
+ * @returns The size of the TilingSprite
82502
+ * @see {@link TilingSprite#width} For getting just the width
82503
+ * @see {@link TilingSprite#height} For getting just the height
82504
+ * @see {@link TilingSprite#setSize} For setting both width and height efficiently
82505
+ */
82506
+ getSize(out2) {
82507
+ out2 || (out2 = {});
82508
+ out2.width = this._width;
82509
+ out2.height = this._height;
82510
+ return out2;
82511
+ }
82512
+ /** @private */
82513
+ updateBounds() {
82514
+ const bounds = this._bounds;
82515
+ const anchor = this._anchor;
82516
+ const width = this._width;
82517
+ const height = this._height;
82518
+ bounds.minX = -anchor._x * width;
82519
+ bounds.maxX = bounds.minX + width;
82520
+ bounds.minY = -anchor._y * height;
82521
+ bounds.maxY = bounds.minY + height;
82522
+ }
82523
+ /**
82524
+ * Checks if the object contains the given point in local coordinates.
82525
+ * Takes into account the anchor offset when determining boundaries.
82526
+ * @example
82527
+ * ```ts
82528
+ * // Create a tiling sprite
82529
+ * const sprite = new TilingSprite({
82530
+ * texture: Texture.from('pattern.png'),
82531
+ * width: 200,
82532
+ * height: 100,
82533
+ * anchor: 0.5 // Center anchor
82534
+ * });
82535
+ *
82536
+ * // Basic point check
82537
+ * const contains = sprite.containsPoint({ x: 50, y: 25 });
82538
+ * console.log('Point is inside:', contains);
82539
+ *
82540
+ * // Check with different anchors
82541
+ * sprite.anchor.set(0); // Top-left anchor
82542
+ * console.log('Contains point:', sprite.containsPoint({ x: 150, y: 75 }));
82543
+ * ```
82544
+ * @param point - The point to check in local coordinates
82545
+ * @returns True if the point is within the sprite's bounds
82546
+ * @see {@link TilingSprite#toLocal} For converting global coordinates to local
82547
+ * @see {@link TilingSprite#anchor} For understanding boundary calculations
82548
+ */
82549
+ containsPoint(point) {
82550
+ const width = this._width;
82551
+ const height = this._height;
82552
+ const x1 = -width * this._anchor._x;
82553
+ let y1 = 0;
82554
+ if (point.x >= x1 && point.x <= x1 + width) {
82555
+ y1 = -height * this._anchor._y;
82556
+ if (point.y >= y1 && point.y <= y1 + height) return true;
82557
+ }
82558
+ return false;
82559
+ }
82560
+ /**
82561
+ * Destroys this sprite renderable and optionally its texture.
82562
+ * @param options - Options parameter. A boolean will act as if all options
82563
+ * have been set to that value
82564
+ * @example
82565
+ * tilingSprite.destroy();
82566
+ * tilingSprite.destroy(true);
82567
+ * tilingSprite.destroy({ texture: true, textureSource: true });
82568
+ */
82569
+ destroy(options = false) {
82570
+ super.destroy(options);
82571
+ this._anchor = null;
82572
+ this._tileTransform = null;
82573
+ this._bounds = null;
82574
+ const destroyTexture = typeof options === "boolean" ? options : options == null ? void 0 : options.texture;
82575
+ if (destroyTexture) {
82576
+ const destroyTextureSource = typeof options === "boolean" ? options : options == null ? void 0 : options.textureSource;
82577
+ this._texture.destroy(destroyTextureSource);
82578
+ }
82579
+ this._texture = null;
82580
+ }
82581
+ };
82582
+ _TilingSprite.defaultOptions = {
82583
+ /** The texture to use for the sprite. */
82584
+ texture: Texture.EMPTY,
82585
+ /** The anchor point of the sprite */
82586
+ anchor: { x: 0, y: 0 },
82587
+ /** The offset of the image that is being tiled. */
82588
+ tilePosition: { x: 0, y: 0 },
82589
+ /** Scaling of the image that is being tiled. */
82590
+ tileScale: { x: 1, y: 1 },
82591
+ /** The rotation of the image that is being tiled. */
82592
+ tileRotation: 0,
82593
+ /**
82594
+ * Flags whether the tiling pattern should originate from the origin instead of the top-left corner in
82595
+ * local space.
82596
+ *
82597
+ * This will make the texture coordinates assigned to each vertex dependent on the value of the anchor. Without
82598
+ * this, the top-left corner always gets the (0, 0) texture coordinate.
82599
+ * @default false
82600
+ */
82601
+ applyAnchorToTexture: false
82602
+ };
82603
+ let TilingSprite = _TilingSprite;
80964
82604
  class AbstractText extends ViewContainer {
80965
82605
  constructor(options, styleClass) {
80966
82606
  const { text, resolution, style: style2, anchor, width, height, roundPixels, ...rest } = options;
@@ -84393,7 +86033,7 @@ function layoutNodes(nodes) {
84393
86033
  });
84394
86034
  return positions;
84395
86035
  }
84396
- function generateTerrain(width, height, nodes, paths) {
86036
+ function generateTerrain(width, height, nodes, paths, verticalBridgeXPositions = [], horizontalBridgeYPositions = []) {
84397
86037
  const tiles = [];
84398
86038
  for (let y2 = 0; y2 < height; y2++) {
84399
86039
  for (let x2 = 0; x2 < width; x2++) {
@@ -84406,6 +86046,36 @@ function generateTerrain(width, height, nodes, paths) {
84406
86046
  });
84407
86047
  }
84408
86048
  }
86049
+ for (const bridgeX of verticalBridgeXPositions) {
86050
+ const bridgeStartX = bridgeX - 1;
86051
+ const bridgeEndX = bridgeX + 1;
86052
+ for (let y2 = 0; y2 < height; y2++) {
86053
+ for (let x2 = bridgeStartX; x2 <= bridgeEndX; x2++) {
86054
+ if (x2 >= 0 && x2 < width) {
86055
+ const tileIndex = y2 * width + x2;
86056
+ if (tileIndex >= 0 && tileIndex < tiles.length) {
86057
+ tiles[tileIndex].type = "water";
86058
+ tiles[tileIndex].biome = "water";
86059
+ }
86060
+ }
86061
+ }
86062
+ }
86063
+ }
86064
+ for (const bridgeY of horizontalBridgeYPositions) {
86065
+ const bridgeStartY = bridgeY - 1;
86066
+ const bridgeEndY = bridgeY + 1;
86067
+ for (let x2 = 0; x2 < width; x2++) {
86068
+ for (let y2 = bridgeStartY; y2 <= bridgeEndY; y2++) {
86069
+ if (y2 >= 0 && y2 < height) {
86070
+ const tileIndex = y2 * width + x2;
86071
+ if (tileIndex >= 0 && tileIndex < tiles.length) {
86072
+ tiles[tileIndex].type = "water";
86073
+ tiles[tileIndex].biome = "water";
86074
+ }
86075
+ }
86076
+ }
86077
+ }
86078
+ }
84409
86079
  for (const path2 of paths) {
84410
86080
  for (const point of path2.points) {
84411
86081
  const x2 = Math.round(point.gridX);
@@ -84520,10 +86190,15 @@ function nodesToOverworldMap(nodes, options = {}) {
84520
86190
  minY = Math.min(minY, node.gridY);
84521
86191
  maxY = Math.max(maxY, node.gridY + node.size);
84522
86192
  });
84523
- const mapWidth = Math.ceil(maxX - minX) + mapPadding * 2;
84524
- const mapHeight = Math.ceil(maxY - minY) + mapPadding * 2;
84525
- const offsetX = mapPadding - minX;
84526
- const offsetY = mapPadding - minY;
86193
+ const calculatedWidth = Math.ceil(maxX - minX) + mapPadding * 2;
86194
+ const calculatedHeight = Math.ceil(maxY - minY) + mapPadding * 2;
86195
+ const squareSize = Math.ceil(Math.max(calculatedWidth, calculatedHeight));
86196
+ const mapWidth = squareSize;
86197
+ const mapHeight = squareSize;
86198
+ const extraHorizontalSpace = Math.floor((squareSize - calculatedWidth) / 2);
86199
+ const extraVerticalSpace = Math.floor((squareSize - calculatedHeight) / 2);
86200
+ const offsetX = mapPadding + extraHorizontalSpace - minX;
86201
+ const offsetY = mapPadding + extraVerticalSpace - minY;
84527
86202
  locationNodes.forEach((node) => {
84528
86203
  node.gridX += offsetX;
84529
86204
  node.gridY += offsetY;
@@ -84608,23 +86283,48 @@ function nodesToUnifiedOverworldMap(nodes, options = {}) {
84608
86283
  };
84609
86284
  }
84610
86285
  const REGION_SPACING = 5;
86286
+ const regionMaps = nodeGroups.map((group) => nodesToOverworldMap(group, options));
86287
+ const maxRegionSize = Math.max(...regionMaps.map((rm) => Math.max(rm.width, rm.height)));
86288
+ const REGION_SIZE = Math.ceil(maxRegionSize);
86289
+ const regionLayout = options.regionLayout || {
86290
+ columns: nodeGroups.length,
86291
+ rows: 1,
86292
+ fillDirection: "row-major"
86293
+ };
84611
86294
  const allNodes = [];
84612
86295
  const allPaths = [];
84613
86296
  const regions = [];
84614
- let currentX = 0;
84615
- let maxHeight = 0;
84616
- nodeGroups.forEach((group, index2) => {
84617
- const regionMap = nodesToOverworldMap(group, options);
86297
+ const horizontalBridges = [];
86298
+ const verticalBridges = [];
86299
+ const gridPositions = [];
86300
+ const fillDirection = regionLayout.fillDirection || "row-major";
86301
+ for (let i2 = 0; i2 < regionMaps.length; i2++) {
86302
+ if (fillDirection === "row-major") {
86303
+ const row = Math.floor(i2 / regionLayout.columns);
86304
+ const col = i2 % regionLayout.columns;
86305
+ gridPositions.push({ row, col });
86306
+ } else {
86307
+ const col = Math.floor(i2 / regionLayout.rows);
86308
+ const row = i2 % regionLayout.rows;
86309
+ gridPositions.push({ row, col });
86310
+ }
86311
+ }
86312
+ regionMaps.forEach((regionMap, index2) => {
86313
+ const gridPos = gridPositions[index2];
86314
+ const regionX = gridPos.col * (REGION_SIZE + REGION_SPACING);
86315
+ const regionY = gridPos.row * (REGION_SIZE + REGION_SPACING);
86316
+ const xOffset = regionX + Math.floor((REGION_SIZE - regionMap.width) / 2);
86317
+ const yOffset = regionY + Math.floor((REGION_SIZE - regionMap.height) / 2);
84618
86318
  const offsetNodes = regionMap.nodes.map((node) => ({
84619
86319
  ...node,
84620
- gridX: node.gridX + currentX,
84621
- gridY: node.gridY
86320
+ gridX: node.gridX + xOffset,
86321
+ gridY: node.gridY + yOffset
84622
86322
  }));
84623
86323
  const offsetPaths = regionMap.paths.map((path2) => ({
84624
86324
  ...path2,
84625
86325
  points: path2.points.map((point) => ({
84626
- gridX: point.gridX + currentX,
84627
- gridY: point.gridY
86326
+ gridX: point.gridX + xOffset,
86327
+ gridY: point.gridY + yOffset
84628
86328
  }))
84629
86329
  }));
84630
86330
  allNodes.push(...offsetNodes);
@@ -84633,22 +86333,39 @@ function nodesToUnifiedOverworldMap(nodes, options = {}) {
84633
86333
  id: `region-${index2}`,
84634
86334
  name: `Region ${index2 + 1}`,
84635
86335
  description: `Contains ${offsetNodes.length} nodes`,
86336
+ gridPosition: gridPos,
84636
86337
  bounds: {
84637
- x: currentX,
84638
- y: 0,
84639
- width: regionMap.width,
84640
- height: regionMap.height
86338
+ x: regionX,
86339
+ y: regionY,
86340
+ width: REGION_SIZE,
86341
+ height: REGION_SIZE
84641
86342
  },
84642
- centerX: currentX + regionMap.width / 2,
84643
- centerY: regionMap.height / 2,
86343
+ centerX: regionX + REGION_SIZE / 2,
86344
+ centerY: regionY + REGION_SIZE / 2,
84644
86345
  nodeIds: offsetNodes.map((n2) => n2.id)
84645
86346
  });
84646
- maxHeight = Math.max(maxHeight, regionMap.height);
84647
- currentX += regionMap.width + REGION_SPACING;
86347
+ if (gridPos.col < regionLayout.columns - 1) {
86348
+ const nextRegionExists = gridPositions.some(
86349
+ (p2) => p2.row === gridPos.row && p2.col === gridPos.col + 1
86350
+ );
86351
+ if (nextRegionExists) {
86352
+ const bridgeX = regionX + REGION_SIZE + Math.floor(REGION_SPACING / 2);
86353
+ horizontalBridges.push(bridgeX);
86354
+ }
86355
+ }
86356
+ if (gridPos.row < regionLayout.rows - 1) {
86357
+ const belowRegionExists = gridPositions.some(
86358
+ (p2) => p2.row === gridPos.row + 1 && p2.col === gridPos.col
86359
+ );
86360
+ if (belowRegionExists) {
86361
+ const bridgeY = regionY + REGION_SIZE + Math.floor(REGION_SPACING / 2);
86362
+ verticalBridges.push(bridgeY);
86363
+ }
86364
+ }
84648
86365
  });
84649
- const totalWidth = currentX - REGION_SPACING;
84650
- const totalHeight = maxHeight;
84651
- const tiles = generateTerrain(totalWidth, totalHeight, allNodes, allPaths);
86366
+ const totalWidth = regionLayout.columns * REGION_SIZE + (regionLayout.columns - 1) * REGION_SPACING;
86367
+ const totalHeight = regionLayout.rows * REGION_SIZE + (regionLayout.rows - 1) * REGION_SPACING;
86368
+ const tiles = generateTerrain(totalWidth, totalHeight, allNodes, allPaths, horizontalBridges, verticalBridges);
84652
86369
  return {
84653
86370
  width: totalWidth,
84654
86371
  height: totalHeight,
@@ -84758,7 +86475,8 @@ function packagesToUnifiedOverworldMap(packages, options = {}) {
84758
86475
  );
84759
86476
  const map2 = nodesToUnifiedOverworldMap(genericNodes, {
84760
86477
  includeDevDependencies: options.includeDevDependencies,
84761
- mapPadding: options.mapPadding
86478
+ mapPadding: options.mapPadding,
86479
+ regionLayout: options.regionLayout
84762
86480
  });
84763
86481
  return {
84764
86482
  ...map2,
@@ -84848,6 +86566,28 @@ function createCanvas(width, height) {
84848
86566
  canvas.height = height;
84849
86567
  return canvas;
84850
86568
  }
86569
+ function generateGrassBackgroundTile() {
86570
+ const size = 32;
86571
+ const canvas = createCanvas(size, size);
86572
+ const ctx = canvas.getContext("2d");
86573
+ ctx.fillStyle = "#3d5a27";
86574
+ ctx.fillRect(0, 0, size, size);
86575
+ const bladeColor = "#4a6b2f";
86576
+ const darkBladeColor = "#2f4520";
86577
+ for (let i2 = 0; i2 < 20; i2++) {
86578
+ const x2 = Math.floor(Math.random() * size);
86579
+ const y2 = Math.floor(Math.random() * size);
86580
+ ctx.fillStyle = Math.random() > 0.5 ? bladeColor : darkBladeColor;
86581
+ ctx.fillRect(x2, y2, 1, 1);
86582
+ }
86583
+ for (let i2 = 0; i2 < 8; i2++) {
86584
+ const x2 = Math.floor(Math.random() * size);
86585
+ const y2 = Math.floor(Math.random() * (size - 1));
86586
+ ctx.fillStyle = bladeColor;
86587
+ ctx.fillRect(x2, y2, 1, 2);
86588
+ }
86589
+ return canvas;
86590
+ }
84851
86591
  function generateGrassTile(theme = "grass") {
84852
86592
  const canvas = createCanvas(ISO_TILE_WIDTH, ISO_TILE_HEIGHT);
84853
86593
  const ctx = canvas.getContext("2d");
@@ -84883,6 +86623,33 @@ function generatePathTile() {
84883
86623
  ctx.fillRect(ISO_TILE_WIDTH / 2 - 12, ISO_TILE_HEIGHT / 2 + 4, 6, 3);
84884
86624
  return canvas;
84885
86625
  }
86626
+ function generateBridgeTile() {
86627
+ const canvas = createCanvas(ISO_TILE_WIDTH, ISO_TILE_HEIGHT);
86628
+ const ctx = canvas.getContext("2d");
86629
+ ctx.fillStyle = "#92400e";
86630
+ ctx.beginPath();
86631
+ ctx.moveTo(ISO_TILE_WIDTH / 2, 0);
86632
+ ctx.lineTo(ISO_TILE_WIDTH, ISO_TILE_HEIGHT / 2);
86633
+ ctx.lineTo(ISO_TILE_WIDTH / 2, ISO_TILE_HEIGHT);
86634
+ ctx.lineTo(0, ISO_TILE_HEIGHT / 2);
86635
+ ctx.closePath();
86636
+ ctx.fill();
86637
+ ctx.strokeStyle = "#78350f";
86638
+ ctx.lineWidth = 2;
86639
+ const plankY = [ISO_TILE_HEIGHT * 0.25, ISO_TILE_HEIGHT * 0.5, ISO_TILE_HEIGHT * 0.75];
86640
+ for (const y2 of plankY) {
86641
+ const widthAtY = y2 <= ISO_TILE_HEIGHT / 2 ? y2 / (ISO_TILE_HEIGHT / 2) * (ISO_TILE_WIDTH / 2) : (ISO_TILE_HEIGHT - y2) / (ISO_TILE_HEIGHT / 2) * (ISO_TILE_WIDTH / 2);
86642
+ ctx.beginPath();
86643
+ ctx.moveTo(ISO_TILE_WIDTH / 2 - widthAtY, y2);
86644
+ ctx.lineTo(ISO_TILE_WIDTH / 2 + widthAtY, y2);
86645
+ ctx.stroke();
86646
+ }
86647
+ ctx.fillStyle = "#a16207";
86648
+ ctx.fillRect(ISO_TILE_WIDTH / 2 - 3, ISO_TILE_HEIGHT / 2 - 1, 6, 2);
86649
+ ctx.fillRect(ISO_TILE_WIDTH / 2 + 10, ISO_TILE_HEIGHT / 2 + 3, 4, 2);
86650
+ ctx.fillRect(ISO_TILE_WIDTH / 2 - 14, ISO_TILE_HEIGHT / 2 + 3, 4, 2);
86651
+ return canvas;
86652
+ }
84886
86653
  function generateLocationSprite(type2, theme, size = 2) {
84887
86654
  const width = ISO_TILE_WIDTH * size;
84888
86655
  const height = ISO_TILE_HEIGHT * size + 64;
@@ -85141,10 +86908,12 @@ function generateDecorativeSprite(type2) {
85141
86908
  }
85142
86909
  function generateSpriteAtlas() {
85143
86910
  const atlas = {};
86911
+ atlas["bg-grass"] = generateGrassBackgroundTile();
85144
86912
  for (const biome of Object.keys(BIOME_COLORS)) {
85145
86913
  atlas[`tile-grass-${biome}`] = generateGrassTile(biome);
85146
86914
  }
85147
86915
  atlas["tile-path"] = generatePathTile();
86916
+ atlas["tile-bridge"] = generateBridgeTile();
85148
86917
  const locationTypes = ["castle", "fortress", "tower", "house", "pipe", "git-repo", "monorepo"];
85149
86918
  const themes = ["grass", "desert", "water", "volcano", "ice"];
85150
86919
  for (const type2 of locationTypes) {
@@ -85163,8 +86932,9 @@ const OverworldMapPanelContent = ({
85163
86932
  packages,
85164
86933
  includeDevDependencies = true,
85165
86934
  includePeerDependencies = false,
85166
- width = 800,
85167
- height = 600,
86935
+ regionLayout,
86936
+ width,
86937
+ height,
85168
86938
  isLoading = false
85169
86939
  }) => {
85170
86940
  const canvasRef = useRef(null);
@@ -85172,29 +86942,35 @@ const OverworldMapPanelContent = ({
85172
86942
  const worldContainerRef = useRef(null);
85173
86943
  const scaleRef = useRef(1);
85174
86944
  const [isRendering, setIsRendering] = useState(true);
86945
+ const dimensionsRef = useRef({ width: width || 800, height: height || 600 });
85175
86946
  const [currentRegionIndex, setCurrentRegionIndex] = useState(0);
85176
86947
  const [isAnimating, setIsAnimating] = useState(false);
85177
86948
  const animationRef = useRef(null);
85178
86949
  const hasInitializedCamera = useRef(false);
86950
+ const skipNextAnimation = useRef(false);
85179
86951
  const mapData = useMemo(() => {
85180
86952
  return packagesToUnifiedOverworldMap(packages, {
85181
86953
  includeDevDependencies,
85182
- includePeerDependencies
86954
+ includePeerDependencies,
86955
+ regionLayout
85183
86956
  });
85184
- }, [packages, includeDevDependencies, includePeerDependencies]);
86957
+ }, [packages, includeDevDependencies, includePeerDependencies, regionLayout]);
85185
86958
  const currentRegion = mapData.regions[currentRegionIndex] || mapData.regions[0];
85186
86959
  useEffect(() => {
85187
86960
  if (!canvasRef.current) return;
85188
86961
  let app;
85189
86962
  let cleanup = false;
85190
86963
  const initPixi = async () => {
85191
- var _a;
86964
+ var _a, _b, _c;
86965
+ const containerWidth = ((_a = canvasRef.current) == null ? void 0 : _a.clientWidth) || width || 800;
86966
+ const containerHeight = ((_b = canvasRef.current) == null ? void 0 : _b.clientHeight) || height || 600;
86967
+ dimensionsRef.current = { width: containerWidth, height: containerHeight };
85192
86968
  app = new Application();
85193
86969
  await app.init({
85194
- width,
85195
- height,
85196
- backgroundColor: 8900331,
85197
- // Sky blue
86970
+ width: containerWidth,
86971
+ height: containerHeight,
86972
+ backgroundColor: 4020775,
86973
+ // Dark grass green (matches background texture)
85198
86974
  antialias: false
85199
86975
  // Pixel-perfect rendering
85200
86976
  });
@@ -85202,7 +86978,7 @@ const OverworldMapPanelContent = ({
85202
86978
  app.destroy(true);
85203
86979
  return;
85204
86980
  }
85205
- (_a = canvasRef.current) == null ? void 0 : _a.appendChild(app.canvas);
86981
+ (_c = canvasRef.current) == null ? void 0 : _c.appendChild(app.canvas);
85206
86982
  appRef.current = app;
85207
86983
  const atlas = generateSpriteAtlas();
85208
86984
  const textures = {};
@@ -85212,6 +86988,37 @@ const OverworldMapPanelContent = ({
85212
86988
  const worldContainer = new Container();
85213
86989
  app.stage.addChild(worldContainer);
85214
86990
  worldContainerRef.current = worldContainer;
86991
+ const bgTexture = textures["bg-grass"];
86992
+ if (bgTexture) {
86993
+ const backgroundTiling = new TilingSprite({
86994
+ texture: bgTexture,
86995
+ width: mapData.width * ISO_TILE_WIDTH * 2,
86996
+ // Make background larger than map
86997
+ height: mapData.height * ISO_TILE_HEIGHT * 2
86998
+ });
86999
+ backgroundTiling.x = -(mapData.width * ISO_TILE_WIDTH * 2) / 4;
87000
+ backgroundTiling.y = -(mapData.height * ISO_TILE_HEIGHT * 2) / 4;
87001
+ worldContainer.addChild(backgroundTiling);
87002
+ }
87003
+ const updateCurrentRegion = () => {
87004
+ if (mapData.regions.length <= 1) return;
87005
+ const viewportCenterX = dimensionsRef.current.width / 2;
87006
+ const viewportCenterY = dimensionsRef.current.height / 2;
87007
+ const worldX = viewportCenterX - worldContainer.x;
87008
+ const worldY = viewportCenterY - worldContainer.y;
87009
+ const gridPos = screenToGrid(worldX, worldY);
87010
+ for (let i2 = 0; i2 < mapData.regions.length; i2++) {
87011
+ const region = mapData.regions[i2];
87012
+ const { x: x2, y: y2, width: width2, height: height2 } = region.bounds;
87013
+ if (gridPos.gridX >= x2 && gridPos.gridX < x2 + width2 && gridPos.gridY >= y2 && gridPos.gridY < y2 + height2) {
87014
+ if (currentRegionIndex !== i2) {
87015
+ skipNextAnimation.current = true;
87016
+ setCurrentRegionIndex(i2);
87017
+ }
87018
+ return;
87019
+ }
87020
+ }
87021
+ };
85215
87022
  let isDragging = false;
85216
87023
  let dragStart = { x: 0, y: 0 };
85217
87024
  let worldStart = { x: 0, y: 0 };
@@ -85230,6 +87037,7 @@ const OverworldMapPanelContent = ({
85230
87037
  const dy = event.globalY - dragStart.y;
85231
87038
  worldContainer.x = worldStart.x + dx;
85232
87039
  worldContainer.y = worldStart.y + dy;
87040
+ updateCurrentRegion();
85233
87041
  }
85234
87042
  });
85235
87043
  app.stage.on("pointerup", () => {
@@ -85254,6 +87062,21 @@ const OverworldMapPanelContent = ({
85254
87062
  tileContainer.addChild(sprite);
85255
87063
  }
85256
87064
  }
87065
+ const bridgeContainer = new Container();
87066
+ worldContainer.addChild(bridgeContainer);
87067
+ for (const tile of mapData.tiles) {
87068
+ if (tile.type === "water") {
87069
+ const { screenX, screenY } = gridToScreen(tile.x, tile.y);
87070
+ const bridgeTexture = textures["tile-bridge"];
87071
+ if (bridgeTexture) {
87072
+ const bridgeSprite = new Sprite(bridgeTexture);
87073
+ bridgeSprite.x = screenX;
87074
+ bridgeSprite.y = screenY;
87075
+ bridgeSprite.anchor.set(0.5, 0.5);
87076
+ bridgeContainer.addChild(bridgeSprite);
87077
+ }
87078
+ }
87079
+ }
85257
87080
  const pathContainer = new Container();
85258
87081
  worldContainer.addChild(pathContainer);
85259
87082
  const pathGraphics = [];
@@ -85377,10 +87200,10 @@ const OverworldMapPanelContent = ({
85377
87200
  const sprite = new Sprite(texture);
85378
87201
  const MAX_SPRITE_SIZE = 256;
85379
87202
  if (sprite.width > MAX_SPRITE_SIZE || sprite.height > MAX_SPRITE_SIZE) {
85380
- const scaleX2 = MAX_SPRITE_SIZE / sprite.width;
85381
- const scaleY2 = MAX_SPRITE_SIZE / sprite.height;
85382
- const scale2 = Math.min(scaleX2, scaleY2);
85383
- sprite.scale.set(scale2, scale2);
87203
+ const scaleX = MAX_SPRITE_SIZE / sprite.width;
87204
+ const scaleY = MAX_SPRITE_SIZE / sprite.height;
87205
+ const scale = Math.min(scaleX, scaleY);
87206
+ sprite.scale.set(scale, scale);
85384
87207
  }
85385
87208
  sprite.x = screenX;
85386
87209
  sprite.y = screenY;
@@ -85503,27 +87326,30 @@ const OverworldMapPanelContent = ({
85503
87326
  });
85504
87327
  }
85505
87328
  }
85506
- let maxRegionWidth = 0;
85507
- let maxRegionHeight = 0;
85508
- for (const region of mapData.regions) {
85509
- const topLeft = gridToScreen(region.bounds.x, region.bounds.y);
85510
- const bottomRight = gridToScreen(
85511
- region.bounds.x + region.bounds.width,
85512
- region.bounds.y + region.bounds.height
85513
- );
85514
- const regionWidth = Math.abs(bottomRight.screenX - topLeft.screenX);
85515
- const regionHeight = Math.abs(bottomRight.screenY - topLeft.screenY);
85516
- maxRegionWidth = Math.max(maxRegionWidth, regionWidth);
85517
- maxRegionHeight = Math.max(maxRegionHeight, regionHeight);
85518
- }
85519
- const padding = 40;
85520
- const availableWidth = width - padding * 2;
85521
- const availableHeight = height - padding * 2;
85522
- const scaleX = availableWidth / maxRegionWidth;
85523
- const scaleY = availableHeight / maxRegionHeight;
85524
- const scale = Math.min(scaleX, scaleY, 1);
85525
- worldContainer.scale.set(scale, scale);
85526
- scaleRef.current = scale;
87329
+ const updateScale = () => {
87330
+ let maxRegionWidth = 0;
87331
+ let maxRegionHeight = 0;
87332
+ for (const region of mapData.regions) {
87333
+ const topLeft = gridToScreen(region.bounds.x, region.bounds.y);
87334
+ const bottomRight = gridToScreen(
87335
+ region.bounds.x + region.bounds.width,
87336
+ region.bounds.y + region.bounds.height
87337
+ );
87338
+ const regionWidth = Math.abs(bottomRight.screenX - topLeft.screenX);
87339
+ const regionHeight = Math.abs(bottomRight.screenY - topLeft.screenY);
87340
+ maxRegionWidth = Math.max(maxRegionWidth, regionWidth);
87341
+ maxRegionHeight = Math.max(maxRegionHeight, regionHeight);
87342
+ }
87343
+ const padding = 40;
87344
+ const availableWidth = dimensionsRef.current.width - padding * 2;
87345
+ const availableHeight = dimensionsRef.current.height - padding * 2;
87346
+ const scaleX = availableWidth / maxRegionWidth;
87347
+ const scaleY = availableHeight / maxRegionHeight;
87348
+ const scale = Math.min(scaleX, scaleY, 1);
87349
+ worldContainer.scale.set(scale, scale);
87350
+ scaleRef.current = scale;
87351
+ };
87352
+ updateScale();
85527
87353
  const easeOutCubic = (t2) => {
85528
87354
  return 1 - Math.pow(1 - t2, 3);
85529
87355
  };
@@ -85542,9 +87368,50 @@ const OverworldMapPanelContent = ({
85542
87368
  });
85543
87369
  setIsRendering(false);
85544
87370
  };
85545
- initPixi();
87371
+ let resizeObserver = null;
87372
+ const initAndSetupResize = async () => {
87373
+ await initPixi();
87374
+ if (canvasRef.current && appRef.current) {
87375
+ resizeObserver = new ResizeObserver((entries) => {
87376
+ if (!appRef.current || !worldContainerRef.current) return;
87377
+ for (const entry of entries) {
87378
+ const { width: newWidth, height: newHeight } = entry.contentRect;
87379
+ dimensionsRef.current = { width: newWidth, height: newHeight };
87380
+ appRef.current.renderer.resize(newWidth, newHeight);
87381
+ const worldContainer = worldContainerRef.current;
87382
+ let maxRegionWidth = 0;
87383
+ let maxRegionHeight = 0;
87384
+ for (const region of mapData.regions) {
87385
+ const topLeft = gridToScreen(region.bounds.x, region.bounds.y);
87386
+ const bottomRight = gridToScreen(
87387
+ region.bounds.x + region.bounds.width,
87388
+ region.bounds.y + region.bounds.height
87389
+ );
87390
+ const regionWidth = Math.abs(bottomRight.screenX - topLeft.screenX);
87391
+ const regionHeight = Math.abs(bottomRight.screenY - topLeft.screenY);
87392
+ maxRegionWidth = Math.max(maxRegionWidth, regionWidth);
87393
+ maxRegionHeight = Math.max(maxRegionHeight, regionHeight);
87394
+ }
87395
+ const padding = 40;
87396
+ const availableWidth = dimensionsRef.current.width - padding * 2;
87397
+ const availableHeight = dimensionsRef.current.height - padding * 2;
87398
+ const scaleX = availableWidth / maxRegionWidth;
87399
+ const scaleY = availableHeight / maxRegionHeight;
87400
+ const scale = Math.min(scaleX, scaleY, 1);
87401
+ worldContainer.scale.set(scale, scale);
87402
+ scaleRef.current = scale;
87403
+ appRef.current.stage.hitArea = appRef.current.screen;
87404
+ }
87405
+ });
87406
+ resizeObserver.observe(canvasRef.current);
87407
+ }
87408
+ };
87409
+ initAndSetupResize();
85546
87410
  return () => {
85547
87411
  cleanup = true;
87412
+ if (resizeObserver) {
87413
+ resizeObserver.disconnect();
87414
+ }
85548
87415
  if (appRef.current) {
85549
87416
  appRef.current.destroy(true);
85550
87417
  appRef.current = null;
@@ -85552,20 +87419,24 @@ const OverworldMapPanelContent = ({
85552
87419
  worldContainerRef.current = null;
85553
87420
  animationRef.current = null;
85554
87421
  };
85555
- }, [mapData, width, height]);
87422
+ }, [mapData]);
85556
87423
  useEffect(() => {
85557
87424
  if (!worldContainerRef.current || !currentRegion || isRendering) return;
85558
87425
  const regionCenter = gridToScreen(currentRegion.centerX, currentRegion.centerY);
85559
87426
  const worldContainer = worldContainerRef.current;
85560
87427
  const scale = scaleRef.current;
85561
- const targetX = width / 2 - regionCenter.screenX * scale;
85562
- const targetY = height / 2 - regionCenter.screenY * scale;
87428
+ const targetX = dimensionsRef.current.width / 2 - regionCenter.screenX * scale;
87429
+ const targetY = dimensionsRef.current.height / 2 - regionCenter.screenY * scale;
85563
87430
  if (!hasInitializedCamera.current) {
85564
87431
  worldContainer.x = targetX;
85565
87432
  worldContainer.y = targetY;
85566
87433
  hasInitializedCamera.current = true;
85567
87434
  return;
85568
87435
  }
87436
+ if (skipNextAnimation.current) {
87437
+ skipNextAnimation.current = false;
87438
+ return;
87439
+ }
85569
87440
  setIsAnimating(true);
85570
87441
  animationRef.current = {
85571
87442
  startTime: performance.now(),
@@ -85574,14 +87445,14 @@ const OverworldMapPanelContent = ({
85574
87445
  targetX,
85575
87446
  targetY
85576
87447
  };
85577
- }, [currentRegionIndex, currentRegion, width, height, isRendering]);
87448
+ }, [currentRegionIndex, currentRegion, isRendering]);
85578
87449
  if (packages.length === 0) {
85579
87450
  return /* @__PURE__ */ jsx(
85580
87451
  "div",
85581
87452
  {
85582
87453
  style: {
85583
- width,
85584
- height,
87454
+ width: "100%",
87455
+ height: "100%",
85585
87456
  display: "flex",
85586
87457
  alignItems: "center",
85587
87458
  justifyContent: "center",
@@ -85592,7 +87463,7 @@ const OverworldMapPanelContent = ({
85592
87463
  }
85593
87464
  );
85594
87465
  }
85595
- return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
87466
+ return /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%", height: "100%", overflow: "hidden" }, children: [
85596
87467
  (isLoading || isRendering) && /* @__PURE__ */ jsx(
85597
87468
  "div",
85598
87469
  {
@@ -85600,8 +87471,8 @@ const OverworldMapPanelContent = ({
85600
87471
  position: "absolute",
85601
87472
  top: 0,
85602
87473
  left: 0,
85603
- width,
85604
- height,
87474
+ width: "100%",
87475
+ height: "100%",
85605
87476
  display: "flex",
85606
87477
  alignItems: "center",
85607
87478
  justifyContent: "center",
@@ -85618,10 +87489,11 @@ const OverworldMapPanelContent = ({
85618
87489
  {
85619
87490
  ref: canvasRef,
85620
87491
  style: {
85621
- width,
85622
- height,
87492
+ width: "100%",
87493
+ height: "100%",
85623
87494
  imageRendering: "pixelated",
85624
- border: "2px solid #1f2937"
87495
+ border: "2px solid #1f2937",
87496
+ boxSizing: "border-box"
85625
87497
  }
85626
87498
  }
85627
87499
  ),
@@ -85697,33 +87569,6 @@ const OverworldMapPanelContent = ({
85697
87569
  ]
85698
87570
  }
85699
87571
  ),
85700
- mapData.regions.length === 1 && /* @__PURE__ */ jsxs(
85701
- "div",
85702
- {
85703
- style: {
85704
- position: "absolute",
85705
- top: 8,
85706
- left: 8,
85707
- padding: "8px 12px",
85708
- backgroundColor: "rgba(0, 0, 0, 0.7)",
85709
- color: "#ffffff",
85710
- fontFamily: "monospace",
85711
- fontSize: 12,
85712
- borderRadius: 4,
85713
- pointerEvents: "none"
85714
- },
85715
- children: [
85716
- /* @__PURE__ */ jsxs("div", { children: [
85717
- "Packages: ",
85718
- mapData.nodes.length
85719
- ] }),
85720
- /* @__PURE__ */ jsxs("div", { children: [
85721
- "Dependencies: ",
85722
- mapData.paths.length
85723
- ] })
85724
- ]
85725
- }
85726
- ),
85727
87572
  /* @__PURE__ */ jsx(
85728
87573
  "div",
85729
87574
  {
@@ -85744,44 +87589,11 @@ const OverworldMapPanelContent = ({
85744
87589
  )
85745
87590
  ] });
85746
87591
  };
85747
- const OverworldMapPanelPreview = () => {
85748
- return /* @__PURE__ */ jsx(
85749
- "div",
85750
- {
85751
- style: {
85752
- width: "100%",
85753
- height: "100%",
85754
- display: "flex",
85755
- alignItems: "center",
85756
- justifyContent: "center",
85757
- backgroundColor: "#87ceeb",
85758
- fontFamily: "monospace",
85759
- fontSize: 14,
85760
- color: "#ffffff"
85761
- },
85762
- children: "8-bit Overworld Map"
85763
- }
85764
- );
85765
- };
85766
- const OverworldMapPanel = ({ context: context2 }) => {
85767
- var _a;
85768
- const packagesSlice = context2.getSlice("packages");
85769
- const packages = ((_a = packagesSlice == null ? void 0 : packagesSlice.data) == null ? void 0 : _a.packages) ?? [];
85770
- const isLoading = (packagesSlice == null ? void 0 : packagesSlice.loading) || false;
85771
- return /* @__PURE__ */ jsx(
85772
- OverworldMapPanelContent,
85773
- {
85774
- packages,
85775
- isLoading,
85776
- includeDevDependencies: true,
85777
- includePeerDependencies: false
85778
- }
85779
- );
85780
- };
85781
87592
  const GitProjectsMapPanelContent = ({
85782
87593
  projects,
85783
- width = 800,
85784
- height = 600,
87594
+ regionLayout,
87595
+ width,
87596
+ height,
85785
87597
  isLoading = false
85786
87598
  }) => {
85787
87599
  const packages = useMemo(() => {
@@ -85814,8 +87626,8 @@ const GitProjectsMapPanelContent = ({
85814
87626
  "div",
85815
87627
  {
85816
87628
  style: {
85817
- width,
85818
- height,
87629
+ width: "100%",
87630
+ height: "100%",
85819
87631
  display: "flex",
85820
87632
  alignItems: "center",
85821
87633
  justifyContent: "center",
@@ -85830,6 +87642,7 @@ const GitProjectsMapPanelContent = ({
85830
87642
  OverworldMapPanelContent,
85831
87643
  {
85832
87644
  packages,
87645
+ regionLayout,
85833
87646
  width,
85834
87647
  height,
85835
87648
  isLoading,
@@ -85838,167 +87651,14 @@ const GitProjectsMapPanelContent = ({
85838
87651
  }
85839
87652
  );
85840
87653
  };
85841
- const GitProjectsMapPanelPreview = () => {
85842
- return /* @__PURE__ */ jsx(
85843
- "div",
85844
- {
85845
- style: {
85846
- width: "100%",
85847
- height: "100%",
85848
- display: "flex",
85849
- alignItems: "center",
85850
- justifyContent: "center",
85851
- backgroundColor: "#87ceeb",
85852
- fontFamily: "monospace",
85853
- fontSize: 14,
85854
- color: "#ffffff"
85855
- },
85856
- children: "Git Projects Map"
85857
- }
85858
- );
85859
- };
85860
- const GitProjectsMapPanel = ({ context: context2 }) => {
85861
- const projects = useMemo(() => {
85862
- return [
85863
- {
85864
- id: "web-ade",
85865
- name: "Web ADE",
85866
- path: "/projects/web-ade",
85867
- category: "frontend",
85868
- importance: 90,
85869
- isRoot: true,
85870
- dependencies: ["shared-ui", "api-client"]
85871
- },
85872
- {
85873
- id: "shared-ui",
85874
- name: "Shared UI",
85875
- path: "/projects/shared-ui",
85876
- category: "library",
85877
- importance: 70,
85878
- dependencies: []
85879
- },
85880
- {
85881
- id: "api-client",
85882
- name: "API Client",
85883
- path: "/projects/api-client",
85884
- category: "library",
85885
- importance: 80,
85886
- dependencies: ["shared-types"]
85887
- },
85888
- {
85889
- id: "shared-types",
85890
- name: "Shared Types",
85891
- path: "/projects/shared-types",
85892
- category: "library",
85893
- importance: 60,
85894
- dependencies: []
85895
- },
85896
- {
85897
- id: "backend-api",
85898
- name: "Backend API",
85899
- path: "/projects/backend-api",
85900
- category: "backend",
85901
- importance: 95,
85902
- isRoot: true,
85903
- dependencies: ["database", "shared-types"]
85904
- },
85905
- {
85906
- id: "database",
85907
- name: "Database",
85908
- path: "/projects/database",
85909
- category: "backend",
85910
- importance: 85,
85911
- dependencies: []
85912
- },
85913
- {
85914
- id: "cli-tool",
85915
- name: "CLI Tool",
85916
- path: "/projects/cli-tool",
85917
- category: "tool",
85918
- importance: 65,
85919
- dependencies: ["api-client"]
85920
- },
85921
- {
85922
- id: "docs-site",
85923
- name: "Documentation",
85924
- path: "/projects/docs-site",
85925
- category: "frontend",
85926
- importance: 50,
85927
- dependencies: []
85928
- },
85929
- {
85930
- id: "mobile-app",
85931
- name: "Mobile App",
85932
- path: "/projects/mobile-app",
85933
- category: "frontend",
85934
- importance: 85,
85935
- dependencies: ["api-client", "shared-ui"]
85936
- },
85937
- {
85938
- id: "auth-service",
85939
- name: "Auth Service",
85940
- path: "/projects/auth-service",
85941
- category: "backend",
85942
- importance: 90,
85943
- dependencies: ["database"]
85944
- },
85945
- {
85946
- id: "notification-service",
85947
- name: "Notifications",
85948
- path: "/projects/notification-service",
85949
- category: "backend",
85950
- importance: 70,
85951
- dependencies: ["database", "shared-types"]
85952
- },
85953
- {
85954
- id: "analytics",
85955
- name: "Analytics",
85956
- path: "/projects/analytics",
85957
- category: "backend",
85958
- importance: 75,
85959
- dependencies: ["database"]
85960
- },
85961
- {
85962
- id: "testing-utils",
85963
- name: "Testing Utils",
85964
- path: "/projects/testing-utils",
85965
- category: "tool",
85966
- importance: 60,
85967
- dependencies: []
85968
- },
85969
- {
85970
- id: "design-system",
85971
- name: "Design System",
85972
- path: "/projects/design-system",
85973
- category: "library",
85974
- importance: 80,
85975
- dependencies: []
85976
- },
85977
- {
85978
- id: "admin-panel",
85979
- name: "Admin Panel",
85980
- path: "/projects/admin-panel",
85981
- category: "frontend",
85982
- importance: 75,
85983
- dependencies: ["api-client", "shared-ui", "design-system"]
85984
- }
85985
- ];
85986
- }, []);
85987
- return /* @__PURE__ */ jsx(
85988
- GitProjectsMapPanelContent,
85989
- {
85990
- projects,
85991
- isLoading: false
85992
- }
85993
- );
85994
- };
85995
87654
  const CollectionMapPanelContent = ({
85996
87655
  collection,
85997
87656
  memberships,
85998
87657
  repositories,
85999
87658
  dependencies = {},
86000
- width = 800,
86001
- height = 600,
87659
+ regionLayout,
87660
+ width,
87661
+ height,
86002
87662
  isLoading = false,
86003
87663
  onProjectMoved
86004
87664
  }) => {
@@ -86008,10 +87668,16 @@ const CollectionMapPanelContent = ({
86008
87668
  );
86009
87669
  return collectionMemberships.map((membership) => {
86010
87670
  var _a, _b, _c;
86011
- const repo = repositories.find((r2) => r2.name === membership.repositoryId);
86012
- if (!repo) return null;
87671
+ const repo = repositories.find((r2) => {
87672
+ var _a2;
87673
+ const repoId = ((_a2 = r2.github) == null ? void 0 : _a2.id) || r2.name;
87674
+ return repoId === membership.repositoryId;
87675
+ });
87676
+ if (!repo) {
87677
+ return null;
87678
+ }
86013
87679
  let category;
86014
- if (((_a = repo.provider) == null ? void 0 : _a.type) === "github") {
87680
+ if (((_a = repo.provider) == null ? void 0 : _a.type) === "github" || repo.github) {
86015
87681
  category = "git-repo";
86016
87682
  } else {
86017
87683
  category = repo.theme || "git-repo";
@@ -86030,7 +87696,7 @@ const CollectionMapPanelContent = ({
86030
87696
  return project;
86031
87697
  }).filter((p2) => p2 !== null);
86032
87698
  }, [collection.id, memberships, repositories, dependencies]);
86033
- return /* @__PURE__ */ jsxs("div", { style: { position: "relative", width, height }, children: [
87699
+ return /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%", height: "100%", overflow: "hidden" }, children: [
86034
87700
  /* @__PURE__ */ jsxs(
86035
87701
  "div",
86036
87702
  {
@@ -86058,6 +87724,7 @@ const CollectionMapPanelContent = ({
86058
87724
  GitProjectsMapPanelContent,
86059
87725
  {
86060
87726
  projects,
87727
+ regionLayout,
86061
87728
  width,
86062
87729
  height,
86063
87730
  isLoading
@@ -86102,7 +87769,7 @@ const CollectionMapPanel = ({ context: context2 }) => {
86102
87769
  );
86103
87770
  const dependencies = {};
86104
87771
  const isLoading = collectionsLoading || repositoriesLoading;
86105
- return /* @__PURE__ */ jsx(
87772
+ return /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ jsx(
86106
87773
  CollectionMapPanelContent,
86107
87774
  {
86108
87775
  collection: selectedCollection,
@@ -86111,7 +87778,7 @@ const CollectionMapPanel = ({ context: context2 }) => {
86111
87778
  dependencies,
86112
87779
  isLoading
86113
87780
  }
86114
- );
87781
+ ) });
86115
87782
  };
86116
87783
  const getCoverageColor = (percentage) => {
86117
87784
  if (percentage >= 80) return "#22c55e";
@@ -86987,45 +88654,6 @@ const panels = [
86987
88654
  console.log("Dependency Graph Panel unmounting");
86988
88655
  }
86989
88656
  },
86990
- {
86991
- metadata: {
86992
- id: "industry-theme.overworld-map",
86993
- name: "Overworld Map",
86994
- icon: "Map",
86995
- version: "0.1.0",
86996
- author: "Industry Theme",
86997
- description: "8-bit Mario-style overworld map for package dependencies",
86998
- slices: ["packages"]
86999
- },
87000
- component: OverworldMapPanel,
87001
- onMount: async (context2) => {
87002
- console.log("Overworld Map Panel mounted");
87003
- if (context2.hasSlice("packages") && !context2.isSliceLoading("packages")) {
87004
- await context2.refresh("repository", "packages");
87005
- }
87006
- },
87007
- onUnmount: async (_context) => {
87008
- console.log("Overworld Map Panel unmounting");
87009
- }
87010
- },
87011
- {
87012
- metadata: {
87013
- id: "industry-theme.git-projects-map",
87014
- name: "Git Projects Map",
87015
- icon: "Map",
87016
- version: "0.1.0",
87017
- author: "Industry Theme",
87018
- description: "Visualize multiple git projects as regions on an 8-bit overworld map",
87019
- slices: []
87020
- },
87021
- component: GitProjectsMapPanel,
87022
- onMount: async (context2) => {
87023
- console.log("Git Projects Map Panel mounted");
87024
- },
87025
- onUnmount: async (_context) => {
87026
- console.log("Git Projects Map Panel unmounting");
87027
- }
87028
- },
87029
88657
  {
87030
88658
  metadata: {
87031
88659
  id: "industry-theme.collection-map",
@@ -87076,7 +88704,7 @@ const onPackageUnload = async () => {
87076
88704
  console.log("Repository Composition Panels package unloading");
87077
88705
  };
87078
88706
  export {
87079
- BigPool as $,
88707
+ roundPixelsBit as $,
87080
88708
  AbstractRenderer as A,
87081
88709
  BindGroup as B,
87082
88710
  Color as C,
@@ -87084,90 +88712,91 @@ export {
87084
88712
  ExtensionType as E,
87085
88713
  FillGradient as F,
87086
88714
  GpuProgram as G,
87087
- Container as H,
87088
- getTextureBatchBindGroup as I,
87089
- GCManagedHash as J,
87090
- fastCopy as K,
87091
- createIdFromString as L,
88715
+ UPDATE_PRIORITY as H,
88716
+ removeItems as I,
88717
+ Container as J,
88718
+ getTextureBatchBindGroup as K,
88719
+ GCManagedHash as L,
87092
88720
  Matrix as M,
87093
- CLEAR as N,
87094
- TextureSource as O,
88721
+ fastCopy as N,
88722
+ createIdFromString as O,
87095
88723
  Point as P,
87096
- CanvasPool as Q,
88724
+ CLEAR as Q,
87097
88725
  RendererType as R,
87098
88726
  Shader as S,
87099
88727
  TexturePool as T,
87100
88728
  UniformGroup as U,
87101
- compileHighShaderGpuProgram as V,
87102
- colorBit as W,
87103
- generateTextureBatchBit as X,
87104
- roundPixelsBit as Y,
87105
- TextureMatrix as Z,
87106
- DefaultBatcher as _,
88729
+ TextureSource as V,
88730
+ CanvasPool as W,
88731
+ compileHighShaderGpuProgram as X,
88732
+ colorBit as Y,
88733
+ generateTextureBatchBit as Z,
88734
+ localUniformBitGroup2 as _,
87107
88735
  State as a,
87108
- getGlobalBounds as a0,
87109
- FilterEffect as a1,
87110
- Sprite as a2,
87111
- BatchableSprite as a3,
87112
- RenderGroup as a4,
87113
- multiplyColors as a5,
87114
- UPDATE_VISIBLE as a6,
87115
- UPDATE_COLOR as a7,
87116
- UPDATE_BLEND as a8,
87117
- TextureStyle as a9,
87118
- SearchPanelPreview as aA,
87119
- DependencyGraphPanel as aB,
87120
- DependencyGraphPanelContent as aC,
87121
- DependencyGraphPanelPreview as aD,
87122
- dependencyTreeToCanvas as aE,
87123
- applyForceLayout as aF,
87124
- applySugiyamaLayout as aG,
87125
- OverworldMapPanel as aH,
87126
- OverworldMapPanelContent as aI,
87127
- OverworldMapPanelPreview as aJ,
87128
- packagesToOverworldMap as aK,
87129
- packagesToUnifiedOverworldMap as aL,
87130
- packagesToOverworldMapCollection as aM,
87131
- nodesToOverworldMap as aN,
87132
- nodesToUnifiedOverworldMap as aO,
87133
- nodesToOverworldMapCollection as aP,
87134
- gridToScreen as aQ,
87135
- screenToGrid as aR,
87136
- MAX_NODES_PER_MAP as aS,
87137
- TelemetryCoveragePanel as aT,
87138
- TelemetryCoveragePanelContent as aU,
87139
- TelemetryCoveragePanelPreview as aV,
87140
- GitProjectsMapPanel as aW,
87141
- GitProjectsMapPanelContent as aX,
87142
- GitProjectsMapPanelPreview as aY,
87143
- CollectionMapPanel as aZ,
87144
- CollectionMapPanelContent as a_,
87145
- Rectangle as aa,
87146
- getLocalBounds as ab,
87147
- color32BitToUniform as ac,
87148
- VERSION as ad,
87149
- deprecation as ae,
87150
- GlobalResourceRegistry as af,
87151
- v8_0_0 as ag,
87152
- RendererInitHook as ah,
87153
- SystemRunner as ai,
87154
- checkMaxIfStatementsInShader as aj,
87155
- compileHighShaderGlProgram as ak,
87156
- colorBitGl as al,
87157
- generateTextureBatchBitGl as am,
87158
- roundPixelsBitGl as an,
87159
- getBatchSamplersUniformGroup as ao,
87160
- panels as ap,
87161
- onPackageLoad as aq,
87162
- onPackageUnload as ar,
87163
- GitChangesPanel as as,
87164
- GitChangesPanelContent as at,
87165
- GitChangesPanelPreview as au,
87166
- PackageCompositionPanel as av,
87167
- PackageCompositionPanelContent as aw,
87168
- PackageCompositionPanelPreview as ax,
87169
- SearchPanel as ay,
87170
- SearchPanelContent as az,
88736
+ CollectionMapPanelContent as a$,
88737
+ localUniformBit as a0,
88738
+ TextureMatrix as a1,
88739
+ DefaultBatcher as a2,
88740
+ BigPool as a3,
88741
+ getGlobalBounds as a4,
88742
+ FilterEffect as a5,
88743
+ Sprite as a6,
88744
+ BatchableSprite as a7,
88745
+ RenderGroup as a8,
88746
+ multiplyColors as a9,
88747
+ PackageCompositionPanel as aA,
88748
+ PackageCompositionPanelContent as aB,
88749
+ PackageCompositionPanelPreview as aC,
88750
+ SearchPanel as aD,
88751
+ SearchPanelContent as aE,
88752
+ SearchPanelPreview as aF,
88753
+ DependencyGraphPanel as aG,
88754
+ DependencyGraphPanelContent as aH,
88755
+ DependencyGraphPanelPreview as aI,
88756
+ dependencyTreeToCanvas as aJ,
88757
+ applyForceLayout as aK,
88758
+ applySugiyamaLayout as aL,
88759
+ OverworldMapPanelContent as aM,
88760
+ packagesToOverworldMap as aN,
88761
+ packagesToUnifiedOverworldMap as aO,
88762
+ packagesToOverworldMapCollection as aP,
88763
+ nodesToOverworldMap as aQ,
88764
+ nodesToUnifiedOverworldMap as aR,
88765
+ nodesToOverworldMapCollection as aS,
88766
+ gridToScreen as aT,
88767
+ screenToGrid as aU,
88768
+ MAX_NODES_PER_MAP as aV,
88769
+ TelemetryCoveragePanel as aW,
88770
+ TelemetryCoveragePanelContent as aX,
88771
+ TelemetryCoveragePanelPreview as aY,
88772
+ GitProjectsMapPanelContent as aZ,
88773
+ CollectionMapPanel as a_,
88774
+ UPDATE_VISIBLE as aa,
88775
+ UPDATE_COLOR as ab,
88776
+ UPDATE_BLEND as ac,
88777
+ TextureStyle as ad,
88778
+ Rectangle as ae,
88779
+ getLocalBounds as af,
88780
+ color32BitToUniform as ag,
88781
+ VERSION as ah,
88782
+ deprecation as ai,
88783
+ GlobalResourceRegistry as aj,
88784
+ v8_0_0 as ak,
88785
+ RendererInitHook as al,
88786
+ SystemRunner as am,
88787
+ checkMaxIfStatementsInShader as an,
88788
+ compileHighShaderGlProgram as ao,
88789
+ colorBitGl as ap,
88790
+ generateTextureBatchBitGl as aq,
88791
+ localUniformBitGl as ar,
88792
+ roundPixelsBitGl as as,
88793
+ getBatchSamplersUniformGroup as at,
88794
+ panels as au,
88795
+ onPackageLoad as av,
88796
+ onPackageUnload as aw,
88797
+ GitChangesPanel as ax,
88798
+ GitChangesPanelContent as ay,
88799
+ GitChangesPanelPreview as az,
87171
88800
  GlProgram as b,
87172
88801
  Texture as c,
87173
88802
  Geometry as d,
@@ -87179,19 +88808,19 @@ export {
87179
88808
  BufferUsage as j,
87180
88809
  EventEmitter as k,
87181
88810
  uid as l,
87182
- groupD8 as m,
87183
- bgr2rgb as n,
87184
- multiplyHexColors as o,
87185
- Graphics as p,
87186
- generateTextureMatrix as q,
87187
- buildLine as r,
87188
- shapeBuilders as s,
87189
- FillPattern as t,
88811
+ canvasUtils as m,
88812
+ groupD8 as n,
88813
+ bgr2rgb as o,
88814
+ multiplyHexColors as p,
88815
+ Graphics as q,
88816
+ canUseNewCanvasBlendModes as r,
88817
+ generateTextureMatrix as s,
88818
+ shapeBuilders as t,
87190
88819
  unsafeEvalSupported as u,
87191
- CanvasSource as v,
88820
+ buildLine as v,
87192
88821
  warn as w,
87193
- Ticker as x,
87194
- UPDATE_PRIORITY as y,
87195
- removeItems as z
88822
+ FillPattern as x,
88823
+ CanvasSource as y,
88824
+ Ticker as z
87196
88825
  };
87197
- //# sourceMappingURL=index-72-eqzyq.js.map
88826
+ //# sourceMappingURL=index-L48T6UlC.js.map