Skip to content

Commit d81c6c0

Browse files
author
DavidQ
committed
Complete Tilemap Studio V2 with HTML-first shell and session-only runtime behavior - PR 11.198
1 parent 64a807d commit d81c6c0

3 files changed

Lines changed: 33 additions & 13 deletions

File tree

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# PR_11_198 Report
22

33
## Files Changed
4+
- `tools/tilemap-studio-v2/index.html`
45
- `tools/tilemap-studio-v2/index.js`
56
- `docs/dev/reports/PR_11_198_report.md`
67

@@ -11,11 +12,18 @@
1112
- `node --check tools/tilemap-studio-v2/index.js`: **PASS** (exit code 0)
1213

1314
## Manual Test Notes
14-
- Open `tools/tilemap-studio-v2/index.html`: not executed in this CLI-only run (no interactive browser session available in terminal tooling).
15-
- Shared header mount target check (`#shared-theme-header` exists in HTML shell): **PASS** by static source inspection.
16-
- Missing session actionable state handling: **PASS** by source inspection of `renderMissing(...)`.
17-
- Valid session tilemap render path: **PASS** by source inspection of `renderTilemap(...)`.
18-
- Console error-free browser run: not executed in this CLI-only run (requires manual browser verification).
15+
- Open `tools/tilemap-studio-v2/index.html`: not executed in this CLI-only run (no interactive browser available in terminal tooling).
16+
- Shared header mount target (`#shared-theme-header`) and mount script path: **PASS** by static source inspection.
17+
- Empty state region (`#tilemapV2EmptyState`) behavior: **PASS** by source inspection.
18+
- Invalid state region (`#tilemapV2InvalidState`) actionable messaging: **PASS** by source inspection.
19+
- Valid/render region (`#tilemapV2ValidState`) tilemap preview rendering: **PASS** by source inspection.
20+
- Console error-free browser run: not executed in this CLI-only run (requires browser validation).
1921

2022
## Samples Smoke Statement
2123
- Full samples smoke was skipped because this PR is scoped to `tools/tilemap-studio-v2` behavior-only changes and does not modify samples, games, schemas, or shared engine runtime contracts.
24+
25+
## Scope Guard Confirmation
26+
- No schema files changed.
27+
- No sample files changed.
28+
- No game files changed.
29+
- No Workspace Manager v1 files changed.

tools/tilemap-studio-v2/index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ <h3>menuTool</h3>
2424
<section class="tilemap-v2-panel" aria-live="polite">
2525
<h3 id="tilemapV2Name">No tilemap loaded</h3>
2626
<span id="tilemapV2Count" class="badge">0 layers</span>
27-
<div id="tilemapV2State">No tilemap session data found. Open Tilemap Studio V2 with a valid hostContextId session.</div>
28-
<div id="tilemapV2Preview" aria-label="Tilemap Studio V2 preview"></div>
27+
<div id="tilemapV2EmptyState">No tilemap session data found. Open Tilemap Studio V2 with a valid hostContextId session.</div>
28+
<div id="tilemapV2InvalidState" hidden>Tilemap session data is invalid. Re-open Tilemap Studio V2 from a valid workspace session.</div>
29+
<div id="tilemapV2ValidState" hidden>
30+
<div id="tilemapV2State">Tilemap Studio V2 loaded the session tilemap.</div>
31+
<div id="tilemapV2Preview" aria-label="Tilemap Studio V2 preview"></div>
32+
</div>
2933
</section>
3034
<aside class="tilemap-v2-panel" data-menu-workspace>
3135
<h3>menuWorkspace</h3>

tools/tilemap-studio-v2/index.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
class TilemapStudioV2 {
22
constructor() {
3+
console.log("[TilemapStudioV2]");
34
document.title = "Tilemap Studio V2";
45
document.body.dataset.toolId = "tilemap-studio-v2";
56
this.readSession();
67
}
78

89
readSession() {
10+
console.log("[SESSION_CONTEXT_READ]");
911
try {
1012
if (!new URL(window.location.href).searchParams.get("hostContextId")) {
1113
this.renderMissing("No hostContextId was provided. Re-open Tilemap Studio V2 from a valid Tool V2 session link.");
@@ -32,6 +34,7 @@ class TilemapStudioV2 {
3234
}
3335

3436
loadContract(sessionContext) {
37+
console.log("[TILEMAP_V2_CONTRACT_LOADED]");
3538
if (!sessionContext || typeof sessionContext !== "object" || Array.isArray(sessionContext)) {
3639
this.renderError("Session context is invalid. Expected an object containing payloadJson.tileMapDocument.");
3740
return;
@@ -64,10 +67,6 @@ class TilemapStudioV2 {
6467
this.renderError("Tilemap session data is invalid. Expected tileMapDocument.layers[].");
6568
return;
6669
}
67-
if (tileMapDocument.layers.length === 0) {
68-
this.renderMissing("Tilemap Studio V2 loaded a valid tilemap document with zero layers.");
69-
return;
70-
}
7170
if (tileMapDocument.layers.some((entry) => !entry || typeof entry !== "object" || Array.isArray(entry) || typeof entry.name !== "string" || !entry.name.trim() || typeof entry.kind !== "string" || !entry.kind.trim() || !Array.isArray(entry.data))) {
7271
this.renderError("Tilemap session data is invalid. Every layer requires name, kind, and data[].");
7372
return;
@@ -78,6 +77,9 @@ class TilemapStudioV2 {
7877
document.getElementById("tilemapV2Name").textContent = tileMapDocument.map.name.trim();
7978
document.getElementById("tilemapV2Count").textContent = `${tileMapDocument.layers.length} layer${tileMapDocument.layers.length === 1 ? "" : "s"}`;
8079
document.getElementById("tilemapV2State").textContent = "Tilemap Studio V2 loaded the session tilemap.";
80+
document.getElementById("tilemapV2EmptyState").hidden = true;
81+
document.getElementById("tilemapV2InvalidState").hidden = true;
82+
document.getElementById("tilemapV2ValidState").hidden = false;
8183
document.getElementById("tilemapV2LayerList").replaceChildren();
8284
tileMapDocument.layers.forEach((entry) => {
8385
const layerItem = document.createElement("li");
@@ -111,7 +113,10 @@ class TilemapStudioV2 {
111113
document.getElementById("tilemapV2WorkspaceReadout").textContent = "Workspace session context is not available.";
112114
document.getElementById("tilemapV2Name").textContent = "No tilemap loaded";
113115
document.getElementById("tilemapV2Count").textContent = "0 layers";
114-
document.getElementById("tilemapV2State").textContent = message;
116+
document.getElementById("tilemapV2EmptyState").textContent = message;
117+
document.getElementById("tilemapV2EmptyState").hidden = false;
118+
document.getElementById("tilemapV2InvalidState").hidden = true;
119+
document.getElementById("tilemapV2ValidState").hidden = true;
115120
document.getElementById("tilemapV2LayerList").replaceChildren();
116121
document.getElementById("tilemapV2Preview").replaceChildren();
117122
}
@@ -122,7 +127,10 @@ class TilemapStudioV2 {
122127
document.getElementById("tilemapV2WorkspaceReadout").textContent = "Workspace writes are disabled for invalid Tilemap Studio V2 session data.";
123128
document.getElementById("tilemapV2Name").textContent = "Tilemap Studio V2 error";
124129
document.getElementById("tilemapV2Count").textContent = "0 layers";
125-
document.getElementById("tilemapV2State").textContent = message;
130+
document.getElementById("tilemapV2InvalidState").textContent = `${message} Re-open Tilemap Studio V2 from a host session that provides payloadJson.tileMapDocument.`;
131+
document.getElementById("tilemapV2EmptyState").hidden = true;
132+
document.getElementById("tilemapV2InvalidState").hidden = false;
133+
document.getElementById("tilemapV2ValidState").hidden = true;
126134
document.getElementById("tilemapV2LayerList").replaceChildren();
127135
document.getElementById("tilemapV2Preview").replaceChildren();
128136
}

0 commit comments

Comments
 (0)