-
Notifications
You must be signed in to change notification settings - Fork 0
PR_26179_CHARLIE_024-sprites-canvas-grid #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| const DEFAULT_GRID_SIZE = 16; | ||
| const SUPPORTED_GRID_SIZES = Object.freeze([16, 32]); | ||
|
|
||
| function gridLabel(size) { | ||
| return `Sprite Creator ${size} by ${size} pixel canvas`; | ||
| } | ||
|
|
||
| function buttonForSize(size) { | ||
| return document.querySelector(`[data-sprites-grid-size="${size}"]`); | ||
| } | ||
|
|
||
| function setGridSize(size) { | ||
| const grid = document.querySelector("[data-sprites-pixel-grid]"); | ||
| const status = document.querySelector("[data-sprites-grid-status]"); | ||
| if (!grid || !SUPPORTED_GRID_SIZES.includes(size)) { | ||
| return; | ||
| } | ||
|
|
||
| grid.replaceChildren(); | ||
| grid.dataset.spritesGridSize = String(size); | ||
| grid.setAttribute("aria-label", gridLabel(size)); | ||
|
|
||
| for (let index = 0; index < size * size; index += 1) { | ||
| const row = Math.floor(index / size) + 1; | ||
| const column = (index % size) + 1; | ||
| const cell = document.createElement("button"); | ||
| cell.className = "sprite-canvas-cell"; | ||
| cell.type = "button"; | ||
| cell.disabled = true; | ||
| cell.setAttribute("role", "gridcell"); | ||
| cell.setAttribute("aria-label", `Pixel row ${row}, column ${column}`); | ||
| cell.dataset.spritePixelRow = String(row); | ||
| cell.dataset.spritePixelColumn = String(column); | ||
| grid.append(cell); | ||
| } | ||
|
|
||
| document.querySelectorAll("[data-sprites-grid-size]").forEach((button) => { | ||
| const isActive = button.dataset.spritesGridSize === String(size); | ||
| button.classList.toggle("primary", isActive); | ||
| button.setAttribute("aria-pressed", String(isActive)); | ||
| }); | ||
|
|
||
| if (status) { | ||
| status.textContent = `Canvas display mode: ${size}x${size}. No pixel data is saved.`; | ||
| } | ||
| } | ||
|
|
||
| function wireGridControls() { | ||
| SUPPORTED_GRID_SIZES.forEach((size) => { | ||
| const button = buttonForSize(size); | ||
| if (!button) { | ||
| return; | ||
| } | ||
| button.addEventListener("click", () => setGridSize(size)); | ||
| }); | ||
| } | ||
|
|
||
| wireGridControls(); | ||
| setGridSize(DEFAULT_GRID_SIZE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
docs_build/dev/reports/PR_26179_CHARLIE_024-sprites-canvas-grid.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # PR_26179_CHARLIE_024-sprites-canvas-grid | ||
|
|
||
| Team: CHARLIE | ||
| Workflow: stacked feature workflow | ||
| Base branch: PR_26179_CHARLIE_023-sprites-toolbar-placeholders | ||
| Canonical ZIP path: dev/workspace/zip/PR_26179_CHARLIE_024-sprites-canvas-grid_delta.zip | ||
|
|
||
| ## Summary | ||
|
|
||
| Added a visible Sprite Creator pixel canvas grid with 16x16 and 32x32 display modes. The grid is rendered by external JavaScript and styled through Theme V2 CSS. This PR adds display behavior only; no persistence, drawing, API, DB, schema, or authoritative browser product data was added. | ||
|
|
||
| ## Branch Validation | ||
|
|
||
| PASS | ||
|
|
||
| - Current branch: PR_26179_CHARLIE_024-sprites-canvas-grid | ||
| - Based on: PR_26179_CHARLIE_023-sprites-toolbar-placeholders | ||
| - No start_of_day files changed | ||
| - No DB/API/schema files changed | ||
| - No stale PR #219-#228 code copied | ||
|
|
||
| ## Requirement Checklist | ||
|
|
||
| | Requirement | Status | Notes | | ||
| | --- | --- | --- | | ||
| | Add visible pixel canvas grid | PASS | Grid renders on page load. | | ||
| | Support 16x16 display mode | PASS | Default grid has 256 cells. | | ||
| | Support 32x32 display mode | PASS | Toggle renders 1024 cells. | | ||
| | No persistence | PASS | No storage/API/database writes. | | ||
| | No drawing behavior | PASS | Pixel cells are disabled display cells. | | ||
| | Theme V2 compliant | PASS | CSS added to shared Theme V2 stylesheet; no inline styles. | | ||
| | No DB/API/schema changes | PASS | Only shell, CSS, JS, test, reports changed. | | ||
|
|
||
| ## Validation Lane Report | ||
|
|
||
| Commands: | ||
|
|
||
| ```text | ||
| node --check assets/toolbox/sprites/js/index.js | ||
| node --check dev/tests/playwright/tools/SpritesToolShell.spec.mjs | ||
| git diff --check -- toolbox/sprites/index.html assets/toolbox/sprites/js/index.js assets/theme-v2/css/gamefoundrystudio.css dev/tests/playwright/tools/SpritesToolShell.spec.mjs | ||
| rg --pcre2 -n -i "<style|style=|<script(?![^>]+src=)|on(click|change|submit|input|load|error)=|imageDataUrl|local-mem|fake-login|MEM DB" toolbox/sprites/index.html assets/toolbox/sprites/js/index.js dev/tests/playwright/tools/SpritesToolShell.spec.mjs | ||
| npx playwright test dev/tests/playwright/tools/SpritesToolShell.spec.mjs --workers=1 --reporter=list --output=<temp> | ||
| ``` | ||
|
|
||
| Results: | ||
|
|
||
| - Node syntax checks: PASS | ||
| - `git diff --check`: PASS | ||
| - Guard scan: PASS, no matches | ||
| - Targeted Playwright: PASS, 1 test passed | ||
|
|
||
| ## Manual Validation Notes | ||
|
|
||
| 1. Open `/toolbox/sprites/index.html` from the stacked branch. | ||
| 2. Confirm the Pixel Grid renders in 16x16 mode by default. | ||
| 3. Click 32x32 and confirm the grid updates and the status text changes. | ||
| 4. Confirm no pixel drawing or save/load behavior exists yet. | ||
|
|
||
| ## ZIP Path | ||
|
|
||
| `dev/workspace/zip/PR_26179_CHARLIE_024-sprites-canvas-grid_delta.zip` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| toolbox/sprites/index.html | ||
| assets/toolbox/sprites/js/index.js | ||
| assets/theme-v2/css/gamefoundrystudio.css | ||
| dev/tests/playwright/tools/SpritesToolShell.spec.mjs | ||
| docs_build/dev/reports/PR_26179_CHARLIE_023-sprites-toolbar-placeholders.md | ||
| docs_build/dev/reports/PR_26179_CHARLIE_024-sprites-canvas-grid.md | ||
| docs_build/dev/reports/codex_changed_files.txt | ||
| docs_build/dev/reports/codex_review.diff |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sprite page links only
assets/theme-v2/css/theme.css, and that file does not importgamefoundrystudio.css(I also checked runtime references withrg "gamefoundrystudio\\.css"). Because these new.sprite-canvas-*rules live in an unloaded stylesheet,/toolbox/sprites/index.htmlnever receivesdisplay: grid, column sizing, aspect ratio, or cell borders, so the generated 16x16/32x32 cells render as unstyled disabled buttons instead of the visible pixel canvas this PR adds. Move or import the rules into the active Theme V2 bundle.Useful? React with 👍 / 👎.