Repository navigation
feat(header): add WordPress-style header navigation modules - #633
Open
queball1999 wants to merge 7 commits into
Open
queball1999 wants to merge 7 commits into
queball1999 wants to merge 7 commits into
Conversation
…tion modules - Add base.nav, a nav bar that collapses to a dropdown or overlay below a chosen width - Add base.nav-item, a menu entry that nests to build submenus - Let a menu item be a link or a static label that toggles its submenu - Add the module contract fields they rely on: instanceCss, canvasCss, canvasViewportWidth, number presets and select icons - Header navigation: this is the core feature, and every later commit on the branch builds on it
- Collect instanceCss from render() and deduplicate it by content - Header navigation: lets the nav publish the media query at its own collapse width, so a published menu actually collapses
- Show presets as one-click buttons under a number field - Render a select whose options carry an icon as an icon button row - Sanitize the icon markup, since a plugin schema can supply it - Expose both options through the plugin SDK control builders - Header navigation: gives the nav its "Collapse below" width presets and its "Menu icon" picker
- Pass the breakpoint frame width to module editor components - Inject a module's canvasCss where the publisher puts module CSS - Author classes now override module styles in the canvas the same way they do when published - Header navigation: the menu collapses in narrow frames and keeps its padding and indents in the editor
- Keep what is being typed instead of snapping back on every keystroke - Accept /paths, #fragments and ?queries - Accept tel: and sms:, which the publisher already allows - Header navigation: a Menu Item's Link field could not be typed into or point at a page section
- Place the button to the left of the switch on toggle controls - It sat on top of the switch thumb on hover - Header navigation: found on the Menu Item's "Enable link" toggle, which the button was covering
- Add a guide to building a menu with base.nav and base.nav-item - Document instanceCss, canvasCss and canvasViewportWidth - Document number presets, select icons and the URL field rules - Header navigation: the docs for the feature and for each piece added to support it
This branch has not been deployed
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
Adds a header navigation menu: two new base modules, plus the engine and editor pieces they need.
What changed
base.nav(Header Navigation): A nav bar that collapses below an author-chosen width into a dropdown or a full-screen overlay, behind a pickable toggle icon. Props: collapse width (presets or any number), collapsed style, menu icon and icon colour, menu alignment, menu background.base.nav-item(Menu Item): A menu entry that nests to any depth, so the page tree is the menu structure. With Enable link off, the label is a static element; on an item with a submenu, the label itself toggles the submenu.instanceCssonrender()output: CSS that depends on an instance's props, deduplicated by content.base.navuses it for the media query at its collapse width.canvasCssonModuleDefinition: A stylesheet for a trusted module's editor component, injected where the publisher puts module CSS (after the reset and framework CSS, before class and user CSS).canvasViewportWidthonModuleComponentProps: The pixel width of the breakpoint frame a component renders in.numbercontrol can offerpresets; aselectwhose options carryiconSvgrenders as an icon button row.Fixes to shared editor controls, found while building the menu
/about,#pricing,?page=2,./a,../a) andtel:/sms:.Why
There was no way to build a responsive site menu without hand-writing the markup, CSS and script. The engine additions exist because the menu needs three things the module contract did not have: CSS that varies per instance, a canvas preview that follows the same cascade as the published page, and knowledge of the frame width in the canvas.
Impact
tel:andsms:links. The bind-to-data button no longer overlaps toggles.instanceCss,canvasCss,canvasViewportWidth, numberpresetsand selecticonSvgare available to first-party modules.presetsandiconSvgare also exposed through the plugin SDK control builders. Plugin modules cannot returninstanceCssor declarecanvasCss.instatic-nav. Menu panels fall back to theCanvassystem colour when no menu background is set.Verification
bun run buildbun testlocally on Windows: 7096 passed, 48 failed. No failures are in tests this PR adds or changes; they are scan timeouts and Windows-only path and symlink failures. Relying on CI for the full pass.bun run lintChecklist