@industry-theme/repository-composition-panels 0.6.5 → 0.6.7
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.
- package/dist/{BufferResource-DWCNbDuZ.js → BufferResource-cAcDbPe9.js} +2 -2
- package/dist/{BufferResource-DWCNbDuZ.js.map → BufferResource-cAcDbPe9.js.map} +1 -1
- package/dist/{CanvasRenderer-DpJ-bT2Z.js → CanvasRenderer-vrEt8Kvw.js} +3 -3
- package/dist/{CanvasRenderer-DpJ-bT2Z.js.map → CanvasRenderer-vrEt8Kvw.js.map} +1 -1
- package/dist/{Filter-BhnS0HKV.js → Filter-xnpEahTO.js} +2 -2
- package/dist/{Filter-BhnS0HKV.js.map → Filter-xnpEahTO.js.map} +1 -1
- package/dist/{RenderTargetSystem-CKiDUYjN.js → RenderTargetSystem-NCEP5Jvy.js} +3 -3
- package/dist/{RenderTargetSystem-CKiDUYjN.js.map → RenderTargetSystem-NCEP5Jvy.js.map} +1 -1
- package/dist/{WebGLRenderer-D-aICZpF.js → WebGLRenderer-KCjes89V.js} +4 -4
- package/dist/{WebGLRenderer-D-aICZpF.js.map → WebGLRenderer-KCjes89V.js.map} +1 -1
- package/dist/{WebGPURenderer-svWdGaNJ.js → WebGPURenderer-CBPe3ZFu.js} +4 -4
- package/dist/{WebGPURenderer-svWdGaNJ.js.map → WebGPURenderer-CBPe3ZFu.js.map} +1 -1
- package/dist/{browserAll-CIGzOQGX.js → browserAll-AfGuQn9U.js} +3 -3
- package/dist/{browserAll-CIGzOQGX.js.map → browserAll-AfGuQn9U.js.map} +1 -1
- package/dist/{index-DzsQqv8L.js → index-BOgxBkoa.js} +258 -104
- package/dist/{index-DzsQqv8L.js.map → index-BOgxBkoa.js.map} +1 -1
- package/dist/{init-BFfqDIZF.js → init-8y10xD3C.js} +3 -3
- package/dist/{init-BFfqDIZF.js.map → init-8y10xD3C.js.map} +1 -1
- package/dist/panels/CollectionMapPanel.d.ts +1 -1
- package/dist/panels/CollectionMapPanel.d.ts.map +1 -1
- package/dist/panels/overworld-map/OverworldMapPanel.d.ts +3 -0
- package/dist/panels/overworld-map/OverworldMapPanel.d.ts.map +1 -1
- package/dist/panels/overworld-map/components/IsometricInteractionManager.d.ts +4 -0
- package/dist/panels/overworld-map/components/IsometricInteractionManager.d.ts.map +1 -1
- package/dist/panels/overworld-map/components/IsometricRenderer.d.ts +12 -0
- package/dist/panels/overworld-map/components/IsometricRenderer.d.ts.map +1 -1
- package/dist/panels/overworld-map/genericMapper.d.ts.map +1 -1
- package/dist/panels/overworld-map/isometricUtils.d.ts +15 -0
- package/dist/panels/overworld-map/isometricUtils.d.ts.map +1 -1
- package/dist/panels.bundle.js +1 -1
- package/dist/webworkerAll-Dc1Ywudq.js +3 -0
- package/dist/webworkerAll-Dc1Ywudq.js.map +1 -0
- package/package.json +1 -1
- package/dist/webworkerAll-BOeuXP2P.js +0 -3
- package/dist/webworkerAll-BOeuXP2P.js.map +0 -1
|
@@ -104205,7 +104205,7 @@ const browserExt = {
|
|
|
104205
104205
|
},
|
|
104206
104206
|
test: () => true,
|
|
104207
104207
|
load: async () => {
|
|
104208
|
-
await import("./browserAll-
|
|
104208
|
+
await import("./browserAll-AfGuQn9U.js");
|
|
104209
104209
|
}
|
|
104210
104210
|
};
|
|
104211
104211
|
const webworkerExt = {
|
|
@@ -104216,7 +104216,7 @@ const webworkerExt = {
|
|
|
104216
104216
|
},
|
|
104217
104217
|
test: () => typeof self !== "undefined" && self.WorkerGlobalScope !== void 0,
|
|
104218
104218
|
load: async () => {
|
|
104219
|
-
await import("./webworkerAll-
|
|
104219
|
+
await import("./webworkerAll-Dc1Ywudq.js");
|
|
104220
104220
|
}
|
|
104221
104221
|
};
|
|
104222
104222
|
class ObservablePoint {
|
|
@@ -116459,19 +116459,19 @@ async function autoDetectRenderer(options) {
|
|
|
116459
116459
|
for (let i2 = 0; i2 < preferredOrder.length; i2++) {
|
|
116460
116460
|
const rendererType = preferredOrder[i2];
|
|
116461
116461
|
if (rendererType === "webgpu" && await isWebGPUSupported()) {
|
|
116462
|
-
const { WebGPURenderer } = await import("./WebGPURenderer-
|
|
116462
|
+
const { WebGPURenderer } = await import("./WebGPURenderer-CBPe3ZFu.js");
|
|
116463
116463
|
RendererClass = WebGPURenderer;
|
|
116464
116464
|
finalOptions = { ...options, ...options.webgpu };
|
|
116465
116465
|
break;
|
|
116466
116466
|
} else if (rendererType === "webgl" && isWebGLSupported(
|
|
116467
116467
|
options.failIfMajorPerformanceCaveat ?? AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat
|
|
116468
116468
|
)) {
|
|
116469
|
-
const { WebGLRenderer } = await import("./WebGLRenderer-
|
|
116469
|
+
const { WebGLRenderer } = await import("./WebGLRenderer-KCjes89V.js");
|
|
116470
116470
|
RendererClass = WebGLRenderer;
|
|
116471
116471
|
finalOptions = { ...options, ...options.webgl };
|
|
116472
116472
|
break;
|
|
116473
116473
|
} else if (rendererType === "canvas") {
|
|
116474
|
-
const { CanvasRenderer } = await import("./CanvasRenderer-
|
|
116474
|
+
const { CanvasRenderer } = await import("./CanvasRenderer-vrEt8Kvw.js");
|
|
116475
116475
|
RendererClass = CanvasRenderer;
|
|
116476
116476
|
finalOptions = { ...options, ...options.canvasOptions };
|
|
116477
116477
|
break;
|
|
@@ -130463,6 +130463,18 @@ function screenToGrid(screenX, screenY) {
|
|
|
130463
130463
|
function getIsometricZIndex(gridX, gridY) {
|
|
130464
130464
|
return gridX + gridY;
|
|
130465
130465
|
}
|
|
130466
|
+
function domEventToGridCoords(clientX, clientY, viewport, canvasElement) {
|
|
130467
|
+
if (!viewport || !canvasElement) {
|
|
130468
|
+
console.warn("[domEventToGridCoords] Missing viewport or canvas element, returning (0, 0)");
|
|
130469
|
+
return { gridX: 0, gridY: 0 };
|
|
130470
|
+
}
|
|
130471
|
+
const rect = canvasElement.getBoundingClientRect();
|
|
130472
|
+
const canvasX = clientX - rect.left;
|
|
130473
|
+
const canvasY = clientY - rect.top;
|
|
130474
|
+
const worldPoint = viewport.toWorld({ x: canvasX, y: canvasY });
|
|
130475
|
+
const gridCoords = screenToGrid(worldPoint.x, worldPoint.y);
|
|
130476
|
+
return gridCoords;
|
|
130477
|
+
}
|
|
130466
130478
|
const ISO_TILE_WIDTH = 64;
|
|
130467
130479
|
const ISO_TILE_HEIGHT = 32;
|
|
130468
130480
|
class IsometricRenderer {
|
|
@@ -130474,6 +130486,24 @@ class IsometricRenderer {
|
|
|
130474
130486
|
this.gridColor = config.gridColor ?? 3355443;
|
|
130475
130487
|
this.regionColor = config.regionColor ?? 16737792;
|
|
130476
130488
|
}
|
|
130489
|
+
/**
|
|
130490
|
+
* Add a texture to the atlas
|
|
130491
|
+
*/
|
|
130492
|
+
addTexture(key, texture) {
|
|
130493
|
+
this.atlas[key] = texture;
|
|
130494
|
+
}
|
|
130495
|
+
/**
|
|
130496
|
+
* Check if a texture exists in the atlas
|
|
130497
|
+
*/
|
|
130498
|
+
hasTexture(key) {
|
|
130499
|
+
return key in this.atlas;
|
|
130500
|
+
}
|
|
130501
|
+
/**
|
|
130502
|
+
* Get all texture keys in the atlas
|
|
130503
|
+
*/
|
|
130504
|
+
getTextureKeys() {
|
|
130505
|
+
return Object.keys(this.atlas);
|
|
130506
|
+
}
|
|
130477
130507
|
/**
|
|
130478
130508
|
* Main rendering method - creates all scene elements
|
|
130479
130509
|
*/
|
|
@@ -131113,6 +131143,12 @@ class IsometricInteractionManager {
|
|
|
131113
131143
|
}
|
|
131114
131144
|
return intersecting;
|
|
131115
131145
|
}
|
|
131146
|
+
/**
|
|
131147
|
+
* Check if a sprite is currently being dragged
|
|
131148
|
+
*/
|
|
131149
|
+
isDragging() {
|
|
131150
|
+
return this.dragState !== null && this.dragState.isDragging;
|
|
131151
|
+
}
|
|
131116
131152
|
/**
|
|
131117
131153
|
* Cleanup resources
|
|
131118
131154
|
*/
|
|
@@ -131806,10 +131842,12 @@ function nodesToUnifiedOverworldMap(nodes, options = {}) {
|
|
|
131806
131842
|
}
|
|
131807
131843
|
}
|
|
131808
131844
|
}
|
|
131845
|
+
const minCol = Math.min(...layoutRegions.map((r2) => r2.gridPosition.col));
|
|
131809
131846
|
const maxCol = Math.max(...layoutRegions.map((r2) => r2.gridPosition.col));
|
|
131847
|
+
const minRow = Math.min(...layoutRegions.map((r2) => r2.gridPosition.row));
|
|
131810
131848
|
const maxRow = Math.max(...layoutRegions.map((r2) => r2.gridPosition.row));
|
|
131811
|
-
const totalCols = maxCol + 1;
|
|
131812
|
-
const totalRows = maxRow + 1;
|
|
131849
|
+
const totalCols = maxCol - minCol + 1;
|
|
131850
|
+
const totalRows = maxRow - minRow + 1;
|
|
131813
131851
|
const mapWidth = totalCols * REGION_SIZE_TILES;
|
|
131814
131852
|
const mapHeight = totalRows * REGION_SIZE_TILES;
|
|
131815
131853
|
const regions = layoutRegions.map((region) => ({
|
|
@@ -131871,7 +131909,8 @@ const OverworldMapPanelContent = ({
|
|
|
131871
131909
|
onAddRegion,
|
|
131872
131910
|
onRenameRegion,
|
|
131873
131911
|
onDeleteRegion,
|
|
131874
|
-
collectionKey
|
|
131912
|
+
collectionKey,
|
|
131913
|
+
onViewportReady
|
|
131875
131914
|
}) => {
|
|
131876
131915
|
const canvasRef = useRef(null);
|
|
131877
131916
|
const appRef = useRef(null);
|
|
@@ -131902,12 +131941,14 @@ const OverworldMapPanelContent = ({
|
|
|
131902
131941
|
return nodes.map((n2) => n2.id).sort().join(",");
|
|
131903
131942
|
}, [collectionKey, nodes]);
|
|
131904
131943
|
const mapData = useMemo(() => {
|
|
131944
|
+
console.log("[OverworldMapPanel] mapData memo recalculating", { nodeCount: nodes.length, customRegions: customRegions.length });
|
|
131905
131945
|
const map2 = nodesToUnifiedOverworldMap(nodes, {
|
|
131906
131946
|
includeDevDependencies,
|
|
131907
131947
|
regionLayout,
|
|
131908
131948
|
customRegions
|
|
131909
131949
|
// Pass through custom regions for manual layout
|
|
131910
131950
|
});
|
|
131951
|
+
console.log("[OverworldMapPanel] mapData created:", { mapNodeCount: map2.nodes.length, mapRegions: map2.regions.length });
|
|
131911
131952
|
mapDataRef.current = map2;
|
|
131912
131953
|
return map2;
|
|
131913
131954
|
}, [nodes, includeDevDependencies, regionLayout, customRegions]);
|
|
@@ -132000,6 +132041,9 @@ const OverworldMapPanelContent = ({
|
|
|
132000
132041
|
app.stage.addChild(viewport);
|
|
132001
132042
|
viewportRef.current = viewport;
|
|
132002
132043
|
worldContainerRef.current = viewport;
|
|
132044
|
+
if (onViewportReady) {
|
|
132045
|
+
onViewportReady(viewport);
|
|
132046
|
+
}
|
|
132003
132047
|
const renderer = new IsometricRenderer({
|
|
132004
132048
|
viewport,
|
|
132005
132049
|
atlas: textures,
|
|
@@ -132295,9 +132339,44 @@ const OverworldMapPanelContent = ({
|
|
|
132295
132339
|
};
|
|
132296
132340
|
}, [stableCollectionKey, width, height]);
|
|
132297
132341
|
useEffect(() => {
|
|
132298
|
-
|
|
132342
|
+
var _a;
|
|
132343
|
+
console.log("[OverworldMapPanel] Scene render effect triggered", { hasViewport: !!viewportRef.current, hasRenderer: !!rendererRef.current, hasMapData: !!mapData });
|
|
132344
|
+
if (!viewportRef.current || !rendererRef.current || !mapData || !appRef.current) return;
|
|
132345
|
+
if ((_a = interactionRef.current) == null ? void 0 : _a.isDragging()) {
|
|
132346
|
+
console.log("[OverworldMapPanel] Skipping scene re-render - drag in progress");
|
|
132347
|
+
return;
|
|
132348
|
+
}
|
|
132349
|
+
console.log("[OverworldMapPanel] Re-rendering scene with", { nodes: mapData.nodes.length, regions: mapData.regions.length });
|
|
132299
132350
|
const renderer = rendererRef.current;
|
|
132300
132351
|
const viewport = viewportRef.current;
|
|
132352
|
+
const app = appRef.current;
|
|
132353
|
+
const existingKeys = new Set(renderer.getTextureKeys().filter((k2) => k2.startsWith("building-")));
|
|
132354
|
+
const neededCombos = /* @__PURE__ */ new Set();
|
|
132355
|
+
for (const node2 of mapData.nodes) {
|
|
132356
|
+
const key = `building-${node2.size.toFixed(2)}-${node2.color}`;
|
|
132357
|
+
neededCombos.add(key);
|
|
132358
|
+
}
|
|
132359
|
+
console.log("[OverworldMapPanel] Checking sprites:", { existing: existingKeys.size, needed: neededCombos.size });
|
|
132360
|
+
let generatedCount = 0;
|
|
132361
|
+
for (const key of neededCombos) {
|
|
132362
|
+
if (!renderer.hasTexture(key)) {
|
|
132363
|
+
const [, sizeStr, colorHex] = key.split("-");
|
|
132364
|
+
const size = parseFloat(sizeStr);
|
|
132365
|
+
const color2 = parseInt(colorHex.replace("#", ""), 16);
|
|
132366
|
+
console.log("[OverworldMapPanel] Generating missing sprite:", { key, size, color: color2 });
|
|
132367
|
+
const buildingGraphics = generateBuildingSprite({ size, color: color2 });
|
|
132368
|
+
const texture = app.renderer.generateTexture({
|
|
132369
|
+
target: buildingGraphics,
|
|
132370
|
+
resolution: 2
|
|
132371
|
+
});
|
|
132372
|
+
renderer.addTexture(key, texture);
|
|
132373
|
+
buildingGraphics.destroy();
|
|
132374
|
+
generatedCount++;
|
|
132375
|
+
}
|
|
132376
|
+
}
|
|
132377
|
+
if (generatedCount > 0) {
|
|
132378
|
+
console.log("[OverworldMapPanel] Generated", generatedCount, "new sprite textures");
|
|
132379
|
+
}
|
|
132301
132380
|
if (sceneContainersRef.current) {
|
|
132302
132381
|
viewport.removeChild(sceneContainersRef.current.background);
|
|
132303
132382
|
viewport.removeChild(sceneContainersRef.current.tiles);
|
|
@@ -132310,7 +132389,9 @@ const OverworldMapPanelContent = ({
|
|
|
132310
132389
|
sceneContainersRef.current.paths.destroy({ children: true });
|
|
132311
132390
|
sceneContainersRef.current.nodes.destroy({ children: true });
|
|
132312
132391
|
}
|
|
132392
|
+
console.log("[OverworldMapPanel] Calling renderer.renderScene...");
|
|
132313
132393
|
const scene = renderer.renderScene(mapData, true);
|
|
132394
|
+
console.log("[OverworldMapPanel] Scene rendered, sprite count:", scene.spriteInstances.size);
|
|
132314
132395
|
viewport.addChild(scene.background);
|
|
132315
132396
|
viewport.addChild(scene.tiles);
|
|
132316
132397
|
viewport.addChild(scene.bridges);
|
|
@@ -132607,14 +132688,10 @@ const CollectionMapPanelContent = ({
|
|
|
132607
132688
|
regionCallbacks
|
|
132608
132689
|
}) => {
|
|
132609
132690
|
var _a;
|
|
132610
|
-
React2__default.useEffect(() => {
|
|
132611
|
-
console.info("[CollectionMapPanelContent] 🎬 Component MOUNTED for collection:", collection.name);
|
|
132612
|
-
return () => {
|
|
132613
|
-
console.info("[CollectionMapPanelContent] 💀 Component UNMOUNTING for collection:", collection.name);
|
|
132614
|
-
};
|
|
132615
|
-
}, []);
|
|
132616
132691
|
const customRegions = ((_a = collection.metadata) == null ? void 0 : _a.customRegions) || [];
|
|
132617
132692
|
const [isEditingRegions, setIsEditingRegions] = React2__default.useState(false);
|
|
132693
|
+
const viewportRef = React2__default.useRef(null);
|
|
132694
|
+
const canvasRef = React2__default.useRef(null);
|
|
132618
132695
|
const handleRenameRegion = useCallback(async (regionId, name2) => {
|
|
132619
132696
|
await regionCallbacks.onRegionUpdated(collection.id, regionId, { name: name2 });
|
|
132620
132697
|
}, [regionCallbacks, collection.id]);
|
|
@@ -132626,68 +132703,109 @@ const CollectionMapPanelContent = ({
|
|
|
132626
132703
|
}
|
|
132627
132704
|
await regionCallbacks.onRegionDeleted(collection.id, regionId);
|
|
132628
132705
|
}, [regionCallbacks, collection.id, customRegions.length]);
|
|
132629
|
-
const handleProjectMoved = useCallback(async (projectId, gridX, gridY) => {
|
|
132630
|
-
var _a2;
|
|
132706
|
+
const handleProjectMoved = useCallback(async (projectId, gridX, gridY, metadata) => {
|
|
132707
|
+
var _a2, _b, _c, _d;
|
|
132708
|
+
console.log("[handleProjectMoved] Moving project:", { projectId, gridX, gridY });
|
|
132709
|
+
const isNewRepo = !!metadata;
|
|
132710
|
+
const existingMembership = memberships.find((m2) => m2.repositoryId === projectId);
|
|
132711
|
+
if (!isNewRepo && !existingMembership) {
|
|
132712
|
+
const error = new Error(
|
|
132713
|
+
`[handleProjectMoved] FATAL ERROR: Attempting to move repo "${projectId}" that doesn't exist in collection!
|
|
132714
|
+
Memberships (${memberships.length}): [${memberships.map((m2) => m2.repositoryId).join(", ")}]
|
|
132715
|
+
This indicates a sprite was rendered without valid backing data.`
|
|
132716
|
+
);
|
|
132717
|
+
console.error(error);
|
|
132718
|
+
throw error;
|
|
132719
|
+
}
|
|
132720
|
+
const isFirstPlacement = isNewRepo || !!existingMembership && !((_a2 = existingMembership.metadata) == null ? void 0 : _a2.regionId);
|
|
132721
|
+
console.log("[handleProjectMoved] Placement check:", {
|
|
132722
|
+
isNewRepo,
|
|
132723
|
+
existingMembership: existingMembership ? { id: existingMembership.repositoryId, hasMetadata: !!existingMembership.metadata, regionId: (_b = existingMembership.metadata) == null ? void 0 : _b.regionId } : null,
|
|
132724
|
+
isExistingWithoutRegion: !!existingMembership && !((_c = existingMembership.metadata) == null ? void 0 : _c.regionId),
|
|
132725
|
+
isFirstPlacement
|
|
132726
|
+
});
|
|
132631
132727
|
const regionCol = Math.floor(gridX / REGION_SIZE_TILES);
|
|
132632
132728
|
const regionRow = Math.floor(gridY / REGION_SIZE_TILES);
|
|
132633
132729
|
const regionOrder = regionRow * 10 + regionCol;
|
|
132634
132730
|
const targetRegion = customRegions.find((r2) => r2.order === regionOrder);
|
|
132635
132731
|
const newRegionId = targetRegion == null ? void 0 : targetRegion.id;
|
|
132732
|
+
console.log("[handleProjectMoved] Target region:", { regionOrder, newRegionId, targetRegion });
|
|
132636
132733
|
if (!newRegionId) {
|
|
132637
132734
|
console.warn("[CollectionMapPanel] ⚠️ Could not determine region for position:", { gridX, gridY, regionOrder });
|
|
132638
132735
|
return;
|
|
132639
132736
|
}
|
|
132737
|
+
if (isFirstPlacement) {
|
|
132738
|
+
console.log("[PLACEMENT] Starting placement for:", projectId);
|
|
132739
|
+
console.log("[PLACEMENT] Target region:", newRegionId);
|
|
132740
|
+
console.log("[PLACEMENT] Target position:", { gridX, gridY });
|
|
132741
|
+
try {
|
|
132742
|
+
if (isNewRepo) {
|
|
132743
|
+
if (!onProjectAdded) {
|
|
132744
|
+
throw new Error("onProjectAdded callback not available");
|
|
132745
|
+
}
|
|
132746
|
+
console.log("[PLACEMENT] Step 1: Calling onProjectAdded (repo not in collection yet)...");
|
|
132747
|
+
await onProjectAdded(projectId, metadata);
|
|
132748
|
+
console.log("[PLACEMENT] Step 1: onProjectAdded completed");
|
|
132749
|
+
} else {
|
|
132750
|
+
console.log("[PLACEMENT] Step 1: SKIPPED (repo already in collection as membership)");
|
|
132751
|
+
}
|
|
132752
|
+
const regionBoundsX2 = regionCol * REGION_SIZE_TILES;
|
|
132753
|
+
const regionBoundsY2 = regionRow * REGION_SIZE_TILES;
|
|
132754
|
+
const relativeGridX2 = gridX - regionBoundsX2;
|
|
132755
|
+
const relativeGridY2 = gridY - regionBoundsY2;
|
|
132756
|
+
const layout2 = {
|
|
132757
|
+
gridX: relativeGridX2,
|
|
132758
|
+
gridY: relativeGridY2
|
|
132759
|
+
};
|
|
132760
|
+
console.log("[PLACEMENT] Step 2: Setting position:", layout2);
|
|
132761
|
+
await regionCallbacks.onRepositoryPositionUpdated(collection.id, projectId, layout2);
|
|
132762
|
+
console.log("[PLACEMENT] Step 2: Position updated");
|
|
132763
|
+
console.log("[PLACEMENT] Step 3: Assigning region:", newRegionId);
|
|
132764
|
+
await regionCallbacks.onRepositoryAssigned(collection.id, projectId, newRegionId);
|
|
132765
|
+
console.log("[PLACEMENT] Step 3: Region assigned");
|
|
132766
|
+
console.log("[PLACEMENT] ✓ Placement completed successfully");
|
|
132767
|
+
} catch (error) {
|
|
132768
|
+
console.error("[PLACEMENT] ✗ ERROR during placement:", error);
|
|
132769
|
+
throw error;
|
|
132770
|
+
}
|
|
132771
|
+
return;
|
|
132772
|
+
}
|
|
132640
132773
|
const regionBoundsX = regionCol * REGION_SIZE_TILES;
|
|
132641
132774
|
const regionBoundsY = regionRow * REGION_SIZE_TILES;
|
|
132642
132775
|
const relativeGridX = gridX - regionBoundsX;
|
|
132643
132776
|
const relativeGridY = gridY - regionBoundsY;
|
|
132644
|
-
console.info("[CollectionMapPanel] 💾 Saving position:", {
|
|
132645
|
-
projectId,
|
|
132646
|
-
absolute: { gridX, gridY },
|
|
132647
|
-
region: (targetRegion == null ? void 0 : targetRegion.name) || "unknown",
|
|
132648
|
-
regionId: newRegionId,
|
|
132649
|
-
regionBounds: { x: regionBoundsX, y: regionBoundsY },
|
|
132650
|
-
relative: { gridX: relativeGridX, gridY: relativeGridY }
|
|
132651
|
-
});
|
|
132652
132777
|
const layout = {
|
|
132653
132778
|
gridX: relativeGridX,
|
|
132654
132779
|
gridY: relativeGridY
|
|
132655
132780
|
};
|
|
132781
|
+
console.log("[handleProjectMoved] Saving position:", { layout, newRegionId });
|
|
132656
132782
|
await regionCallbacks.onRepositoryPositionUpdated(collection.id, projectId, layout);
|
|
132657
132783
|
const membership = memberships.find((m2) => m2.repositoryId === projectId);
|
|
132658
|
-
const oldRegionId = (
|
|
132784
|
+
const oldRegionId = (_d = membership == null ? void 0 : membership.metadata) == null ? void 0 : _d.regionId;
|
|
132659
132785
|
if (oldRegionId !== newRegionId) {
|
|
132660
|
-
console.
|
|
132786
|
+
console.log("[handleProjectMoved] Region changed, updating assignment:", { oldRegionId, newRegionId });
|
|
132661
132787
|
await regionCallbacks.onRepositoryAssigned(collection.id, projectId, newRegionId);
|
|
132662
132788
|
}
|
|
132663
|
-
}, [collection.id, regionCallbacks, memberships, customRegions]);
|
|
132789
|
+
}, [collection.id, regionCallbacks, memberships, customRegions, onProjectAdded]);
|
|
132664
132790
|
const handleProjectDrop = useCallback(async (data, event) => {
|
|
132665
|
-
|
|
132666
|
-
if (!onProjectAdded) {
|
|
132667
|
-
console.warn("No onProjectAdded callback provided - cannot add project to collection");
|
|
132668
|
-
return;
|
|
132669
|
-
}
|
|
132791
|
+
console.log("[handleProjectDrop] Drop event:", { data, eventType: event.type });
|
|
132670
132792
|
const repositoryPath = data.primaryData;
|
|
132671
132793
|
const repositoryMetadata = data.metadata || {};
|
|
132672
|
-
|
|
132673
|
-
|
|
132674
|
-
|
|
132675
|
-
|
|
132676
|
-
|
|
132677
|
-
|
|
132678
|
-
|
|
132679
|
-
|
|
132680
|
-
|
|
132681
|
-
|
|
132682
|
-
|
|
132683
|
-
|
|
132684
|
-
|
|
132685
|
-
|
|
132686
|
-
|
|
132687
|
-
await regionCallbacks.onRepositoryAssigned(collection.id, repositoryPath, targetRegionId);
|
|
132688
|
-
}
|
|
132689
|
-
}
|
|
132690
|
-
}, [collection.id, onProjectAdded, customRegions, regionCallbacks]);
|
|
132794
|
+
const repoId = (repositoryMetadata == null ? void 0 : repositoryMetadata.name) || repositoryPath;
|
|
132795
|
+
console.log("[handleProjectDrop] Converting drop position to grid coords");
|
|
132796
|
+
const gridCoords = domEventToGridCoords(
|
|
132797
|
+
event.clientX,
|
|
132798
|
+
event.clientY,
|
|
132799
|
+
viewportRef.current,
|
|
132800
|
+
canvasRef.current
|
|
132801
|
+
);
|
|
132802
|
+
console.log("[handleProjectDrop] Drop at grid position:", gridCoords);
|
|
132803
|
+
const gridX = Math.round(gridCoords.gridX);
|
|
132804
|
+
const gridY = Math.round(gridCoords.gridY);
|
|
132805
|
+
console.log("[handleProjectDrop] Snapped to grid:", { gridX, gridY });
|
|
132806
|
+
console.log("[handleProjectDrop] Placing repo at drop position");
|
|
132807
|
+
await handleProjectMoved(repoId, gridX, gridY, repositoryMetadata);
|
|
132808
|
+
}, [handleProjectMoved]);
|
|
132691
132809
|
const { isDragOver, ...dropZoneProps } = useDropZone({
|
|
132692
132810
|
handlers: [
|
|
132693
132811
|
{
|
|
@@ -132698,20 +132816,27 @@ const CollectionMapPanelContent = ({
|
|
|
132698
132816
|
showVisualFeedback: true
|
|
132699
132817
|
});
|
|
132700
132818
|
const nodes = useMemo(() => {
|
|
132701
|
-
console.
|
|
132819
|
+
console.log("[nodes memo] Converting memberships to nodes", {
|
|
132820
|
+
collectionId: collection.id,
|
|
132821
|
+
totalMemberships: memberships.length,
|
|
132822
|
+
totalRepositories: repositories.length
|
|
132823
|
+
});
|
|
132702
132824
|
const collectionMemberships = memberships.filter(
|
|
132703
132825
|
(m2) => m2.collectionId === collection.id
|
|
132704
132826
|
);
|
|
132705
|
-
|
|
132706
|
-
|
|
132827
|
+
console.log("[nodes memo] Filtered memberships for collection:", collectionMemberships);
|
|
132828
|
+
const memberNodes = collectionMemberships.map((membership) => {
|
|
132829
|
+
var _a2, _b, _c, _d, _e2, _f, _g;
|
|
132707
132830
|
const repo = repositories.find((r2) => {
|
|
132708
132831
|
var _a3;
|
|
132709
132832
|
const repoId = ((_a3 = r2.github) == null ? void 0 : _a3.id) || r2.name;
|
|
132710
132833
|
return repoId === membership.repositoryId;
|
|
132711
132834
|
});
|
|
132712
132835
|
if (!repo) {
|
|
132836
|
+
console.warn("[nodes memo] No repository found for membership:", membership.repositoryId);
|
|
132713
132837
|
return null;
|
|
132714
132838
|
}
|
|
132839
|
+
console.log("[nodes memo] Creating node for:", membership.repositoryId);
|
|
132715
132840
|
let category;
|
|
132716
132841
|
if (repo.github) {
|
|
132717
132842
|
category = "git-repo";
|
|
@@ -132742,62 +132867,103 @@ const CollectionMapPanelContent = ({
|
|
|
132742
132867
|
layout: (_g = membership.metadata) == null ? void 0 : _g.layout
|
|
132743
132868
|
// Pass saved position data
|
|
132744
132869
|
};
|
|
132745
|
-
if ((_h = membership.metadata) == null ? void 0 : _h.layout) {
|
|
132746
|
-
console.info("[CollectionMapPanel] 📍 Node", repo.name, "has saved layout:", membership.metadata.layout);
|
|
132747
|
-
}
|
|
132748
132870
|
return node2;
|
|
132749
132871
|
}).filter((n2) => n2 !== null);
|
|
132872
|
+
console.log("[nodes memo] Created nodes:", { total: memberNodes.length });
|
|
132873
|
+
return memberNodes;
|
|
132750
132874
|
}, [collection.id, memberships, repositories, dependencies]);
|
|
132875
|
+
const validatedNodes = useMemo(() => {
|
|
132876
|
+
console.log("[validatedNodes] Validating nodes:", nodes.length);
|
|
132877
|
+
const nodesWithPositions = nodes.filter(
|
|
132878
|
+
(n2) => {
|
|
132879
|
+
var _a2, _b;
|
|
132880
|
+
return n2.regionId && ((_a2 = n2.layout) == null ? void 0 : _a2.gridX) !== void 0 && ((_b = n2.layout) == null ? void 0 : _b.gridY) !== void 0;
|
|
132881
|
+
}
|
|
132882
|
+
);
|
|
132883
|
+
const isInitialLoad = nodesWithPositions.length === 0 && nodes.length > 0;
|
|
132884
|
+
if (isInitialLoad) {
|
|
132885
|
+
console.log("[validatedNodes] Initial load detected, skipping validation (auto-layout will run)");
|
|
132886
|
+
return nodes;
|
|
132887
|
+
}
|
|
132888
|
+
const invalidNodes = [];
|
|
132889
|
+
nodes.forEach((node2) => {
|
|
132890
|
+
var _a2, _b;
|
|
132891
|
+
const hasRegion = !!node2.regionId;
|
|
132892
|
+
const hasPosition = ((_a2 = node2.layout) == null ? void 0 : _a2.gridX) !== void 0 && ((_b = node2.layout) == null ? void 0 : _b.gridY) !== void 0;
|
|
132893
|
+
if (!hasRegion) {
|
|
132894
|
+
invalidNodes.push({
|
|
132895
|
+
id: node2.id,
|
|
132896
|
+
reason: `Missing regionId (has layout: ${hasPosition})`
|
|
132897
|
+
});
|
|
132898
|
+
}
|
|
132899
|
+
});
|
|
132900
|
+
if (invalidNodes.length > 0) {
|
|
132901
|
+
const error = new Error(
|
|
132902
|
+
`[CollectionMapPanel] FATAL: Attempting to render nodes without regionId!
|
|
132903
|
+
This should never happen. All nodes must have a regionId before rendering.
|
|
132904
|
+
(Nodes without layout positions will be auto-positioned using circle packing)
|
|
132905
|
+
|
|
132906
|
+
Invalid nodes (${invalidNodes.length}):
|
|
132907
|
+
` + invalidNodes.map((n2) => ` - ${n2.id}: ${n2.reason}`).join("\n") + `
|
|
132908
|
+
|
|
132909
|
+
Total nodes: ${nodes.length}
|
|
132910
|
+
Collection: ${collection.id}
|
|
132911
|
+
|
|
132912
|
+
This is not initial load - auto-assignment should have already run.`
|
|
132913
|
+
);
|
|
132914
|
+
console.error(error);
|
|
132915
|
+
throw error;
|
|
132916
|
+
}
|
|
132917
|
+
console.log("[validatedNodes] ✓ All nodes valid");
|
|
132918
|
+
return nodes;
|
|
132919
|
+
}, [nodes, collection.id]);
|
|
132751
132920
|
const hasComputedLayout = useRef(false);
|
|
132752
132921
|
const prevCollectionIdRef = useRef(null);
|
|
132753
132922
|
useEffect(() => {
|
|
132754
|
-
console.info("[CollectionMapPanel] 🏗️ Layout effect running, hasComputedLayout:", hasComputedLayout.current, "nodes:", nodes.length);
|
|
132755
132923
|
if (prevCollectionIdRef.current !== null && prevCollectionIdRef.current !== collection.id) {
|
|
132756
|
-
console.info("[CollectionMapPanel] 🔄 Collection changed from", prevCollectionIdRef.current, "to", collection.id, "- resetting hasComputedLayout");
|
|
132757
132924
|
hasComputedLayout.current = false;
|
|
132758
132925
|
}
|
|
132759
132926
|
prevCollectionIdRef.current = collection.id;
|
|
132760
132927
|
if (hasComputedLayout.current) {
|
|
132761
|
-
console.info("[CollectionMapPanel] 🏗️ Skipping - already computed layout");
|
|
132762
132928
|
return;
|
|
132763
132929
|
}
|
|
132764
132930
|
if (nodes.length === 0) {
|
|
132765
|
-
console.info("[CollectionMapPanel] 🏗️ Skipping - no nodes");
|
|
132766
132931
|
return;
|
|
132767
132932
|
}
|
|
132768
132933
|
const needsRegions = customRegions.length === 0 && !nodes.some((n2) => n2.regionId);
|
|
132769
|
-
const
|
|
132770
|
-
|
|
132771
|
-
|
|
132934
|
+
const nodesWithPositions = nodes.filter(
|
|
132935
|
+
(n2) => {
|
|
132936
|
+
var _a2, _b;
|
|
132937
|
+
return n2.regionId && ((_a2 = n2.layout) == null ? void 0 : _a2.gridX) !== void 0 && ((_b = n2.layout) == null ? void 0 : _b.gridY) !== void 0;
|
|
132938
|
+
}
|
|
132772
132939
|
);
|
|
132773
|
-
|
|
132940
|
+
const isInitialLoad = nodesWithPositions.length === 0 && nodes.length > 0;
|
|
132941
|
+
const needsLayout = isInitialLoad;
|
|
132774
132942
|
if (!needsRegions && !needsLayout) {
|
|
132775
|
-
console.info("[CollectionMapPanel] 🏗️ All nodes have layout, setting hasComputedLayout=true");
|
|
132776
132943
|
hasComputedLayout.current = true;
|
|
132777
132944
|
return;
|
|
132778
132945
|
}
|
|
132946
|
+
hasComputedLayout.current = true;
|
|
132779
132947
|
const map2 = nodesToUnifiedOverworldMap(nodes, {
|
|
132780
132948
|
regionLayout,
|
|
132781
132949
|
customRegions
|
|
132782
132950
|
});
|
|
132783
132951
|
(async () => {
|
|
132784
|
-
var _a2
|
|
132952
|
+
var _a2;
|
|
132785
132953
|
const updates = {};
|
|
132786
132954
|
if (needsRegions && map2.regions.length > 0) {
|
|
132787
132955
|
updates.regions = map2.regions.map((region, index2) => ({
|
|
132788
132956
|
id: region.id,
|
|
132789
132957
|
name: region.name,
|
|
132790
132958
|
order: index2,
|
|
132791
|
-
createdAt:
|
|
132959
|
+
createdAt: 0
|
|
132960
|
+
// Deterministic value - regions don't need real timestamps
|
|
132792
132961
|
}));
|
|
132793
132962
|
}
|
|
132794
|
-
const
|
|
132963
|
+
const anyMissingRegionId = nodes.some((n2) => !n2.regionId);
|
|
132795
132964
|
updates.positions = map2.nodes.filter((node2) => {
|
|
132796
132965
|
const originalNode = nodes.find((n2) => n2.id === node2.id);
|
|
132797
|
-
const needsUpdate =
|
|
132798
|
-
if (!needsUpdate) {
|
|
132799
|
-
console.info("[CollectionMapPanel] 🏗️ Skipping", node2.id, "- already has layout:", originalNode == null ? void 0 : originalNode.layout);
|
|
132800
|
-
}
|
|
132966
|
+
const needsUpdate = anyMissingRegionId || !(originalNode == null ? void 0 : originalNode.layout) || originalNode.layout.gridX === void 0 || originalNode.layout.gridY === void 0;
|
|
132801
132967
|
return needsUpdate;
|
|
132802
132968
|
}).map((node2) => ({
|
|
132803
132969
|
repositoryId: node2.id,
|
|
@@ -132820,27 +132986,26 @@ const CollectionMapPanelContent = ({
|
|
|
132820
132986
|
}
|
|
132821
132987
|
}
|
|
132822
132988
|
}
|
|
132823
|
-
console.info("[CollectionMapPanel] 🏗️ Creating", updates.assignments.length, "region assignments");
|
|
132824
132989
|
}
|
|
132825
|
-
if (anyMissingRegionId2) {
|
|
132826
|
-
console.info("[CollectionMapPanel] 🏗️ Recomputing ALL positions due to missing regionId assignments");
|
|
132827
|
-
}
|
|
132828
|
-
console.info("[CollectionMapPanel] 🏗️ Initializing layout for", (_b = updates.positions) == null ? void 0 : _b.length, "nodes");
|
|
132829
132990
|
await regionCallbacks.onBatchLayoutInitialized(collection.id, updates);
|
|
132830
|
-
console.info("[CollectionMapPanel] 🏗️ Layout initialized, setting hasComputedLayout=true");
|
|
132831
|
-
hasComputedLayout.current = true;
|
|
132832
132991
|
})();
|
|
132833
132992
|
}, [collection.id, nodes, regionLayout, customRegions, regionCallbacks]);
|
|
132993
|
+
const handleViewportReady = useCallback((viewport) => {
|
|
132994
|
+
console.log("[CollectionMapPanel] Viewport ready for coordinate conversion");
|
|
132995
|
+
viewportRef.current = viewport;
|
|
132996
|
+
}, []);
|
|
132834
132997
|
return /* @__PURE__ */ jsxs(
|
|
132835
132998
|
"div",
|
|
132836
132999
|
{
|
|
133000
|
+
ref: canvasRef,
|
|
132837
133001
|
style: {
|
|
132838
133002
|
position: "relative",
|
|
132839
133003
|
width: "100%",
|
|
132840
133004
|
height: "100%",
|
|
132841
133005
|
overflow: "hidden",
|
|
132842
|
-
|
|
132843
|
-
|
|
133006
|
+
boxSizing: "border-box",
|
|
133007
|
+
border: isDragOver ? "2px solid #3b82f6" : "2px solid transparent",
|
|
133008
|
+
transition: "border-color 0.2s ease"
|
|
132844
133009
|
},
|
|
132845
133010
|
...dropZoneProps,
|
|
132846
133011
|
children: [
|
|
@@ -132877,17 +133042,18 @@ const CollectionMapPanelContent = ({
|
|
|
132877
133042
|
/* @__PURE__ */ jsx(
|
|
132878
133043
|
OverworldMapPanelContent,
|
|
132879
133044
|
{
|
|
132880
|
-
nodes,
|
|
133045
|
+
nodes: validatedNodes,
|
|
132881
133046
|
regionLayout,
|
|
132882
133047
|
isLoading,
|
|
132883
133048
|
isEditingRegions,
|
|
132884
133049
|
customRegions,
|
|
132885
133050
|
collectionKey: collection.id,
|
|
132886
133051
|
onProjectMoved: handleProjectMoved,
|
|
133052
|
+
onViewportReady: handleViewportReady,
|
|
132887
133053
|
onAddRegion: async (position2) => {
|
|
132888
133054
|
const order2 = position2.row * 10 + position2.col;
|
|
132889
133055
|
const name2 = `Region ${customRegions.length + 1}`;
|
|
132890
|
-
await regionCallbacks.onRegionCreated(collection.id, { name: name2, order: order2 });
|
|
133056
|
+
await regionCallbacks.onRegionCreated(collection.id, { name: name2, order: order2, createdAt: 0 });
|
|
132891
133057
|
},
|
|
132892
133058
|
onRenameRegion: handleRenameRegion,
|
|
132893
133059
|
onDeleteRegion: handleDeleteRegion
|
|
@@ -132899,32 +133065,20 @@ const CollectionMapPanelContent = ({
|
|
|
132899
133065
|
};
|
|
132900
133066
|
const CollectionMapPanel = ({ context: context2, actions }) => {
|
|
132901
133067
|
var _a, _b, _c, _d;
|
|
132902
|
-
React2__default.useEffect(() => {
|
|
132903
|
-
console.info("[CollectionMapPanel] 🎬 Panel component MOUNTED");
|
|
132904
|
-
return () => {
|
|
132905
|
-
console.info("[CollectionMapPanel] 💀 Panel component UNMOUNTING");
|
|
132906
|
-
};
|
|
132907
|
-
}, []);
|
|
132908
133068
|
const { selectedCollectionView } = context2;
|
|
132909
133069
|
const selectedCollection = (_a = selectedCollectionView == null ? void 0 : selectedCollectionView.data) == null ? void 0 : _a.collection;
|
|
132910
133070
|
const memberships = ((_b = selectedCollectionView == null ? void 0 : selectedCollectionView.data) == null ? void 0 : _b.memberships) || [];
|
|
132911
133071
|
const repositories = ((_c = selectedCollectionView == null ? void 0 : selectedCollectionView.data) == null ? void 0 : _c.repositories) || [];
|
|
132912
133072
|
const dependencies = ((_d = selectedCollectionView == null ? void 0 : selectedCollectionView.data) == null ? void 0 : _d.dependencies) || {};
|
|
132913
133073
|
const isLoading = (selectedCollectionView == null ? void 0 : selectedCollectionView.loading) ?? false;
|
|
132914
|
-
React2__default.useEffect(() => {
|
|
132915
|
-
console.info("[CollectionMapPanel] 📊 Memberships updated for collection:", selectedCollection == null ? void 0 : selectedCollection.name);
|
|
132916
|
-
console.info("[CollectionMapPanel] 📊 Memberships:", memberships.map((m2) => {
|
|
132917
|
-
var _a2, _b2;
|
|
132918
|
-
return {
|
|
132919
|
-
repo: m2.repositoryId,
|
|
132920
|
-
regionId: (_a2 = m2.metadata) == null ? void 0 : _a2.regionId,
|
|
132921
|
-
layout: (_b2 = m2.metadata) == null ? void 0 : _b2.layout
|
|
132922
|
-
};
|
|
132923
|
-
}));
|
|
132924
|
-
}, [memberships, selectedCollection == null ? void 0 : selectedCollection.name]);
|
|
132925
133074
|
const handleProjectAdded = useCallback((repositoryPath, repositoryMetadata) => {
|
|
132926
|
-
|
|
133075
|
+
console.log("[handleProjectAdded] Called with:", { repositoryPath, repositoryMetadata, selectedCollection: selectedCollection == null ? void 0 : selectedCollection.id });
|
|
133076
|
+
if (!selectedCollection) {
|
|
133077
|
+
console.warn("[handleProjectAdded] No selected collection");
|
|
133078
|
+
return;
|
|
133079
|
+
}
|
|
132927
133080
|
if (actions.addRepositoryToCollection) {
|
|
133081
|
+
console.log("[handleProjectAdded] Calling addRepositoryToCollection");
|
|
132928
133082
|
actions.addRepositoryToCollection(selectedCollection.id, repositoryPath, repositoryMetadata);
|
|
132929
133083
|
} else {
|
|
132930
133084
|
console.warn("Actions does not support addRepositoryToCollection - drag-drop feature requires context integration");
|
|
@@ -134005,4 +134159,4 @@ export {
|
|
|
134005
134159
|
UPDATE_PRIORITY as y,
|
|
134006
134160
|
removeItems as z
|
|
134007
134161
|
};
|
|
134008
|
-
//# sourceMappingURL=index-
|
|
134162
|
+
//# sourceMappingURL=index-BOgxBkoa.js.map
|