This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+2 -1
View File
@@ -138,7 +138,8 @@
}
},
"interactivity": true,
"renaming": false
"renaming": false,
"contentRole": true
},
"editorStyle": "wp-block-navigation-editor",
"style": "wp-block-navigation"
+36 -19
View File
@@ -142,7 +142,6 @@
.components-placeholder.wp-block-navigation-placeholder{
background:none;
box-shadow:none;
color:inherit;
min-height:0;
outline:none;
padding:0;
@@ -153,14 +152,15 @@
.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{
margin-bottom:0;
}
.components-placeholder.wp-block-navigation-placeholder{
color:inherit;
}
.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{
color:#1e1e1e;
}
.wp-block-navigation-placeholder__preview{
align-items:center;
background:#0000;
color:currentColor;
display:flex;
font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
font-size:13px;
@@ -169,6 +169,10 @@
.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{
display:none;
}
.wp-block-navigation-placeholder__preview{
background:#0000;
color:currentColor;
}
.wp-block-navigation-placeholder__preview:before{
border:1px dashed;
border-radius:inherit;
@@ -204,14 +208,16 @@
border-radius:2px;
box-shadow:inset 0 0 0 1px #1e1e1e;
display:none;
float:right;
position:relative;
width:100%;
z-index:1;
}
.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls{
display:flex;
}
.wp-block-navigation-placeholder__controls{
float:right;
width:100%;
}
.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr{
display:none;
}
@@ -251,11 +257,13 @@
font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
font-size:13px;
gap:6px;
height:100%;
}
.wp-block-navigation-placeholder__actions .components-dropdown,.wp-block-navigation-placeholder__actions>.components-button{
margin-left:0;
}
.wp-block-navigation-placeholder__actions{
height:100%;
}
.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr{
background-color:#1e1e1e;
border:0;
@@ -273,12 +281,12 @@
.wp-block-navigation__responsive-container.is-menu-open{
position:fixed;
top:155px;
top:159px;
}
@media (min-width:782px){
.wp-block-navigation__responsive-container.is-menu-open{
right:36px;
top:93px;
top:97px;
}
}
@media (min-width:960px){
@@ -288,20 +296,20 @@
}
.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{
top:141px;
top:145px;
}
.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{
right:0;
top:155px;
top:159px;
}
@media (min-width:782px){
.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{
top:61px;
top:65px;
}
}
.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{
top:109px;
top:113px;
}
body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{
@@ -367,9 +375,9 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
align-items:center;
background-color:#f0f0f0;
display:flex;
grid-column:span 2;
height:64px !important;
justify-content:space-between;
margin-bottom:12px;
padding:0 24px;
width:100%;
}
@@ -416,10 +424,6 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
.wp-block-navigation__menu-inspector-controls{
overflow-x:auto;
scrollbar-color:#0000 #0000;
scrollbar-gutter:stable both-edges;
scrollbar-width:thin;
will-change:transform;
}
.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar{
height:12px;
@@ -437,9 +441,17 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
.wp-block-navigation__menu-inspector-controls:focus-within::-webkit-scrollbar-thumb,.wp-block-navigation__menu-inspector-controls:focus::-webkit-scrollbar-thumb,.wp-block-navigation__menu-inspector-controls:hover::-webkit-scrollbar-thumb{
background-color:#949494;
}
.wp-block-navigation__menu-inspector-controls{
scrollbar-color:#0000 #0000;
scrollbar-gutter:stable both-edges;
scrollbar-width:thin;
}
.wp-block-navigation__menu-inspector-controls:focus,.wp-block-navigation__menu-inspector-controls:focus-within,.wp-block-navigation__menu-inspector-controls:hover{
scrollbar-color:#949494 #0000;
}
.wp-block-navigation__menu-inspector-controls{
will-change:transform;
}
@media (hover:none){
.wp-block-navigation__menu-inspector-controls{
scrollbar-color:#949494 #0000;
@@ -450,6 +462,11 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
margin-right:24px;
}
.wp-block-navigation__overlay-menu-icon-toggle-group{
margin-bottom:16px;
.editor-sidebar__panel .wp-block-navigation__submenu-header{
margin-bottom:0;
margin-top:0;
}
.wp-block-navigation__submenu-accessibility-notice{
grid-column:span 2;
}
File diff suppressed because one or more lines are too long
+36 -19
View File
@@ -142,7 +142,6 @@
.components-placeholder.wp-block-navigation-placeholder{
background:none;
box-shadow:none;
color:inherit;
min-height:0;
outline:none;
padding:0;
@@ -153,14 +152,15 @@
.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{
margin-bottom:0;
}
.components-placeholder.wp-block-navigation-placeholder{
color:inherit;
}
.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{
color:#1e1e1e;
}
.wp-block-navigation-placeholder__preview{
align-items:center;
background:#0000;
color:currentColor;
display:flex;
font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
font-size:13px;
@@ -169,6 +169,10 @@
.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{
display:none;
}
.wp-block-navigation-placeholder__preview{
background:#0000;
color:currentColor;
}
.wp-block-navigation-placeholder__preview:before{
border:1px dashed;
border-radius:inherit;
@@ -204,14 +208,16 @@
border-radius:2px;
box-shadow:inset 0 0 0 1px #1e1e1e;
display:none;
float:left;
position:relative;
width:100%;
z-index:1;
}
.wp-block-navigation.is-selected .wp-block-navigation-placeholder__controls{
display:flex;
}
.wp-block-navigation-placeholder__controls{
float:left;
width:100%;
}
.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-medium .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator,.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions__indicator+hr{
display:none;
}
@@ -251,11 +257,13 @@
font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
font-size:13px;
gap:6px;
height:100%;
}
.wp-block-navigation-placeholder__actions .components-dropdown,.wp-block-navigation-placeholder__actions>.components-button{
margin-right:0;
}
.wp-block-navigation-placeholder__actions{
height:100%;
}
.wp-block-navigation-placeholder__actions.wp-block-navigation-placeholder__actions hr{
background-color:#1e1e1e;
border:0;
@@ -273,12 +281,12 @@
.wp-block-navigation__responsive-container.is-menu-open{
position:fixed;
top:155px;
top:159px;
}
@media (min-width:782px){
.wp-block-navigation__responsive-container.is-menu-open{
left:36px;
top:93px;
top:97px;
}
}
@media (min-width:960px){
@@ -288,20 +296,20 @@
}
.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{
top:141px;
top:145px;
}
.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{
left:0;
top:155px;
top:159px;
}
@media (min-width:782px){
.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{
top:61px;
top:65px;
}
}
.is-fullscreen-mode .is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-fullscreen-mode .is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{
top:109px;
top:113px;
}
body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{
@@ -367,9 +375,9 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
align-items:center;
background-color:#f0f0f0;
display:flex;
grid-column:span 2;
height:64px !important;
justify-content:space-between;
margin-bottom:12px;
padding:0 24px;
width:100%;
}
@@ -416,10 +424,6 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
.wp-block-navigation__menu-inspector-controls{
overflow-x:auto;
scrollbar-color:#0000 #0000;
scrollbar-gutter:stable both-edges;
scrollbar-width:thin;
will-change:transform;
}
.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar{
height:12px;
@@ -437,9 +441,17 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
.wp-block-navigation__menu-inspector-controls:focus-within::-webkit-scrollbar-thumb,.wp-block-navigation__menu-inspector-controls:focus::-webkit-scrollbar-thumb,.wp-block-navigation__menu-inspector-controls:hover::-webkit-scrollbar-thumb{
background-color:#949494;
}
.wp-block-navigation__menu-inspector-controls{
scrollbar-color:#0000 #0000;
scrollbar-gutter:stable both-edges;
scrollbar-width:thin;
}
.wp-block-navigation__menu-inspector-controls:focus,.wp-block-navigation__menu-inspector-controls:focus-within,.wp-block-navigation__menu-inspector-controls:hover{
scrollbar-color:#949494 #0000;
}
.wp-block-navigation__menu-inspector-controls{
will-change:transform;
}
@media (hover:none){
.wp-block-navigation__menu-inspector-controls{
scrollbar-color:#949494 #0000;
@@ -450,6 +462,11 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
margin-left:24px;
}
.wp-block-navigation__overlay-menu-icon-toggle-group{
margin-bottom:16px;
.editor-sidebar__panel .wp-block-navigation__submenu-header{
margin-bottom:0;
margin-top:0;
}
.wp-block-navigation__submenu-accessibility-notice{
grid-column:span 2;
}
File diff suppressed because one or more lines are too long
+27 -14
View File
@@ -1,10 +1,5 @@
.wp-block-navigation{
position:relative;
--navigation-layout-justification-setting:flex-start;
--navigation-layout-direction:row;
--navigation-layout-wrap:wrap;
--navigation-layout-justify:flex-start;
--navigation-layout-align:center;
}
.wp-block-navigation ul{
margin-bottom:0;
@@ -27,6 +22,7 @@
}
.wp-block-navigation .wp-block-navigation-item__content{
display:block;
z-index:1;
}
.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content{
color:inherit;
@@ -60,6 +56,13 @@
margin-top:.075em;
width:inherit;
}
.wp-block-navigation{
--navigation-layout-justification-setting:flex-start;
--navigation-layout-direction:row;
--navigation-layout-wrap:wrap;
--navigation-layout-justify:flex-start;
--navigation-layout-align:center;
}
.wp-block-navigation.is-vertical{
--navigation-layout-direction:column;
--navigation-layout-justify:initial;
@@ -93,14 +96,8 @@
color:inherit;
display:flex;
flex-direction:column;
height:0;
opacity:0;
overflow:hidden;
position:absolute;
right:-1px;
top:100%;
visibility:hidden;
width:0;
z-index:2;
}
@media not (prefers-reduced-motion){
@@ -108,9 +105,16 @@
transition:opacity .1s linear;
}
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container{
height:0;
overflow:hidden;
visibility:hidden;
width:0;
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content{
display:flex;
flex-grow:1;
padding:.5em 1em;
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content .wp-block-navigation__submenu-icon{
margin-left:0;
@@ -119,6 +123,10 @@
.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content{
margin:0;
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container{
right:-1px;
top:100%;
}
@media (min-width:782px){
.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{
right:100%;
@@ -185,6 +193,9 @@ button.wp-block-navigation-item__content{
.wp-block-navigation-submenu__toggle{
cursor:pointer;
}
.wp-block-navigation-submenu__toggle[aria-expanded=true]+.wp-block-navigation__submenu-icon>svg,.wp-block-navigation-submenu__toggle[aria-expanded=true]>svg{
transform:rotate(-180deg);
}
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{
padding-left:.85em;
@@ -289,9 +300,6 @@ button.wp-block-navigation-item__content{
background-color:inherit;
display:flex;
flex-direction:column;
overflow:auto;
padding:clamp(1rem, var(--wp--style--root--padding-top), 20rem) clamp(1rem, var(--wp--style--root--padding-left), 20rem) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem);
z-index:100000;
}
@media not (prefers-reduced-motion){
.wp-block-navigation__responsive-container.is-menu-open{
@@ -299,6 +307,11 @@ button.wp-block-navigation-item__content{
animation-fill-mode:forwards;
}
}
.wp-block-navigation__responsive-container.is-menu-open{
overflow:auto;
padding:clamp(1rem, var(--wp--style--root--padding-top), 20rem) clamp(1rem, var(--wp--style--root--padding-left), 20rem) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem);
z-index:100000;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{
align-items:var(--navigation-layout-justification-setting, inherit);
display:flex;
File diff suppressed because one or more lines are too long
+27 -14
View File
@@ -1,10 +1,5 @@
.wp-block-navigation{
position:relative;
--navigation-layout-justification-setting:flex-start;
--navigation-layout-direction:row;
--navigation-layout-wrap:wrap;
--navigation-layout-justify:flex-start;
--navigation-layout-align:center;
}
.wp-block-navigation ul{
margin-bottom:0;
@@ -27,6 +22,7 @@
}
.wp-block-navigation .wp-block-navigation-item__content{
display:block;
z-index:1;
}
.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content{
color:inherit;
@@ -60,6 +56,13 @@
margin-top:.075em;
width:inherit;
}
.wp-block-navigation{
--navigation-layout-justification-setting:flex-start;
--navigation-layout-direction:row;
--navigation-layout-wrap:wrap;
--navigation-layout-justify:flex-start;
--navigation-layout-align:center;
}
.wp-block-navigation.is-vertical{
--navigation-layout-direction:column;
--navigation-layout-justify:initial;
@@ -93,14 +96,8 @@
color:inherit;
display:flex;
flex-direction:column;
height:0;
left:-1px;
opacity:0;
overflow:hidden;
position:absolute;
top:100%;
visibility:hidden;
width:0;
z-index:2;
}
@media not (prefers-reduced-motion){
@@ -108,9 +105,16 @@
transition:opacity .1s linear;
}
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container{
height:0;
overflow:hidden;
visibility:hidden;
width:0;
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content{
display:flex;
flex-grow:1;
padding:.5em 1em;
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content .wp-block-navigation__submenu-icon{
margin-left:auto;
@@ -119,6 +123,10 @@
.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content{
margin:0;
}
.wp-block-navigation .has-child .wp-block-navigation__submenu-container{
left:-1px;
top:100%;
}
@media (min-width:782px){
.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{
left:100%;
@@ -185,6 +193,9 @@ button.wp-block-navigation-item__content{
.wp-block-navigation-submenu__toggle{
cursor:pointer;
}
.wp-block-navigation-submenu__toggle[aria-expanded=true]+.wp-block-navigation__submenu-icon>svg,.wp-block-navigation-submenu__toggle[aria-expanded=true]>svg{
transform:rotate(180deg);
}
.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{
padding-left:0;
@@ -289,9 +300,6 @@ button.wp-block-navigation-item__content{
background-color:inherit;
display:flex;
flex-direction:column;
overflow:auto;
padding:clamp(1rem, var(--wp--style--root--padding-top), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-left), 20rem);
z-index:100000;
}
@media not (prefers-reduced-motion){
.wp-block-navigation__responsive-container.is-menu-open{
@@ -299,6 +307,11 @@ button.wp-block-navigation-item__content{
animation-fill-mode:forwards;
}
}
.wp-block-navigation__responsive-container.is-menu-open{
overflow:auto;
padding:clamp(1rem, var(--wp--style--root--padding-top), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-left), 20rem);
z-index:100000;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{
align-items:var(--navigation-layout-justification-setting, inherit);
display:flex;
File diff suppressed because one or more lines are too long
+139 -177
View File
@@ -30,194 +30,156 @@ var x = (y) => {
var y = (x) => (() => (x))
const interactivity_namespaceObject = x({ ["getContext"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext), ["getElement"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement), ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store), ["withSyncEvent"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.withSyncEvent) });
;// ./node_modules/@wordpress/block-library/build-module/navigation/view.js
/**
* WordPress dependencies
*/
const focusableSelectors = ['a[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
// This is a fix for Safari in iOS/iPadOS. Without it, Safari doesn't focus out
// when the user taps in the body. It can be removed once we add an overlay to
// capture the clicks, instead of relying on the focusout event.
document.addEventListener('click', () => {});
const {
state,
actions
} = (0,interactivity_namespaceObject.store)('core/navigation', {
state: {
get roleAttribute() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' && state.isMenuOpen ? 'dialog' : null;
},
get ariaModal() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' && state.isMenuOpen ? 'true' : null;
},
get ariaLabel() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' && state.isMenuOpen ? ctx.ariaLabel : null;
},
get isMenuOpen() {
// The menu is opened if either `click`, `hover` or `focus` is true.
return Object.values(state.menuOpenedBy).filter(Boolean).length > 0;
},
get menuOpenedBy() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === 'overlay' ? ctx.overlayOpenedBy : ctx.submenuOpenedBy;
}
},
actions: {
openMenuOnHover() {
const {
type,
overlayOpenedBy
} = (0,interactivity_namespaceObject.getContext)();
if (type === 'submenu' &&
// Only open on hover if the overlay is closed.
Object.values(overlayOpenedBy || {}).filter(Boolean).length === 0) {
actions.openMenu('hover');
const focusableSelectors = [
"a[href]",
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
"select:not([disabled]):not([aria-hidden])",
"textarea:not([disabled]):not([aria-hidden])",
"button:not([disabled]):not([aria-hidden])",
"[contenteditable]",
'[tabindex]:not([tabindex^="-"])'
];
document.addEventListener("click", () => {
});
const { state, actions } = (0,interactivity_namespaceObject.store)(
"core/navigation",
{
state: {
get roleAttribute() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === "overlay" && state.isMenuOpen ? "dialog" : null;
},
get ariaModal() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === "overlay" && state.isMenuOpen ? "true" : null;
},
get ariaLabel() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === "overlay" && state.isMenuOpen ? ctx.ariaLabel : null;
},
get isMenuOpen() {
return Object.values(state.menuOpenedBy).filter(Boolean).length > 0;
},
get menuOpenedBy() {
const ctx = (0,interactivity_namespaceObject.getContext)();
return ctx.type === "overlay" ? ctx.overlayOpenedBy : ctx.submenuOpenedBy;
}
},
closeMenuOnHover() {
const {
type,
overlayOpenedBy
} = (0,interactivity_namespaceObject.getContext)();
if (type === 'submenu' &&
// Only close on hover if the overlay is closed.
Object.values(overlayOpenedBy || {}).filter(Boolean).length === 0) {
actions.closeMenu('hover');
}
},
openMenuOnClick() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
ctx.previousFocus = ref;
actions.openMenu('click');
},
closeMenuOnClick() {
actions.closeMenu('click');
actions.closeMenu('focus');
},
openMenuOnFocus() {
actions.openMenu('focus');
},
toggleMenuOnClick() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
// Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261
if (window.document.activeElement !== ref) {
ref.focus();
}
const {
menuOpenedBy
} = state;
if (menuOpenedBy.click || menuOpenedBy.focus) {
actions.closeMenu('click');
actions.closeMenu('focus');
} else {
ctx.previousFocus = ref;
actions.openMenu('click');
}
},
handleMenuKeydown: (0,interactivity_namespaceObject.withSyncEvent)(event => {
const {
type,
firstFocusableElement,
lastFocusableElement
} = (0,interactivity_namespaceObject.getContext)();
if (state.menuOpenedBy.click) {
// If Escape close the menu.
if (event?.key === 'Escape') {
actions.closeMenu('click');
actions.closeMenu('focus');
return;
actions: {
openMenuOnHover() {
const { type, overlayOpenedBy } = (0,interactivity_namespaceObject.getContext)();
if (type === "submenu" && // Only open on hover if the overlay is closed.
Object.values(overlayOpenedBy || {}).filter(Boolean).length === 0) {
actions.openMenu("hover");
}
// Trap focus if it is an overlay (main menu).
if (type === 'overlay' && event.key === 'Tab') {
// If shift + tab it change the direction.
if (event.shiftKey && window.document.activeElement === firstFocusableElement) {
event.preventDefault();
lastFocusableElement.focus();
} else if (!event.shiftKey && window.document.activeElement === lastFocusableElement) {
event.preventDefault();
firstFocusableElement.focus();
},
closeMenuOnHover() {
const { type, overlayOpenedBy } = (0,interactivity_namespaceObject.getContext)();
if (type === "submenu" && // Only close on hover if the overlay is closed.
Object.values(overlayOpenedBy || {}).filter(Boolean).length === 0) {
actions.closeMenu("hover");
}
},
openMenuOnClick() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const { ref } = (0,interactivity_namespaceObject.getElement)();
ctx.previousFocus = ref;
actions.openMenu("click");
},
closeMenuOnClick() {
actions.closeMenu("click");
actions.closeMenu("focus");
},
openMenuOnFocus() {
actions.openMenu("focus");
},
toggleMenuOnClick() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const { ref } = (0,interactivity_namespaceObject.getElement)();
if (window.document.activeElement !== ref) {
ref.focus();
}
const { menuOpenedBy } = state;
if (menuOpenedBy.click || menuOpenedBy.focus) {
actions.closeMenu("click");
actions.closeMenu("focus");
} else {
ctx.previousFocus = ref;
actions.openMenu("click");
}
},
handleMenuKeydown: (0,interactivity_namespaceObject.withSyncEvent)((event) => {
const { type, firstFocusableElement, lastFocusableElement } = (0,interactivity_namespaceObject.getContext)();
if (state.menuOpenedBy.click) {
if (event.key === "Escape") {
event.stopPropagation();
actions.closeMenu("click");
actions.closeMenu("focus");
return;
}
if (type === "overlay" && event.key === "Tab") {
if (event.shiftKey && window.document.activeElement === firstFocusableElement) {
event.preventDefault();
lastFocusableElement.focus();
} else if (!event.shiftKey && window.document.activeElement === lastFocusableElement) {
event.preventDefault();
firstFocusableElement.focus();
}
}
}
}),
handleMenuFocusout: (0,interactivity_namespaceObject.withSyncEvent)((event) => {
const { modal, type } = (0,interactivity_namespaceObject.getContext)();
if (event.relatedTarget === null || !modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement && type === "submenu") {
actions.closeMenu("click");
actions.closeMenu("focus");
}
}),
openMenu(menuOpenedOn = "click") {
const { type } = (0,interactivity_namespaceObject.getContext)();
state.menuOpenedBy[menuOpenedOn] = true;
if (type === "overlay") {
document.documentElement.classList.add("has-modal-open");
}
},
closeMenu(menuClosedOn = "click") {
const ctx = (0,interactivity_namespaceObject.getContext)();
state.menuOpenedBy[menuClosedOn] = false;
if (!state.isMenuOpen) {
if (ctx.modal?.contains(window.document.activeElement)) {
ctx.previousFocus?.focus();
}
ctx.modal = null;
ctx.previousFocus = null;
if (ctx.type === "overlay") {
document.documentElement.classList.remove(
"has-modal-open"
);
}
}
}
}),
handleMenuFocusout(event) {
const {
modal,
type
} = (0,interactivity_namespaceObject.getContext)();
// If focus is outside modal, and in the document, close menu
// event.target === The element losing focus
// event.relatedTarget === The element receiving focus (if any)
// When focusout is outside the document,
// `window.document.activeElement` doesn't change.
// The event.relatedTarget is null when something outside the navigation menu is clicked. This is only necessary for Safari.
if (event.relatedTarget === null || !modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement && type === 'submenu') {
actions.closeMenu('click');
actions.closeMenu('focus');
}
},
openMenu(menuOpenedOn = 'click') {
const {
type
} = (0,interactivity_namespaceObject.getContext)();
state.menuOpenedBy[menuOpenedOn] = true;
if (type === 'overlay') {
// Add a `has-modal-open` class to the <html> root.
document.documentElement.classList.add('has-modal-open');
}
},
closeMenu(menuClosedOn = 'click') {
const ctx = (0,interactivity_namespaceObject.getContext)();
state.menuOpenedBy[menuClosedOn] = false;
// Check if the menu is still open or not.
if (!state.isMenuOpen) {
if (ctx.modal?.contains(window.document.activeElement)) {
ctx.previousFocus?.focus();
callbacks: {
initMenu() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const { ref } = (0,interactivity_namespaceObject.getElement)();
if (state.isMenuOpen) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
ctx.modal = ref;
ctx.firstFocusableElement = focusableElements[0];
ctx.lastFocusableElement = focusableElements[focusableElements.length - 1];
}
ctx.modal = null;
ctx.previousFocus = null;
if (ctx.type === 'overlay') {
document.documentElement.classList.remove('has-modal-open');
},
focusFirstElement() {
const { ref } = (0,interactivity_namespaceObject.getElement)();
if (state.isMenuOpen) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
focusableElements?.[0]?.focus();
}
}
}
},
callbacks: {
initMenu() {
const ctx = (0,interactivity_namespaceObject.getContext)();
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
if (state.isMenuOpen) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
ctx.modal = ref;
ctx.firstFocusableElement = focusableElements[0];
ctx.lastFocusableElement = focusableElements[focusableElements.length - 1];
}
},
focusFirstElement() {
const {
ref
} = (0,interactivity_namespaceObject.getElement)();
if (state.isMenuOpen) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
focusableElements?.[0]?.focus();
}
}
}
}, {
lock: true
});
{ lock: true }
);
+1 -1
View File
@@ -1 +1 @@
import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store,withSyncEvent:()=>e.withSyncEvent}),o=["a[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];document.addEventListener("click",(()=>{}));const{state:l,actions:c}=(0,n.store)("core/navigation",{state:{get roleAttribute(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"dialog":null},get ariaModal(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"true":null},get ariaLabel(){const e=(0,n.getContext)();return"overlay"===e.type&&l.isMenuOpen?e.ariaLabel:null},get isMenuOpen(){return Object.values(l.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){const e=(0,n.getContext)();return"overlay"===e.type?e.overlayOpenedBy:e.submenuOpenedBy}},actions:{openMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.openMenu("hover")},closeMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.closeMenu("hover")},openMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();e.previousFocus=t,c.openMenu("click")},closeMenuOnClick(){c.closeMenu("click"),c.closeMenu("focus")},openMenuOnFocus(){c.openMenu("focus")},toggleMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();window.document.activeElement!==t&&t.focus();const{menuOpenedBy:o}=l;o.click||o.focus?(c.closeMenu("click"),c.closeMenu("focus")):(e.previousFocus=t,c.openMenu("click"))},handleMenuKeydown:(0,n.withSyncEvent)((e=>{const{type:t,firstFocusableElement:o,lastFocusableElement:u}=(0,n.getContext)();if(l.menuOpenedBy.click){if("Escape"===e?.key)return c.closeMenu("click"),void c.closeMenu("focus");"overlay"===t&&"Tab"===e.key&&(e.shiftKey&&window.document.activeElement===o?(e.preventDefault(),u.focus()):e.shiftKey||window.document.activeElement!==u||(e.preventDefault(),o.focus()))}})),handleMenuFocusout(e){const{modal:t,type:o}=(0,n.getContext)();(null===e.relatedTarget||!t?.contains(e.relatedTarget)&&e.target!==window.document.activeElement&&"submenu"===o)&&(c.closeMenu("click"),c.closeMenu("focus"))},openMenu(e="click"){const{type:t}=(0,n.getContext)();l.menuOpenedBy[e]=!0,"overlay"===t&&document.documentElement.classList.add("has-modal-open")},closeMenu(e="click"){const t=(0,n.getContext)();l.menuOpenedBy[e]=!1,l.isMenuOpen||(t.modal?.contains(window.document.activeElement)&&t.previousFocus?.focus(),t.modal=null,t.previousFocus=null,"overlay"===t.type&&document.documentElement.classList.remove("has-modal-open"))}},callbacks:{initMenu(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();if(l.isMenuOpen){const n=t.querySelectorAll(o);e.modal=t,e.firstFocusableElement=n[0],e.lastFocusableElement=n[n.length-1]}},focusFirstElement(){const{ref:e}=(0,n.getElement)();if(l.isMenuOpen){const t=e.querySelectorAll(o);t?.[0]?.focus()}}}},{lock:!0});
import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store,withSyncEvent:()=>e.withSyncEvent}),o=["a[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];document.addEventListener("click",(()=>{}));const{state:l,actions:c}=(0,n.store)("core/navigation",{state:{get roleAttribute(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"dialog":null},get ariaModal(){return"overlay"===(0,n.getContext)().type&&l.isMenuOpen?"true":null},get ariaLabel(){const e=(0,n.getContext)();return"overlay"===e.type&&l.isMenuOpen?e.ariaLabel:null},get isMenuOpen(){return Object.values(l.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){const e=(0,n.getContext)();return"overlay"===e.type?e.overlayOpenedBy:e.submenuOpenedBy}},actions:{openMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.openMenu("hover")},closeMenuOnHover(){const{type:e,overlayOpenedBy:t}=(0,n.getContext)();"submenu"===e&&0===Object.values(t||{}).filter(Boolean).length&&c.closeMenu("hover")},openMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();e.previousFocus=t,c.openMenu("click")},closeMenuOnClick(){c.closeMenu("click"),c.closeMenu("focus")},openMenuOnFocus(){c.openMenu("focus")},toggleMenuOnClick(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();window.document.activeElement!==t&&t.focus();const{menuOpenedBy:o}=l;o.click||o.focus?(c.closeMenu("click"),c.closeMenu("focus")):(e.previousFocus=t,c.openMenu("click"))},handleMenuKeydown:(0,n.withSyncEvent)((e=>{const{type:t,firstFocusableElement:o,lastFocusableElement:u}=(0,n.getContext)();if(l.menuOpenedBy.click){if("Escape"===e.key)return e.stopPropagation(),c.closeMenu("click"),void c.closeMenu("focus");"overlay"===t&&"Tab"===e.key&&(e.shiftKey&&window.document.activeElement===o?(e.preventDefault(),u.focus()):e.shiftKey||window.document.activeElement!==u||(e.preventDefault(),o.focus()))}})),handleMenuFocusout:(0,n.withSyncEvent)((e=>{const{modal:t,type:o}=(0,n.getContext)();(null===e.relatedTarget||!t?.contains(e.relatedTarget)&&e.target!==window.document.activeElement&&"submenu"===o)&&(c.closeMenu("click"),c.closeMenu("focus"))})),openMenu(e="click"){const{type:t}=(0,n.getContext)();l.menuOpenedBy[e]=!0,"overlay"===t&&document.documentElement.classList.add("has-modal-open")},closeMenu(e="click"){const t=(0,n.getContext)();l.menuOpenedBy[e]=!1,l.isMenuOpen||(t.modal?.contains(window.document.activeElement)&&t.previousFocus?.focus(),t.modal=null,t.previousFocus=null,"overlay"===t.type&&document.documentElement.classList.remove("has-modal-open"))}},callbacks:{initMenu(){const e=(0,n.getContext)(),{ref:t}=(0,n.getElement)();if(l.isMenuOpen){const n=t.querySelectorAll(o);e.modal=t,e.firstFocusableElement=n[0],e.lastFocusableElement=n[n.length-1]}},focusFirstElement(){const{ref:e}=(0,n.getElement)();if(l.isMenuOpen){const t=e.querySelectorAll(o);t?.[0]?.focus()}}}},{lock:!0});