Skip to content
Merged
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
30ef7db
fix: css issue
troychaplin Jan 3, 2026
f0a26dd
add: block attr for drop down menu
troychaplin Jan 3, 2026
36e79b0
add: admin modal
troychaplin Jan 3, 2026
68446af
change: admin modal styles
troychaplin Jan 3, 2026
7f0c3b0
change: modal preview
troychaplin Jan 3, 2026
9e32d8c
add: functional user interface
troychaplin Jan 3, 2026
253be9d
fix: formatting
troychaplin Jan 3, 2026
f2d253b
fix: controllers in modal
troychaplin Jan 3, 2026
a340f2b
clean up code
troychaplin Jan 3, 2026
9c6aa91
fix: appearance styles
troychaplin Jan 3, 2026
686ff2f
fix: php lint errors
troychaplin Jan 3, 2026
26cfc86
fix: styles
troychaplin Jan 3, 2026
3d4c9bd
test
troychaplin Jan 3, 2026
5c03e0a
fix: conflict with typography styles
troychaplin Jan 3, 2026
e2f3b68
fix: appearance applies to button and dropdown
troychaplin Jan 3, 2026
8630ed8
fix: typography styles
troychaplin Jan 3, 2026
dc34675
clean up: modal styles
troychaplin Jan 4, 2026
d041c05
fix: font and size in preview
troychaplin Jan 4, 2026
ec886b3
removed: logs
troychaplin Jan 4, 2026
850b736
remove: old files
troychaplin Jan 4, 2026
05a0018
add: padding options
troychaplin Jan 4, 2026
eece791
change: split up dropdown style panels
troychaplin Jan 4, 2026
98e7e9d
fix: border control
troychaplin Jan 4, 2026
e6b4c09
finish: border controller
troychaplin Jan 4, 2026
915bbf9
fix: border control
troychaplin Jan 4, 2026
b521554
fix: radius control
troychaplin Jan 4, 2026
e7fb63f
change: core supported border radius control
troychaplin Jan 4, 2026
3c9113c
fix: border styles
troychaplin Jan 4, 2026
b4b57f9
add: shadow dropdown
troychaplin Jan 4, 2026
c8389bf
change: panel names
troychaplin Jan 4, 2026
692752e
change: panel names
troychaplin Jan 4, 2026
667d977
add: sticky position on preview nav
troychaplin Jan 4, 2026
8f1d0e4
fix: color resets
troychaplin Jan 4, 2026
c8ad8c4
fix: color resets
troychaplin Jan 4, 2026
ff1f9e9
change: attribute names
troychaplin Jan 4, 2026
6aeb0fe
change: docs
troychaplin Jan 4, 2026
fdb7ad5
fix: php lint errors
troychaplin Jan 4, 2026
db4f061
fix: css lint errors
troychaplin Jan 4, 2026
0b02bad
refactor: php classes
troychaplin Jan 4, 2026
55d512d
change: preview menu
troychaplin Jan 4, 2026
2fa9f77
fix: merge conflicts
troychaplin Jan 4, 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
117 changes: 117 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Priority Plus Navigation - Claude Context

## Project Overview

A WordPress block plugin that extends the core Navigation block with the "Priority Plus" responsive pattern. Navigation items that don't fit in available space automatically move to a "More" dropdown menu.

## Architecture

### Block Variation Approach
- Extends `core/navigation` as a block variation (not a wrapper block)
- Registered in `src/variation/block.js` with name `priority-plus-navigation`
- Identified by className `is-style-priority-plus-navigation`
- Custom attributes prefixed with `priorityNav*`

### Key Files

**Editor (Block Extension)**
- `src/variation/block.js` - Registers block variation and extends core/navigation attributes
- `src/variation/controls.js` - Adds InspectorControls via `editor.BlockEdit` filter
- `src/variation/constants.js` - Shared defaults (DEFAULT_DROPDOWN_STYLES)

**Modal & Components**
- `src/variation/components/dropdown-customizer-modal.js` - Main modal component for dropdown styling
- `src/variation/components/dropdown-preview.js` - Live preview inside modal
- `src/variation/components/panels/color-panel.js` - PanelColorSettings for dropdown colors
- `src/variation/components/panels/menu-styles-panel.js` - ToolsPanel for border, radius, shadow
- `src/variation/components/panels/menu-spacing-panel.js` - ToolsPanel for item spacing and indent

**Styles**
- `src/variation/components/modal.scss` - Modal layout styles
- `src/variation/components/dropdown-preview.scss` - Preview component styles
- `src/styles/style.scss` - Frontend dropdown styles
- `src/styles/editor.scss` - Editor-specific styles

**Frontend**
- `src/core/PriorityNav.js` - Main frontend class handling overflow detection
- `src/layout/width-calculator.js` - Width calculation algorithm
- `src/dom/dom-builder.js` - Builds dropdown menu dynamically
- `src/dom/dom-extractor.js` - Extracts nav item data
- `src/events/accordion-handler.js` - Handles accordion submenus
- `src/events/event-handlers.js` - Click/keyboard event handlers

## Modal Structure (Dropdown Customizer)

Triggered from ToolsPanel in controls.js via "Customize Dropdown" button.

```
DropdownCustomizerModal
├── ColorPanel - Background, hover background, hover text colors
├── MenuStylesPanel - Border (BorderBoxControl), border radius, box shadow
├── MenuSpacingPanel - Item spacing (BoxControl/SpacingSizesControl), multi-level indent
└── DropdownPreview - Live preview with actual frontend classes
```

**State Flow:**
1. `controls.js` manages `isDropdownCustomizerOpen` state
2. Modal reads `attributes.priorityNavDropdownStyles` merged with DEFAULT_DROPDOWN_STYLES
3. Updates via `updateStyle(key, value)` helper → `setAttributes({ priorityNavDropdownStyles: {...} })`
4. Preview updates instantly using CSS custom properties

## Custom Attributes (on core/navigation)

```javascript
priorityNavEnabled: boolean // Whether Priority+ is active
priorityNavMoreLabel: string // "More" button text
priorityNavMoreBackgroundColor: string
priorityNavMoreBackgroundColorHover: string
priorityNavMoreTextColor: string
priorityNavMoreTextColorHover: string
priorityNavMorePadding: object // {top, right, bottom, left}
priorityNavDropdownStyles: object // Full dropdown styling object
priorityNavTypographyFontFamily: string // Copied from block for preview
priorityNavTypographyFontSize: string
priorityNavTypographyFontWeight: string
priorityNavTypographyFontStyle: string
```

## DEFAULT_DROPDOWN_STYLES

```javascript
{
backgroundColor: '#ffffff',
borderColor: '#dddddd',
borderWidth: '1px',
borderRadius: '4px',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
itemSpacing: { top: '0.75rem', right: '1rem', bottom: '0.75rem', left: '1rem' },
itemHoverBackgroundColor: 'rgba(0, 0, 0, 0.05)',
itemHoverTextColor: 'inherit',
multiLevelIndent: '1.25rem',
}
```

## WordPress Components Used

- `Modal`, `Button`, `TextControl`, `BoxControl` from `@wordpress/components`
- `ToolsPanel`, `ToolsPanelItem` (experimental)
- `BorderBoxControl`, `UnitControl` (experimental)
- `SpacingSizesControl` (experimental) from `@wordpress/block-editor`
- `PanelColorSettings`, `InspectorControls`, `useSetting` from `@wordpress/block-editor`

## Build Commands

```bash
npm run start # Development with hot reload
npm run build # Production build
npm run lint:js # Lint JavaScript
npm run lint:css # Lint CSS/SCSS
```

## Notes

- Modal uses two-column grid layout (controls left, preview right)
- Preview uses exact same CSS classes as frontend for accuracy
- Preset values (var:preset|spacing|30) are converted to CSS custom properties
- BorderBoxControl in MenuStylesPanel handles both color and width updates atomically
- Typography settings are mirrored from navigation block for preview accuracy
Loading