Skip to content

Commit 07de809

Browse files
committed
Add Colors project swatch accordions and tag filtering - PR_26159_027-colors-tags-accordions
1 parent ec5b958 commit 07de809

8 files changed

Lines changed: 436 additions & 116 deletions

File tree

assets/theme-v2/css/forms.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ input[type="color"][data-palette-swatch-size="large"] {
184184

185185
.palette-swatch-check {
186186
position: absolute;
187-
top: calc(var(--space-8) * -1);
188-
left: calc(var(--space-8) * -1);
187+
top: var(--space-3);
188+
left: var(--space-3);
189189
z-index: var(--z-index-md);
190190
width: var(--space-14);
191191
height: var(--space-14);
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# PR_26159_027 Colors Tags Accordions Report
2+
3+
## Executive Summary
4+
PASS. The Colors center panel now uses the requested Project Swatches and Picker Swatches accordions, picker clicks add colors to Project Swatches with retained picker settings/metadata, hover text is reduced to the requested four fields, Project Swatches checkboxes are visually inset inside swatches, user-defined tag filtering supports typeahead plus Any/All match modes, and the requested button/terminology cleanup is implemented.
5+
6+
Playwright impacted: Yes.
7+
8+
## Requirement Checklist
9+
| Requirement | Status | Evidence |
10+
| --- | --- | --- |
11+
| Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` first | PASS | Read before implementation. |
12+
| Use PR_26159_026 as base context | PASS | Built on existing PR_026 Colors picker metadata/restore behavior in `toolbox/colors/colors.js`, `toolbox/colors/index.html`, and palette repository metadata preservation. |
13+
| Rename workflow terms: Project Swatches and Picker Swatches | PASS | Center accordions and user-facing Project Swatches messages updated in `toolbox/colors/index.html` and `toolbox/colors/colors.js`. |
14+
| Center panel has Project Swatches and Picker Swatches accordions | PASS | `[data-palette-fullscreen-panels] > details > summary` Playwright assertion expects exactly `Project Swatches`, then `Picker Swatches`. |
15+
| Project Swatches appears above Picker Swatches | PASS | Playwright compares accordion top positions and asserts Project Swatches comes first. |
16+
| Picker swatch click adds to Project Swatches | PASS | `Palette Tool generated grid swatches can be selected, pinned, and refreshed` clicks picker swatches and verifies Project Swatches count/selected swatch. |
17+
| Project Swatches retain picker settings | PASS | Generated swatches store `pickerSettings` and `metadata`; Playwright verifies stored theme, type, variant, colors, steps, contrast, saturation, hue shift, sort field/direction, and swatch size on the selected tile. |
18+
| Move selected/project swatch checkbox inside the color swatch | PASS | Reusable Theme V2 `.palette-swatch-check` now uses top/left `var(--space-3)`; Playwright verifies approximately 3px inset from the swatch top-left. |
19+
| Store everything formerly shown in tooltip as color metadata | PASS | `metadataFromPickerSettings` and repository `cloneColorMetadata` preserve generation details, tags, source, and picker settings. |
20+
| Hover tooltip displays only Name, Hex, Theme, Palette Type | PASS | `pickerTooltipText` and `swatchTooltipText` now produce four-line tooltips; Playwright asserts no Contrast details appear in tooltip and checks exact selected swatch title. |
21+
| Keep remaining picker settings/generation details as metadata | PASS | Playwright checks `data-palette-metadata-*` attributes for generation settings; repository preserves `metadata` through normalize/clone/persist paths. |
22+
| Change form button labels to Add, Update, Clear | PASS | `toolbox/colors/index.html` labels updated; Playwright uses data hooks to validate buttons. |
23+
| Place Add, Update, Clear side by side | PASS | Buttons remain in the existing Theme V2 `hero-actions` row; no page-local CSS added. |
24+
| Right panel tags use checkboxes | PASS | `renderTags` renders checkbox filters; Playwright validates checkbox filters and checked/uncheck behavior. |
25+
| Tags are user-defined, not rigid categories | PASS | Right panel only renders tags from Project Swatches; suggested vocabulary is only in the typeahead datalist after typing. |
26+
| Add Tag uses typeahead with broad suggestions | PASS | `SUGGESTED_TAGS` added; Playwright types `pla` and verifies `Player` appears as a datalist option, then adds it. |
27+
| Suggestions do not appear in right panel until selected or added | PASS | Right panel tag list derives from active Project Swatches only; Playwright verifies `player` appears only after adding the suggested tag. |
28+
| Remove Deselect All | PASS | Playwright asserts no `Deselect All` button is present. |
29+
| Keep only Clear Filters | PASS | Right panel includes `Clear Filters`; no Deselect All control exists. |
30+
| Clicking checked tag unchecks it | PASS | Playwright clicks a checked tag checkbox and asserts it becomes unchecked. |
31+
| More than one tag can be checked | PASS | Playwright checks `batch` and `solo` together. |
32+
| Add Match Mode radio buttons | PASS | `Any selected tag` and `All selected tags` radios added and validated by Playwright. |
33+
| Do not label UI as AND/OR | PASS | Static scan found no AND/OR match labels in Colors UI; user-facing labels are Any selected tag and All selected tags. |
34+
| Any selected tag matches at least one selected tag | PASS | Playwright verifies batch+solo in Any mode shows Anchor and Brownstone. |
35+
| All selected tags matches every selected tag | PASS | Playwright switches to All mode and verifies only Anchor remains. |
36+
| Clear Filters resets tag filters and shows all Project Swatches | PASS | Playwright clicks Clear Filters, verifies checked filters reset, button disables, and all three Project Swatches show. |
37+
| Preserve Defined Swatch Selector ownership | PASS | Defined Swatch Selector remains in Picker Swatches with Theme Collection, Palette Type, Variant. |
38+
| Preserve Picker controls ownership | PASS | Swatch Type / Theme remains in Picker Swatches with Colors, Steps, Contrast, Saturation, Hue Shift, Generate, Reset. |
39+
| Preserve Admin toolbox unfiltered list and non-admin filtering | PASS | `ToolboxRoutePages.spec.mjs` passed. |
40+
| Preserve Colors on toolbox/index.html | PASS | `ToolboxRoutePages.spec.mjs` passed. |
41+
| No inline script/style/event handlers | PASS | Static scans found no `<style>`, inline handlers, or inline scripts; existing script tags are external. |
42+
| No page-local CSS | PASS | No page/tool-local CSS added. The only styling change is to existing reusable Theme V2 `.palette-swatch-check` placement in `assets/theme-v2/css/forms.css`. |
43+
| Validate no console errors | PASS | Targeted Playwright helper captured page errors/console errors; Palette and Toolbox lanes passed. |
44+
| Do not run full samples validation | PASS | Full samples validation skipped by request. |
45+
| Produce repo-structured ZIP | PASS | Created under `tmp/PR_26159_027-colors-tags-accordions_delta.zip`. |
46+
47+
## Validation Evidence
48+
| Lane | Status | Evidence |
49+
| --- | --- | --- |
50+
| Changed-file syntax | PASS | `node --check toolbox/colors/colors.js`; `node --check src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js`; `node --check tests/playwright/tools/PaletteToolMockRepository.spec.mjs`. |
51+
| Changed-file/static validation | PASS | `git diff --check` passed with LF/CRLF warnings only. Static scans verified removed labels/hooks and no inline handlers/styles/scripts. |
52+
| Palette Tool runtime/UI lane | PASS | `npx playwright test tests/playwright/tools/PaletteToolMockRepository.spec.mjs --timeout=180000` -> 6 passed. |
53+
| Toolbox registration/navigation lane | PASS | `npx playwright test tests/playwright/tools/ToolboxRoutePages.spec.mjs --timeout=180000` -> 2 passed. |
54+
| Playwright V8 coverage | PASS/WARN | `docs_build/dev/reports/playwright_v8_coverage_report.txt` generated. `toolbox/colors/colors.js` covered at 84%; `palette-workspace-repository.js` is WARN because it is server/dev runtime and not collected by browser V8 coverage. |
55+
56+
## Skipped Lanes
57+
| Lane | Reason |
58+
| --- | --- |
59+
| Full samples validation | Skipped by request. This PR changes the Colors tool UI/runtime and reusable Theme V2 swatch checkbox placement, not sample manifests or the shared sample loader. |
60+
| Broad workspace smoke | Skipped because no Project Workspace launch/manifest contract changed. Targeted Palette Tool and Toolbox route lanes cover the affected tool behavior and registration/visibility requirements. |
61+
62+
## Changed Files
63+
- `assets/theme-v2/css/forms.css`
64+
- `src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js`
65+
- `tests/playwright/tools/PaletteToolMockRepository.spec.mjs`
66+
- `toolbox/colors/colors.js`
67+
- `toolbox/colors/index.html`
68+
- `docs_build/dev/reports/coverage_changed_js_guardrail.txt`
69+
- `docs_build/dev/reports/playwright_v8_coverage_report.txt`
70+
- `docs_build/dev/reports/colors-tags-accordions-report.md`
71+
- `docs_build/dev/reports/codex_review.diff`
72+
- `docs_build/dev/reports/codex_changed_files.txt`
73+
74+
## Notes
75+
- The Project Swatches checkbox is visually placed inside the swatch using the existing reusable Theme V2 swatch selector. It is intentionally not nested inside the swatch button element to avoid invalid nested interactive controls.
76+
- The right-panel suggested tag vocabulary is stored in JavaScript for datalist/typeahead use only. Suggestions are not rendered as tag filters until a user adds/selects them on a Project Swatch.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ 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-
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
11-
(91%) src/dev-runtime/admin/admin-notes-viewer.js - executed lines 520/520; executed functions 48/53
9+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10+
(84%) toolbox/colors/colors.js - executed lines 1802/1802; executed functions 153/182
1211

1312
Guardrail warnings:
14-
(0%) src/dev-runtime/admin/admin-notes-menu.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
15-
(0%) src/dev-runtime/server/local-api-server.mjs - WARNING: changed runtime JS file missing from coverage; advisory only
13+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,26 @@ 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-
(77%) Toolbox Index - exercised 8 runtime JS files
15+
(84%) Toolbox Index - exercised 3 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
17-
(74%) Theme V2 Shared JS - exercised 2 runtime JS files
17+
(70%) Theme V2 Shared JS - exercised 2 runtime JS files
1818

1919
Changed runtime JS files covered:
20-
(0%) toolbox/toolRegistry.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21-
(58%) toolbox/colors/colors.js - executed lines 1117/1117; executed functions 66/113
22-
(95%) toolbox/tools-page-accordions.js - executed lines 783/783; executed functions 74/78
20+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21+
(84%) toolbox/colors/colors.js - executed lines 1802/1802; executed functions 153/182
2322

2423
Files with executed line/function counts where available:
25-
(38%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 3/8
2624
(58%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 11/19
27-
(58%) toolbox/colors/colors.js - executed lines 1117/1117; executed functions 66/113
2825
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 201/201; executed functions 9/14
29-
(71%) toolbox/project-workspace/project-workspace.js - executed lines 264/264; executed functions 17/24
30-
(78%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 441/441; executed functions 31/40
31-
(89%) toolbox/tool-registry-api-client.js - executed lines 148/148; executed functions 24/27
32-
(91%) toolbox/game-design/game-design.js - executed lines 242/242; executed functions 20/22
33-
(95%) toolbox/tools-page-accordions.js - executed lines 783/783; executed functions 74/78
26+
(73%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 441/441; executed functions 29/40
27+
(78%) toolbox/tool-registry-api-client.js - executed lines 148/148; executed functions 21/27
28+
(84%) toolbox/colors/colors.js - executed lines 1802/1802; executed functions 153/182
3429
(100%) toolbox/colors/palette-api-client.js - executed lines 19/19; executed functions 4/4
35-
(100%) toolbox/game-design/game-design-api-client.js - executed lines 12/12; executed functions 2/2
36-
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
3730

3831
Uncovered or low-coverage changed JS files:
39-
(0%) toolbox/toolRegistry.js - WARNING: uncovered changed runtime JS file; advisory only
32+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - WARNING: uncovered changed runtime JS file; advisory only
4033

4134
Changed JS files considered:
35+
(0%) src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js - changed JS file not collected as browser runtime coverage
4236
(0%) tests/playwright/tools/PaletteToolMockRepository.spec.mjs - changed JS file not collected as browser runtime coverage
43-
(0%) tests/playwright/tools/RootToolsFutureState.spec.mjs - changed JS file not collected as browser runtime coverage
44-
(0%) tests/playwright/tools/ToolboxRoutePages.spec.mjs - changed JS file not collected as browser runtime coverage
45-
(0%) toolbox/toolRegistry.js - changed JS file not collected as browser runtime coverage
46-
(58%) toolbox/colors/colors.js - changed JS file with browser V8 coverage
47-
(95%) toolbox/tools-page-accordions.js - changed JS file with browser V8 coverage
37+
(84%) toolbox/colors/colors.js - changed JS file with browser V8 coverage

src/dev-runtime/persistence/tool-repositories/palette-workspace-repository.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ function clonePickerSettings(settings) {
7676
};
7777
}
7878

79+
function cloneColorMetadata(metadata) {
80+
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) {
81+
return null;
82+
}
83+
const cloned = { ...metadata };
84+
if (Array.isArray(metadata.activeTags)) {
85+
cloned.activeTags = [...metadata.activeTags];
86+
}
87+
if (Array.isArray(metadata.tags)) {
88+
cloned.tags = [...metadata.tags];
89+
}
90+
const pickerSettings = clonePickerSettings(metadata.pickerSettings);
91+
if (pickerSettings) {
92+
cloned.pickerSettings = pickerSettings;
93+
}
94+
return cloned;
95+
}
96+
7997
function cloneSwatch(swatch) {
8098
const cloned = {
8199
symbol: swatch.symbol,
@@ -88,6 +106,10 @@ function cloneSwatch(swatch) {
88106
if (pickerSettings) {
89107
cloned.pickerSettings = pickerSettings;
90108
}
109+
const metadata = cloneColorMetadata(swatch.metadata);
110+
if (metadata) {
111+
cloned.metadata = metadata;
112+
}
91113
return cloned;
92114
}
93115

@@ -244,6 +266,7 @@ export function normalizePaletteSwatchInput(input = {}, options = {}) {
244266
const name = normalizeText(source.name);
245267
const tags = normalizeTags(source.tags);
246268
const pickerSettings = clonePickerSettings(source.pickerSettings);
269+
const metadata = cloneColorMetadata(source.metadata);
247270

248271
const swatch = {
249272
symbol,
@@ -255,6 +278,16 @@ export function normalizePaletteSwatchInput(input = {}, options = {}) {
255278
if (pickerSettings) {
256279
swatch.pickerSettings = pickerSettings;
257280
}
281+
if (metadata) {
282+
swatch.metadata = {
283+
...metadata,
284+
hex,
285+
name,
286+
pickerSettings: pickerSettings || metadata.pickerSettings,
287+
source: normalizeSource(source.source || options.source),
288+
tags: [...tags]
289+
};
290+
}
258291
return swatch;
259292
}
260293

@@ -690,6 +723,7 @@ export function createProjectWorkspacePaletteRepository(options = {}) {
690723
.filter((row) => row.projectId === projectId)
691724
.map((row) => ({
692725
hex: row.hex,
726+
metadata: cloneColorMetadata(row.metadata) || undefined,
693727
name: row.name,
694728
pickerSettings: clonePickerSettings(row.pickerSettings) || undefined,
695729
source: row.source,
@@ -720,6 +754,7 @@ export function createProjectWorkspacePaletteRepository(options = {}) {
720754
}, index),
721755
hex: swatch.hex,
722756
id: `${projectId}-palette-color-${index + 1}`,
757+
metadata: cloneColorMetadata(swatch.metadata) || undefined,
723758
name: swatch.name,
724759
pickerSettings: clonePickerSettings(swatch.pickerSettings) || undefined,
725760
projectId,

0 commit comments

Comments
 (0)