feat(ui): add theme presets config for workspace-defined color schemes#84
Open
advancedresearcharray wants to merge 16 commits into
Open
feat(ui): add theme presets config for workspace-defined color schemes#84advancedresearcharray wants to merge 16 commits into
advancedresearcharray wants to merge 16 commits into
Conversation
Allow workspaces to define theme preset JSON under [ui.theme] presets_dir and optionally restrict the selector via allowed_presets. Adds API loading, UI merge/filter with allow-list fallback, preset selectors in the header and Theme Editor, and config template documentation. Closes kiwifs#352
Use uiConfigStore for allowedPresets to avoid redundant fetches, stop refetching presets on every selection change, sync server prefs when auto-resolving disallowed presets, and surface validation errors in the header. Add API path-traversal regression test. Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes CI TypeScript build after theme.allowedPresets mock support. Co-authored-by: Cursor <cursoragent@cursor.com>
When GET /theme/presets errors, fall back to built-ins but still honor allowed_presets from ui-config. Adds filterPresetsWithAllowList helper and regression test for the fallback path. Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid stripping CSS variables when localStorage holds a workspace preset name before GET /theme/presets returns. Sync auto-resolved presets to the server via PUT /theme. Add shouldRemovePresetTheme regression test. Closes kiwifs#352 Co-authored-by: Cursor <cursoragent@cursor.com>
Ignore in-flight GET /theme/presets responses after the user switches spaces so a slow prior response cannot overwrite the active preset list. Co-authored-by: Cursor <cursoragent@cursor.com>
…fs#352) Initialize and refresh availablePresets with filterPresetsWithAllowList so the selector respects allowed_presets immediately. DemoShell awaits ui-config load before mounting App in demo mode. Signed-off-by: Array Fleet <fleet@advancedresearcharray.local> Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Re-ran regression tests (Go + UI) — all green. Fix mergePresets doc comment to match built-in-wins behavior. Add episodic delivery log. Closes kiwifs#352 Signed-off-by: Array Fleet <fleet@advancedresearcharray.local> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Array Fleet <fleet@advancedresearcharray.local> Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve server prefs and space switches through resolveActivePresetName instead of raw preset assignment, block disallowed getTheme token fallback, surface presets API failures in presetErrors, and preserve workspace-only allow-list names until /theme/presets returns. Closes kiwifs#352 Signed-off-by: Array Fleet <fleet@advancedresearcharray.local> Co-authored-by: Cursor <cursoragent@cursor.com>
Refetch preferences when the active space changes, prefer space-local preset storage over stale server prefs, cancel in-flight getTheme on space switch, and reject setPreset names outside the filtered list. Closes kiwifs#352 Signed-off-by: Array Fleet <fleet@advancedresearcharray.local> Co-authored-by: Cursor <cursoragent@cursor.com>
…-07-03) Record hands-on verification of workspace theme presets config against acceptance criteria; all Go and UI regression tests pass on delivery branch. Co-authored-by: Cursor <cursoragent@cursor.com>
Apply peer-review fixes: stop preserving workspace-only allow-list names after presets finish loading, fall back to built-ins when the filtered list is empty, and pass theme state into KiwiThemeEditor instead of a second useTheme() instance. Co-authored-by: Cursor <cursoragent@cursor.com>
Confirm theme presets implementation passes Go and UI tests after peer-review fixes; log delivery verification for fleet takeover. Co-authored-by: Cursor <cursoragent@cursor.com>
Record green test run and PR delivery after fleet takeover. Closes kiwifs#352 verification path. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
[ui.theme]config withpresets_dir(default.kiwi/themes/) and optionalallowed_presetsallow-listGET /api/kiwi/theme/presetswith per-file validation errorsallowed_presetsfrom/api/kiwi/ui-configCloses kiwifs#352
Test plan
go test ./internal/themepresets/...go test ./internal/config/... -run TestUIConfigThemePresetsgo test ./internal/api/... -run 'ThemePreset|UIConfig_Theme'cd ui && npm test -- --run src/themes/index.test.ts src/lib/uiConfigStore.test.ts.kiwi/themes/corporate-light.json, confirm preset appears in header selectorallowed_presetsin config.toml, confirm only listed presets shown