Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ffaa596
[dark-mode] Phase 1.1: Create ThemeManager module
Hunta Mar 31, 2026
0010710
[dark-mode] Add Agents.md to .gitignore - local development reference…
Hunta Mar 31, 2026
8f208e5
[dark-mode] Phase 2.1-2.3: Create header theme toggle UI and function…
Hunta Mar 31, 2026
729dfbb
[dark-mode] Phase 1.1 and Phase 2.1-2.3 task documentation - Foundati…
Hunta Mar 31, 2026
8fcdc5e
[dark-mode] Update Tasks.md - Add Task 2.3-DOC completion status for …
Hunta Mar 31, 2026
6ac9981
[dark-mode] Refactor documentation folder structure
Hunta Mar 31, 2026
d08a3ca
[dark-mode] Phase 2.4: Update page component styles - Replace hardcod…
Hunta Mar 31, 2026
1d48c17
[dark-mode] Phase 1.2-1.3 task documentation - CSS variables and app …
Hunta Mar 31, 2026
80029f9
[dark-mode] Phase 1.3 app initialization documentation - Synchronous …
Hunta Mar 31, 2026
2662980
[dark-mode] Phase 1.1-1.3 and Phase 2.1-2.4 completion: Updated Tasks…
Hunta Mar 31, 2026
37bef23
[dark-mode] Add comprehensive completion summary for phases 1.1-1.3 a…
Hunta Mar 31, 2026
3e00591
[dark-mode] Add checkpoint verification report - All requirements met…
Hunta Mar 31, 2026
d0c67aa
[dark-mode] Add session completion report - All 7 requirements fulfil…
Hunta Mar 31, 2026
f94da7a
[dark-mode] Final Tasks.md update: Mark all phases 1.1-1.3 and 2.1-2.…
Hunta Mar 31, 2026
a52c2db
[dark-mode] Phase 2.5: Update sidebar component styles - Replace hard…
Hunta Mar 31, 2026
8ae487d
[dark-mode] Phase 2.6: Update button component styles - Complete dark…
Hunta Mar 31, 2026
907cfd4
[dark-mode] Phase 2.7: Update input/form component styles with CSS va…
Hunta Mar 31, 2026
0fb7bdf
[dark-mode] Phase 2.8: Update remaining component styles - Documentat…
Hunta Mar 31, 2026
fbb8eb4
[dark-mode] Fix: Initialize ThemeToggle module in docReady
Hunta Mar 31, 2026
884d469
[dark-mode] Pre testing development summary docs.
Hunta Mar 31, 2026
7844eb0
[dark-mode] Dark theme implementation, Playwright e2e tests, bug fixe…
Hunta Mar 31, 2026
1267cf2
[dark-mode] Phase 3.2: WCAG AA accessibility fixes and Playwright a11…
Hunta Mar 31, 2026
feea8a4
[dark-mode] Phase 3.3: Performance tests — toggle timing, layout shif…
Hunta Mar 31, 2026
8cc3574
[dark-mode] Phase 3.4: localStorage persistence edge-case tests (FR-2.2)
Hunta Mar 31, 2026
2b4665d
[dark-mode] Phase 3.5: Cross-browser compatibility tests and ThemeMan…
Hunta Mar 31, 2026
c390e71
[dark-mode] Phase 4.1: Code review and cleanup
Hunta Mar 31, 2026
e0e1d12
[dark-mode] Move e2e tests to src/test/e2e
Hunta Mar 31, 2026
14146c4
[dark-mode] Phase 4.2: ThemeManager unit tests with JSDOM
Hunta Mar 31, 2026
7993ba1
[dark-mode] Phase 4.3: Prune outdated documentation
Hunta Mar 31, 2026
c68cdfe
[dark-mode] Phase 4.3: Add Phase 3 testing documentation
Hunta Mar 31, 2026
3deaad7
[dark-mode] Phase 4.4: Update project documentation (README, DEVELOPM…
Hunta Mar 31, 2026
1e81fd9
[dark-mode] Update PR comments and progress-report
Hunta Apr 1, 2026
8c1b063
[dark-mode] Add production deployment and setup instructions
Hunta Apr 3, 2026
51f9324
[dark-mode] Update port to 3000 in documentation and config
Hunta Apr 3, 2026
2ca5eb4
[dark-mode] Revert port chaneg.
Hunta Apr 3, 2026
5973c75
[dark-mode] Address PR review comments: indentation, types, config, c…
Hunta Apr 8, 2026
d97ed5e
[dark-mode] Fix indentation
Hunta Apr 13, 2026
8ca0964
[dark-mode] Consolidate AI slop.
Hunta Apr 13, 2026
24e2131
[dark-mode] Removed planning docs.
Hunta Apr 13, 2026
1fc1307
Merge branch 'main' into feature/dark-mode
Hunta Apr 14, 2026
83bffcf
[dark-mode] Camel case this
Hunta Apr 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 278 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,284 @@
root = false
root = true

# All files
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
trim_trailing_whitespace = true
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:error
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:error
csharp_style_namespace_declarations = file_scoped:error
csharp_style_prefer_method_group_conversion = false:suggestion
csharp_style_prefer_top_level_statements = true:suggestion
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = true:suggestion
csharp_style_expression_bodied_operators = true:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:error
csharp_style_throw_expression = true:error
csharp_style_prefer_null_check_over_type_check = true:error
csharp_prefer_simple_default_expression = true:error
csharp_style_prefer_local_over_anonymous_function = true:error
csharp_style_prefer_index_operator = true:error
csharp_style_implicit_object_creation_when_type_is_apparent = true:error
csharp_style_prefer_range_operator = true:error
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = true:error
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_unused_value_assignment_preference = discard_variable:error
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:warning
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:warning
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:warning
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:warning
csharp_style_conditional_delegate_call = true:error
csharp_style_prefer_switch_expression = false:error
csharp_style_prefer_pattern_matching = true:error
csharp_style_pattern_matching_over_is_with_cast_check = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_prefer_not_pattern = true:error
csharp_style_prefer_extended_property_pattern = true:error
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_elsewhere = false:silent
csharp_space_around_binary_operators = before_and_after
csharp_indent_case_contents_when_block = false
csharp_space_between_parentheses = false
csharp_preserve_single_line_blocks = false
dotnet_diagnostic.CA1070.severity = warning
dotnet_diagnostic.CA1047.severity = error
dotnet_diagnostic.ASP0000.severity = error
dotnet_diagnostic.CA1200.severity = error
dotnet_diagnostic.CA1309.severity = error
dotnet_diagnostic.CA1311.severity = error
dotnet_diagnostic.CA1507.severity = error
dotnet_diagnostic.CA1508.severity = error
dotnet_diagnostic.MVC1004.severity = none
dotnet_diagnostic.CA1802.severity = error
dotnet_diagnostic.CA1805.severity = error
dotnet_diagnostic.CA1824.severity = error
dotnet_diagnostic.CA1825.severity = error
dotnet_diagnostic.CA1841.severity = error
dotnet_diagnostic.CA1845.severity = error
dotnet_diagnostic.CA1851.severity = error
dotnet_diagnostic.CA1855.severity = error
dotnet_diagnostic.CA1856.severity = none
dotnet_diagnostic.CA1857.severity = none
dotnet_diagnostic.CA1865.severity = error
dotnet_diagnostic.CA1867.severity = none
dotnet_diagnostic.CA1866.severity = none
dotnet_diagnostic.CA1870.severity = error
dotnet_diagnostic.CA1820.severity = error
dotnet_diagnostic.xUnit2000.severity = error
dotnet_diagnostic.xUnit2001.severity = error
dotnet_diagnostic.xUnit2002.severity = error
dotnet_diagnostic.xUnit2003.severity = error
dotnet_diagnostic.xUnit2004.severity = error
dotnet_diagnostic.xUnit2005.severity = error
dotnet_diagnostic.xUnit2006.severity = error
dotnet_diagnostic.xUnit2007.severity = error
dotnet_diagnostic.xUnit2008.severity = error
dotnet_diagnostic.xUnit2009.severity = error
dotnet_diagnostic.xUnit2010.severity = error
dotnet_diagnostic.xUnit2011.severity = error
dotnet_diagnostic.xUnit2012.severity = error
dotnet_diagnostic.xUnit2013.severity = error
dotnet_diagnostic.xUnit2015.severity = error
dotnet_diagnostic.xUnit2017.severity = error
dotnet_diagnostic.xUnit2018.severity = error
dotnet_diagnostic.xUnit2020.severity = error
dotnet_diagnostic.xUnit2022.severity = error
dotnet_diagnostic.xUnit2023.severity = error
dotnet_diagnostic.xUnit2024.severity = error
dotnet_diagnostic.xUnit2025.severity = error
dotnet_diagnostic.xUnit2026.severity = error
dotnet_diagnostic.xUnit2027.severity = error
dotnet_diagnostic.xUnit2028.severity = error
dotnet_diagnostic.xUnit3000.severity = none
dotnet_diagnostic.xUnit1005.severity = error
dotnet_diagnostic.xUnit1006.severity = error
dotnet_diagnostic.xUnit1008.severity = error
dotnet_diagnostic.xUnit1012.severity = error
dotnet_diagnostic.xUnit1013.severity = error
dotnet_diagnostic.xUnit1014.severity = error
dotnet_diagnostic.xUnit1021.severity = error
dotnet_diagnostic.xUnit1025.severity = error
dotnet_diagnostic.xUnit1026.severity = error
dotnet_diagnostic.xUnit1030.severity = error
dotnet_diagnostic.xUnit1031.severity = error
dotnet_diagnostic.xUnit1034.severity = error
dotnet_diagnostic.xUnit1042.severity = error
csharp_new_line_before_open_brace = types,methods,anonymous_methods,control_blocks,anonymous_types,object_collection_array_initializers,lambdas,accessors
csharp_prefer_system_threading_lock = true:suggestion
csharp_style_prefer_implicitly_typed_lambda_expression = true:suggestion
csharp_style_prefer_unbound_generic_type_in_nameof = true:suggestion

# Xml files
[*.xml]
indent_size = 2


[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = error
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = error
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = error
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = none

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
dotnet_style_coalesce_expression = true:error
dotnet_style_null_propagation = true:error
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:error
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_object_initializer = true:error
dotnet_style_collection_initializer = true:error
dotnet_style_prefer_conditional_expression_over_assignment = true:error
dotnet_style_prefer_simplified_boolean_expressions = true:error
dotnet_style_explicit_tuple_names = true:error
dotnet_style_prefer_conditional_expression_over_return = true:error
dotnet_style_prefer_inferred_tuple_names = true:error
dotnet_style_prefer_inferred_anonymous_type_member_names = true:error
dotnet_style_prefer_compound_assignment = true:error
dotnet_style_prefer_simplified_interpolation = true:error
dotnet_style_prefer_collection_expression = when_types_loosely_match:none
dotnet_style_namespace_match_folder = true:error
dotnet_style_readonly_field = true:error
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error
dotnet_style_require_accessibility_modifiers = for_non_interface_members:error
dotnet_style_allow_multiple_blank_lines_experimental = true:suggestion
dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
dotnet_code_quality_unused_parameters = all:error
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_event = false:error
dotnet_diagnostic.CA1001.severity = error
dotnet_diagnostic.CA1008.severity = error
dotnet_diagnostic.CA1010.severity = warning
dotnet_diagnostic.CA1012.severity = error
dotnet_diagnostic.CA1014.severity = none
dotnet_diagnostic.CA1016.severity = error
dotnet_diagnostic.CA1017.severity = none
dotnet_diagnostic.CA1019.severity = error
dotnet_diagnostic.CA1024.severity = error
dotnet_diagnostic.CA1027.severity = error
dotnet_diagnostic.CA1028.severity = error
dotnet_diagnostic.CA1030.severity = error
dotnet_diagnostic.CA1031.severity = none
dotnet_diagnostic.CA1034.severity = error
dotnet_diagnostic.CA1040.severity = error
dotnet_diagnostic.CA1041.severity = error
dotnet_diagnostic.CA1043.severity = error
dotnet_diagnostic.CA1044.severity = error
dotnet_diagnostic.CA1045.severity = error
dotnet_diagnostic.CA1046.severity = none
dotnet_diagnostic.CA1050.severity = error
dotnet_diagnostic.CA1051.severity = warning
dotnet_diagnostic.CA1052.severity = error
dotnet_diagnostic.CA1054.severity = error
dotnet_diagnostic.CA1055.severity = error
dotnet_diagnostic.CA1056.severity = error
dotnet_diagnostic.CA1058.severity = error
dotnet_diagnostic.CA1061.severity = error
dotnet_diagnostic.CA1062.severity = none
dotnet_diagnostic.CA1063.severity = error
dotnet_diagnostic.CA1064.severity = error
dotnet_diagnostic.CA1065.severity = error
dotnet_diagnostic.CA1066.severity = error
dotnet_diagnostic.CA1067.severity = error
dotnet_diagnostic.CA1068.severity = error
dotnet_diagnostic.CA1069.severity = error
dotnet_diagnostic.CA1303.severity = error
dotnet_diagnostic.CA1304.severity = error
dotnet_diagnostic.CA1305.severity = error
dotnet_diagnostic.CA1307.severity = silent
dotnet_diagnostic.CA1308.severity = none
dotnet_diagnostic.CA1310.severity = error
dotnet_diagnostic.CA2101.severity = warning
dotnet_diagnostic.CA1501.severity = error
dotnet_diagnostic.CA1506.severity = none
dotnet_diagnostic.CA1509.severity = error
dotnet_diagnostic.CA1510.severity = error
dotnet_diagnostic.CA1511.severity = error
dotnet_diagnostic.CA1512.severity = error
dotnet_diagnostic.CA1513.severity = error
dotnet_diagnostic.CA1700.severity = error
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CA1708.severity = error
dotnet_diagnostic.CA1710.severity = suggestion
dotnet_diagnostic.CA1712.severity = error
dotnet_diagnostic.CA1715.severity = error
dotnet_diagnostic.CA1716.severity = warning
dotnet_diagnostic.CA1720.severity = none
dotnet_diagnostic.CA1721.severity = error
dotnet_diagnostic.CA1724.severity = none
dotnet_diagnostic.CA1725.severity = warning
dotnet_diagnostic.CA1727.severity = none
dotnet_diagnostic.CA1806.severity = error
dotnet_diagnostic.CA1810.severity = error

# IDE0305: Simplify collection initialization
dotnet_diagnostic.IDE0305.severity = none
108 changes: 108 additions & 0 deletions .github/specs/dark-mode/DarkMode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Dark Mode Implementation

**Branch:** `feature/dark-mode`
**Status:** ✅ Complete
**Last Updated:** March 31, 2026

## Overview

A complete dark mode implementation with theme persistence, system preference detection, and full accessibility compliance (WCAG 2.1 AA). The feature includes 139 Playwright e2e tests and 30 Mocha unit tests, all passing.

## Architecture

### ThemeManager Module
Singleton pattern with synchronous initialization to prevent flash of unstyled content (FOUC):
- **Storage:** localStorage key `codex-docs-theme` persists user preference
- **System Detection:** `prefers-color-scheme` media query for system preference detection
- **Priority:** Saved preference > System preference > Light mode default
- **Event:** Custom `themeChange` event for reactive module updates

### CSS Variables System
Theme values defined via CSS custom properties with automatic switching:
- **Light theme:** `:root` selector in `vars.pcss` (default)
- **Dark theme:** `[data-theme="dark"]` selector in `dark-mode.pcss`
- **System preference:** `@media (prefers-color-scheme: dark)` fallback

### Theme Toggle UI
- Header button with sun/moon SVG icons (`header.twig`)
- Keyboard support: Enter and Space keys activate toggle
- ARIA labels for screen reader accessibility

## Implementation Details

### Files Created
- `src/frontend/js/modules/themeManager.js` — Theme management
- `src/frontend/styles/dark-mode.pcss` — Dark theme CSS variables
- `playwright.config.ts` — Multi-browser test configuration
- `src/test/e2e/dark-mode/*.spec.ts` — E2E test suite (9 files)
- `src/test/modules/themeManager.ts` — Unit tests

### Files Modified
- `src/frontend/js/app.js` — Import & init ThemeManager first
- `src/frontend/js/modules/themeToggle.js` — Fixed event listener
- `src/frontend/styles/vars.pcss` — Light theme color definitions
- `src/frontend/styles/components/header.pcss`, `copy-button.pcss`, `page.pcss`, `sidebar.pcss`, `writing.pcss`, `diff.pcss` — Replaced hardcoded colors with CSS variables
- `src/backend/database/local.ts` — Migrated to `@seald-io/nedb` for Node 24 compatibility
- `src/backend/routes/pages.ts` — Fixed race condition with `await`

## Bug Fixes

| Issue | Root Cause | Solution |
|-------|-----------|----------|
| Icons not updating | Event listener used wrong name | Changed to listen for `themeChange` event |
| Page white in dark mode | Hardcoded `white` backgrounds | Replaced with `var(--color-bg-main)` |
| Dark mode lost after login | Missing script tag | Added `main.bundle.js` to login template |
| Redirect 500 error | Async `alias.save()` not awaited | Added `await` keyword |
| Node 24 crash | `util.isDate` removed from Node 24 | Migrated to `@seald-io/nedb` fork |

## WCAG AA Compliance

All color contrast ratios updated to meet WCAG AA standards:
- Text on background: 4.5:1 minimum
- UI boundary elements: 3:1 minimum
- Tested with 26 dedicated accessibility tests

## Testing Coverage

- **Visual & Functional:** 35 tests (toggle, persistence, system preference, component colors, FOUC prevention)
- **Accessibility:** 26 tests (contrast ratios, keyboard navigation, focus visibility, ARIA/semantics)
- **Performance:** 12 tests (toggle timing <100ms, layout stability, CSS architecture)
- **Cross-browser:** 57 tests (Chromium, Firefox, WebKit)
- **Unit:** 30 tests (ThemeManager with JSDOM)

## Color Palette

Final zinc-based palette (WCAG AA compliant):
- Background: `#18181B`
- Surface/Cards: `#27272A`
- Borders: `#71717A`
- Text: `#E4E4E7`
- Accent colors adjusted for contrast compliance

## API

### ThemeManager
```javascript
import ThemeManager from './modules/themeManager';

// Initialize (called in app startup)
ThemeManager.init();

// Get current theme
ThemeManager.getCurrentTheme(); // Returns 'light' or 'dark'

// Set theme
ThemeManager.setTheme('dark');

// Listen for changes
document.addEventListener('themeChange', (e) => {
console.log('Theme changed to:', e.detail.theme);
});
```

## Browser Support

- Chromium (v100+)
- Firefox (v97+)
- WebKit/Safari (v15+)
- Requires CSS custom properties & `prefers-color-scheme` support
Loading