Skip to content

Commit a009fe3

Browse files
committed
Fix Colors picker preview behavior - PR_26159_038-colors-picker-preview-behavior
1 parent f8ea486 commit a009fe3

8 files changed

Lines changed: 476 additions & 250 deletions

File tree

assets/theme-v2/css/accordion.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ details.vertical-accordion summary:active:after {
131131
background-image: linear-gradient(135deg, transparent 50%, currentColor 50%), linear-gradient(45deg, currentColor 50%, transparent 50%)
132132
}
133133

134+
details.vertical-accordion summary .status {
135+
font-weight: normal
136+
}
137+
138+
details.vertical-accordion summary .action-group--end {
139+
margin-left: auto
140+
}
141+
134142
details.vertical-accordion[open] summary:active:after {
135143
background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)
136144
}

assets/theme-v2/css/forms.css

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,17 @@ input[type="color"][data-palette-swatch-size="large"] {
267267
pointer-events: none
268268
}
269269

270+
.palette-generator-preview-color {
271+
box-sizing: border-box;
272+
width: 100%;
273+
min-width: var(--space-0);
274+
height: 100%;
275+
min-height: var(--space-0);
276+
border: var(--border-width-sm) solid var(--line);
277+
border-radius: var(--space-0);
278+
pointer-events: none
279+
}
280+
270281
.palette-generator-preview-swatch input[type="color"]::-webkit-color-swatch-wrapper {
271282
padding: var(--space-0)
272283
}
@@ -296,13 +307,24 @@ input[type="color"][data-palette-swatch-size="large"] {
296307
outline-offset: calc(var(--space-3) * -1)
297308
}
298309

310+
.palette-generator-preview-swatch:hover {
311+
transform: none
312+
}
313+
299314
.palette-swatch-tile[data-palette-selected="true"],
300315
.palette-generator-preview-swatch[data-palette-selected="true"] {
301316
outline: var(--border-width-sm) solid var(--gold);
302317
outline-offset: calc(var(--space-3) * -1);
303318
box-shadow: inset 0 0 0 var(--space-3) var(--gold-soft), 0 0 var(--space-18) var(--orange-shadow-color)
304319
}
305320

321+
.palette-generator-preview-swatch:focus-visible,
322+
.palette-generator-preview-swatch[data-palette-selected="true"] {
323+
outline: 0;
324+
box-shadow: none;
325+
transform: none
326+
}
327+
306328
.palette-swatch-pin {
307329
position: absolute;
308330
top: var(--space-3);
@@ -322,10 +344,6 @@ input[type="color"][data-palette-swatch-size="large"] {
322344
background: var(--green)
323345
}
324346

325-
.palette-generator-preview-swatch[data-palette-generator-availability="available"] .palette-swatch-pin {
326-
background: var(--green)
327-
}
328-
329347
input[type="file"],
330348
select {
331349
min-height: var(--space-44)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# PR_26159_038-colors-picker-preview-behavior Report
2+
3+
## Summary
4+
5+
Implemented the Colors Picker Preview behavior polish from PR_26159_038:
6+
7+
- Picker Preview red pins add swatches to Project Swatches.
8+
- Picker Preview green pins remove already-added swatches from Project Swatches.
9+
- Same-column duplicate Hex swatches keep their true color, have no pin, and do not add.
10+
- Added `Show duplicates` beside the `Available Picker Swatches (xx)` header count.
11+
- Changed Steps to a numeric spinner where actual rows are `steps * 2 + 1`.
12+
- Removed Generate because live updates regenerate the preview.
13+
- Moved Tags to the left column after Picker Swatches.
14+
- Moved History to the right column before Validation.
15+
- Moved Restore Grid Picker Settings into the Project Swatches accordion header.
16+
17+
## Requirement Checklist
18+
19+
| Requirement | Status | Evidence |
20+
| --- | --- | --- |
21+
| Red pin adds a swatch to Project Swatches | PASS | `toolbox/colors/colors.js` `activateGeneratorPreviewTile`; Playwright test `Palette Tool uses green pins...` and generated-grid test |
22+
| Green pin removes an already-added swatch | PASS | `toolbox/colors/colors.js` `activateGeneratorPreviewTile`; Playwright test `Palette Tool uses green pins to remove already-added picker swatches` |
23+
| No pin duplicate does nothing | PASS | `toolbox/colors/colors.js` duplicate availability path; Playwright test `Palette Tool blocks only lower duplicate hexes...` |
24+
| Picker Preview swatches do not remain selected/boxed after click | PASS | `createGeneratorPreviewInput` always sets `data-palette-selected="false"`; CSS removes preview focus/selected outlines; Playwright asserts no selected state/box after click |
25+
| Add Show duplicates checkbox beside Available Picker Swatches | PASS | `toolbox/colors/index.html` `data-palette-show-duplicates`; Playwright asserts checked default and hide/show behavior |
26+
| Available Picker Swatches count is not bold | PASS | `assets/theme-v2/css/accordion.css`; Playwright checks computed font weight |
27+
| Show duplicates checked shows full grid | PASS | Default checked state plus row-count assertions in targeted Playwright |
28+
| Show duplicates unchecked hides duplicate-color swatches | PASS | Duplicate Playwright test unchecks control and verifies lower duplicate disappears |
29+
| Duplicate detection is same-column Hex and keeps top instance | PASS | `duplicatePickerHexReasons`; duplicate Playwright test validates top duplicate addable and lower duplicate blocked |
30+
| Duplicate swatches do not get pins | PASS | `appendPickerRows` and `createGeneratorPreviewInput`; duplicate Playwright test checks no pin on lower duplicate |
31+
| Add human-readable Theme display/control where needed | PASS | Existing Theme label/dropdown preserved in left Picker Swatches control table |
32+
| Contrast, Saturation, Hue Shift on one line | PASS | `toolbox/colors/index.html` grid `cols-3`; Playwright layout assertion |
33+
| Remove Generate button | PASS | `toolbox/colors/index.html` removed button; `toolbox/colors/colors.js` removed Generate handler; Playwright asserts selector absent |
34+
| Steps numeric spinner increments by 1 | PASS | `paletteGeneratorSteps` is `type="number"` with `step="1"`; Playwright asserts attributes |
35+
| Steps means rows above/below center | PASS | `actualPaletteGeneratorRows(steps)` returns `steps * 2 + 1`; Playwright validates `Grid 8 x 3` and row counts |
36+
| Grid summary uses actual rows | PASS | `renderPaletteGeneratorPreview`; Playwright asserts `Grid 8 x 3` and changed row counts |
37+
| Generated swatch names use Hex instead of row/column suffix | PASS | `generatorSwatchName`; Playwright asserts Hex present and no `R# C#` suffix |
38+
| History moved to right column before Validation | PASS | `toolbox/colors/index.html`; Playwright layout assertion with `data-palette-history-accordion` |
39+
| Tags moved to left column after Picker Swatches | PASS | `toolbox/colors/index.html`; Playwright layout assertion with `data-palette-tags-accordion` |
40+
| Restore Grid Picker Settings in Project Swatches header anchored right | PASS | `toolbox/colors/index.html`; `assets/theme-v2/css/accordion.css`; Playwright header layout assertion |
41+
| Preserve Project Swatches and Picker Preview vertical sharing | PASS | Existing `accordion-fill-panel` behavior preserved; Playwright height-sharing assertions pass |
42+
| Preserve no forced accordion height | PASS | No fixed height added; targeted Playwright vertical sharing assertions pass |
43+
| Add/Update/Clear show no Symbol validation | PASS | Existing repository and UI tests pass; static scan found no active Colors `Symbol: Enter a symbol` string |
44+
| No console errors | PASS | `expectNoPageFailures` passed across targeted Palette Tool Playwright lane |
45+
46+
## Validation
47+
48+
| Lane | Result | Evidence |
49+
| --- | --- | --- |
50+
| Changed-file syntax | PASS | `node --check toolbox/colors/colors.js`; `node --check tests/playwright/tools/PaletteToolMockRepository.spec.mjs` |
51+
| Static diff whitespace | PASS | `git diff --check` |
52+
| Static active-source scan | PASS | Active Colors/runtime scan found no stale Generate handler, old `Colors x Steps`, old active `Already in Project` unavailable logic, or active Symbol validation string. Remaining Generate hits are tests asserting absence. |
53+
| Targeted Palette/Colors Playwright | PASS | `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs` passed 8/8 |
54+
| Playwright V8 coverage | PASS | `docs_build/dev/reports/playwright_v8_coverage_report.txt` shows `toolbox/colors/colors.js` covered by browser V8 coverage |
55+
56+
## Skipped Lanes
57+
58+
| Lane | Skipped | Reason |
59+
| --- | --- | --- |
60+
| Full samples validation | Yes | PR only changes Colors tool behavior, reusable Theme V2 swatch/accordion CSS, and targeted Palette Playwright coverage. No shared sample loader/framework changed. |
61+
| Full workspace suite | Yes | Existing request says do not run full samples validation; targeted Colors runtime lane covers touched UI/runtime behavior. |
62+
63+
## Notes
64+
65+
- The first targeted Playwright run exposed two implementation/test issues: old layout expectations and physical pointer clicks not synthesizing `click` in the preview grid. The final implementation handles pointer activation directly while preserving click/keyboard activation through the same runtime path.
66+
- The active branch is `PR_26159_038-colors-picker-preview-behavior`; these changes are not on `main` until committed, pushed, and merged.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Missing changed runtime JS files are WARN, not FAIL.
66
Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
9-
(85%) toolbox/colors/colors.js - executed lines 1938/1938; executed functions 166/195
9+
(85%) toolbox/colors/colors.js - executed lines 1981/1981; executed functions 169/200
1010

1111
Guardrail warnings:
1212
(100%) none - no changed runtime JS coverage warnings

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ Note: entry percentages use function coverage when available, otherwise line cov
1212
Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.
1313

1414
Exercised tool entry points detected:
15-
(85%) Toolbox Index - exercised 3 runtime JS files
15+
(84%) Toolbox Index - exercised 3 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
1717
(64%) Theme V2 Shared JS - exercised 2 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(85%) toolbox/colors/colors.js - executed lines 1938/1938; executed functions 166/195
20+
(85%) toolbox/colors/colors.js - executed lines 1981/1981; executed functions 169/200
2121

2222
Files with executed line/function counts where available:
2323
(58%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 11/19
2424
(64%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 525/525; executed functions 28/44
2525
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 201/201; executed functions 9/14
2626
(78%) toolbox/tool-registry-api-client.js - executed lines 148/148; executed functions 21/27
27-
(85%) toolbox/colors/colors.js - executed lines 1938/1938; executed functions 166/195
27+
(85%) toolbox/colors/colors.js - executed lines 1981/1981; executed functions 169/200
2828
(100%) toolbox/colors/palette-api-client.js - executed lines 19/19; executed functions 4/4
2929

3030
Uncovered or low-coverage changed JS files:

0 commit comments

Comments
 (0)