diff options
Diffstat (limited to '')
32 files changed, 4313 insertions, 0 deletions
diff --git a/wp-includes/blocks/navigation-link.php b/wp-includes/blocks/navigation-link.php new file mode 100644 index 0000000..5333ab6 --- /dev/null +++ b/wp-includes/blocks/navigation-link.php @@ -0,0 +1,371 @@ +<?php +/** + * Server-side rendering of the `core/navigation-link` block. + * + * @package WordPress + */ + +/** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the navigation markup in the front-end. + * + * @param array $context Navigation block context. + * @param array $attributes Block attributes. + * @param bool $is_sub_menu Whether the link is part of a sub-menu. + * @return array Colors CSS classes and inline styles. + */ +function block_core_navigation_link_build_css_colors( $context, $attributes, $is_sub_menu = false ) { + $colors = array( + 'css_classes' => array(), + 'inline_styles' => '', + ); + + // Text color. + $named_text_color = null; + $custom_text_color = null; + + if ( $is_sub_menu && array_key_exists( 'customOverlayTextColor', $context ) ) { + $custom_text_color = $context['customOverlayTextColor']; + } elseif ( $is_sub_menu && array_key_exists( 'overlayTextColor', $context ) ) { + $named_text_color = $context['overlayTextColor']; + } elseif ( array_key_exists( 'customTextColor', $context ) ) { + $custom_text_color = $context['customTextColor']; + } elseif ( array_key_exists( 'textColor', $context ) ) { + $named_text_color = $context['textColor']; + } elseif ( isset( $context['style']['color']['text'] ) ) { + $custom_text_color = $context['style']['color']['text']; + } + + // If has text color. + if ( ! is_null( $named_text_color ) ) { + // Add the color class. + array_push( $colors['css_classes'], 'has-text-color', sprintf( 'has-%s-color', $named_text_color ) ); + } elseif ( ! is_null( $custom_text_color ) ) { + // Add the custom color inline style. + $colors['css_classes'][] = 'has-text-color'; + $colors['inline_styles'] .= sprintf( 'color: %s;', $custom_text_color ); + } + + // Background color. + $named_background_color = null; + $custom_background_color = null; + + if ( $is_sub_menu && array_key_exists( 'customOverlayBackgroundColor', $context ) ) { + $custom_background_color = $context['customOverlayBackgroundColor']; + } elseif ( $is_sub_menu && array_key_exists( 'overlayBackgroundColor', $context ) ) { + $named_background_color = $context['overlayBackgroundColor']; + } elseif ( array_key_exists( 'customBackgroundColor', $context ) ) { + $custom_background_color = $context['customBackgroundColor']; + } elseif ( array_key_exists( 'backgroundColor', $context ) ) { + $named_background_color = $context['backgroundColor']; + } elseif ( isset( $context['style']['color']['background'] ) ) { + $custom_background_color = $context['style']['color']['background']; + } + + // If has background color. + if ( ! is_null( $named_background_color ) ) { + // Add the background-color class. + array_push( $colors['css_classes'], 'has-background', sprintf( 'has-%s-background-color', $named_background_color ) ); + } elseif ( ! is_null( $custom_background_color ) ) { + // Add the custom background-color inline style. + $colors['css_classes'][] = 'has-background'; + $colors['inline_styles'] .= sprintf( 'background-color: %s;', $custom_background_color ); + } + + return $colors; +} + +/** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the navigation markup in the front-end. + * + * @param array $context Navigation block context. + * @return array Font size CSS classes and inline styles. + */ +function block_core_navigation_link_build_css_font_sizes( $context ) { + // CSS classes. + $font_sizes = array( + 'css_classes' => array(), + 'inline_styles' => '', + ); + + $has_named_font_size = array_key_exists( 'fontSize', $context ); + $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); + + if ( $has_named_font_size ) { + // Add the font size class. + $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); + } elseif ( $has_custom_font_size ) { + // Add the custom font size inline style. + $font_sizes['inline_styles'] = sprintf( + 'font-size: %s;', + wp_get_typography_font_size_value( + array( + 'size' => $context['style']['typography']['fontSize'], + ) + ) + ); + } + + return $font_sizes; +} + +/** + * Returns the top-level submenu SVG chevron icon. + * + * @return string + */ +function block_core_navigation_link_render_submenu_icon() { + return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>'; +} + +/** + * Decodes a url if it's encoded, returning the same url if not. + * + * @param string $url The url to decode. + * + * @return string $url Returns the decoded url. + */ +function block_core_navigation_link_maybe_urldecode( $url ) { + $is_url_encoded = false; + $query = parse_url( $url, PHP_URL_QUERY ); + $query_params = wp_parse_args( $query ); + + foreach ( $query_params as $query_param ) { + if ( rawurldecode( $query_param ) !== $query_param ) { + $is_url_encoded = true; + break; + } + } + + if ( $is_url_encoded ) { + return rawurldecode( $url ); + } + + return $url; +} + + +/** + * Renders the `core/navigation-link` block. + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the post content with the legacy widget added. + */ +function render_block_core_navigation_link( $attributes, $content, $block ) { + $navigation_link_has_id = isset( $attributes['id'] ) && is_numeric( $attributes['id'] ); + $is_post_type = isset( $attributes['kind'] ) && 'post-type' === $attributes['kind']; + $is_post_type = $is_post_type || isset( $attributes['type'] ) && ( 'post' === $attributes['type'] || 'page' === $attributes['type'] ); + + // Don't render the block's subtree if it is a draft or if the ID does not exist. + if ( $is_post_type && $navigation_link_has_id ) { + $post = get_post( $attributes['id'] ); + if ( ! $post || 'publish' !== $post->post_status ) { + return ''; + } + } + + // Don't render the block's subtree if it has no label. + if ( empty( $attributes['label'] ) ) { + return ''; + } + + $font_sizes = block_core_navigation_link_build_css_font_sizes( $block->context ); + $classes = array_merge( + $font_sizes['css_classes'] + ); + $style_attribute = $font_sizes['inline_styles']; + + $css_classes = trim( implode( ' ', $classes ) ); + $has_submenu = count( $block->inner_blocks ) > 0; + $kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] ); + $is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind ); + + $wrapper_attributes = get_block_wrapper_attributes( + array( + 'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) . + ( $is_active ? ' current-menu-item' : '' ), + 'style' => $style_attribute, + ) + ); + $html = '<li ' . $wrapper_attributes . '>' . + '<a class="wp-block-navigation-item__content" '; + + // Start appending HTML attributes to anchor tag. + if ( isset( $attributes['url'] ) ) { + $html .= ' href="' . esc_url( block_core_navigation_link_maybe_urldecode( $attributes['url'] ) ) . '"'; + } + + if ( $is_active ) { + $html .= ' aria-current="page"'; + } + + if ( isset( $attributes['opensInNewTab'] ) && true === $attributes['opensInNewTab'] ) { + $html .= ' target="_blank" '; + } + + if ( isset( $attributes['rel'] ) ) { + $html .= ' rel="' . esc_attr( $attributes['rel'] ) . '"'; + } elseif ( isset( $attributes['nofollow'] ) && $attributes['nofollow'] ) { + $html .= ' rel="nofollow"'; + } + + if ( isset( $attributes['title'] ) ) { + $html .= ' title="' . esc_attr( $attributes['title'] ) . '"'; + } + + // End appending HTML attributes to anchor tag. + + // Start anchor tag content. + $html .= '>' . + // Wrap title with span to isolate it from submenu icon. + '<span class="wp-block-navigation-item__label">'; + + if ( isset( $attributes['label'] ) ) { + $html .= wp_kses_post( $attributes['label'] ); + } + + $html .= '</span>'; + + // Add description if available. + if ( ! empty( $attributes['description'] ) ) { + $html .= '<span class="wp-block-navigation-item__description">'; + $html .= wp_kses_post( $attributes['description'] ); + $html .= '</span>'; + } + + $html .= '</a>'; + // End anchor tag content. + + if ( isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'] && $has_submenu ) { + // The submenu icon can be hidden by a CSS rule on the Navigation Block. + $html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_link_render_submenu_icon() . '</span>'; + } + + if ( $has_submenu ) { + $inner_blocks_html = ''; + foreach ( $block->inner_blocks as $inner_block ) { + $inner_blocks_html .= $inner_block->render(); + } + + $html .= sprintf( + '<ul class="wp-block-navigation__submenu-container">%s</ul>', + $inner_blocks_html + ); + } + + $html .= '</li>'; + + return $html; +} + +/** + * Returns a navigation link variation + * + * @param WP_Taxonomy|WP_Post_Type $entity post type or taxonomy entity. + * @param string $kind string of value 'taxonomy' or 'post-type'. + * + * @return array + */ +function build_variation_for_navigation_link( $entity, $kind ) { + $title = ''; + $description = ''; + + if ( property_exists( $entity->labels, 'item_link' ) ) { + $title = $entity->labels->item_link; + } + if ( property_exists( $entity->labels, 'item_link_description' ) ) { + $description = $entity->labels->item_link_description; + } + + $variation = array( + 'name' => $entity->name, + 'title' => $title, + 'description' => $description, + 'attributes' => array( + 'type' => $entity->name, + 'kind' => $kind, + ), + ); + + // Tweak some value for the variations. + $variation_overrides = array( + 'post_tag' => array( + 'name' => 'tag', + 'attributes' => array( + 'type' => 'tag', + 'kind' => $kind, + ), + ), + 'post_format' => array( + // The item_link and item_link_description for post formats is the + // same as for tags, so need to be overridden. + 'title' => __( 'Post Format Link' ), + 'description' => __( 'A link to a post format' ), + 'attributes' => array( + 'type' => 'post_format', + 'kind' => $kind, + ), + ), + ); + + if ( array_key_exists( $entity->name, $variation_overrides ) ) { + $variation = array_merge( + $variation, + $variation_overrides[ $entity->name ] + ); + } + + return $variation; +} + +/** + * Register the navigation link block. + * + * @uses render_block_core_navigation() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ +function register_block_core_navigation_link() { + $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' ); + $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' ); + + // Use two separate arrays as a way to order the variations in the UI. + // Known variations (like Post Link and Page Link) are added to the + // `built_ins` array. Variations for custom post types and taxonomies are + // added to the `variations` array and will always appear after `built-ins. + $built_ins = array(); + $variations = array(); + + if ( $post_types ) { + foreach ( $post_types as $post_type ) { + $variation = build_variation_for_navigation_link( $post_type, 'post-type' ); + if ( $post_type->_builtin ) { + $built_ins[] = $variation; + } else { + $variations[] = $variation; + } + } + } + if ( $taxonomies ) { + foreach ( $taxonomies as $taxonomy ) { + $variation = build_variation_for_navigation_link( $taxonomy, 'taxonomy' ); + if ( $taxonomy->_builtin ) { + $built_ins[] = $variation; + } else { + $variations[] = $variation; + } + } + } + + register_block_type_from_metadata( + __DIR__ . '/navigation-link', + array( + 'render_callback' => 'render_block_core_navigation_link', + 'variations' => array_merge( $built_ins, $variations ), + ) + ); +} +add_action( 'init', 'register_block_core_navigation_link' ); diff --git a/wp-includes/blocks/navigation-link/block.json b/wp-includes/blocks/navigation-link/block.json new file mode 100644 index 0000000..b2cbeae --- /dev/null +++ b/wp-includes/blocks/navigation-link/block.json @@ -0,0 +1,78 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "core/navigation-link", + "title": "Custom Link", + "category": "design", + "parent": [ "core/navigation" ], + "description": "Add a page, link, or another item to your navigation.", + "textdomain": "default", + "attributes": { + "label": { + "type": "string" + }, + "type": { + "type": "string" + }, + "description": { + "type": "string" + }, + "rel": { + "type": "string" + }, + "id": { + "type": "number" + }, + "opensInNewTab": { + "type": "boolean", + "default": false + }, + "url": { + "type": "string" + }, + "title": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "isTopLevelLink": { + "type": "boolean" + } + }, + "usesContext": [ + "textColor", + "customTextColor", + "backgroundColor", + "customBackgroundColor", + "overlayTextColor", + "customOverlayTextColor", + "overlayBackgroundColor", + "customOverlayBackgroundColor", + "fontSize", + "customFontSize", + "showSubmenuIcon", + "maxNestingLevel", + "style" + ], + "supports": { + "reusable": false, + "html": false, + "__experimentalSlashInserter": true, + "typography": { + "fontSize": true, + "lineHeight": true, + "__experimentalFontFamily": true, + "__experimentalFontWeight": true, + "__experimentalFontStyle": true, + "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, + "__experimentalDefaultControls": { + "fontSize": true + } + } + }, + "editorStyle": "wp-block-navigation-link-editor", + "style": "wp-block-navigation-link" +} diff --git a/wp-includes/blocks/navigation-link/editor-rtl.css b/wp-includes/blocks/navigation-link/editor-rtl.css new file mode 100644 index 0000000..c7811c0 --- /dev/null +++ b/wp-includes/blocks/navigation-link/editor-rtl.css @@ -0,0 +1,77 @@ +.wp-block-navigation .block-list-appender{ + position:relative; +} +.wp-block-navigation .has-child{ + cursor:pointer; +} +.wp-block-navigation .has-child .wp-block-navigation__submenu-container{ + z-index:28; +} +.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{ + z-index:29; +} +.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{ + height:auto !important; + min-width:200px !important; + opacity:1 !important; + overflow:visible !important; + visibility:visible !important; + width:auto !important; +} +.wp-block-navigation-item .wp-block-navigation-item__content{ + cursor:text; +} +.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{ + min-width:20px; +} +.wp-block-navigation-item .block-list-appender{ + margin:16px 16px 16px auto; +} + +.wp-block-navigation-link__invalid-item{ + color:#000; +} +.wp-block-navigation-link__placeholder{ + background-image:none !important; + box-shadow:none !important; + position:relative; + text-decoration:none !important; +} +.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{ + --wp-underline-color:var(--wp-admin-theme-color); + background-image:linear-gradient(-45deg, transparent 20%, var(--wp-underline-color) 30%, var(--wp-underline-color) 36%, transparent 46%), linear-gradient(-135deg, transparent 54%, var(--wp-underline-color) 64%, var(--wp-underline-color) 70%, transparent 80%); + background-position:100% 100%; + background-repeat:repeat-x; + background-size:6px 3px; + padding-bottom:.1em; +} +.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{ + --wp-underline-color:#fff; +} +.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{ + cursor:pointer; +} +.link-control-transform{ + border-top:1px solid #ccc; + padding:0 16px 8px; +} + +.link-control-transform__subheading{ + color:#1e1e1e; + font-size:11px; + font-weight:500; + margin-bottom:1.5em; + text-transform:uppercase; +} + +.link-control-transform__items{ + display:flex; + justify-content:space-between; +} + +.link-control-transform__item{ + flex-basis:33%; + flex-direction:column; + gap:8px; + height:auto; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/editor-rtl.min.css b/wp-includes/blocks/navigation-link/editor-rtl.min.css new file mode 100644 index 0000000..78accfe --- /dev/null +++ b/wp-includes/blocks/navigation-link/editor-rtl.min.css @@ -0,0 +1 @@ +.wp-block-navigation .block-list-appender{position:relative}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;overflow:visible!important;visibility:visible!important;width:auto!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px 16px 16px auto}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__placeholder{background-image:none!important;box-shadow:none!important;position:relative;text-decoration:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(-45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(-135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:100% 100%;background-repeat:repeat-x;background-size:6px 3px;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{color:#1e1e1e;font-size:11px;font-weight:500;margin-bottom:1.5em;text-transform:uppercase}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/editor.css b/wp-includes/blocks/navigation-link/editor.css new file mode 100644 index 0000000..e1faecb --- /dev/null +++ b/wp-includes/blocks/navigation-link/editor.css @@ -0,0 +1,77 @@ +.wp-block-navigation .block-list-appender{ + position:relative; +} +.wp-block-navigation .has-child{ + cursor:pointer; +} +.wp-block-navigation .has-child .wp-block-navigation__submenu-container{ + z-index:28; +} +.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{ + z-index:29; +} +.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{ + height:auto !important; + min-width:200px !important; + opacity:1 !important; + overflow:visible !important; + visibility:visible !important; + width:auto !important; +} +.wp-block-navigation-item .wp-block-navigation-item__content{ + cursor:text; +} +.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{ + min-width:20px; +} +.wp-block-navigation-item .block-list-appender{ + margin:16px auto 16px 16px; +} + +.wp-block-navigation-link__invalid-item{ + color:#000; +} +.wp-block-navigation-link__placeholder{ + background-image:none !important; + box-shadow:none !important; + position:relative; + text-decoration:none !important; +} +.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{ + --wp-underline-color:var(--wp-admin-theme-color); + background-image:linear-gradient(45deg, transparent 20%, var(--wp-underline-color) 30%, var(--wp-underline-color) 36%, transparent 46%), linear-gradient(135deg, transparent 54%, var(--wp-underline-color) 64%, var(--wp-underline-color) 70%, transparent 80%); + background-position:0 100%; + background-repeat:repeat-x; + background-size:6px 3px; + padding-bottom:.1em; +} +.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{ + --wp-underline-color:#fff; +} +.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{ + cursor:pointer; +} +.link-control-transform{ + border-top:1px solid #ccc; + padding:0 16px 8px; +} + +.link-control-transform__subheading{ + color:#1e1e1e; + font-size:11px; + font-weight:500; + margin-bottom:1.5em; + text-transform:uppercase; +} + +.link-control-transform__items{ + display:flex; + justify-content:space-between; +} + +.link-control-transform__item{ + flex-basis:33%; + flex-direction:column; + gap:8px; + height:auto; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/editor.min.css b/wp-includes/blocks/navigation-link/editor.min.css new file mode 100644 index 0000000..92e6313 --- /dev/null +++ b/wp-includes/blocks/navigation-link/editor.min.css @@ -0,0 +1 @@ +.wp-block-navigation .block-list-appender{position:relative}.wp-block-navigation .has-child{cursor:pointer}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation .has-child:hover .wp-block-navigation__submenu-container{z-index:29}.wp-block-navigation .has-child.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation .has-child.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;overflow:visible!important;visibility:visible!important;width:auto!important}.wp-block-navigation-item .wp-block-navigation-item__content{cursor:text}.wp-block-navigation-item.is-editing,.wp-block-navigation-item.is-selected{min-width:20px}.wp-block-navigation-item .block-list-appender{margin:16px auto 16px 16px}.wp-block-navigation-link__invalid-item{color:#000}.wp-block-navigation-link__placeholder{background-image:none!important;box-shadow:none!important;position:relative;text-decoration:none!important}.wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:var(--wp-admin-theme-color);background-image:linear-gradient(45deg,transparent 20%,var(--wp-underline-color) 30%,var(--wp-underline-color) 36%,transparent 46%),linear-gradient(135deg,transparent 54%,var(--wp-underline-color) 64%,var(--wp-underline-color) 70%,transparent 80%);background-position:0 100%;background-repeat:repeat-x;background-size:6px 3px;padding-bottom:.1em}.is-dark-theme .wp-block-navigation-link__placeholder .wp-block-navigation-link__placeholder-text span{--wp-underline-color:#fff}.wp-block-navigation-link__placeholder.wp-block-navigation-item__content{cursor:pointer}.link-control-transform{border-top:1px solid #ccc;padding:0 16px 8px}.link-control-transform__subheading{color:#1e1e1e;font-size:11px;font-weight:500;margin-bottom:1.5em;text-transform:uppercase}.link-control-transform__items{display:flex;justify-content:space-between}.link-control-transform__item{flex-basis:33%;flex-direction:column;gap:8px;height:auto}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/style-rtl.css b/wp-includes/blocks/navigation-link/style-rtl.css new file mode 100644 index 0000000..c1a6879 --- /dev/null +++ b/wp-includes/blocks/navigation-link/style-rtl.css @@ -0,0 +1,6 @@ +.wp-block-navigation .wp-block-navigation-item__label{ + overflow-wrap:break-word; +} +.wp-block-navigation .wp-block-navigation-item__description{ + display:none; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/style-rtl.min.css b/wp-includes/blocks/navigation-link/style-rtl.min.css new file mode 100644 index 0000000..6515ef8 --- /dev/null +++ b/wp-includes/blocks/navigation-link/style-rtl.min.css @@ -0,0 +1 @@ +.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/style.css b/wp-includes/blocks/navigation-link/style.css new file mode 100644 index 0000000..c1a6879 --- /dev/null +++ b/wp-includes/blocks/navigation-link/style.css @@ -0,0 +1,6 @@ +.wp-block-navigation .wp-block-navigation-item__label{ + overflow-wrap:break-word; +} +.wp-block-navigation .wp-block-navigation-item__description{ + display:none; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-link/style.min.css b/wp-includes/blocks/navigation-link/style.min.css new file mode 100644 index 0000000..6515ef8 --- /dev/null +++ b/wp-includes/blocks/navigation-link/style.min.css @@ -0,0 +1 @@ +.wp-block-navigation .wp-block-navigation-item__label{overflow-wrap:break-word}.wp-block-navigation .wp-block-navigation-item__description{display:none}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-submenu.php b/wp-includes/blocks/navigation-submenu.php new file mode 100644 index 0000000..2ae23a9 --- /dev/null +++ b/wp-includes/blocks/navigation-submenu.php @@ -0,0 +1,252 @@ +<?php +/** + * Server-side rendering of the `core/navigation-submenu` block. + * + * @package WordPress + */ + +/** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the navigation markup in the front-end. + * + * @param array $context Navigation block context. + * @return array Font size CSS classes and inline styles. + */ +function block_core_navigation_submenu_build_css_font_sizes( $context ) { + // CSS classes. + $font_sizes = array( + 'css_classes' => array(), + 'inline_styles' => '', + ); + + $has_named_font_size = array_key_exists( 'fontSize', $context ); + $has_custom_font_size = isset( $context['style']['typography']['fontSize'] ); + + if ( $has_named_font_size ) { + // Add the font size class. + $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] ); + } elseif ( $has_custom_font_size ) { + // Add the custom font size inline style. + $font_sizes['inline_styles'] = sprintf( + 'font-size: %s;', + wp_get_typography_font_size_value( + array( + 'size' => $context['style']['typography']['fontSize'], + ) + ) + ); + } + + return $font_sizes; +} + +/** + * Returns the top-level submenu SVG chevron icon. + * + * @return string + */ +function block_core_navigation_submenu_render_submenu_icon() { + return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>'; +} + +/** + * Renders the `core/navigation-submenu` block. + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the post content with the legacy widget added. + */ +function render_block_core_navigation_submenu( $attributes, $content, $block ) { + $navigation_link_has_id = isset( $attributes['id'] ) && is_numeric( $attributes['id'] ); + $is_post_type = isset( $attributes['kind'] ) && 'post-type' === $attributes['kind']; + $is_post_type = $is_post_type || isset( $attributes['type'] ) && ( 'post' === $attributes['type'] || 'page' === $attributes['type'] ); + + // Don't render the block's subtree if it is a draft. + if ( $is_post_type && $navigation_link_has_id && 'publish' !== get_post_status( $attributes['id'] ) ) { + return ''; + } + + // Don't render the block's subtree if it has no label. + if ( empty( $attributes['label'] ) ) { + return ''; + } + + $font_sizes = block_core_navigation_submenu_build_css_font_sizes( $block->context ); + $style_attribute = $font_sizes['inline_styles']; + + $css_classes = trim( implode( ' ', $font_sizes['css_classes'] ) ); + $has_submenu = count( $block->inner_blocks ) > 0; + $kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] ); + $is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind ); + + $show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon']; + $open_on_click = isset( $block->context['openSubmenusOnClick'] ) && $block->context['openSubmenusOnClick']; + $open_on_hover_and_click = isset( $block->context['openSubmenusOnClick'] ) && ! $block->context['openSubmenusOnClick'] && + $show_submenu_indicators; + + $wrapper_attributes = get_block_wrapper_attributes( + array( + 'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) . + ( $open_on_click ? ' open-on-click' : '' ) . ( $open_on_hover_and_click ? ' open-on-hover-click' : '' ) . + ( $is_active ? ' current-menu-item' : '' ), + 'style' => $style_attribute, + ) + ); + + $label = ''; + + if ( isset( $attributes['label'] ) ) { + $label .= wp_kses_post( $attributes['label'] ); + } + + $aria_label = sprintf( + /* translators: Accessibility text. %s: Parent page title. */ + __( '%s submenu' ), + wp_strip_all_tags( $label ) + ); + + $html = '<li ' . $wrapper_attributes . '>'; + + // If Submenus open on hover, we render an anchor tag with attributes. + // If submenu icons are set to show, we also render a submenu button, so the submenu can be opened on click. + if ( ! $open_on_click ) { + $item_url = isset( $attributes['url'] ) ? $attributes['url'] : ''; + // Start appending HTML attributes to anchor tag. + $html .= '<a class="wp-block-navigation-item__content"'; + + // The href attribute on a and area elements is not required; + // when those elements do not have href attributes they do not create hyperlinks. + // But also The href attribute must have a value that is a valid URL potentially + // surrounded by spaces. + // see: https://html.spec.whatwg.org/multipage/links.html#links-created-by-a-and-area-elements. + if ( ! empty( $item_url ) ) { + $html .= ' href="' . esc_url( $item_url ) . '"'; + } + + if ( $is_active ) { + $html .= ' aria-current="page"'; + } + + if ( isset( $attributes['opensInNewTab'] ) && true === $attributes['opensInNewTab'] ) { + $html .= ' target="_blank" '; + } + + if ( isset( $attributes['rel'] ) ) { + $html .= ' rel="' . esc_attr( $attributes['rel'] ) . '"'; + } elseif ( isset( $attributes['nofollow'] ) && $attributes['nofollow'] ) { + $html .= ' rel="nofollow"'; + } + + if ( isset( $attributes['title'] ) ) { + $html .= ' title="' . esc_attr( $attributes['title'] ) . '"'; + } + + $html .= '>'; + // End appending HTML attributes to anchor tag. + + $html .= $label; + + $html .= '</a>'; + // End anchor tag content. + + if ( $show_submenu_indicators ) { + // The submenu icon is rendered in a button here + // so that there's a clickable element to open the submenu. + $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>'; + } + } else { + // If menus open on click, we render the parent as a button. + $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">'; + + // Wrap title with span to isolate it from submenu icon. + $html .= '<span class="wp-block-navigation-item__label">'; + + $html .= $label; + + $html .= '</span>'; + + $html .= '</button>'; + + $html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_submenu_render_submenu_icon() . '</span>'; + + } + + if ( $has_submenu ) { + // Copy some attributes from the parent block to this one. + // Ideally this would happen in the client when the block is created. + if ( array_key_exists( 'overlayTextColor', $block->context ) ) { + $attributes['textColor'] = $block->context['overlayTextColor']; + } + if ( array_key_exists( 'overlayBackgroundColor', $block->context ) ) { + $attributes['backgroundColor'] = $block->context['overlayBackgroundColor']; + } + if ( array_key_exists( 'customOverlayTextColor', $block->context ) ) { + $attributes['style']['color']['text'] = $block->context['customOverlayTextColor']; + } + if ( array_key_exists( 'customOverlayBackgroundColor', $block->context ) ) { + $attributes['style']['color']['background'] = $block->context['customOverlayBackgroundColor']; + } + + // This allows us to be able to get a response from wp_apply_colors_support. + $block->block_type->supports['color'] = true; + $colors_supports = wp_apply_colors_support( $block->block_type, $attributes ); + $css_classes = 'wp-block-navigation__submenu-container'; + if ( array_key_exists( 'class', $colors_supports ) ) { + $css_classes .= ' ' . $colors_supports['class']; + } + + $style_attribute = ''; + if ( array_key_exists( 'style', $colors_supports ) ) { + $style_attribute = $colors_supports['style']; + } + + $inner_blocks_html = ''; + foreach ( $block->inner_blocks as $inner_block ) { + $inner_blocks_html .= $inner_block->render(); + } + + if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) { + $tag_processor = new WP_HTML_Tag_Processor( $html ); + while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item__content' ) ) ) { + $tag_processor->add_class( 'current-menu-ancestor' ); + } + $html = $tag_processor->get_updated_html(); + } + + $wrapper_attributes = get_block_wrapper_attributes( + array( + 'class' => $css_classes, + 'style' => $style_attribute, + ) + ); + + $html .= sprintf( + '<ul %s>%s</ul>', + $wrapper_attributes, + $inner_blocks_html + ); + + } + + $html .= '</li>'; + + return $html; +} + +/** + * Register the navigation submenu block. + * + * @uses render_block_core_navigation_submenu() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ +function register_block_core_navigation_submenu() { + register_block_type_from_metadata( + __DIR__ . '/navigation-submenu', + array( + 'render_callback' => 'render_block_core_navigation_submenu', + ) + ); +} +add_action( 'init', 'register_block_core_navigation_submenu' ); diff --git a/wp-includes/blocks/navigation-submenu/block.json b/wp-includes/blocks/navigation-submenu/block.json new file mode 100644 index 0000000..9136410 --- /dev/null +++ b/wp-includes/blocks/navigation-submenu/block.json @@ -0,0 +1,65 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "core/navigation-submenu", + "title": "Submenu", + "category": "design", + "parent": [ "core/navigation" ], + "description": "Add a submenu to your navigation.", + "textdomain": "default", + "attributes": { + "label": { + "type": "string" + }, + "type": { + "type": "string" + }, + "description": { + "type": "string" + }, + "rel": { + "type": "string" + }, + "id": { + "type": "number" + }, + "opensInNewTab": { + "type": "boolean", + "default": false + }, + "url": { + "type": "string" + }, + "title": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "isTopLevelItem": { + "type": "boolean" + } + }, + "usesContext": [ + "textColor", + "customTextColor", + "backgroundColor", + "customBackgroundColor", + "overlayTextColor", + "customOverlayTextColor", + "overlayBackgroundColor", + "customOverlayBackgroundColor", + "fontSize", + "customFontSize", + "showSubmenuIcon", + "maxNestingLevel", + "openSubmenusOnClick", + "style" + ], + "supports": { + "reusable": false, + "html": false + }, + "editorStyle": "wp-block-navigation-submenu-editor", + "style": "wp-block-navigation-submenu" +} diff --git a/wp-includes/blocks/navigation-submenu/editor-rtl.css b/wp-includes/blocks/navigation-submenu/editor-rtl.css new file mode 100644 index 0000000..e13b9ba --- /dev/null +++ b/wp-includes/blocks/navigation-submenu/editor-rtl.css @@ -0,0 +1,31 @@ +.wp-block-navigation-submenu{ + display:block; +} +.wp-block-navigation-submenu .wp-block-navigation__submenu-container{ + z-index:28; +} +.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{ + height:auto !important; + min-width:200px !important; + opacity:1 !important; + position:absolute; + right:-1px; + top:100%; + visibility:visible !important; + width:auto !important; +} +@media (min-width:782px){ + .wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + right:100%; + top:-1px; + } + .wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{ + background:transparent; + content:""; + display:block; + height:100%; + left:100%; + position:absolute; + width:.5em; + } +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-submenu/editor-rtl.min.css b/wp-includes/blocks/navigation-submenu/editor-rtl.min.css new file mode 100644 index 0000000..85f8d79 --- /dev/null +++ b/wp-includes/blocks/navigation-submenu/editor-rtl.min.css @@ -0,0 +1 @@ +.wp-block-navigation-submenu{display:block}.wp-block-navigation-submenu .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{height:auto!important;min-width:200px!important;opacity:1!important;position:absolute;right:-1px;top:100%;visibility:visible!important;width:auto!important}@media (min-width:782px){.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:-1px}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{background:transparent;content:"";display:block;height:100%;left:100%;position:absolute;width:.5em}}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-submenu/editor.css b/wp-includes/blocks/navigation-submenu/editor.css new file mode 100644 index 0000000..866c2d3 --- /dev/null +++ b/wp-includes/blocks/navigation-submenu/editor.css @@ -0,0 +1,31 @@ +.wp-block-navigation-submenu{ + display:block; +} +.wp-block-navigation-submenu .wp-block-navigation__submenu-container{ + z-index:28; +} +.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{ + height:auto !important; + left:-1px; + min-width:200px !important; + opacity:1 !important; + position:absolute; + top:100%; + visibility:visible !important; + width:auto !important; +} +@media (min-width:782px){ + .wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:100%; + top:-1px; + } + .wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{ + background:transparent; + content:""; + display:block; + height:100%; + position:absolute; + right:100%; + width:.5em; + } +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation-submenu/editor.min.css b/wp-includes/blocks/navigation-submenu/editor.min.css new file mode 100644 index 0000000..e55a4d8 --- /dev/null +++ b/wp-includes/blocks/navigation-submenu/editor.min.css @@ -0,0 +1 @@ +.wp-block-navigation-submenu{display:block}.wp-block-navigation-submenu .wp-block-navigation__submenu-container{z-index:28}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container{height:auto!important;left:-1px;min-width:200px!important;opacity:1!important;position:absolute;top:100%;visibility:visible!important;width:auto!important}@media (min-width:782px){.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:-1px}.wp-block-navigation-submenu.has-child-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before,.wp-block-navigation-submenu.is-selected>.wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{background:transparent;content:"";display:block;height:100%;position:absolute;right:100%;width:.5em}}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation.php b/wp-includes/blocks/navigation.php new file mode 100644 index 0000000..4d9fe4a --- /dev/null +++ b/wp-includes/blocks/navigation.php @@ -0,0 +1,1068 @@ +<?php +/** + * Server-side rendering of the `core/navigation` block. + * + * @package WordPress + */ + +// These functions are used for the __unstableLocation feature and only active +// when the gutenberg plugin is active. +if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { + /** + * Returns the menu items for a WordPress menu location. + * + * @param string $location The menu location. + * @return array Menu items for the location. + */ + function block_core_navigation_get_menu_items_at_location( $location ) { + if ( empty( $location ) ) { + return; + } + + // Build menu data. The following approximates the code in + // `wp_nav_menu()` and `gutenberg_output_block_nav_menu`. + + // Find the location in the list of locations, returning early if the + // location can't be found. + $locations = get_nav_menu_locations(); + if ( ! isset( $locations[ $location ] ) ) { + return; + } + + // Get the menu from the location, returning early if there is no + // menu or there was an error. + $menu = wp_get_nav_menu_object( $locations[ $location ] ); + if ( ! $menu || is_wp_error( $menu ) ) { + return; + } + + $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); + _wp_menu_item_classes_by_context( $menu_items ); + + return $menu_items; + } + + + /** + * Sorts a standard array of menu items into a nested structure keyed by the + * id of the parent menu. + * + * @param array $menu_items Menu items to sort. + * @return array An array keyed by the id of the parent menu where each element + * is an array of menu items that belong to that parent. + */ + function block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) { + $sorted_menu_items = array(); + foreach ( (array) $menu_items as $menu_item ) { + $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; + } + unset( $menu_items, $menu_item ); + + $menu_items_by_parent_id = array(); + foreach ( $sorted_menu_items as $menu_item ) { + $menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item; + } + + return $menu_items_by_parent_id; + } +} + + +/** + * Add Interactivity API directives to the navigation-submenu and page-list + * blocks markup using the Tag Processor. + * + * @param string $w Markup of the navigation block. + * @param array $block_attributes Block attributes. + * + * @return string Submenu markup with the directives injected. + */ +function block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) { + while ( $w->next_tag( + array( + 'tag_name' => 'LI', + 'class_name' => 'has-child', + ) + ) ) { + // Add directives to the parent `<li>`. + $w->set_attribute( 'data-wp-interactive', true ); + $w->set_attribute( 'data-wp-context', '{ "core": { "navigation": { "submenuOpenedBy": {}, "type": "submenu" } } }' ); + $w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initMenu' ); + $w->set_attribute( 'data-wp-on--focusout', 'actions.core.navigation.handleMenuFocusout' ); + $w->set_attribute( 'data-wp-on--keydown', 'actions.core.navigation.handleMenuKeydown' ); + + // This is a fix for Safari. Without it, Safari doesn't change the active + // element when the user clicks on a button. It can be removed once we add + // an overlay to capture the clicks, instead of relying on the focusout + // event. + $w->set_attribute( 'tabindex', '-1' ); + + if ( ! isset( $block_attributes['openSubmenusOnClick'] ) || false === $block_attributes['openSubmenusOnClick'] ) { + $w->set_attribute( 'data-wp-on--mouseenter', 'actions.core.navigation.openMenuOnHover' ); + $w->set_attribute( 'data-wp-on--mouseleave', 'actions.core.navigation.closeMenuOnHover' ); + } + + // Add directives to the toggle submenu button. + if ( $w->next_tag( + array( + 'tag_name' => 'BUTTON', + 'class_name' => 'wp-block-navigation-submenu__toggle', + ) + ) ) { + $w->set_attribute( 'data-wp-on--click', 'actions.core.navigation.toggleMenuOnClick' ); + $w->set_attribute( 'data-wp-bind--aria-expanded', 'selectors.core.navigation.isMenuOpen' ); + // The `aria-expanded` attribute for SSR is already added in the submenu block. + } + // Add directives to the submenu. + if ( $w->next_tag( + array( + 'tag_name' => 'UL', + 'class_name' => 'wp-block-navigation__submenu-container', + ) + ) ) { + $w->set_attribute( 'data-wp-on--focus', 'actions.core.navigation.openMenuOnFocus' ); + } + + // Iterate through subitems if exist. + block_core_navigation_add_directives_to_submenu( $w, $block_attributes ); + } + return $w->get_updated_html(); +} + +/** + * Build an array with CSS classes and inline styles defining the colors + * which will be applied to the navigation markup in the front-end. + * + * @param array $attributes Navigation block attributes. + * + * @return array Colors CSS classes and inline styles. + */ +function block_core_navigation_build_css_colors( $attributes ) { + $colors = array( + 'css_classes' => array(), + 'inline_styles' => '', + 'overlay_css_classes' => array(), + 'overlay_inline_styles' => '', + ); + + // Text color. + $has_named_text_color = array_key_exists( 'textColor', $attributes ); + $has_custom_text_color = array_key_exists( 'customTextColor', $attributes ); + + // If has text color. + if ( $has_custom_text_color || $has_named_text_color ) { + // Add has-text-color class. + $colors['css_classes'][] = 'has-text-color'; + } + + if ( $has_named_text_color ) { + // Add the color class. + $colors['css_classes'][] = sprintf( 'has-%s-color', $attributes['textColor'] ); + } elseif ( $has_custom_text_color ) { + // Add the custom color inline style. + $colors['inline_styles'] .= sprintf( 'color: %s;', $attributes['customTextColor'] ); + } + + // Background color. + $has_named_background_color = array_key_exists( 'backgroundColor', $attributes ); + $has_custom_background_color = array_key_exists( 'customBackgroundColor', $attributes ); + + // If has background color. + if ( $has_custom_background_color || $has_named_background_color ) { + // Add has-background class. + $colors['css_classes'][] = 'has-background'; + } + + if ( $has_named_background_color ) { + // Add the background-color class. + $colors['css_classes'][] = sprintf( 'has-%s-background-color', $attributes['backgroundColor'] ); + } elseif ( $has_custom_background_color ) { + // Add the custom background-color inline style. + $colors['inline_styles'] .= sprintf( 'background-color: %s;', $attributes['customBackgroundColor'] ); + } + + // Overlay text color. + $has_named_overlay_text_color = array_key_exists( 'overlayTextColor', $attributes ); + $has_custom_overlay_text_color = array_key_exists( 'customOverlayTextColor', $attributes ); + + // If has overlay text color. + if ( $has_custom_overlay_text_color || $has_named_overlay_text_color ) { + // Add has-text-color class. + $colors['overlay_css_classes'][] = 'has-text-color'; + } + + if ( $has_named_overlay_text_color ) { + // Add the overlay color class. + $colors['overlay_css_classes'][] = sprintf( 'has-%s-color', $attributes['overlayTextColor'] ); + } elseif ( $has_custom_overlay_text_color ) { + // Add the custom overlay color inline style. + $colors['overlay_inline_styles'] .= sprintf( 'color: %s;', $attributes['customOverlayTextColor'] ); + } + + // Overlay background color. + $has_named_overlay_background_color = array_key_exists( 'overlayBackgroundColor', $attributes ); + $has_custom_overlay_background_color = array_key_exists( 'customOverlayBackgroundColor', $attributes ); + + // If has overlay background color. + if ( $has_custom_overlay_background_color || $has_named_overlay_background_color ) { + // Add has-background class. + $colors['overlay_css_classes'][] = 'has-background'; + } + + if ( $has_named_overlay_background_color ) { + // Add the overlay background-color class. + $colors['overlay_css_classes'][] = sprintf( 'has-%s-background-color', $attributes['overlayBackgroundColor'] ); + } elseif ( $has_custom_overlay_background_color ) { + // Add the custom overlay background-color inline style. + $colors['overlay_inline_styles'] .= sprintf( 'background-color: %s;', $attributes['customOverlayBackgroundColor'] ); + } + + return $colors; +} + +/** + * Build an array with CSS classes and inline styles defining the font sizes + * which will be applied to the navigation markup in the front-end. + * + * @param array $attributes Navigation block attributes. + * + * @return array Font size CSS classes and inline styles. + */ +function block_core_navigation_build_css_font_sizes( $attributes ) { + // CSS classes. + $font_sizes = array( + 'css_classes' => array(), + 'inline_styles' => '', + ); + + $has_named_font_size = array_key_exists( 'fontSize', $attributes ); + $has_custom_font_size = array_key_exists( 'customFontSize', $attributes ); + + if ( $has_named_font_size ) { + // Add the font size class. + $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $attributes['fontSize'] ); + } elseif ( $has_custom_font_size ) { + // Add the custom font size inline style. + $font_sizes['inline_styles'] = sprintf( 'font-size: %spx;', $attributes['customFontSize'] ); + } + + return $font_sizes; +} + +/** + * Returns the top-level submenu SVG chevron icon. + * + * @return string + */ +function block_core_navigation_render_submenu_icon() { + return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>'; +} + +/** + * Filter out empty "null" blocks from the block list. + * 'parse_blocks' includes a null block with '\n\n' as the content when + * it encounters whitespace. This is not a bug but rather how the parser + * is designed. + * + * @param array $parsed_blocks the parsed blocks to be normalized. + * @return array the normalized parsed blocks. + */ +function block_core_navigation_filter_out_empty_blocks( $parsed_blocks ) { + $filtered = array_filter( + $parsed_blocks, + static function ( $block ) { + return isset( $block['blockName'] ); + } + ); + + // Reset keys. + return array_values( $filtered ); +} + +/** + * Returns true if the navigation block contains a nested navigation block. + * + * @param WP_Block_List $inner_blocks Inner block instance to be normalized. + * @return bool true if the navigation block contains a nested navigation block. + */ +function block_core_navigation_block_contains_core_navigation( $inner_blocks ) { + foreach ( $inner_blocks as $block ) { + if ( 'core/navigation' === $block->name ) { + return true; + } + if ( $block->inner_blocks && block_core_navigation_block_contains_core_navigation( $block->inner_blocks ) ) { + return true; + } + } + + return false; +} + +/** + * Retrieves the appropriate fallback to be used on the front of the + * site when there is no menu assigned to the Nav block. + * + * This aims to mirror how the fallback mechanic for wp_nav_menu works. + * See https://developer.wordpress.org/reference/functions/wp_nav_menu/#more-information. + * + * @return array the array of blocks to be used as a fallback. + */ +function block_core_navigation_get_fallback_blocks() { + $page_list_fallback = array( + array( + 'blockName' => 'core/page-list', + ), + ); + + $registry = WP_Block_Type_Registry::get_instance(); + + // If `core/page-list` is not registered then return empty blocks. + $fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array(); + + if ( class_exists( 'WP_Navigation_Fallback' ) ) { + $navigation_post = WP_Navigation_Fallback::get_fallback(); + } else { + $navigation_post = Gutenberg_Navigation_Fallback::get_fallback(); + } + + // Use the first non-empty Navigation as fallback if available. + if ( $navigation_post ) { + $parsed_blocks = parse_blocks( $navigation_post->post_content ); + $maybe_fallback = block_core_navigation_filter_out_empty_blocks( $parsed_blocks ); + + // Normalizing blocks may result in an empty array of blocks if they were all `null` blocks. + // In this case default to the (Page List) fallback. + $fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks; + } + + /** + * Filters the fallback experience for the Navigation block. + * + * Returning a falsey value will opt out of the fallback and cause the block not to render. + * To customise the blocks provided return an array of blocks - these should be valid + * children of the `core/navigation` block. + * + * @since 5.9.0 + * + * @param array[] default fallback blocks provided by the default block mechanic. + */ + return apply_filters( 'block_core_navigation_render_fallback', $fallback_blocks ); +} + +/** + * Iterate through all inner blocks recursively and get navigation link block's post IDs. + * + * @param WP_Block_List $inner_blocks Block list class instance. + * + * @return array Array of post IDs. + */ +function block_core_navigation_get_post_ids( $inner_blocks ) { + $post_ids = array_map( 'block_core_navigation_from_block_get_post_ids', iterator_to_array( $inner_blocks ) ); + return array_unique( array_merge( ...$post_ids ) ); +} + +/** + * Get post IDs from a navigation link block instance. + * + * @param WP_Block $block Instance of a block. + * + * @return array Array of post IDs. + */ +function block_core_navigation_from_block_get_post_ids( $block ) { + $post_ids = array(); + + if ( $block->inner_blocks ) { + $post_ids = block_core_navigation_get_post_ids( $block->inner_blocks ); + } + + if ( 'core/navigation-link' === $block->name || 'core/navigation-submenu' === $block->name ) { + if ( $block->attributes && isset( $block->attributes['kind'] ) && 'post-type' === $block->attributes['kind'] && isset( $block->attributes['id'] ) ) { + $post_ids[] = $block->attributes['id']; + } + } + + return $post_ids; +} + +/** + * Renders the `core/navigation` block on server. + * + * @param array $attributes The block attributes. + * @param string $content The saved content. + * @param WP_Block $block The parsed block. + * + * @return string Returns the post content with the legacy widget added. + */ +function render_block_core_navigation( $attributes, $content, $block ) { + static $seen_menu_names = array(); + + // Flag used to indicate whether the rendered output is considered to be + // a fallback (i.e. the block has no menu associated with it). + $is_fallback = false; + + $nav_menu_name = $attributes['ariaLabel'] ?? ''; + + /** + * Deprecated: + * The rgbTextColor and rgbBackgroundColor attributes + * have been deprecated in favor of + * customTextColor and customBackgroundColor ones. + * Move the values from old attrs to the new ones. + */ + if ( isset( $attributes['rgbTextColor'] ) && empty( $attributes['textColor'] ) ) { + $attributes['customTextColor'] = $attributes['rgbTextColor']; + } + + if ( isset( $attributes['rgbBackgroundColor'] ) && empty( $attributes['backgroundColor'] ) ) { + $attributes['customBackgroundColor'] = $attributes['rgbBackgroundColor']; + } + + unset( $attributes['rgbTextColor'], $attributes['rgbBackgroundColor'] ); + + /** + * This is for backwards compatibility after `isResponsive` attribute has been removed. + */ + $has_old_responsive_attribute = ! empty( $attributes['isResponsive'] ) && $attributes['isResponsive']; + $is_responsive_menu = isset( $attributes['overlayMenu'] ) && 'never' !== $attributes['overlayMenu'] || $has_old_responsive_attribute; + + $inner_blocks = $block->inner_blocks; + + // Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render. + if ( array_key_exists( 'navigationMenuId', $attributes ) ) { + $attributes['ref'] = $attributes['navigationMenuId']; + } + + // If: + // - the gutenberg plugin is active + // - `__unstableLocation` is defined + // - we have menu items at the defined location + // - we don't have a relationship to a `wp_navigation` Post (via `ref`). + // ...then create inner blocks from the classic menu assigned to that location. + if ( + defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && + array_key_exists( '__unstableLocation', $attributes ) && + ! array_key_exists( 'ref', $attributes ) && + ! empty( block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ) ) + ) { + $menu_items = block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ); + if ( empty( $menu_items ) ) { + return ''; + } + + $menu_items_by_parent_id = block_core_navigation_sort_menu_items_by_parent_id( $menu_items ); + $parsed_blocks = block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[0], $menu_items_by_parent_id ); + $inner_blocks = new WP_Block_List( $parsed_blocks, $attributes ); + } + + // Load inner blocks from the navigation post. + if ( array_key_exists( 'ref', $attributes ) ) { + $navigation_post = get_post( $attributes['ref'] ); + if ( ! isset( $navigation_post ) ) { + return ''; + } + + // Only published posts are valid. If this is changed then a corresponding change + // must also be implemented in `use-navigation-menu.js`. + if ( 'publish' === $navigation_post->post_status ) { + $nav_menu_name = $navigation_post->post_title; + + if ( isset( $seen_menu_names[ $nav_menu_name ] ) ) { + ++$seen_menu_names[ $nav_menu_name ]; + } else { + $seen_menu_names[ $nav_menu_name ] = 1; + } + + $parsed_blocks = parse_blocks( $navigation_post->post_content ); + + // 'parse_blocks' includes a null block with '\n\n' as the content when + // it encounters whitespace. This code strips it. + $compacted_blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks ); + + // TODO - this uses the full navigation block attributes for the + // context which could be refined. + $inner_blocks = new WP_Block_List( $compacted_blocks, $attributes ); + } + } + + // If there are no inner blocks then fallback to rendering an appropriate fallback. + if ( empty( $inner_blocks ) ) { + $is_fallback = true; // indicate we are rendering the fallback. + + $fallback_blocks = block_core_navigation_get_fallback_blocks(); + + // Fallback my have been filtered so do basic test for validity. + if ( empty( $fallback_blocks ) || ! is_array( $fallback_blocks ) ) { + return ''; + } + + $inner_blocks = new WP_Block_List( $fallback_blocks, $attributes ); + } + + if ( block_core_navigation_block_contains_core_navigation( $inner_blocks ) ) { + return ''; + } + + /** + * Filter navigation block $inner_blocks. + * Allows modification of a navigation block menu items. + * + * @since 6.1.0 + * + * @param \WP_Block_List $inner_blocks + */ + $inner_blocks = apply_filters( 'block_core_navigation_render_inner_blocks', $inner_blocks ); + + $layout_justification = array( + 'left' => 'items-justified-left', + 'right' => 'items-justified-right', + 'center' => 'items-justified-center', + 'space-between' => 'items-justified-space-between', + ); + + // Restore legacy classnames for submenu positioning. + $layout_class = ''; + if ( + isset( $attributes['layout']['justifyContent'] ) && + isset( $layout_justification[ $attributes['layout']['justifyContent'] ] ) + ) { + $layout_class .= $layout_justification[ $attributes['layout']['justifyContent'] ]; + } + if ( isset( $attributes['layout']['orientation'] ) && 'vertical' === $attributes['layout']['orientation'] ) { + $layout_class .= ' is-vertical'; + } + + if ( isset( $attributes['layout']['flexWrap'] ) && 'nowrap' === $attributes['layout']['flexWrap'] ) { + $layout_class .= ' no-wrap'; + } + + // Manually add block support text decoration as CSS class. + $text_decoration = $attributes['style']['typography']['textDecoration'] ?? null; + $text_decoration_class = sprintf( 'has-text-decoration-%s', $text_decoration ); + + $colors = block_core_navigation_build_css_colors( $attributes ); + $font_sizes = block_core_navigation_build_css_font_sizes( $attributes ); + $classes = array_merge( + $colors['css_classes'], + $font_sizes['css_classes'], + $is_responsive_menu ? array( 'is-responsive' ) : array(), + $layout_class ? array( $layout_class ) : array(), + $is_fallback ? array( 'is-fallback' ) : array(), + $text_decoration ? array( $text_decoration_class ) : array() + ); + + $post_ids = block_core_navigation_get_post_ids( $inner_blocks ); + if ( $post_ids ) { + _prime_post_caches( $post_ids, false, false ); + } + + $list_item_nav_blocks = array( + 'core/navigation-link', + 'core/home-link', + 'core/site-title', + 'core/site-logo', + 'core/navigation-submenu', + ); + + $needs_list_item_wrapper = array( + 'core/site-title', + 'core/site-logo', + ); + + $block_styles = isset( $attributes['styles'] ) ? $attributes['styles'] : ''; + $style = $block_styles . $colors['inline_styles'] . $font_sizes['inline_styles']; + $class = implode( ' ', $classes ); + + // If the menu name has been used previously then append an ID + // to the name to ensure uniqueness across a given post. + if ( isset( $seen_menu_names[ $nav_menu_name ] ) && $seen_menu_names[ $nav_menu_name ] > 1 ) { + $count = $seen_menu_names[ $nav_menu_name ]; + $nav_menu_name = $nav_menu_name . ' ' . ( $count ); + } + + $wrapper_attributes = get_block_wrapper_attributes( + array( + 'class' => $class, + 'style' => $style, + 'aria-label' => $nav_menu_name, + ) + ); + + $container_attributes = get_block_wrapper_attributes( + array( + 'class' => 'wp-block-navigation__container ' . $class, + 'style' => $style, + ) + ); + + $inner_blocks_html = ''; + $is_list_open = false; + $has_submenus = false; + foreach ( $inner_blocks as $inner_block ) { + $is_list_item = in_array( $inner_block->name, $list_item_nav_blocks, true ); + + if ( $is_list_item && ! $is_list_open ) { + $is_list_open = true; + $inner_blocks_html .= sprintf( + '<ul %1$s>', + $container_attributes + ); + } + + if ( ! $is_list_item && $is_list_open ) { + $is_list_open = false; + $inner_blocks_html .= '</ul>'; + } + + $inner_block_content = $inner_block->render(); + $p = new WP_HTML_Tag_Processor( $inner_block_content ); + if ( $p->next_tag( + array( + 'name' => 'LI', + 'class_name' => 'has-child', + ) + ) ) { + $has_submenus = true; + } + if ( ! empty( $inner_block_content ) ) { + if ( in_array( $inner_block->name, $needs_list_item_wrapper, true ) ) { + $inner_blocks_html .= '<li class="wp-block-navigation-item">' . $inner_block_content . '</li>'; + } else { + $inner_blocks_html .= $inner_block_content; + } + } + } + + if ( $is_list_open ) { + $inner_blocks_html .= '</ul>'; + } + + $should_load_view_script = ( $has_submenus && ( $attributes['openSubmenusOnClick'] || $attributes['showSubmenuIcon'] ) ) || $is_responsive_menu; + $view_js_file = 'wp-block-navigation-view'; + + // If the script already exists, there is no point in removing it from viewScript. + if ( ! wp_script_is( $view_js_file ) ) { + $script_handles = $block->block_type->view_script_handles; + + // If the script is not needed, and it is still in the `view_script_handles`, remove it. + if ( ! $should_load_view_script && in_array( $view_js_file, $script_handles, true ) ) { + $block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) ); + } + // If the script is needed, but it was previously removed, add it again. + if ( $should_load_view_script && ! in_array( $view_js_file, $script_handles, true ) ) { + $block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) ); + } + } + + // Add directives to the submenu if needed. + if ( $has_submenus && $should_load_view_script ) { + $w = new WP_HTML_Tag_Processor( $inner_blocks_html ); + $inner_blocks_html = block_core_navigation_add_directives_to_submenu( $w, $attributes ); + } + + $modal_unique_id = wp_unique_id( 'modal-' ); + + // Determine whether or not navigation elements should be wrapped in the markup required to make it responsive, + // return early if they don't. + if ( ! $is_responsive_menu ) { + return sprintf( + '<nav %1$s>%2$s</nav>', + $wrapper_attributes, + $inner_blocks_html + ); + } + + $is_hidden_by_default = isset( $attributes['overlayMenu'] ) && 'always' === $attributes['overlayMenu']; + + $responsive_container_classes = array( + 'wp-block-navigation__responsive-container', + $is_hidden_by_default ? 'hidden-by-default' : '', + implode( ' ', $colors['overlay_css_classes'] ), + ); + $open_button_classes = array( + 'wp-block-navigation__responsive-container-open', + $is_hidden_by_default ? 'always-shown' : '', + ); + + $should_display_icon_label = isset( $attributes['hasIcon'] ) && true === $attributes['hasIcon']; + $toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="7.5" width="16" height="1.5" /><rect x="4" y="15" width="16" height="1.5" /></svg>'; + if ( isset( $attributes['icon'] ) ) { + if ( 'menu' === $attributes['icon'] ) { + $toggle_button_icon = '<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z" /></svg>'; + } + } + $toggle_button_content = $should_display_icon_label ? $toggle_button_icon : __( 'Menu' ); + $toggle_close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path></svg>'; + $toggle_close_button_content = $should_display_icon_label ? $toggle_close_button_icon : __( 'Close' ); + $toggle_aria_label_open = $should_display_icon_label ? 'aria-label="' . __( 'Open menu' ) . '"' : ''; // Open button label. + $toggle_aria_label_close = $should_display_icon_label ? 'aria-label="' . __( 'Close menu' ) . '"' : ''; // Close button label. + + // Add Interactivity API directives to the markup if needed. + $nav_element_directives = ''; + $open_button_directives = ''; + $responsive_container_directives = ''; + $responsive_dialog_directives = ''; + $close_button_directives = ''; + if ( $should_load_view_script ) { + $nav_element_context = wp_json_encode( + array( + 'core' => array( + 'navigation' => array( + 'overlayOpenedBy' => array(), + 'type' => 'overlay', + 'roleAttribute' => '', + 'ariaLabel' => __( 'Menu' ), + ), + ), + ), + JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP + ); + $nav_element_directives = ' + data-wp-interactive + data-wp-context=\'' . $nav_element_context . '\' + '; + $open_button_directives = ' + data-wp-on--click="actions.core.navigation.openMenuOnClick" + data-wp-on--keydown="actions.core.navigation.handleMenuKeydown" + '; + $responsive_container_directives = ' + data-wp-class--has-modal-open="selectors.core.navigation.isMenuOpen" + data-wp-class--is-menu-open="selectors.core.navigation.isMenuOpen" + data-wp-effect="effects.core.navigation.initMenu" + data-wp-on--keydown="actions.core.navigation.handleMenuKeydown" + data-wp-on--focusout="actions.core.navigation.handleMenuFocusout" + tabindex="-1" + '; + $responsive_dialog_directives = ' + data-wp-bind--aria-modal="selectors.core.navigation.ariaModal" + data-wp-bind--aria-label="selectors.core.navigation.ariaLabel" + data-wp-bind--role="selectors.core.navigation.roleAttribute" + data-wp-effect="effects.core.navigation.focusFirstElement" + '; + $close_button_directives = ' + data-wp-on--click="actions.core.navigation.closeMenuOnClick" + '; + } + + $responsive_container_markup = sprintf( + '<button aria-haspopup="true" %3$s class="%6$s" %10$s>%8$s</button> + <div class="%5$s" style="%7$s" id="%1$s" %11$s> + <div class="wp-block-navigation__responsive-close" tabindex="-1"> + <div class="wp-block-navigation__responsive-dialog" %12$s> + <button %4$s class="wp-block-navigation__responsive-container-close" %13$s>%9$s</button> + <div class="wp-block-navigation__responsive-container-content" id="%1$s-content"> + %2$s + </div> + </div> + </div> + </div>', + esc_attr( $modal_unique_id ), + $inner_blocks_html, + $toggle_aria_label_open, + $toggle_aria_label_close, + esc_attr( implode( ' ', $responsive_container_classes ) ), + esc_attr( implode( ' ', $open_button_classes ) ), + esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ), + $toggle_button_content, + $toggle_close_button_content, + $open_button_directives, + $responsive_container_directives, + $responsive_dialog_directives, + $close_button_directives + ); + + return sprintf( + '<nav %1$s %3$s>%2$s</nav>', + $wrapper_attributes, + $responsive_container_markup, + $nav_element_directives + ); +} + +/** + * Register the navigation block. + * + * @uses render_block_core_navigation() + * @throws WP_Error An WP_Error exception parsing the block definition. + */ +function register_block_core_navigation() { + register_block_type_from_metadata( + __DIR__ . '/navigation', + array( + 'render_callback' => 'render_block_core_navigation', + ) + ); +} + +add_action( 'init', 'register_block_core_navigation' ); + +/** + * Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly. + * + * @param array $parsed_block The block being rendered. + * + * @return array The block being rendered without typographic presets. + */ +function block_core_navigation_typographic_presets_backcompatibility( $parsed_block ) { + if ( 'core/navigation' === $parsed_block['blockName'] ) { + $attribute_to_prefix_map = array( + 'fontStyle' => 'var:preset|font-style|', + 'fontWeight' => 'var:preset|font-weight|', + 'textDecoration' => 'var:preset|text-decoration|', + 'textTransform' => 'var:preset|text-transform|', + ); + foreach ( $attribute_to_prefix_map as $style_attribute => $prefix ) { + if ( ! empty( $parsed_block['attrs']['style']['typography'][ $style_attribute ] ) ) { + $prefix_len = strlen( $prefix ); + $attribute_value = &$parsed_block['attrs']['style']['typography'][ $style_attribute ]; + if ( 0 === strncmp( $attribute_value, $prefix, $prefix_len ) ) { + $attribute_value = substr( $attribute_value, $prefix_len ); + } + if ( 'textDecoration' === $style_attribute && 'strikethrough' === $attribute_value ) { + $attribute_value = 'line-through'; + } + } + } + } + + return $parsed_block; +} + +add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' ); + +/** + * Ensure that the view script has the `wp-interactivity` dependency. + * + * @since 6.4.0 + * + * @global WP_Scripts $wp_scripts + */ +function block_core_navigation_ensure_interactivity_dependency() { + global $wp_scripts; + if ( + isset( $wp_scripts->registered['wp-block-navigation-view'] ) && + ! in_array( 'wp-interactivity', $wp_scripts->registered['wp-block-navigation-view']->deps, true ) + ) { + $wp_scripts->registered['wp-block-navigation-view']->deps[] = 'wp-interactivity'; + } +} + +add_action( 'wp_print_scripts', 'block_core_navigation_ensure_interactivity_dependency' ); + +/** + * Turns menu item data into a nested array of parsed blocks + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead. + * + * @param array $menu_items An array of menu items that represent + * an individual level of a menu. + * @param array $menu_items_by_parent_id An array keyed by the id of the + * parent menu where each element is an + * array of menu items that belong to + * that parent. + * @return array An array of parsed block data. + */ +function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) { + + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::parse_blocks_from_menu_items' ); + + if ( empty( $menu_items ) ) { + return array(); + } + + $blocks = array(); + + foreach ( $menu_items as $menu_item ) { + $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null; + $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null; + $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target; + $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null; + $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom'; + + $block = array( + 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link', + 'attrs' => array( + 'className' => $class_name, + 'description' => $menu_item->description, + 'id' => $id, + 'kind' => $kind, + 'label' => $menu_item->title, + 'opensInNewTab' => $opens_in_new_tab, + 'rel' => $rel, + 'title' => $menu_item->attr_title, + 'type' => $menu_item->object, + 'url' => $menu_item->url, + ), + ); + + $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] ) + ? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id ) + : array(); + $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] ); + + $blocks[] = $block; + } + + return $blocks; +} + +/** + * Get the classic navigation menu to use as a fallback. + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback() instead. + * + * @return object WP_Term The classic navigation. + */ +function block_core_navigation_get_classic_menu_fallback() { + + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback' ); + + $classic_nav_menus = wp_get_nav_menus(); + + // If menus exist. + if ( $classic_nav_menus && ! is_wp_error( $classic_nav_menus ) ) { + // Handles simple use case where user has a classic menu and switches to a block theme. + + // Returns the menu assigned to location `primary`. + $locations = get_nav_menu_locations(); + if ( isset( $locations['primary'] ) ) { + $primary_menu = wp_get_nav_menu_object( $locations['primary'] ); + if ( $primary_menu ) { + return $primary_menu; + } + } + + // Returns a menu if `primary` is its slug. + foreach ( $classic_nav_menus as $classic_nav_menu ) { + if ( 'primary' === $classic_nav_menu->slug ) { + return $classic_nav_menu; + } + } + + // Otherwise return the most recently created classic menu. + usort( + $classic_nav_menus, + static function ( $a, $b ) { + return $b->term_id - $a->term_id; + } + ); + return $classic_nav_menus[0]; + } +} + +/** + * Converts a classic navigation to blocks. + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead. + * + * @param object $classic_nav_menu WP_Term The classic navigation object to convert. + * @return array the normalized parsed blocks. + */ +function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ) { + + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback_blocks' ); + + // BEGIN: Code that already exists in wp_nav_menu(). + $menu_items = wp_get_nav_menu_items( $classic_nav_menu->term_id, array( 'update_post_term_cache' => false ) ); + + // Set up the $menu_item variables. + _wp_menu_item_classes_by_context( $menu_items ); + + $sorted_menu_items = array(); + foreach ( (array) $menu_items as $menu_item ) { + $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; + } + + unset( $menu_items, $menu_item ); + + // END: Code that already exists in wp_nav_menu(). + + $menu_items_by_parent_id = array(); + foreach ( $sorted_menu_items as $menu_item ) { + $menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item; + } + + $inner_blocks = block_core_navigation_parse_blocks_from_menu_items( + isset( $menu_items_by_parent_id[0] ) + ? $menu_items_by_parent_id[0] + : array(), + $menu_items_by_parent_id + ); + + return serialize_blocks( $inner_blocks ); +} + +/** + * If there's a classic menu then use it as a fallback. + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::create_classic_menu_fallback() instead. + * + * @return array the normalized parsed blocks. + */ +function block_core_navigation_maybe_use_classic_menu_fallback() { + + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::create_classic_menu_fallback' ); + + // See if we have a classic menu. + $classic_nav_menu = block_core_navigation_get_classic_menu_fallback(); + + if ( ! $classic_nav_menu ) { + return; + } + + // If we have a classic menu then convert it to blocks. + $classic_nav_menu_blocks = block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ); + + if ( empty( $classic_nav_menu_blocks ) ) { + return; + } + + // Create a new navigation menu from the classic menu. + $wp_insert_post_result = wp_insert_post( + array( + 'post_content' => $classic_nav_menu_blocks, + 'post_title' => $classic_nav_menu->name, + 'post_name' => $classic_nav_menu->slug, + 'post_status' => 'publish', + 'post_type' => 'wp_navigation', + ), + true // So that we can check whether the result is an error. + ); + + if ( is_wp_error( $wp_insert_post_result ) ) { + return; + } + + // Fetch the most recently published navigation which will be the classic one created above. + return block_core_navigation_get_most_recently_published_navigation(); +} + +/** + * Finds the most recently published `wp_navigation` Post. + * + * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead. + * + * @return WP_Post|null the first non-empty Navigation or null. + */ +function block_core_navigation_get_most_recently_published_navigation() { + + _deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_most_recently_published_navigation' ); + + // Default to the most recently created menu. + $parsed_args = array( + 'post_type' => 'wp_navigation', + 'no_found_rows' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'order' => 'DESC', + 'orderby' => 'date', + 'post_status' => 'publish', + 'posts_per_page' => 1, // get only the most recent. + ); + + $navigation_post = new WP_Query( $parsed_args ); + if ( count( $navigation_post->posts ) > 0 ) { + return $navigation_post->posts[0]; + } + + return null; +} diff --git a/wp-includes/blocks/navigation/block.json b/wp-includes/blocks/navigation/block.json new file mode 100644 index 0000000..cb5ca4f --- /dev/null +++ b/wp-includes/blocks/navigation/block.json @@ -0,0 +1,141 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "apiVersion": 3, + "name": "core/navigation", + "title": "Navigation", + "category": "theme", + "description": "A collection of blocks that allow visitors to get around your site.", + "keywords": [ "menu", "navigation", "links" ], + "textdomain": "default", + "attributes": { + "ref": { + "type": "number" + }, + "textColor": { + "type": "string" + }, + "customTextColor": { + "type": "string" + }, + "rgbTextColor": { + "type": "string" + }, + "backgroundColor": { + "type": "string" + }, + "customBackgroundColor": { + "type": "string" + }, + "rgbBackgroundColor": { + "type": "string" + }, + "showSubmenuIcon": { + "type": "boolean", + "default": true + }, + "openSubmenusOnClick": { + "type": "boolean", + "default": false + }, + "overlayMenu": { + "type": "string", + "default": "mobile" + }, + "icon": { + "type": "string", + "default": "handle" + }, + "hasIcon": { + "type": "boolean", + "default": true + }, + "__unstableLocation": { + "type": "string" + }, + "overlayBackgroundColor": { + "type": "string" + }, + "customOverlayBackgroundColor": { + "type": "string" + }, + "overlayTextColor": { + "type": "string" + }, + "customOverlayTextColor": { + "type": "string" + }, + "maxNestingLevel": { + "type": "number", + "default": 5 + }, + "templateLock": { + "type": [ "string", "boolean" ], + "enum": [ "all", "insert", "contentOnly", false ] + } + }, + "providesContext": { + "textColor": "textColor", + "customTextColor": "customTextColor", + "backgroundColor": "backgroundColor", + "customBackgroundColor": "customBackgroundColor", + "overlayTextColor": "overlayTextColor", + "customOverlayTextColor": "customOverlayTextColor", + "overlayBackgroundColor": "overlayBackgroundColor", + "customOverlayBackgroundColor": "customOverlayBackgroundColor", + "fontSize": "fontSize", + "customFontSize": "customFontSize", + "showSubmenuIcon": "showSubmenuIcon", + "openSubmenusOnClick": "openSubmenusOnClick", + "style": "style", + "maxNestingLevel": "maxNestingLevel" + }, + "supports": { + "align": [ "wide", "full" ], + "ariaLabel": true, + "html": false, + "inserter": true, + "typography": { + "fontSize": true, + "lineHeight": true, + "__experimentalFontStyle": true, + "__experimentalFontWeight": true, + "__experimentalTextTransform": true, + "__experimentalFontFamily": true, + "__experimentalLetterSpacing": true, + "__experimentalTextDecoration": true, + "__experimentalSkipSerialization": [ "textDecoration" ], + "__experimentalDefaultControls": { + "fontSize": true + } + }, + "spacing": { + "blockGap": true, + "units": [ "px", "em", "rem", "vh", "vw" ], + "__experimentalDefaultControls": { + "blockGap": true + } + }, + "layout": { + "allowSwitching": false, + "allowInheriting": false, + "allowVerticalAlignment": false, + "allowSizingOnChildren": true, + "default": { + "type": "flex" + } + }, + "__experimentalStyle": { + "elements": { + "link": { + "color": { + "text": "inherit" + } + } + } + }, + "interactivity": true + }, + "viewScript": "file:./view.min.js", + "editorStyle": "wp-block-navigation-editor", + "style": "wp-block-navigation" +} diff --git a/wp-includes/blocks/navigation/editor-rtl.css b/wp-includes/blocks/navigation/editor-rtl.css new file mode 100644 index 0000000..aeaa09c --- /dev/null +++ b/wp-includes/blocks/navigation/editor-rtl.css @@ -0,0 +1,476 @@ +.editor-styles-wrapper .wp-block-navigation ul{ + margin-bottom:0; + margin-right:0; + margin-top:0; + padding-right:0; +} +.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{ + margin:revert; +} + +.wp-block-navigation-item__label{ + display:inline; +} +.wp-block-navigation-item,.wp-block-navigation__container{ + background-color:inherit; +} + +.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{ + opacity:0; + visibility:hidden; +} + +.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{ + display:flex; + opacity:1; + visibility:visible; +} + +.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{ + opacity:1; + visibility:visible; +} + +.is-editing>.wp-block-navigation__container{ + display:flex; + flex-direction:column; + opacity:1; + visibility:visible; +} + +.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{ + opacity:1; + visibility:hidden; +} +.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{ + visibility:visible; +} + +.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{ + display:block; + position:static; + width:100%; +} +.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{ + background:#1e1e1e; + border-radius:2px; + color:#fff; + margin-left:0; + margin-right:auto; + padding:0; + width:24px; +} + +.wp-block-navigation__submenu-container .block-list-appender{ + display:none; +} +.block-library-colors-selector{ + width:auto; +} +.block-library-colors-selector .block-library-colors-selector__toggle{ + display:block; + margin:0 auto; + padding:3px; + width:auto; +} +.block-library-colors-selector .block-library-colors-selector__icon-container{ + align-items:center; + border-radius:4px; + display:flex; + height:30px; + margin:0 auto; + padding:3px; + position:relative; +} +.block-library-colors-selector .block-library-colors-selector__state-selection{ + border-radius:11px; + box-shadow:inset 0 0 0 1px rgba(0,0,0,.2); + height:22px; + line-height:20px; + margin-left:auto; + margin-right:auto; + min-height:22px; + min-width:22px; + padding:2px; + width:22px; +} +.block-library-colors-selector .block-library-colors-selector__state-selection>svg{ + min-width:auto !important; +} +.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{ + color:inherit; +} + +.block-library-colors-selector__popover .color-palette-controller-container{ + padding:16px; +} +.block-library-colors-selector__popover .components-base-control__label{ + height:20px; + line-height:20px; +} +.block-library-colors-selector__popover .component-color-indicator{ + float:left; + margin-top:2px; +} +.block-library-colors-selector__popover .components-panel__body-title{ + display:none; +} + +.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender{ + background-color:#1e1e1e; + color:#fff; +} +.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{ + padding:0; +} + +.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{ + background-color:transparent; + color:#1e1e1e; +} +@keyframes loadingpulse{ + 0%{ + opacity:1; + } + 50%{ + opacity:.5; + } + to{ + opacity:1; + } +} +.components-placeholder.wp-block-navigation-placeholder{ + background:none; + box-shadow:none; + color:inherit; + min-height:0; + outline:none; + padding:0; +} +.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{ + font-size:inherit; +} +.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{ + margin-bottom:0; +} +.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{ + color:#1e1e1e; +} + +.wp-block-navigation-placeholder__preview{ + align-items:center; + background:transparent; + color:currentColor; + display:flex; + font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif; + font-size:13px; + min-width:96px; +} +.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{ + display:none; +} +.wp-block-navigation-placeholder__preview:before{ + border:1px dashed; + border-radius:2px; + border-radius:inherit; + bottom:0; + content:""; + display:block; + left:0; + pointer-events:none; + position:absolute; + right:0; + top:0; +} +.wp-block-navigation-placeholder__preview:before:before{ + background:currentColor; + bottom:0; + content:""; + left:0; + opacity:.1; + pointer-events:none; + position:absolute; + right:0; + top:0; +} +.wp-block-navigation-placeholder__preview>svg{ + fill:currentColor; +} + +.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{ + min-height:90px; +} + +.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{ + min-height:132px; +} + +.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{ + align-items:flex-start; + flex-direction:row; + padding:6px 8px; +} + +.wp-block-navigation-placeholder__controls{ + background-color:#fff; + 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; +} +.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; +} +.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{ + align-items:flex-start; + flex-direction:column; +} +.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{ + display:none; +} +.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{ + height:36px; + margin-left:12px; +} + +.wp-block-navigation-placeholder__actions__indicator{ + align-items:center; + display:flex; + height:36px; + justify-content:flex-start; + line-height:0; + margin-right:4px; + padding:0 0 0 6px; +} +.wp-block-navigation-placeholder__actions__indicator svg{ + fill:currentColor; + margin-left:4px; +} + +.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{ + flex-direction:row !important; +} + +.wp-block-navigation-placeholder__actions{ + align-items:center; + display:flex; + 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.wp-block-navigation-placeholder__actions hr{ + background-color:#1e1e1e; + border:0; + height:100%; + margin:auto 0; + max-height:16px; + min-height:1px; + min-width:1px; +} +@media (min-width:600px){ + .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{ + display:none; + } +} + +.wp-block-navigation__responsive-container.is-menu-open{ + position:fixed; + top:155px; +} +@media (min-width:782px){ + .wp-block-navigation__responsive-container.is-menu-open{ + right:36px; + top:93px; + } +} +@media (min-width:960px){ + .wp-block-navigation__responsive-container.is-menu-open{ + right:160px; + } +} + +@media (min-width:782px){ + .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{ + top:141px; + } +} + +.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{ + top:141px; +} + +.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{ + left:280px; +} + +.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{ + right:0; + top:155px; +} +@media (min-width:782px){ + .is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{ + top:61px; + } + .is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{ + top:109px; + } +} +.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; +} + +body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{ + bottom:0; + left:0; + right:0; + top:0; +} + +.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{ + color:inherit; + height:auto; + padding:0; +} + +.components-heading.wp-block-navigation-off-canvas-editor__title{ + margin:0; +} + +.wp-block-navigation-off-canvas-editor__header{ + margin-bottom:8px; +} + +.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{ + margin-top:16px; +} + +@keyframes fadein{ + 0%{ + opacity:0; + } + to{ + opacity:1; + } +} +.wp-block-navigation__loading-indicator-container{ + padding:8px 12px; +} + +.wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator{ + margin-top:0; +} + +@keyframes fadeouthalf{ + 0%{ + opacity:1; + } + to{ + opacity:.5; + } +} +.wp-block-navigation-delete-menu-button{ + justify-content:center; + margin-bottom:16px; + width:100%; +} + +.components-button.is-link.wp-block-navigation-manage-menus-button{ + margin-bottom:16px; +} + +.wp-block-navigation__overlay-menu-preview{ + align-items:center; + background-color:#f0f0f0; + display:flex; + height:64px; + justify-content:space-between; + margin-bottom:12px; + padding:0 24px; + width:100%; +} +.wp-block-navigation__overlay-menu-preview.open{ + background-color:#fff; + box-shadow:inset 0 0 0 1px #e0e0e0; + outline:1px solid transparent; +} + +.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{ + display:none; +} +.wp-block-navigation__navigation-selector{ + margin-bottom:16px; + width:100%; +} + +.wp-block-navigation__navigation-selector-button{ + border:1px solid; + justify-content:space-between; + width:100%; +} + +.wp-block-navigation__navigation-selector-button__icon{ + flex:0 0 auto; +} + +.wp-block-navigation__navigation-selector-button__label{ + flex:0 1 auto; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; +} + +.wp-block-navigation__navigation-selector-button--createnew{ + border:1px solid; + margin-bottom:16px; + width:100%; +} + +.wp-block-navigation__responsive-container-open.components-button{ + opacity:1; +} + +.wp-block-navigation__menu-inspector-controls{ + overflow-x:auto; + scrollbar-color:transparent transparent; + scrollbar-gutter:stable both-edges; + scrollbar-width:thin; + will-change:transform; +} +.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar{ + height:12px; + width:12px; +} +.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-track{ + background-color:transparent; +} +.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-thumb{ + background-clip:padding-box; + background-color:transparent; + border:3px solid transparent; + border-radius:8px; +} +.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:focus,.wp-block-navigation__menu-inspector-controls:focus-within,.wp-block-navigation__menu-inspector-controls:hover{ + scrollbar-color:#949494 transparent; +} +@media (hover:none){ + .wp-block-navigation__menu-inspector-controls{ + scrollbar-color:#949494 transparent; + } +} + +.wp-block-navigation__menu-inspector-controls__empty-message{ + margin-right:24px; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/editor-rtl.min.css b/wp-includes/blocks/navigation/editor-rtl.min.css new file mode 100644 index 0000000..c5618b8 --- /dev/null +++ b/wp-includes/blocks/navigation/editor-rtl.min.css @@ -0,0 +1 @@ +.editor-styles-wrapper .wp-block-navigation ul{margin-bottom:0;margin-right:0;margin-top:0;padding-right:0}.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{margin:revert}.wp-block-navigation-item__label{display:inline}.wp-block-navigation-item,.wp-block-navigation__container{background-color:inherit}.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{opacity:0;visibility:hidden}.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{display:flex;opacity:1;visibility:visible}.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{opacity:1;visibility:visible}.is-editing>.wp-block-navigation__container{display:flex;flex-direction:column;opacity:1;visibility:visible}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{opacity:1;visibility:hidden}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{visibility:visible}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{display:block;position:static;width:100%}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{background:#1e1e1e;border-radius:2px;color:#fff;margin-left:0;margin-right:auto;padding:0;width:24px}.wp-block-navigation__submenu-container .block-list-appender{display:none}.block-library-colors-selector{width:auto}.block-library-colors-selector .block-library-colors-selector__toggle{display:block;margin:0 auto;padding:3px;width:auto}.block-library-colors-selector .block-library-colors-selector__icon-container{align-items:center;border-radius:4px;display:flex;height:30px;margin:0 auto;padding:3px;position:relative}.block-library-colors-selector .block-library-colors-selector__state-selection{border-radius:11px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);height:22px;line-height:20px;margin-left:auto;margin-right:auto;min-height:22px;min-width:22px;padding:2px;width:22px}.block-library-colors-selector .block-library-colors-selector__state-selection>svg{min-width:auto!important}.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{color:inherit}.block-library-colors-selector__popover .color-palette-controller-container{padding:16px}.block-library-colors-selector__popover .components-base-control__label{height:20px;line-height:20px}.block-library-colors-selector__popover .component-color-indicator{float:left;margin-top:2px}.block-library-colors-selector__popover .components-panel__body-title{display:none}.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender{background-color:#1e1e1e;color:#fff}.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{padding:0}.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{background-color:transparent;color:#1e1e1e}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.components-placeholder.wp-block-navigation-placeholder{background:none;box-shadow:none;color:inherit;min-height:0;outline:none;padding:0}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{font-size:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{margin-bottom:0}.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{color:#1e1e1e}.wp-block-navigation-placeholder__preview{align-items:center;background:transparent;color:currentColor;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;min-width:96px}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{display:none}.wp-block-navigation-placeholder__preview:before{border:1px dashed;border-radius:2px;border-radius:inherit;bottom:0;content:"";display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}.wp-block-navigation-placeholder__preview:before:before{background:currentColor;bottom:0;content:"";left:0;opacity:.1;pointer-events:none;position:absolute;right:0;top:0}.wp-block-navigation-placeholder__preview>svg{fill:currentColor}.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{min-height:90px}.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{min-height:132px}.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{align-items:flex-start;flex-direction:row;padding:6px 8px}.wp-block-navigation-placeholder__controls{background-color:#fff;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}.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}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{align-items:flex-start;flex-direction:column}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{display:none}.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{height:36px;margin-left:12px}.wp-block-navigation-placeholder__actions__indicator{align-items:center;display:flex;height:36px;justify-content:flex-start;line-height:0;margin-right:4px;padding:0 0 0 6px}.wp-block-navigation-placeholder__actions__indicator svg{fill:currentColor;margin-left:4px}.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{flex-direction:row!important}.wp-block-navigation-placeholder__actions{align-items:center;display:flex;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.wp-block-navigation-placeholder__actions hr{background-color:#1e1e1e;border:0;height:100%;margin:auto 0;max-height:16px;min-height:1px;min-width:1px}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{display:none}}.wp-block-navigation__responsive-container.is-menu-open{position:fixed;top:155px}@media (min-width:782px){.wp-block-navigation__responsive-container.is-menu-open{right:36px;top:93px}}@media (min-width:960px){.wp-block-navigation__responsive-container.is-menu-open{right:160px}}@media (min-width:782px){.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:141px}}.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:141px}.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{left:280px}.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{right:0;top:155px}@media (min-width:782px){.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{top:61px}.is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:109px}}.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}body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{bottom:0;left:0;right:0;top:0}.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{color:inherit;height:auto;padding:0}.components-heading.wp-block-navigation-off-canvas-editor__title{margin:0}.wp-block-navigation-off-canvas-editor__header{margin-bottom:8px}.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{margin-top:16px}@keyframes fadein{0%{opacity:0}to{opacity:1}}.wp-block-navigation__loading-indicator-container{padding:8px 12px}.wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator{margin-top:0}@keyframes fadeouthalf{0%{opacity:1}to{opacity:.5}}.wp-block-navigation-delete-menu-button{justify-content:center;margin-bottom:16px;width:100%}.components-button.is-link.wp-block-navigation-manage-menus-button{margin-bottom:16px}.wp-block-navigation__overlay-menu-preview{align-items:center;background-color:#f0f0f0;display:flex;height:64px;justify-content:space-between;margin-bottom:12px;padding:0 24px;width:100%}.wp-block-navigation__overlay-menu-preview.open{background-color:#fff;box-shadow:inset 0 0 0 1px #e0e0e0;outline:1px solid transparent}.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{display:none}.wp-block-navigation__navigation-selector{margin-bottom:16px;width:100%}.wp-block-navigation__navigation-selector-button{border:1px solid;justify-content:space-between;width:100%}.wp-block-navigation__navigation-selector-button__icon{flex:0 0 auto}.wp-block-navigation__navigation-selector-button__label{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-block-navigation__navigation-selector-button--createnew{border:1px solid;margin-bottom:16px;width:100%}.wp-block-navigation__responsive-container-open.components-button{opacity:1}.wp-block-navigation__menu-inspector-controls{overflow-x:auto;scrollbar-color:transparent transparent;scrollbar-gutter:stable both-edges;scrollbar-width:thin;will-change:transform}.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar{height:12px;width:12px}.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-track{background-color:transparent}.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:transparent;border:3px solid transparent;border-radius:8px}.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:focus,.wp-block-navigation__menu-inspector-controls:focus-within,.wp-block-navigation__menu-inspector-controls:hover{scrollbar-color:#949494 transparent}@media (hover:none){.wp-block-navigation__menu-inspector-controls{scrollbar-color:#949494 transparent}}.wp-block-navigation__menu-inspector-controls__empty-message{margin-right:24px}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/editor.css b/wp-includes/blocks/navigation/editor.css new file mode 100644 index 0000000..581c748 --- /dev/null +++ b/wp-includes/blocks/navigation/editor.css @@ -0,0 +1,476 @@ +.editor-styles-wrapper .wp-block-navigation ul{ + margin-bottom:0; + margin-left:0; + margin-top:0; + padding-left:0; +} +.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{ + margin:revert; +} + +.wp-block-navigation-item__label{ + display:inline; +} +.wp-block-navigation-item,.wp-block-navigation__container{ + background-color:inherit; +} + +.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{ + opacity:0; + visibility:hidden; +} + +.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{ + display:flex; + opacity:1; + visibility:visible; +} + +.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{ + opacity:1; + visibility:visible; +} + +.is-editing>.wp-block-navigation__container{ + display:flex; + flex-direction:column; + opacity:1; + visibility:visible; +} + +.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{ + opacity:1; + visibility:hidden; +} +.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{ + visibility:visible; +} + +.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{ + display:block; + position:static; + width:100%; +} +.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{ + background:#1e1e1e; + border-radius:2px; + color:#fff; + margin-left:auto; + margin-right:0; + padding:0; + width:24px; +} + +.wp-block-navigation__submenu-container .block-list-appender{ + display:none; +} +.block-library-colors-selector{ + width:auto; +} +.block-library-colors-selector .block-library-colors-selector__toggle{ + display:block; + margin:0 auto; + padding:3px; + width:auto; +} +.block-library-colors-selector .block-library-colors-selector__icon-container{ + align-items:center; + border-radius:4px; + display:flex; + height:30px; + margin:0 auto; + padding:3px; + position:relative; +} +.block-library-colors-selector .block-library-colors-selector__state-selection{ + border-radius:11px; + box-shadow:inset 0 0 0 1px rgba(0,0,0,.2); + height:22px; + line-height:20px; + margin-left:auto; + margin-right:auto; + min-height:22px; + min-width:22px; + padding:2px; + width:22px; +} +.block-library-colors-selector .block-library-colors-selector__state-selection>svg{ + min-width:auto !important; +} +.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{ + color:inherit; +} + +.block-library-colors-selector__popover .color-palette-controller-container{ + padding:16px; +} +.block-library-colors-selector__popover .components-base-control__label{ + height:20px; + line-height:20px; +} +.block-library-colors-selector__popover .component-color-indicator{ + float:right; + margin-top:2px; +} +.block-library-colors-selector__popover .components-panel__body-title{ + display:none; +} + +.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender{ + background-color:#1e1e1e; + color:#fff; +} +.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{ + padding:0; +} + +.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{ + background-color:transparent; + color:#1e1e1e; +} +@keyframes loadingpulse{ + 0%{ + opacity:1; + } + 50%{ + opacity:.5; + } + to{ + opacity:1; + } +} +.components-placeholder.wp-block-navigation-placeholder{ + background:none; + box-shadow:none; + color:inherit; + min-height:0; + outline:none; + padding:0; +} +.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{ + font-size:inherit; +} +.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{ + margin-bottom:0; +} +.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{ + color:#1e1e1e; +} + +.wp-block-navigation-placeholder__preview{ + align-items:center; + background:transparent; + color:currentColor; + display:flex; + font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif; + font-size:13px; + min-width:96px; +} +.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{ + display:none; +} +.wp-block-navigation-placeholder__preview:before{ + border:1px dashed; + border-radius:2px; + border-radius:inherit; + bottom:0; + content:""; + display:block; + left:0; + pointer-events:none; + position:absolute; + right:0; + top:0; +} +.wp-block-navigation-placeholder__preview:before:before{ + background:currentColor; + bottom:0; + content:""; + left:0; + opacity:.1; + pointer-events:none; + position:absolute; + right:0; + top:0; +} +.wp-block-navigation-placeholder__preview>svg{ + fill:currentColor; +} + +.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{ + min-height:90px; +} + +.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{ + min-height:132px; +} + +.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{ + align-items:flex-start; + flex-direction:row; + padding:6px 8px; +} + +.wp-block-navigation-placeholder__controls{ + background-color:#fff; + 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; +} +.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; +} +.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{ + align-items:flex-start; + flex-direction:column; +} +.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{ + display:none; +} +.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{ + height:36px; + margin-right:12px; +} + +.wp-block-navigation-placeholder__actions__indicator{ + align-items:center; + display:flex; + height:36px; + justify-content:flex-start; + line-height:0; + margin-left:4px; + padding:0 6px 0 0; +} +.wp-block-navigation-placeholder__actions__indicator svg{ + fill:currentColor; + margin-right:4px; +} + +.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{ + flex-direction:row !important; +} + +.wp-block-navigation-placeholder__actions{ + align-items:center; + display:flex; + 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.wp-block-navigation-placeholder__actions hr{ + background-color:#1e1e1e; + border:0; + height:100%; + margin:auto 0; + max-height:16px; + min-height:1px; + min-width:1px; +} +@media (min-width:600px){ + .wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{ + display:none; + } +} + +.wp-block-navigation__responsive-container.is-menu-open{ + position:fixed; + top:155px; +} +@media (min-width:782px){ + .wp-block-navigation__responsive-container.is-menu-open{ + left:36px; + top:93px; + } +} +@media (min-width:960px){ + .wp-block-navigation__responsive-container.is-menu-open{ + left:160px; + } +} + +@media (min-width:782px){ + .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{ + top:141px; + } +} + +.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{ + top:141px; +} + +.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{ + right:280px; +} + +.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{ + left:0; + top:155px; +} +@media (min-width:782px){ + .is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{ + top:61px; + } + .is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{ + top:109px; + } +} +.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; +} + +body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{ + bottom:0; + left:0; + right:0; + top:0; +} + +.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{ + color:inherit; + height:auto; + padding:0; +} + +.components-heading.wp-block-navigation-off-canvas-editor__title{ + margin:0; +} + +.wp-block-navigation-off-canvas-editor__header{ + margin-bottom:8px; +} + +.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{ + margin-top:16px; +} + +@keyframes fadein{ + 0%{ + opacity:0; + } + to{ + opacity:1; + } +} +.wp-block-navigation__loading-indicator-container{ + padding:8px 12px; +} + +.wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator{ + margin-top:0; +} + +@keyframes fadeouthalf{ + 0%{ + opacity:1; + } + to{ + opacity:.5; + } +} +.wp-block-navigation-delete-menu-button{ + justify-content:center; + margin-bottom:16px; + width:100%; +} + +.components-button.is-link.wp-block-navigation-manage-menus-button{ + margin-bottom:16px; +} + +.wp-block-navigation__overlay-menu-preview{ + align-items:center; + background-color:#f0f0f0; + display:flex; + height:64px; + justify-content:space-between; + margin-bottom:12px; + padding:0 24px; + width:100%; +} +.wp-block-navigation__overlay-menu-preview.open{ + background-color:#fff; + box-shadow:inset 0 0 0 1px #e0e0e0; + outline:1px solid transparent; +} + +.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{ + display:none; +} +.wp-block-navigation__navigation-selector{ + margin-bottom:16px; + width:100%; +} + +.wp-block-navigation__navigation-selector-button{ + border:1px solid; + justify-content:space-between; + width:100%; +} + +.wp-block-navigation__navigation-selector-button__icon{ + flex:0 0 auto; +} + +.wp-block-navigation__navigation-selector-button__label{ + flex:0 1 auto; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; +} + +.wp-block-navigation__navigation-selector-button--createnew{ + border:1px solid; + margin-bottom:16px; + width:100%; +} + +.wp-block-navigation__responsive-container-open.components-button{ + opacity:1; +} + +.wp-block-navigation__menu-inspector-controls{ + overflow-x:auto; + scrollbar-color:transparent transparent; + scrollbar-gutter:stable both-edges; + scrollbar-width:thin; + will-change:transform; +} +.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar{ + height:12px; + width:12px; +} +.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-track{ + background-color:transparent; +} +.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-thumb{ + background-clip:padding-box; + background-color:transparent; + border:3px solid transparent; + border-radius:8px; +} +.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:focus,.wp-block-navigation__menu-inspector-controls:focus-within,.wp-block-navigation__menu-inspector-controls:hover{ + scrollbar-color:#949494 transparent; +} +@media (hover:none){ + .wp-block-navigation__menu-inspector-controls{ + scrollbar-color:#949494 transparent; + } +} + +.wp-block-navigation__menu-inspector-controls__empty-message{ + margin-left:24px; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/editor.min.css b/wp-includes/blocks/navigation/editor.min.css new file mode 100644 index 0000000..d601f57 --- /dev/null +++ b/wp-includes/blocks/navigation/editor.min.css @@ -0,0 +1 @@ +.editor-styles-wrapper .wp-block-navigation ul{margin-bottom:0;margin-left:0;margin-top:0;padding-left:0}.editor-styles-wrapper .wp-block-navigation .wp-block-navigation-item.wp-block{margin:revert}.wp-block-navigation-item__label{display:inline}.wp-block-navigation-item,.wp-block-navigation__container{background-color:inherit}.wp-block-navigation:not(.is-selected):not(.has-child-selected) .has-child:hover>.wp-block-navigation__submenu-container{opacity:0;visibility:hidden}.has-child.has-child-selected>.wp-block-navigation__submenu-container,.has-child.is-selected>.wp-block-navigation__submenu-container{display:flex;opacity:1;visibility:visible}.is-dragging-components-draggable .has-child.is-dragging-within>.wp-block-navigation__submenu-container{opacity:1;visibility:visible}.is-editing>.wp-block-navigation__container{display:flex;flex-direction:column;opacity:1;visibility:visible}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container{opacity:1;visibility:hidden}.is-dragging-components-draggable .wp-block-navigation-link>.wp-block-navigation__container .block-editor-block-draggable-chip-wrapper{visibility:visible}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender{display:block;position:static;width:100%}.is-editing>.wp-block-navigation__submenu-container>.block-list-appender .block-editor-button-block-appender{background:#1e1e1e;border-radius:2px;color:#fff;margin-left:auto;margin-right:0;padding:0;width:24px}.wp-block-navigation__submenu-container .block-list-appender{display:none}.block-library-colors-selector{width:auto}.block-library-colors-selector .block-library-colors-selector__toggle{display:block;margin:0 auto;padding:3px;width:auto}.block-library-colors-selector .block-library-colors-selector__icon-container{align-items:center;border-radius:4px;display:flex;height:30px;margin:0 auto;padding:3px;position:relative}.block-library-colors-selector .block-library-colors-selector__state-selection{border-radius:11px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2);height:22px;line-height:20px;margin-left:auto;margin-right:auto;min-height:22px;min-width:22px;padding:2px;width:22px}.block-library-colors-selector .block-library-colors-selector__state-selection>svg{min-width:auto!important}.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg,.block-library-colors-selector .block-library-colors-selector__state-selection.has-text-color>svg path{color:inherit}.block-library-colors-selector__popover .color-palette-controller-container{padding:16px}.block-library-colors-selector__popover .components-base-control__label{height:20px;line-height:20px}.block-library-colors-selector__popover .component-color-indicator{float:right;margin-top:2px}.block-library-colors-selector__popover .components-panel__body-title{display:none}.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender{background-color:#1e1e1e;color:#fff}.wp-block-navigation .wp-block+.block-list-appender .block-editor-button-block-appender.block-editor-button-block-appender.block-editor-button-block-appender{padding:0}.wp-block-navigation .wp-block .wp-block .block-editor-button-block-appender{background-color:transparent;color:#1e1e1e}@keyframes loadingpulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.components-placeholder.wp-block-navigation-placeholder{background:none;box-shadow:none;color:inherit;min-height:0;outline:none;padding:0}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset{font-size:inherit}.components-placeholder.wp-block-navigation-placeholder .components-placeholder__fieldset .components-button{margin-bottom:0}.wp-block-navigation.is-selected .components-placeholder.wp-block-navigation-placeholder{color:#1e1e1e}.wp-block-navigation-placeholder__preview{align-items:center;background:transparent;color:currentColor;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;font-size:13px;min-width:96px}.wp-block-navigation.is-selected .wp-block-navigation-placeholder__preview{display:none}.wp-block-navigation-placeholder__preview:before{border:1px dashed;border-radius:2px;border-radius:inherit;bottom:0;content:"";display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}.wp-block-navigation-placeholder__preview:before:before{background:currentColor;bottom:0;content:"";left:0;opacity:.1;pointer-events:none;position:absolute;right:0;top:0}.wp-block-navigation-placeholder__preview>svg{fill:currentColor}.wp-block-navigation.is-vertical .is-medium .components-placeholder__fieldset,.wp-block-navigation.is-vertical .is-small .components-placeholder__fieldset{min-height:90px}.wp-block-navigation.is-vertical .is-large .components-placeholder__fieldset{min-height:132px}.wp-block-navigation-placeholder__controls,.wp-block-navigation-placeholder__preview{align-items:flex-start;flex-direction:row;padding:6px 8px}.wp-block-navigation-placeholder__controls{background-color:#fff;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}.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}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions{align-items:flex-start;flex-direction:column}.is-small .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr,.wp-block-navigation.is-vertical .wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__actions hr{display:none}.wp-block-navigation-placeholder__controls .wp-block-navigation-placeholder__icon{height:36px;margin-right:12px}.wp-block-navigation-placeholder__actions__indicator{align-items:center;display:flex;height:36px;justify-content:flex-start;line-height:0;margin-left:4px;padding:0 6px 0 0}.wp-block-navigation-placeholder__actions__indicator svg{fill:currentColor;margin-right:4px}.wp-block-navigation .components-placeholder.is-medium .components-placeholder__fieldset{flex-direction:row!important}.wp-block-navigation-placeholder__actions{align-items:center;display:flex;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.wp-block-navigation-placeholder__actions hr{background-color:#1e1e1e;border:0;height:100%;margin:auto 0;max-height:16px;min-height:1px;min-width:1px}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.is-menu-open) .components-button.wp-block-navigation__responsive-container-close{display:none}}.wp-block-navigation__responsive-container.is-menu-open{position:fixed;top:155px}@media (min-width:782px){.wp-block-navigation__responsive-container.is-menu-open{left:36px;top:93px}}@media (min-width:960px){.wp-block-navigation__responsive-container.is-menu-open{left:160px}}@media (min-width:782px){.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:141px}}.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open{top:141px}.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open{right:280px}.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{left:0;top:155px}@media (min-width:782px){.is-fullscreen-mode .wp-block-navigation__responsive-container.is-menu-open{top:61px}.is-fullscreen-mode .has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open{top:109px}}.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}body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-open{bottom:0;left:0;right:0;top:0}.components-button.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close,.components-button.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{color:inherit;height:auto;padding:0}.components-heading.wp-block-navigation-off-canvas-editor__title{margin:0}.wp-block-navigation-off-canvas-editor__header{margin-bottom:8px}.is-menu-open .wp-block-navigation__responsive-container-content * .block-list-appender{margin-top:16px}@keyframes fadein{0%{opacity:0}to{opacity:1}}.wp-block-navigation__loading-indicator-container{padding:8px 12px}.wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator{margin-top:0}@keyframes fadeouthalf{0%{opacity:1}to{opacity:.5}}.wp-block-navigation-delete-menu-button{justify-content:center;margin-bottom:16px;width:100%}.components-button.is-link.wp-block-navigation-manage-menus-button{margin-bottom:16px}.wp-block-navigation__overlay-menu-preview{align-items:center;background-color:#f0f0f0;display:flex;height:64px;justify-content:space-between;margin-bottom:12px;padding:0 24px;width:100%}.wp-block-navigation__overlay-menu-preview.open{background-color:#fff;box-shadow:inset 0 0 0 1px #e0e0e0;outline:1px solid transparent}.wp-block-navigation-placeholder__actions hr+hr,.wp-block-navigation__toolbar-menu-selector.components-toolbar-group:empty{display:none}.wp-block-navigation__navigation-selector{margin-bottom:16px;width:100%}.wp-block-navigation__navigation-selector-button{border:1px solid;justify-content:space-between;width:100%}.wp-block-navigation__navigation-selector-button__icon{flex:0 0 auto}.wp-block-navigation__navigation-selector-button__label{flex:0 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-block-navigation__navigation-selector-button--createnew{border:1px solid;margin-bottom:16px;width:100%}.wp-block-navigation__responsive-container-open.components-button{opacity:1}.wp-block-navigation__menu-inspector-controls{overflow-x:auto;scrollbar-color:transparent transparent;scrollbar-gutter:stable both-edges;scrollbar-width:thin;will-change:transform}.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar{height:12px;width:12px}.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-track{background-color:transparent}.wp-block-navigation__menu-inspector-controls::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:transparent;border:3px solid transparent;border-radius:8px}.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:focus,.wp-block-navigation__menu-inspector-controls:focus-within,.wp-block-navigation__menu-inspector-controls:hover{scrollbar-color:#949494 transparent}@media (hover:none){.wp-block-navigation__menu-inspector-controls{scrollbar-color:#949494 transparent}}.wp-block-navigation__menu-inspector-controls__empty-message{margin-left:24px}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/style-rtl.css b/wp-includes/blocks/navigation/style-rtl.css new file mode 100644 index 0000000..8d9606d --- /dev/null +++ b/wp-includes/blocks/navigation/style-rtl.css @@ -0,0 +1,465 @@ +.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; + position:relative; +} +.wp-block-navigation ul{ + margin-bottom:0; + margin-right:0; + margin-top:0; + padding-right:0; +} +.wp-block-navigation ul,.wp-block-navigation ul li{ + list-style:none; + padding:0; +} +.wp-block-navigation .wp-block-navigation-item{ + align-items:center; + background-color:inherit; + display:flex; + position:relative; +} +.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{ + display:none; +} +.wp-block-navigation .wp-block-navigation-item__content{ + display:block; +} +.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content{ + color:inherit; +} +.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{ + text-decoration:underline; +} +.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{ + text-decoration:line-through; +} +.wp-block-navigation:where(:not([class*=has-text-decoration])) a{ + text-decoration:none; +} +.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{ + text-decoration:none; +} +.wp-block-navigation .wp-block-navigation__submenu-icon{ + align-self:center; + background-color:inherit; + border:none; + color:currentColor; + display:inline-block; + font-size:inherit; + height:.6em; + line-height:0; + margin-right:.25em; + padding:0; + width:.6em; +} +.wp-block-navigation .wp-block-navigation__submenu-icon svg{ + stroke:currentColor; + display:inline-block; + height:inherit; + margin-top:.075em; + width:inherit; +} +.wp-block-navigation.is-vertical{ + --navigation-layout-direction:column; + --navigation-layout-justify:initial; + --navigation-layout-align:flex-start; +} +.wp-block-navigation.no-wrap{ + --navigation-layout-wrap:nowrap; +} +.wp-block-navigation.items-justified-center{ + --navigation-layout-justification-setting:center; + --navigation-layout-justify:center; +} +.wp-block-navigation.items-justified-center.is-vertical{ + --navigation-layout-align:center; +} +.wp-block-navigation.items-justified-right{ + --navigation-layout-justification-setting:flex-end; + --navigation-layout-justify:flex-end; +} +.wp-block-navigation.items-justified-right.is-vertical{ + --navigation-layout-align:flex-end; +} +.wp-block-navigation.items-justified-space-between{ + --navigation-layout-justification-setting:space-between; + --navigation-layout-justify:space-between; +} + +.wp-block-navigation .has-child .wp-block-navigation__submenu-container{ + align-items:normal; + background-color:inherit; + color:inherit; + display:flex; + flex-direction:column; + height:0; + opacity:0; + overflow:hidden; + position:absolute; + right:-1px; + top:100%; + transition:opacity .1s linear; + visibility:hidden; + width:0; + z-index:2; +} +.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content{ + display:flex; + flex-grow:1; +} +.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; + margin-right:auto; +} +.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content{ + margin:0; +} +@media (min-width:782px){ + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + right:100%; + top:-1px; + } + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{ + background:transparent; + content:""; + display:block; + height:100%; + left:100%; + position:absolute; + width:.5em; + } + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon{ + margin-left:.25em; + } + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon svg{ + transform:rotate(90deg); + } +} +.wp-block-navigation .has-child:not(.open-on-click):hover>.wp-block-navigation__submenu-container{ + height:auto; + min-width:200px; + opacity:1; + overflow:visible; + visibility:visible; + width:auto; +} +.wp-block-navigation .has-child:not(.open-on-click):not(.open-on-hover-click):focus-within>.wp-block-navigation__submenu-container{ + height:auto; + min-width:200px; + opacity:1; + overflow:visible; + visibility:visible; + width:auto; +} +.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{ + height:auto; + min-width:200px; + opacity:1; + overflow:visible; + visibility:visible; + width:auto; +} + +.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{ + right:0; + top:100%; +} +@media (min-width:782px){ + .wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + right:100%; + top:0; + } +} + +.wp-block-navigation-submenu{ + display:flex; + position:relative; +} +.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{ + stroke:currentColor; +} + +button.wp-block-navigation-item__content{ + background-color:transparent; + border:none; + color:currentColor; + font-family:inherit; + font-size:inherit; + font-style:inherit; + font-weight:inherit; + line-height:inherit; + text-align:right; + text-transform:inherit; +} + +.wp-block-navigation-submenu__toggle{ + cursor:pointer; +} + +.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{ + padding-left:.85em; +} +.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{ + margin-right:-.6em; + pointer-events:none; +} +.wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{ + gap:inherit; +} +:where(.wp-block-navigation.has-background .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation.has-background .wp-block-navigation-submenu a:not(.wp-element-button)){ + padding:.5em 1em; +} + +:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content){ + padding:.5em 1em; +} +.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{ + left:0; + right:auto; +} +.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:-1px; + right:-1px; +} +@media (min-width:782px){ + .wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:100%; + right:auto; + } +} + +.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{ + background-color:#fff; + border:1px solid rgba(0,0,0,.15); +} + +.wp-block-navigation.has-background .wp-block-navigation__submenu-container{ + background-color:inherit; +} + +.wp-block-navigation:not(.has-text-color) .wp-block-navigation__submenu-container{ + color:#000; +} + +.wp-block-navigation__container{ + align-items:var(--navigation-layout-align, initial); + display:flex; + flex-direction:var(--navigation-layout-direction, initial); + flex-wrap:var(--navigation-layout-wrap, wrap); + justify-content:var(--navigation-layout-justify, initial); + list-style:none; + margin:0; + padding-right:0; +} +.wp-block-navigation__container .is-responsive{ + display:none; +} + +.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{ + flex-grow:1; +} +@keyframes overlay-menu__fade-in-animation{ + 0%{ + opacity:0; + transform:translateY(.5em); + } + to{ + opacity:1; + transform:translateY(0); + } +} +.wp-block-navigation__responsive-container{ + bottom:0; + display:none; + left:0; + position:fixed; + right:0; + top:0; +} +.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a){ + color:inherit; +} +.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{ + align-items:var(--navigation-layout-align, initial); + display:flex; + flex-direction:var(--navigation-layout-direction, initial); + flex-wrap:var(--navigation-layout-wrap, wrap); + justify-content:var(--navigation-layout-justify, initial); +} +.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){ + background-color:inherit !important; + color:inherit !important; +} +.wp-block-navigation__responsive-container.is-menu-open{ + animation:overlay-menu__fade-in-animation .1s ease-out; + animation-fill-mode:forwards; + 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), 20em) clamp(1rem, var(--wp--style--root--padding-bottom), 20rem) clamp(1rem, var(--wp--style--root--padding-right), 20rem); + z-index:100000; +} +@media (prefers-reduced-motion:reduce){ + .wp-block-navigation__responsive-container.is-menu-open{ + animation-delay:0s; + animation-duration:1ms; + } +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{ + align-items:var(--navigation-layout-justification-setting, inherit); + display:flex; + flex-direction:column; + flex-wrap:nowrap; + overflow:visible; + padding-top:calc(2rem + 24px); +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{ + justify-content:flex-start; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{ + display:none; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{ + border:none; + height:auto; + min-width:200px; + opacity:1; + overflow:initial; + padding-left:2rem; + padding-right:2rem; + position:static; + visibility:visible; + width:auto; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{ + gap:inherit; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{ + padding-top:var(--wp--style--block-gap, 2em); +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{ + padding:0; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{ + align-items:var(--navigation-layout-justification-setting, initial); + display:flex; + flex-direction:column; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{ + background:transparent !important; + color:inherit !important; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{ + left:auto; + right:auto; +} +@media (min-width:600px){ + .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){ + background-color:inherit; + display:block; + position:relative; + width:100%; + z-index:auto; + } + .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{ + display:none; + } + .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{ + right:0; + } +} + +.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{ + background-color:#fff; +} + +.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open{ + color:#000; +} + +.wp-block-navigation__toggle_button_label{ + font-size:1rem; + font-weight:700; +} + +.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{ + background:transparent; + border:none; + color:currentColor; + cursor:pointer; + margin:0; + padding:0; + text-transform:inherit; + vertical-align:middle; +} +.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{ + fill:currentColor; + display:block; + height:24px; + pointer-events:none; + width:24px; +} + +.wp-block-navigation__responsive-container-open{ + display:flex; +} +.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{ + font-family:inherit; + font-size:inherit; + font-weight:inherit; +} +@media (min-width:600px){ + .wp-block-navigation__responsive-container-open:not(.always-shown){ + display:none; + } +} + +.wp-block-navigation__responsive-container-close{ + left:0; + position:absolute; + top:0; + z-index:2; +} +.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close{ + font-family:inherit; + font-size:inherit; + font-weight:inherit; +} + +.wp-block-navigation__responsive-close{ + width:100%; +} +.has-modal-open .wp-block-navigation__responsive-close{ + margin-left:auto; + margin-right:auto; + max-width:var(--wp--style--global--wide-size, 100%); +} +.wp-block-navigation__responsive-close:focus{ + outline:none; +} + +.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{ + box-sizing:border-box; +} + +.wp-block-navigation__responsive-dialog{ + position:relative; +} + +.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{ + margin-top:46px; +} +@media (min-width:782px){ + .has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{ + margin-top:32px; + } +} + +html.has-modal-open{ + overflow:hidden; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/style-rtl.min.css b/wp-includes/blocks/navigation/style-rtl.min.css new file mode 100644 index 0000000..4e5f7bc --- /dev/null +++ b/wp-includes/blocks/navigation/style-rtl.min.css @@ -0,0 +1 @@ +.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;position:relative}.wp-block-navigation ul{margin-bottom:0;margin-right:0;margin-top:0;padding-right:0}.wp-block-navigation ul,.wp-block-navigation ul li{list-style:none;padding:0}.wp-block-navigation .wp-block-navigation-item{align-items:center;background-color:inherit;display:flex;position:relative}.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{display:none}.wp-block-navigation .wp-block-navigation-item__content{display:block}.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content{color:inherit}.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{text-decoration:underline}.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{text-decoration:line-through}.wp-block-navigation:where(:not([class*=has-text-decoration])) a{text-decoration:none}.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{text-decoration:none}.wp-block-navigation .wp-block-navigation__submenu-icon{align-self:center;background-color:inherit;border:none;color:currentColor;display:inline-block;font-size:inherit;height:.6em;line-height:0;margin-right:.25em;padding:0;width:.6em}.wp-block-navigation .wp-block-navigation__submenu-icon svg{stroke:currentColor;display:inline-block;height:inherit;margin-top:.075em;width:inherit}.wp-block-navigation.is-vertical{--navigation-layout-direction:column;--navigation-layout-justify:initial;--navigation-layout-align:flex-start}.wp-block-navigation.no-wrap{--navigation-layout-wrap:nowrap}.wp-block-navigation.items-justified-center{--navigation-layout-justification-setting:center;--navigation-layout-justify:center}.wp-block-navigation.items-justified-center.is-vertical{--navigation-layout-align:center}.wp-block-navigation.items-justified-right{--navigation-layout-justification-setting:flex-end;--navigation-layout-justify:flex-end}.wp-block-navigation.items-justified-right.is-vertical{--navigation-layout-align:flex-end}.wp-block-navigation.items-justified-space-between{--navigation-layout-justification-setting:space-between;--navigation-layout-justify:space-between}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{align-items:normal;background-color:inherit;color:inherit;display:flex;flex-direction:column;height:0;opacity:0;overflow:hidden;position:absolute;right:-1px;top:100%;transition:opacity .1s linear;visibility:hidden;width:0;z-index:2}.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content{display:flex;flex-grow:1}.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;margin-right:auto}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content{margin:0}@media (min-width:782px){.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:-1px}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{background:transparent;content:"";display:block;height:100%;left:100%;position:absolute;width:.5em}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon{margin-left:.25em}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon svg{transform:rotate(90deg)}}.wp-block-navigation .has-child:not(.open-on-click):hover>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;overflow:visible;visibility:visible;width:auto}.wp-block-navigation .has-child:not(.open-on-click):not(.open-on-hover-click):focus-within>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;overflow:visible;visibility:visible;width:auto}.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;overflow:visible;visibility:visible;width:auto}.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{right:0;top:100%}@media (min-width:782px){.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{right:100%;top:0}}.wp-block-navigation-submenu{display:flex;position:relative}.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{stroke:currentColor}button.wp-block-navigation-item__content{background-color:transparent;border:none;color:currentColor;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;line-height:inherit;text-align:right;text-transform:inherit}.wp-block-navigation-submenu__toggle{cursor:pointer}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{padding-left:.85em}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{margin-right:-.6em;pointer-events:none}.wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{gap:inherit}:where(.wp-block-navigation.has-background .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation.has-background .wp-block-navigation-submenu a:not(.wp-element-button)){padding:.5em 1em}:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content){padding:.5em 1em}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{left:0;right:auto}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:-1px;right:-1px}@media (min-width:782px){.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;right:auto}}.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{background-color:#fff;border:1px solid rgba(0,0,0,.15)}.wp-block-navigation.has-background .wp-block-navigation__submenu-container{background-color:inherit}.wp-block-navigation:not(.has-text-color) .wp-block-navigation__submenu-container{color:#000}.wp-block-navigation__container{align-items:var(--navigation-layout-align,initial);display:flex;flex-direction:var(--navigation-layout-direction,initial);flex-wrap:var(--navigation-layout-wrap,wrap);justify-content:var(--navigation-layout-justify,initial);list-style:none;margin:0;padding-right:0}.wp-block-navigation__container .is-responsive{display:none}.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{flex-grow:1}@keyframes overlay-menu__fade-in-animation{0%{opacity:0;transform:translateY(.5em)}to{opacity:1;transform:translateY(0)}}.wp-block-navigation__responsive-container{bottom:0;display:none;left:0;position:fixed;right:0;top:0}.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a){color:inherit}.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{align-items:var(--navigation-layout-align,initial);display:flex;flex-direction:var(--navigation-layout-direction,initial);flex-wrap:var(--navigation-layout-wrap,wrap);justify-content:var(--navigation-layout-justify,initial)}.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){background-color:inherit!important;color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open{animation:overlay-menu__fade-in-animation .1s ease-out;animation-fill-mode:forwards;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),20em) clamp(1rem,var(--wp--style--root--padding-bottom),20rem) clamp(1rem,var(--wp--style--root--padding-right),20rem);z-index:100000}@media (prefers-reduced-motion:reduce){.wp-block-navigation__responsive-container.is-menu-open{animation-delay:0s;animation-duration:1ms}}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{align-items:var(--navigation-layout-justification-setting,inherit);display:flex;flex-direction:column;flex-wrap:nowrap;overflow:visible;padding-top:calc(2rem + 24px)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{justify-content:flex-start}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{border:none;height:auto;min-width:200px;opacity:1;overflow:initial;padding-left:2rem;padding-right:2rem;position:static;visibility:visible;width:auto}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{gap:inherit}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{padding-top:var(--wp--style--block-gap,2em)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{padding:0}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{align-items:var(--navigation-layout-justification-setting,initial);display:flex;flex-direction:column}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{background:transparent!important;color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:auto;right:auto}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){background-color:inherit;display:block;position:relative;width:100%;z-index:auto}.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{right:0}}.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{background-color:#fff}.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open{color:#000}.wp-block-navigation__toggle_button_label{font-size:1rem;font-weight:700}.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{background:transparent;border:none;color:currentColor;cursor:pointer;margin:0;padding:0;text-transform:inherit;vertical-align:middle}.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{fill:currentColor;display:block;height:24px;pointer-events:none;width:24px}.wp-block-navigation__responsive-container-open{display:flex}.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{font-family:inherit;font-size:inherit;font-weight:inherit}@media (min-width:600px){.wp-block-navigation__responsive-container-open:not(.always-shown){display:none}}.wp-block-navigation__responsive-container-close{left:0;position:absolute;top:0;z-index:2}.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close{font-family:inherit;font-size:inherit;font-weight:inherit}.wp-block-navigation__responsive-close{width:100%}.has-modal-open .wp-block-navigation__responsive-close{margin-left:auto;margin-right:auto;max-width:var(--wp--style--global--wide-size,100%)}.wp-block-navigation__responsive-close:focus{outline:none}.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{box-sizing:border-box}.wp-block-navigation__responsive-dialog{position:relative}.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{margin-top:46px}@media (min-width:782px){.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{margin-top:32px}}html.has-modal-open{overflow:hidden}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/style.css b/wp-includes/blocks/navigation/style.css new file mode 100644 index 0000000..6c7ebaf --- /dev/null +++ b/wp-includes/blocks/navigation/style.css @@ -0,0 +1,465 @@ +.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; + position:relative; +} +.wp-block-navigation ul{ + margin-bottom:0; + margin-left:0; + margin-top:0; + padding-left:0; +} +.wp-block-navigation ul,.wp-block-navigation ul li{ + list-style:none; + padding:0; +} +.wp-block-navigation .wp-block-navigation-item{ + align-items:center; + background-color:inherit; + display:flex; + position:relative; +} +.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{ + display:none; +} +.wp-block-navigation .wp-block-navigation-item__content{ + display:block; +} +.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content{ + color:inherit; +} +.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{ + text-decoration:underline; +} +.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{ + text-decoration:line-through; +} +.wp-block-navigation:where(:not([class*=has-text-decoration])) a{ + text-decoration:none; +} +.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{ + text-decoration:none; +} +.wp-block-navigation .wp-block-navigation__submenu-icon{ + align-self:center; + background-color:inherit; + border:none; + color:currentColor; + display:inline-block; + font-size:inherit; + height:.6em; + line-height:0; + margin-left:.25em; + padding:0; + width:.6em; +} +.wp-block-navigation .wp-block-navigation__submenu-icon svg{ + stroke:currentColor; + display:inline-block; + height:inherit; + margin-top:.075em; + width:inherit; +} +.wp-block-navigation.is-vertical{ + --navigation-layout-direction:column; + --navigation-layout-justify:initial; + --navigation-layout-align:flex-start; +} +.wp-block-navigation.no-wrap{ + --navigation-layout-wrap:nowrap; +} +.wp-block-navigation.items-justified-center{ + --navigation-layout-justification-setting:center; + --navigation-layout-justify:center; +} +.wp-block-navigation.items-justified-center.is-vertical{ + --navigation-layout-align:center; +} +.wp-block-navigation.items-justified-right{ + --navigation-layout-justification-setting:flex-end; + --navigation-layout-justify:flex-end; +} +.wp-block-navigation.items-justified-right.is-vertical{ + --navigation-layout-align:flex-end; +} +.wp-block-navigation.items-justified-space-between{ + --navigation-layout-justification-setting:space-between; + --navigation-layout-justify:space-between; +} + +.wp-block-navigation .has-child .wp-block-navigation__submenu-container{ + align-items:normal; + background-color:inherit; + color:inherit; + display:flex; + flex-direction:column; + height:0; + left:-1px; + opacity:0; + overflow:hidden; + position:absolute; + top:100%; + transition:opacity .1s linear; + visibility:hidden; + width:0; + z-index:2; +} +.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content{ + display:flex; + flex-grow:1; +} +.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; + margin-right:0; +} +.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content{ + margin:0; +} +@media (min-width:782px){ + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:100%; + top:-1px; + } + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{ + background:transparent; + content:""; + display:block; + height:100%; + position:absolute; + right:100%; + width:.5em; + } + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon{ + margin-right:.25em; + } + .wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon svg{ + transform:rotate(-90deg); + } +} +.wp-block-navigation .has-child:not(.open-on-click):hover>.wp-block-navigation__submenu-container{ + height:auto; + min-width:200px; + opacity:1; + overflow:visible; + visibility:visible; + width:auto; +} +.wp-block-navigation .has-child:not(.open-on-click):not(.open-on-hover-click):focus-within>.wp-block-navigation__submenu-container{ + height:auto; + min-width:200px; + opacity:1; + overflow:visible; + visibility:visible; + width:auto; +} +.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{ + height:auto; + min-width:200px; + opacity:1; + overflow:visible; + visibility:visible; + width:auto; +} + +.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{ + left:0; + top:100%; +} +@media (min-width:782px){ + .wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:100%; + top:0; + } +} + +.wp-block-navigation-submenu{ + display:flex; + position:relative; +} +.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{ + stroke:currentColor; +} + +button.wp-block-navigation-item__content{ + background-color:transparent; + border:none; + color:currentColor; + font-family:inherit; + font-size:inherit; + font-style:inherit; + font-weight:inherit; + line-height:inherit; + text-align:left; + text-transform:inherit; +} + +.wp-block-navigation-submenu__toggle{ + cursor:pointer; +} + +.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{ + padding-right:.85em; +} +.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{ + margin-left:-.6em; + pointer-events:none; +} +.wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{ + gap:inherit; +} +:where(.wp-block-navigation.has-background .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation.has-background .wp-block-navigation-submenu a:not(.wp-element-button)){ + padding:.5em 1em; +} + +:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content){ + padding:.5em 1em; +} +.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{ + left:auto; + right:0; +} +.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:-1px; + right:-1px; +} +@media (min-width:782px){ + .wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{ + left:auto; + right:100%; + } +} + +.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{ + background-color:#fff; + border:1px solid rgba(0,0,0,.15); +} + +.wp-block-navigation.has-background .wp-block-navigation__submenu-container{ + background-color:inherit; +} + +.wp-block-navigation:not(.has-text-color) .wp-block-navigation__submenu-container{ + color:#000; +} + +.wp-block-navigation__container{ + align-items:var(--navigation-layout-align, initial); + display:flex; + flex-direction:var(--navigation-layout-direction, initial); + flex-wrap:var(--navigation-layout-wrap, wrap); + justify-content:var(--navigation-layout-justify, initial); + list-style:none; + margin:0; + padding-left:0; +} +.wp-block-navigation__container .is-responsive{ + display:none; +} + +.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{ + flex-grow:1; +} +@keyframes overlay-menu__fade-in-animation{ + 0%{ + opacity:0; + transform:translateY(.5em); + } + to{ + opacity:1; + transform:translateY(0); + } +} +.wp-block-navigation__responsive-container{ + bottom:0; + display:none; + left:0; + position:fixed; + right:0; + top:0; +} +.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a){ + color:inherit; +} +.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{ + align-items:var(--navigation-layout-align, initial); + display:flex; + flex-direction:var(--navigation-layout-direction, initial); + flex-wrap:var(--navigation-layout-wrap, wrap); + justify-content:var(--navigation-layout-justify, initial); +} +.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){ + background-color:inherit !important; + color:inherit !important; +} +.wp-block-navigation__responsive-container.is-menu-open{ + animation:overlay-menu__fade-in-animation .1s ease-out; + animation-fill-mode:forwards; + 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), 20em); + z-index:100000; +} +@media (prefers-reduced-motion:reduce){ + .wp-block-navigation__responsive-container.is-menu-open{ + animation-delay:0s; + animation-duration:1ms; + } +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{ + align-items:var(--navigation-layout-justification-setting, inherit); + display:flex; + flex-direction:column; + flex-wrap:nowrap; + overflow:visible; + padding-top:calc(2rem + 24px); +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{ + justify-content:flex-start; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{ + display:none; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{ + border:none; + height:auto; + min-width:200px; + opacity:1; + overflow:initial; + padding-left:2rem; + padding-right:2rem; + position:static; + visibility:visible; + width:auto; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{ + gap:inherit; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{ + padding-top:var(--wp--style--block-gap, 2em); +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{ + padding:0; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{ + align-items:var(--navigation-layout-justification-setting, initial); + display:flex; + flex-direction:column; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{ + background:transparent !important; + color:inherit !important; +} +.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{ + left:auto; + right:auto; +} +@media (min-width:600px){ + .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){ + background-color:inherit; + display:block; + position:relative; + width:100%; + z-index:auto; + } + .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{ + display:none; + } + .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{ + left:0; + } +} + +.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{ + background-color:#fff; +} + +.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open{ + color:#000; +} + +.wp-block-navigation__toggle_button_label{ + font-size:1rem; + font-weight:700; +} + +.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{ + background:transparent; + border:none; + color:currentColor; + cursor:pointer; + margin:0; + padding:0; + text-transform:inherit; + vertical-align:middle; +} +.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{ + fill:currentColor; + display:block; + height:24px; + pointer-events:none; + width:24px; +} + +.wp-block-navigation__responsive-container-open{ + display:flex; +} +.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{ + font-family:inherit; + font-size:inherit; + font-weight:inherit; +} +@media (min-width:600px){ + .wp-block-navigation__responsive-container-open:not(.always-shown){ + display:none; + } +} + +.wp-block-navigation__responsive-container-close{ + position:absolute; + right:0; + top:0; + z-index:2; +} +.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close{ + font-family:inherit; + font-size:inherit; + font-weight:inherit; +} + +.wp-block-navigation__responsive-close{ + width:100%; +} +.has-modal-open .wp-block-navigation__responsive-close{ + margin-left:auto; + margin-right:auto; + max-width:var(--wp--style--global--wide-size, 100%); +} +.wp-block-navigation__responsive-close:focus{ + outline:none; +} + +.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{ + box-sizing:border-box; +} + +.wp-block-navigation__responsive-dialog{ + position:relative; +} + +.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{ + margin-top:46px; +} +@media (min-width:782px){ + .has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{ + margin-top:32px; + } +} + +html.has-modal-open{ + overflow:hidden; +}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/style.min.css b/wp-includes/blocks/navigation/style.min.css new file mode 100644 index 0000000..67a42cf --- /dev/null +++ b/wp-includes/blocks/navigation/style.min.css @@ -0,0 +1 @@ +.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;position:relative}.wp-block-navigation ul{margin-bottom:0;margin-left:0;margin-top:0;padding-left:0}.wp-block-navigation ul,.wp-block-navigation ul li{list-style:none;padding:0}.wp-block-navigation .wp-block-navigation-item{align-items:center;background-color:inherit;display:flex;position:relative}.wp-block-navigation .wp-block-navigation-item .wp-block-navigation__submenu-container:empty{display:none}.wp-block-navigation .wp-block-navigation-item__content{display:block}.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content{color:inherit}.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-underline .wp-block-navigation-item__content:focus{text-decoration:underline}.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:active,.wp-block-navigation.has-text-decoration-line-through .wp-block-navigation-item__content:focus{text-decoration:line-through}.wp-block-navigation:where(:not([class*=has-text-decoration])) a{text-decoration:none}.wp-block-navigation:where(:not([class*=has-text-decoration])) a:active,.wp-block-navigation:where(:not([class*=has-text-decoration])) a:focus{text-decoration:none}.wp-block-navigation .wp-block-navigation__submenu-icon{align-self:center;background-color:inherit;border:none;color:currentColor;display:inline-block;font-size:inherit;height:.6em;line-height:0;margin-left:.25em;padding:0;width:.6em}.wp-block-navigation .wp-block-navigation__submenu-icon svg{stroke:currentColor;display:inline-block;height:inherit;margin-top:.075em;width:inherit}.wp-block-navigation.is-vertical{--navigation-layout-direction:column;--navigation-layout-justify:initial;--navigation-layout-align:flex-start}.wp-block-navigation.no-wrap{--navigation-layout-wrap:nowrap}.wp-block-navigation.items-justified-center{--navigation-layout-justification-setting:center;--navigation-layout-justify:center}.wp-block-navigation.items-justified-center.is-vertical{--navigation-layout-align:center}.wp-block-navigation.items-justified-right{--navigation-layout-justification-setting:flex-end;--navigation-layout-justify:flex-end}.wp-block-navigation.items-justified-right.is-vertical{--navigation-layout-align:flex-end}.wp-block-navigation.items-justified-space-between{--navigation-layout-justification-setting:space-between;--navigation-layout-justify:space-between}.wp-block-navigation .has-child .wp-block-navigation__submenu-container{align-items:normal;background-color:inherit;color:inherit;display:flex;flex-direction:column;height:0;left:-1px;opacity:0;overflow:hidden;position:absolute;top:100%;transition:opacity .1s linear;visibility:hidden;width:0;z-index:2}.wp-block-navigation .has-child .wp-block-navigation__submenu-container>.wp-block-navigation-item>.wp-block-navigation-item__content{display:flex;flex-grow:1}.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;margin-right:0}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation-item__content{margin:0}@media (min-width:782px){.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:-1px}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container:before{background:transparent;content:"";display:block;height:100%;position:absolute;right:100%;width:.5em}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon{margin-right:.25em}.wp-block-navigation .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-icon svg{transform:rotate(-90deg)}}.wp-block-navigation .has-child:not(.open-on-click):hover>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;overflow:visible;visibility:visible;width:auto}.wp-block-navigation .has-child:not(.open-on-click):not(.open-on-hover-click):focus-within>.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;overflow:visible;visibility:visible;width:auto}.wp-block-navigation .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]~.wp-block-navigation__submenu-container{height:auto;min-width:200px;opacity:1;overflow:visible;visibility:visible;width:auto}.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container{left:0;top:100%}@media (min-width:782px){.wp-block-navigation.has-background .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:100%;top:0}}.wp-block-navigation-submenu{display:flex;position:relative}.wp-block-navigation-submenu .wp-block-navigation__submenu-icon svg{stroke:currentColor}button.wp-block-navigation-item__content{background-color:transparent;border:none;color:currentColor;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;line-height:inherit;text-align:left;text-transform:inherit}.wp-block-navigation-submenu__toggle{cursor:pointer}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle{padding-right:.85em}.wp-block-navigation-item.open-on-click .wp-block-navigation-submenu__toggle+.wp-block-navigation__submenu-icon{margin-left:-.6em;pointer-events:none}.wp-block-navigation .wp-block-page-list,.wp-block-navigation__container,.wp-block-navigation__responsive-close,.wp-block-navigation__responsive-container,.wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-dialog{gap:inherit}:where(.wp-block-navigation.has-background .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation.has-background .wp-block-navigation-submenu a:not(.wp-element-button)){padding:.5em 1em}:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),:where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content){padding:.5em 1em}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container{left:auto;right:0}.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:-1px;right:-1px}@media (min-width:782px){.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-right .wp-block-page-list>.has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between .wp-block-page-list>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container,.wp-block-navigation.items-justified-space-between>.wp-block-navigation__container>.has-child:last-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container{left:auto;right:100%}}.wp-block-navigation:not(.has-background) .wp-block-navigation__submenu-container{background-color:#fff;border:1px solid rgba(0,0,0,.15)}.wp-block-navigation.has-background .wp-block-navigation__submenu-container{background-color:inherit}.wp-block-navigation:not(.has-text-color) .wp-block-navigation__submenu-container{color:#000}.wp-block-navigation__container{align-items:var(--navigation-layout-align,initial);display:flex;flex-direction:var(--navigation-layout-direction,initial);flex-wrap:var(--navigation-layout-wrap,wrap);justify-content:var(--navigation-layout-justify,initial);list-style:none;margin:0;padding-left:0}.wp-block-navigation__container .is-responsive{display:none}.wp-block-navigation__container:only-child,.wp-block-page-list:only-child{flex-grow:1}@keyframes overlay-menu__fade-in-animation{0%{opacity:0;transform:translateY(.5em)}to{opacity:1;transform:translateY(0)}}.wp-block-navigation__responsive-container{bottom:0;display:none;left:0;position:fixed;right:0;top:0}.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a){color:inherit}.wp-block-navigation__responsive-container .wp-block-navigation__responsive-container-content{align-items:var(--navigation-layout-align,initial);display:flex;flex-direction:var(--navigation-layout-direction,initial);flex-wrap:var(--navigation-layout-wrap,wrap);justify-content:var(--navigation-layout-justify,initial)}.wp-block-navigation__responsive-container:not(.is-menu-open.is-menu-open){background-color:inherit!important;color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open{animation:overlay-menu__fade-in-animation .1s ease-out;animation-fill-mode:forwards;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),20em);z-index:100000}@media (prefers-reduced-motion:reduce){.wp-block-navigation__responsive-container.is-menu-open{animation-delay:0s;animation-duration:1ms}}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content{align-items:var(--navigation-layout-justification-setting,inherit);display:flex;flex-direction:column;flex-wrap:nowrap;overflow:visible;padding-top:calc(2rem + 24px)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{justify-content:flex-start}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container{border:none;height:auto;min-width:200px;opacity:1;overflow:initial;padding-left:2rem;padding-right:2rem;position:static;visibility:visible;width:auto}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{gap:inherit}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container{padding-top:var(--wp--style--block-gap,2em)}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content{padding:0}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-page-list{align-items:var(--navigation-layout-justification-setting,initial);display:flex;flex-direction:column}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item .wp-block-navigation__submenu-container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list{background:transparent!important;color:inherit!important}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:auto;right:auto}@media (min-width:600px){.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open){background-color:inherit;display:block;position:relative;width:100%;z-index:auto}.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) .wp-block-navigation__responsive-container-close{display:none}.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container.wp-block-navigation__submenu-container{left:0}}.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open{background-color:#fff}.wp-block-navigation:not(.has-text-color) .wp-block-navigation__responsive-container.is-menu-open{color:#000}.wp-block-navigation__toggle_button_label{font-size:1rem;font-weight:700}.wp-block-navigation__responsive-container-close,.wp-block-navigation__responsive-container-open{background:transparent;border:none;color:currentColor;cursor:pointer;margin:0;padding:0;text-transform:inherit;vertical-align:middle}.wp-block-navigation__responsive-container-close svg,.wp-block-navigation__responsive-container-open svg{fill:currentColor;display:block;height:24px;pointer-events:none;width:24px}.wp-block-navigation__responsive-container-open{display:flex}.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open.wp-block-navigation__responsive-container-open{font-family:inherit;font-size:inherit;font-weight:inherit}@media (min-width:600px){.wp-block-navigation__responsive-container-open:not(.always-shown){display:none}}.wp-block-navigation__responsive-container-close{position:absolute;right:0;top:0;z-index:2}.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close{font-family:inherit;font-size:inherit;font-weight:inherit}.wp-block-navigation__responsive-close{width:100%}.has-modal-open .wp-block-navigation__responsive-close{margin-left:auto;margin-right:auto;max-width:var(--wp--style--global--wide-size,100%)}.wp-block-navigation__responsive-close:focus{outline:none}.is-menu-open .wp-block-navigation__responsive-close,.is-menu-open .wp-block-navigation__responsive-container-content,.is-menu-open .wp-block-navigation__responsive-dialog{box-sizing:border-box}.wp-block-navigation__responsive-dialog{position:relative}.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{margin-top:46px}@media (min-width:782px){.has-modal-open .admin-bar .is-menu-open .wp-block-navigation__responsive-dialog{margin-top:32px}}html.has-modal-open{overflow:hidden}
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/view-modal.asset.php b/wp-includes/blocks/navigation/view-modal.asset.php new file mode 100644 index 0000000..9438565 --- /dev/null +++ b/wp-includes/blocks/navigation/view-modal.asset.php @@ -0,0 +1 @@ +<?php return array('dependencies' => array(), 'version' => 'a145d0113e969f692877'); diff --git a/wp-includes/blocks/navigation/view-modal.min.asset.php b/wp-includes/blocks/navigation/view-modal.min.asset.php new file mode 100644 index 0000000..42722aa --- /dev/null +++ b/wp-includes/blocks/navigation/view-modal.min.asset.php @@ -0,0 +1 @@ +<?php return array('dependencies' => array(), 'version' => 'b478fa3cd1475dec97d3'); diff --git a/wp-includes/blocks/navigation/view.asset.php b/wp-includes/blocks/navigation/view.asset.php new file mode 100644 index 0000000..fbf69db --- /dev/null +++ b/wp-includes/blocks/navigation/view.asset.php @@ -0,0 +1 @@ +<?php return array('dependencies' => array(), 'version' => 'b3eba25769c9fe5ec0fa'); diff --git a/wp-includes/blocks/navigation/view.js b/wp-includes/blocks/navigation/view.js new file mode 100644 index 0000000..46b2c68 --- /dev/null +++ b/wp-includes/blocks/navigation/view.js @@ -0,0 +1,213 @@ +"use strict"; +(self["__WordPressPrivateInteractivityAPI__"] = self["__WordPressPrivateInteractivityAPI__"] || []).push([[3],{ + +/***/ 932: +/***/ (function(__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) { + +/* harmony import */ var _wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(754); +/** + * 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 openMenu = (store, menuOpenedOn) => { + const { + context, + selectors + } = store; + selectors.core.navigation.menuOpenedBy(store)[menuOpenedOn] = true; + if (context.core.navigation.type === 'overlay') { + // Add a `has-modal-open` class to the <html> root. + document.documentElement.classList.add('has-modal-open'); + } +}; +const closeMenu = (store, menuClosedOn) => { + const { + context, + selectors + } = store; + selectors.core.navigation.menuOpenedBy(store)[menuClosedOn] = false; + // Check if the menu is still open or not. + if (!selectors.core.navigation.isMenuOpen(store)) { + if (context.core.navigation.modal?.contains(window.document.activeElement)) { + context.core.navigation.previousFocus?.focus(); + } + context.core.navigation.modal = null; + context.core.navigation.previousFocus = null; + if (context.core.navigation.type === 'overlay') { + document.documentElement.classList.remove('has-modal-open'); + } + } +}; +(0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__/* .store */ .h)({ + effects: { + core: { + navigation: { + initMenu: store => { + const { + context, + selectors, + ref + } = store; + if (selectors.core.navigation.isMenuOpen(store)) { + const focusableElements = ref.querySelectorAll(focusableSelectors); + context.core.navigation.modal = ref; + context.core.navigation.firstFocusableElement = focusableElements[0]; + context.core.navigation.lastFocusableElement = focusableElements[focusableElements.length - 1]; + } + }, + focusFirstElement: store => { + const { + selectors, + ref + } = store; + if (selectors.core.navigation.isMenuOpen(store)) { + ref.querySelector('.wp-block-navigation-item > *:first-child').focus(); + } + } + } + } + }, + selectors: { + core: { + navigation: { + roleAttribute: store => { + const { + context, + selectors + } = store; + return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? 'dialog' : null; + }, + ariaModal: store => { + const { + context, + selectors + } = store; + return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? 'true' : null; + }, + ariaLabel: store => { + const { + context, + selectors + } = store; + return context.core.navigation.type === 'overlay' && selectors.core.navigation.isMenuOpen(store) ? context.core.navigation.ariaLabel : null; + }, + isMenuOpen: ({ + context + }) => + // The menu is opened if either `click`, `hover` or `focus` is true. + Object.values(context.core.navigation[context.core.navigation.type === 'overlay' ? 'overlayOpenedBy' : 'submenuOpenedBy']).filter(Boolean).length > 0, + menuOpenedBy: ({ + context + }) => context.core.navigation[context.core.navigation.type === 'overlay' ? 'overlayOpenedBy' : 'submenuOpenedBy'] + } + } + }, + actions: { + core: { + navigation: { + openMenuOnHover(store) { + const { + navigation + } = store.context.core; + if (navigation.type === 'submenu' && + // Only open on hover if the overlay is closed. + Object.values(navigation.overlayOpenedBy || {}).filter(Boolean).length === 0) openMenu(store, 'hover'); + }, + closeMenuOnHover(store) { + closeMenu(store, 'hover'); + }, + openMenuOnClick(store) { + const { + context, + ref + } = store; + context.core.navigation.previousFocus = ref; + openMenu(store, 'click'); + }, + closeMenuOnClick(store) { + closeMenu(store, 'click'); + closeMenu(store, 'focus'); + }, + openMenuOnFocus(store) { + openMenu(store, 'focus'); + }, + toggleMenuOnClick: store => { + const { + selectors, + context, + ref + } = store; + // 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 = selectors.core.navigation.menuOpenedBy(store); + if (menuOpenedBy.click || menuOpenedBy.focus) { + closeMenu(store, 'click'); + closeMenu(store, 'focus'); + } else { + context.core.navigation.previousFocus = ref; + openMenu(store, 'click'); + } + }, + handleMenuKeydown: store => { + const { + context, + selectors, + event + } = store; + if (selectors.core.navigation.menuOpenedBy(store).click) { + // If Escape close the menu. + if (event?.key === 'Escape') { + closeMenu(store, 'click'); + closeMenu(store, 'focus'); + return; + } + + // Trap focus if it is an overlay (main menu). + if (context.core.navigation.type === 'overlay' && event.key === 'Tab') { + // If shift + tab it change the direction. + if (event.shiftKey && window.document.activeElement === context.core.navigation.firstFocusableElement) { + event.preventDefault(); + context.core.navigation.lastFocusableElement.focus(); + } else if (!event.shiftKey && window.document.activeElement === context.core.navigation.lastFocusableElement) { + event.preventDefault(); + context.core.navigation.firstFocusableElement.focus(); + } + } + } + }, + handleMenuFocusout: store => { + const { + context, + event + } = store; + // 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 outsite 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 || !context.core.navigation.modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement) { + closeMenu(store, 'click'); + closeMenu(store, 'focus'); + } + } + } + } + } +}); + +/***/ }) + +}, +/******/ function(__webpack_require__) { // webpackRuntimeModules +/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } +/******/ var __webpack_exports__ = (__webpack_exec__(932)); +/******/ } +]);
\ No newline at end of file diff --git a/wp-includes/blocks/navigation/view.min.asset.php b/wp-includes/blocks/navigation/view.min.asset.php new file mode 100644 index 0000000..5675933 --- /dev/null +++ b/wp-includes/blocks/navigation/view.min.asset.php @@ -0,0 +1 @@ +<?php return array('dependencies' => array(), 'version' => 'e3d6f3216904b5b42831'); diff --git a/wp-includes/blocks/navigation/view.min.js b/wp-includes/blocks/navigation/view.min.js new file mode 100644 index 0000000..37f1ffd --- /dev/null +++ b/wp-includes/blocks/navigation/view.min.js @@ -0,0 +1 @@ +"use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[3],{932:function(e,n,o){var t=o(754);const a=["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 i=(e,n)=>{const{context:o,selectors:t}=e;t.core.navigation.menuOpenedBy(e)[n]=!0,"overlay"===o.core.navigation.type&&document.documentElement.classList.add("has-modal-open")},c=(e,n)=>{const{context:o,selectors:t}=e;t.core.navigation.menuOpenedBy(e)[n]=!1,t.core.navigation.isMenuOpen(e)||(o.core.navigation.modal?.contains(window.document.activeElement)&&o.core.navigation.previousFocus?.focus(),o.core.navigation.modal=null,o.core.navigation.previousFocus=null,"overlay"===o.core.navigation.type&&document.documentElement.classList.remove("has-modal-open"))};(0,t.h)({effects:{core:{navigation:{initMenu:e=>{const{context:n,selectors:o,ref:t}=e;if(o.core.navigation.isMenuOpen(e)){const e=t.querySelectorAll(a);n.core.navigation.modal=t,n.core.navigation.firstFocusableElement=e[0],n.core.navigation.lastFocusableElement=e[e.length-1]}},focusFirstElement:e=>{const{selectors:n,ref:o}=e;n.core.navigation.isMenuOpen(e)&&o.querySelector(".wp-block-navigation-item > *:first-child").focus()}}}},selectors:{core:{navigation:{roleAttribute:e=>{const{context:n,selectors:o}=e;return"overlay"===n.core.navigation.type&&o.core.navigation.isMenuOpen(e)?"dialog":null},ariaModal:e=>{const{context:n,selectors:o}=e;return"overlay"===n.core.navigation.type&&o.core.navigation.isMenuOpen(e)?"true":null},ariaLabel:e=>{const{context:n,selectors:o}=e;return"overlay"===n.core.navigation.type&&o.core.navigation.isMenuOpen(e)?n.core.navigation.ariaLabel:null},isMenuOpen:({context:e})=>Object.values(e.core.navigation["overlay"===e.core.navigation.type?"overlayOpenedBy":"submenuOpenedBy"]).filter(Boolean).length>0,menuOpenedBy:({context:e})=>e.core.navigation["overlay"===e.core.navigation.type?"overlayOpenedBy":"submenuOpenedBy"]}}},actions:{core:{navigation:{openMenuOnHover(e){const{navigation:n}=e.context.core;"submenu"===n.type&&0===Object.values(n.overlayOpenedBy||{}).filter(Boolean).length&&i(e,"hover")},closeMenuOnHover(e){c(e,"hover")},openMenuOnClick(e){const{context:n,ref:o}=e;n.core.navigation.previousFocus=o,i(e,"click")},closeMenuOnClick(e){c(e,"click"),c(e,"focus")},openMenuOnFocus(e){i(e,"focus")},toggleMenuOnClick:e=>{const{selectors:n,context:o,ref:t}=e;window.document.activeElement!==t&&t.focus();const a=n.core.navigation.menuOpenedBy(e);a.click||a.focus?(c(e,"click"),c(e,"focus")):(o.core.navigation.previousFocus=t,i(e,"click"))},handleMenuKeydown:e=>{const{context:n,selectors:o,event:t}=e;if(o.core.navigation.menuOpenedBy(e).click){if("Escape"===t?.key)return c(e,"click"),void c(e,"focus");"overlay"===n.core.navigation.type&&"Tab"===t.key&&(t.shiftKey&&window.document.activeElement===n.core.navigation.firstFocusableElement?(t.preventDefault(),n.core.navigation.lastFocusableElement.focus()):t.shiftKey||window.document.activeElement!==n.core.navigation.lastFocusableElement||(t.preventDefault(),n.core.navigation.firstFocusableElement.focus()))}},handleMenuFocusout:e=>{const{context:n,event:o}=e;(null===o.relatedTarget||!n.core.navigation.modal?.contains(o.relatedTarget)&&o.target!==window.document.activeElement)&&(c(e,"click"),c(e,"focus"))}}}}})}},function(e){var n;n=932,e(e.s=n)}]);
\ No newline at end of file |