<?php
/**
 * Mobile menu settings schema.
 *
 * Wording note: labels here are read by people who have never heard of a
 * breakpoint, a trigger or a viewport. Where a term is unavoidable the help
 * text explains it in the words someone would use to describe the problem,
 * not the words a developer would use to describe the fix.
 *
 * `ui.advanced` collapses a property into the "Fine tuning" section, so the
 * visible form stays down to the handful of decisions that actually matter.
 * The rule applied throughout: a setting is only visible by default when
 * leaving it alone would produce a menu somebody would want to change. Colour
 * and spacing knobs that inherit sensibly are all advanced.
 *
 * @package MenuVerse
 */

defined( 'ABSPATH' ) || exit;

return array(
	'type'       => 'object',
	'properties' => array(
		'menu'                  => array(
			'type'    => 'string',
			'default' => '',
			'pattern' => '^$|^[a-z][a-z0-9_]*:\d+$',
			'ui'      => array(
				'control' => 'menu-picker',
				'group'   => 'general',
				'label'   => __( 'Which menu to show', 'menuverse' ),
				'help'    => __( 'One of the menus you have already built. MenuVerse only displays it, so you carry on editing it where you always did.', 'menuverse' ),
			),
		),
		'auto_insert'           => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'general',
				'label'   => __( 'Show it on every page automatically', 'menuverse' ),
				'help'    => __( 'Puts the menu button at the top of every page for you.', 'menuverse' ),
			),
		),
		'breakpoint'            => array(
			'type'    => 'integer',
			'default' => 782,
			'minimum' => 320,
			'maximum' => 1600,
			'ui'      => array(
				'control' => 'range',
				'group'   => 'general',
				'unit'    => 'px',
				'label'   => __( 'Show the menu button on screens narrower than', 'menuverse' ),
				'help'    => __( 'On wider screens your normal theme menu shows instead. The default suits most phones and small tablets.', 'menuverse' ),
			),
		),
		'show_on'               => array(
			'type'    => 'string',
			'default' => 'all',
			'enum'    => array( 'all', 'specific', 'exclude' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'general',
				'label'   => __( 'Which pages it appears on', 'menuverse' ),
				'help'    => __( 'This applies to the automatic placement. A menu you place yourself, with the block or the shortcode, always shows.', 'menuverse' ),
				'options' => array(
					'all'      => __( 'Everywhere', 'menuverse' ),
					'specific' => __( 'Only some pages', 'menuverse' ),
					'exclude'  => __( 'Everywhere except', 'menuverse' ),
				),
			),
		),
		'show_on_pages'         => array(
			'type'    => 'array',
			'default' => array(),
			// Clamped at 0 rather than 1: an unrecognised or negative value
			// then lands on 0 and is dropped when the rules are read, instead
			// of being pulled up into a real page id and quietly targeting a
			// page nobody chose.
			'items'   => array(
				'type'    => 'integer',
				'minimum' => 0,
			),
			'ui'      => array(
				'control'  => 'post-picker-multi',
				'postType' => 'page',
				'group'    => 'general',
				'label'    => __( 'Show it only on these', 'menuverse' ),
				'showIf'   => array( 'show_on' => 'specific' ),
			),
		),
		'show_on_exclude_pages' => array(
			'type'    => 'array',
			'default' => array(),
			// Clamped at 0 for the same reason as the list above.
			'items'   => array(
				'type'    => 'integer',
				'minimum' => 0,
			),
			'ui'      => array(
				'control'  => 'post-picker-multi',
				'postType' => 'page',
				'group'    => 'general',
				'label'    => __( 'Hide it on these', 'menuverse' ),
				'showIf'   => array( 'show_on' => 'exclude' ),
			),
		),
		'hide_for_admins'       => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'general',
				'advanced' => true,
				'label'    => __( 'Hide it from administrators', 'menuverse' ),
				'help'     => __( 'Handy while you are still working on the site.', 'menuverse' ),
			),
		),
		'hide_selector'         => array(
			'type'      => 'string',
			'default'   => '',
			'maxLength' => 200,
			'ui'        => array(
				'control'     => 'text',
				'group'       => 'general',
				'advanced'    => true,
				'placeholder' => '.site-header nav',
				'label'       => __( 'Hide your theme’s own menu on small screens', 'menuverse' ),
				'help'        => __( 'Only needed if your theme’s menu still shows up next to this one. Enter the CSS selector of the menu to hide, for example .site-header nav. If you are not sure, leave this empty.', 'menuverse' ),
			),
		),

		'header_bar'            => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'header',
				'label'   => __( 'Put the button in a bar across the top', 'menuverse' ),
				'help'    => __( 'A strip along the top of the screen holding your logo and the menu button. Leave this off if your theme already has a header that works on phones.', 'menuverse' ),
			),
		),
		'header_brand'          => array(
			'type'    => 'string',
			'default' => 'logo',
			'enum'    => array( 'logo', 'title', 'custom', 'none' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'header',
				'label'   => __( 'What sits next to the button', 'menuverse' ),
				'help'    => __( 'Your logo is the one you already set under Appearance, so there is nothing to upload here. If you have not set one, the site name is used instead.', 'menuverse' ),
				'showIf'  => array( 'header_bar' => true ),
				'options' => array(
					'logo'   => __( 'Site logo', 'menuverse' ),
					'title'  => __( 'Site name', 'menuverse' ),
					'custom' => __( 'Your own words', 'menuverse' ),
					'none'   => __( 'Nothing', 'menuverse' ),
				),
			),
		),
		'header_brand_text'     => array(
			'type'      => 'string',
			'default'   => '',
			'maxLength' => 60,
			'ui'        => array(
				'control' => 'text',
				'group'   => 'header',
				'label'   => __( 'The words to show', 'menuverse' ),
				'showIf'  => array(
					'header_bar'   => true,
					'header_brand' => 'custom',
				),
			),
		),
		'header_trigger_side'   => array(
			'type'    => 'string',
			'default' => 'end',
			'enum'    => array( 'start', 'end' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'header',
				'label'   => __( 'Which side the button sits on', 'menuverse' ),
				'showIf'  => array( 'header_bar' => true ),
				'options' => array(
					'start' => __( 'Start edge', 'menuverse' ),
					'end'   => __( 'End edge', 'menuverse' ),
				),
			),
		),
		'header_sticky'         => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'header',
				'label'   => __( 'Keep the bar on screen while people scroll', 'menuverse' ),
				'showIf'  => array( 'header_bar' => true ),
			),
		),
		'header_hide_on_scroll' => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'header',
				'advanced' => true,
				'label'    => __( 'Slide the bar away when scrolling down', 'menuverse' ),
				'help'     => __( 'It comes back as soon as someone scrolls up. Gives long pages more room to read.', 'menuverse' ),
				'showIf'   => array(
					'header_bar'    => true,
					'header_sticky' => true,
				),
			),
		),
		'header_offset_page'    => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'header',
				'advanced' => true,
				'label'    => __( 'Push the page down so the bar does not cover it', 'menuverse' ),
				'help'     => __( 'Turn this off only if your theme already leaves a gap at the top.', 'menuverse' ),
				'showIf'   => array( 'header_bar' => true ),
			),
		),
		'header_height'         => array(
			'type'    => 'string',
			'format'  => 'css-size',
			'default' => '56px',
			'ui'      => array(
				'control'  => 'unit',
				'group'    => 'header',
				'advanced' => true,
				'label'    => __( 'How tall the bar is', 'menuverse' ),
				'token'    => '--menuverse-header-height',
				'showIf'   => array( 'header_bar' => true ),
			),
		),
		'header_brand_height'   => array(
			'type'    => 'string',
			'format'  => 'css-size',
			'default' => '28px',
			'ui'      => array(
				'control'  => 'unit',
				'group'    => 'header',
				'advanced' => true,
				'label'    => __( 'How tall the logo is', 'menuverse' ),
				'token'    => '--menuverse-header-brand-height',
				'showIf'   => array(
					'header_bar'   => true,
					'header_brand' => 'logo',
				),
			),
		),
		'header_background'     => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control' => 'color',
				'group'   => 'header',
				'label'   => __( 'Bar background', 'menuverse' ),
				'help'    => __( 'Leave empty to match the menu panel.', 'menuverse' ),
				'token'   => '--menuverse-header-background',
				'showIf'  => array( 'header_bar' => true ),
			),
		),
		'header_text'           => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control' => 'color',
				'group'   => 'header',
				'label'   => __( 'Bar text and icon colour', 'menuverse' ),
				'token'   => '--menuverse-header-text',
				'showIf'  => array( 'header_bar' => true ),
			),
		),
		'header_shadow'         => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'header',
				'advanced' => true,
				'label'    => __( 'Draw a line under the bar', 'menuverse' ),
				'showIf'   => array( 'header_bar' => true ),
			),
		),

		'trigger_icon'          => array(
			'type'    => 'string',
			'default' => 'bars',
			'enum'    => array( 'bars', 'bars-compact', 'bars-rounded', 'dots' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'trigger',
				'label'   => __( 'Button icon', 'menuverse' ),
				'help'    => __( 'Ignored while the button is set to fold into a cross, which draws its own lines.', 'menuverse' ),
				'showIf'  => array( 'trigger_animation' => 'none' ),
				'options' => array(
					'bars'         => __( 'Bars', 'menuverse' ),
					'bars-compact' => __( 'Compact', 'menuverse' ),
					'bars-rounded' => __( 'Rounded', 'menuverse' ),
					'dots'         => __( 'Dots', 'menuverse' ),
				),
			),
		),
		'trigger_animation'     => array(
			'type'    => 'string',
			'default' => 'squeeze',
			'enum'    => array( 'none', 'squeeze', 'spin', 'arrow' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'trigger',
				'label'   => __( 'What the button does when the menu opens', 'menuverse' ),
				'help'    => __( 'Turning the button into a cross tells people the same button closes the menu again. Visitors who have asked their device to reduce motion get the end state without the movement.', 'menuverse' ),
				'options' => array(
					'none'    => __( 'Stays put', 'menuverse' ),
					'squeeze' => __( 'Folds into a cross', 'menuverse' ),
					'spin'    => __( 'Spins into a cross', 'menuverse' ),
					'arrow'   => __( 'Turns into an arrow', 'menuverse' ),
				),
			),
		),
		'trigger_label'         => array(
			'type'      => 'string',
			'default'   => 'Menu',
			'maxLength' => 40,
			'ui'        => array(
				'control' => 'text',
				'group'   => 'trigger',
				'label'   => __( 'What the button is called', 'menuverse' ),
				'help'    => __( 'Screen readers announce this, so keep it even if you do not show it on screen.', 'menuverse' ),
			),
		),
		'trigger_show_label'    => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'trigger',
				'label'   => __( 'Show that word next to the icon', 'menuverse' ),
			),
		),
		'trigger_placement'     => array(
			'type'    => 'string',
			'default' => 'inline',
			'enum'    => array( 'inline', 'fixed-start', 'fixed-end' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'trigger',
				'label'   => __( 'Where the button sits', 'menuverse' ),
				'help'    => __( 'Pinned keeps it on screen while the page scrolls. Ignored while the top bar is switched on, because the bar already places it.', 'menuverse' ),
				'showIf'  => array( 'header_bar' => false ),
				'options' => array(
					'inline'      => __( 'Where it lands', 'menuverse' ),
					'fixed-start' => __( 'Pinned, start', 'menuverse' ),
					'fixed-end'   => __( 'Pinned, end', 'menuverse' ),
				),
			),
		),
		'trigger_size'          => array(
			'type'    => 'string',
			'format'  => 'css-size',
			'default' => '44px',
			'ui'      => array(
				'control'  => 'unit',
				'group'    => 'trigger',
				'advanced' => true,
				'label'    => __( 'Button size', 'menuverse' ),
				'help'     => __( 'Anything under 44px gets hard to tap accurately on a phone.', 'menuverse' ),
				'token'    => '--menuverse-trigger-size',
			),
		),
		'trigger_color'         => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control' => 'color',
				'group'   => 'trigger',
				'label'   => __( 'Icon colour', 'menuverse' ),
				'help'    => __( 'Leave empty to inherit your theme’s colour.', 'menuverse' ),
				'token'   => '--menuverse-trigger-color',
			),
		),
		'trigger_background'    => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control'  => 'color',
				'group'    => 'trigger',
				'advanced' => true,
				'label'    => __( 'Button background', 'menuverse' ),
				'token'    => '--menuverse-trigger-background',
			),
		),

		'panel_side'            => array(
			'type'    => 'string',
			'default' => 'start',
			'enum'    => array( 'start', 'end', 'fullscreen' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'panel',
				'label'   => __( 'Where the menu slides in from', 'menuverse' ),
				'options' => array(
					'start'      => __( 'Start edge', 'menuverse' ),
					'end'        => __( 'End edge', 'menuverse' ),
					'fullscreen' => __( 'Whole screen', 'menuverse' ),
				),
			),
		),
		'panel_motion'          => array(
			'type'    => 'string',
			'default' => 'over',
			'enum'    => array( 'over', 'push' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'panel',
				'label'   => __( 'What happens to the page behind it', 'menuverse' ),
				'help'    => __( 'Pushing the page across is the effect most phone apps use. It needs your theme to wrap its content in one element; if the page does not move, stay with covering it.', 'menuverse' ),
				'showIf'  => array( 'panel_side' => array( 'start', 'end' ) ),
				'options' => array(
					'over' => __( 'It is covered', 'menuverse' ),
					'push' => __( 'It slides across', 'menuverse' ),
				),
			),
		),
		'panel_width'           => array(
			'type'    => 'string',
			'format'  => 'css-size',
			'default' => '320px',
			'ui'      => array(
				'control' => 'unit',
				'group'   => 'panel',
				'label'   => __( 'How wide it opens', 'menuverse' ),
				'token'   => '--menuverse-panel-width',
			),
		),
		'panel_background'      => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control' => 'color',
				'group'   => 'panel',
				'label'   => __( 'Background colour', 'menuverse' ),
				'token'   => '--menuverse-panel-background',
			),
		),
		'panel_text'            => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control' => 'color',
				'group'   => 'panel',
				'label'   => __( 'Link colour', 'menuverse' ),
				'token'   => '--menuverse-panel-text',
			),
		),
		'panel_link_active'     => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control'  => 'color',
				'group'    => 'panel',
				'advanced' => true,
				'label'    => __( 'Colour when a link is tapped', 'menuverse' ),
				'help'     => __( 'Leave empty to use your accent colour.', 'menuverse' ),
				'token'    => '--menuverse-panel-link-active',
			),
		),
		'panel_current'         => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control'  => 'color',
				'group'    => 'panel',
				'advanced' => true,
				'label'    => __( 'Colour for the page someone is on', 'menuverse' ),
				'token'    => '--menuverse-panel-current',
			),
		),
		'panel_dividers'        => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'panel',
				'advanced' => true,
				'label'    => __( 'Draw a line between the links', 'menuverse' ),
			),
		),
		'overlay_color'         => array(
			'type'    => 'string',
			'format'  => 'color',
			'default' => '',
			'ui'      => array(
				'control'  => 'color',
				'group'    => 'panel',
				'advanced' => true,
				'label'    => __( 'Shading over the rest of the page', 'menuverse' ),
				'token'    => '--menuverse-overlay',
			),
		),
		'show_close'            => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'panel',
				'advanced' => true,
				'label'    => __( 'Show a close button', 'menuverse' ),
				'help'     => __( 'Tapping outside the menu and pressing Escape always close it, with or without this button.', 'menuverse' ),
			),
		),
		'animation'             => array(
			'type'    => 'string',
			'default' => 'slide',
			'enum'    => array( 'slide', 'fade', 'none' ),
			'ui'      => array(
				'control'  => 'segmented',
				'group'    => 'panel',
				'advanced' => true,
				'label'    => __( 'How it opens', 'menuverse' ),
				'help'     => __( 'Visitors who have asked their device to reduce motion always get the plain version.', 'menuverse' ),
				'options'  => array(
					'slide' => __( 'Slide', 'menuverse' ),
					'fade'  => __( 'Fade', 'menuverse' ),
					'none'  => __( 'Instant', 'menuverse' ),
				),
			),
		),

		'show_search'           => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'extras',
				'label'   => __( 'Put a search box in the menu', 'menuverse' ),
				'help'    => __( 'Searches this site, using the results page your theme already has.', 'menuverse' ),
			),
		),
		'search_placeholder'    => array(
			'type'      => 'string',
			'default'   => '',
			'maxLength' => 60,
			'ui'        => array(
				'control'     => 'text',
				'group'       => 'extras',
				'label'       => __( 'The greyed out words in the box', 'menuverse' ),
				'placeholder' => __( 'Search…', 'menuverse' ),
				'showIf'      => array( 'show_search' => true ),
			),
		),
		'social_links'          => array(
			'type'     => 'array',
			'default'  => array(),
			'minItems' => 0,
			// The row of icons stops reading as a row somewhere around eight,
			// and the dashboard says so. The storage ceiling is higher on
			// purpose: settings are sanitized on every read, so a lower number
			// here would throw away rows an existing site had already saved.
			'maxItems' => 16,
			'items'    => array(
				'type'       => 'object',
				'properties' => array(
					'icon'  => array(
						'type'    => 'string',
						'format'  => 'icon',
						'default' => 'link-2',
						'ui'      => array( 'label' => __( 'Icon', 'menuverse' ) ),
					),
					'url'   => array(
						'type'    => 'string',
						'format'  => 'url',
						'default' => '',
						'ui'      => array(
							'label'       => __( 'Where it goes', 'menuverse' ),
							'placeholder' => 'https://',
							'required'    => true,
						),
					),
					'label' => array(
						'type'      => 'string',
						'default'   => '',
						'maxLength' => 40,
						'ui'        => array(
							'label' => __( 'What it is called', 'menuverse' ),
							'help'  => __( 'Not shown on screen. Screen readers read it out, so name the service rather than saying “link”.', 'menuverse' ),
						),
					),
				),
			),
			'ui'       => array(
				'control'        => 'repeater',
				'group'          => 'extras',
				'label'          => __( 'Icons at the bottom of the menu', 'menuverse' ),
				'help'           => __( 'Your social profiles, or anything else worth a single tap. Leave the list empty to show none.', 'menuverse' ),
				'addLabel'       => __( 'Add an icon', 'menuverse' ),
				'titleKey'       => 'label',
				'iconKey'        => 'icon',
				'maxRecommended' => 8,
			),
		),
		'social_size'           => array(
			'type'    => 'string',
			'format'  => 'css-size',
			'default' => '22px',
			'ui'      => array(
				'control'  => 'unit',
				'group'    => 'extras',
				'advanced' => true,
				'label'    => __( 'How big those icons are', 'menuverse' ),
				'token'    => '--menuverse-social-size',
			),
		),
		'panel_html'            => array(
			'type'      => 'string',
			'format'    => 'html',
			'default'   => '',
			'maxLength' => 2000,
			'ui'        => array(
				'control'  => 'textarea',
				'group'    => 'extras',
				'advanced' => true,
				'label'    => __( 'Anything else to show under the menu', 'menuverse' ),
				'help'     => __( 'Opening hours, a phone number, a short note. Basic formatting is kept and anything unsafe is stripped out.', 'menuverse' ),
			),
		),

		'submenu_mode'          => array(
			'type'    => 'string',
			'default' => 'accordion',
			'enum'    => array( 'accordion', 'expanded' ),
			'ui'      => array(
				'control' => 'segmented',
				'group'   => 'submenus',
				'label'   => __( 'Menu items that have items under them', 'menuverse' ),
				'help'    => __( 'Fold away keeps the list short; always open shows everything at once.', 'menuverse' ),
				'options' => array(
					'accordion' => __( 'Fold away', 'menuverse' ),
					'expanded'  => __( 'Always open', 'menuverse' ),
				),
			),
		),
		'submenu_auto_current'  => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'submenus',
				'label'   => __( 'Open the section the visitor is already in', 'menuverse' ),
				'help'    => __( 'Someone reading a page three levels down sees where they are without tapping anything. This happens before the page finishes loading, so nothing jumps about.', 'menuverse' ),
				'showIf'  => array( 'submenu_mode' => 'accordion' ),
			),
		),
		'submenu_single'        => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'submenus',
				'advanced' => true,
				'label'    => __( 'Close one when another opens', 'menuverse' ),
			),
		),
		'submenu_indent'        => array(
			'type'    => 'string',
			'format'  => 'css-size',
			'default' => '16px',
			'ui'      => array(
				'control'  => 'unit',
				'group'    => 'submenus',
				'advanced' => true,
				'label'    => __( 'How far to indent them', 'menuverse' ),
				'token'    => '--menuverse-submenu-indent',
			),
		),
		'max_depth'             => array(
			'type'    => 'integer',
			'default' => 0,
			'minimum' => 0,
			'maximum' => 6,
			'ui'      => array(
				'control'  => 'range',
				'group'    => 'submenus',
				'advanced' => true,
				'label'    => __( 'How many levels deep to show', 'menuverse' ),
				'help'     => __( 'Zero shows every level of your menu, however deep it goes.', 'menuverse' ),
			),
		),

		'close_on_link'         => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'behaviour',
				'label'   => __( 'Close the menu when someone taps a link', 'menuverse' ),
				'help'    => __( 'Worth keeping on for links that jump within the same page, where nothing else would close it.', 'menuverse' ),
			),
		),
		'swipe_to_close'        => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control' => 'toggle',
				'group'   => 'behaviour',
				'label'   => __( 'Let people swipe the menu shut', 'menuverse' ),
				'help'    => __( 'A swipe back towards the edge it came from closes it, the way a phone app would.', 'menuverse' ),
			),
		),
		'close_on_scroll'       => array(
			'type'    => 'boolean',
			'default' => false,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'behaviour',
				'advanced' => true,
				'label'    => __( 'Close the menu if the page scrolls', 'menuverse' ),
				'help'     => __( 'Only takes effect when the page behind the menu is left scrollable.', 'menuverse' ),
			),
		),
		'scroll_lock'           => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'behaviour',
				'advanced' => true,
				'label'    => __( 'Stop the page scrolling behind the menu', 'menuverse' ),
				'help'     => __( 'Recommended. Without it, scrolling inside the menu can drag the page underneath.', 'menuverse' ),
			),
		),
		'admin_bar_offset'      => array(
			'type'    => 'boolean',
			'default' => true,
			'ui'      => array(
				'control'  => 'toggle',
				'group'    => 'behaviour',
				'advanced' => true,
				'label'    => __( 'Leave room for the WordPress toolbar', 'menuverse' ),
				'help'     => __( 'Only ever seen by people logged in to this site. Stops the black admin strip sitting on top of the menu.', 'menuverse' ),
			),
		),
	),
	'ui'         => array(
		'preview' => array(
			'viewport' => 360,
		),
		// The preset gallery draws a small picture of what each look produces,
		// and a bottom bar and a sliding panel are not the same picture. The
		// schema names the one to draw rather than the gallery guessing from
		// the module id, so a third party module gets to pick too.
		'swatch'  => 'panel',
		'presets' => array(
			array(
				'id'          => 'classic',
				'label'       => __( 'Classic slide-in', 'menuverse' ),
				'description' => __( 'A panel that slides in from the side. What most sites use.', 'menuverse' ),
				'category'    => __( 'Panel', 'menuverse' ),
				'values'      => array(
					'header_bar'         => false,
					'panel_side'         => 'start',
					'panel_motion'       => 'over',
					'panel_width'        => '320px',
					'animation'          => 'slide',
					'trigger_icon'       => 'bars',
					'trigger_animation'  => 'squeeze',
					'trigger_placement'  => 'inline',
					'trigger_show_label' => false,
					'submenu_mode'       => 'accordion',
				),
			),
			array(
				'id'          => 'header-bar',
				'label'       => __( 'App style top bar', 'menuverse' ),
				'description' => __( 'A bar across the top with your logo and the menu button, staying put as people scroll.', 'menuverse' ),
				'category'    => __( 'Top bar', 'menuverse' ),
				'values'      => array(
					'header_bar'          => true,
					'header_brand'        => 'logo',
					'header_trigger_side' => 'end',
					'header_sticky'       => true,
					'header_offset_page'  => true,
					'header_shadow'       => true,
					'panel_side'          => 'end',
					'panel_motion'        => 'over',
					'panel_width'         => '320px',
					'animation'           => 'slide',
					'trigger_animation'   => 'squeeze',
					'trigger_show_label'  => false,
					'submenu_mode'        => 'accordion',
				),
			),
			array(
				'id'          => 'fullscreen',
				'label'       => __( 'Fullscreen', 'menuverse' ),
				'description' => __( 'The menu takes over the whole screen. Good for short menus and bold designs.', 'menuverse' ),
				'category'    => __( 'Panel', 'menuverse' ),
				'values'      => array(
					'header_bar'         => false,
					'panel_side'         => 'fullscreen',
					'animation'          => 'fade',
					'trigger_icon'       => 'bars-rounded',
					'trigger_animation'  => 'spin',
					'trigger_placement'  => 'inline',
					'trigger_show_label' => false,
					'submenu_mode'       => 'expanded',
				),
			),
			array(
				'id'          => 'push',
				'label'       => __( 'Push the page across', 'menuverse' ),
				'description' => __( 'The page slides sideways to reveal the menu, the way a phone app does.', 'menuverse' ),
				'category'    => __( 'Panel', 'menuverse' ),
				'values'      => array(
					'header_bar'         => false,
					'panel_side'         => 'start',
					'panel_motion'       => 'push',
					'panel_width'        => '300px',
					'animation'          => 'slide',
					'trigger_icon'       => 'bars',
					'trigger_animation'  => 'arrow',
					'trigger_placement'  => 'inline',
					'trigger_show_label' => false,
					'submenu_mode'       => 'accordion',
				),
			),
			array(
				'id'          => 'floating',
				'label'       => __( 'Floating button', 'menuverse' ),
				'description' => __( 'A round button that stays on screen while people scroll.', 'menuverse' ),
				'category'    => __( 'Panel', 'menuverse' ),
				'values'      => array(
					'header_bar'         => false,
					'panel_side'         => 'end',
					'panel_motion'       => 'over',
					'panel_width'        => '300px',
					'animation'          => 'slide',
					'trigger_icon'       => 'bars-rounded',
					'trigger_animation'  => 'squeeze',
					'trigger_placement'  => 'fixed-end',
					'trigger_show_label' => false,
					'trigger_size'       => '52px',
					'submenu_mode'       => 'accordion',
				),
			),
		),
		'groups'  => array(
			'general'   => array(
				'label'       => __( 'The basics', 'menuverse' ),
				'description' => __( 'Which menu to show, and where it should appear.', 'menuverse' ),
				'order'       => 10,
			),

			/*
			 * Seven headings, but not seven steps. Groups sharing a `tab` id
			 * collapse into one step and keep their own headings inside it,
			 * which is what takes this module from eight steps to five —
			 * "the button and the bar it sits in" is one decision to a reader,
			 * and so is "the panel and everything in it", however many
			 * settings each turns out to hold.
			 */
			'header'    => array(
				'label'       => __( 'The bar across the top', 'menuverse' ),
				'description' => __( 'An optional strip holding your logo and the menu button. Skip this step if your theme’s own header already works on phones.', 'menuverse' ),
				'order'       => 20,
				'tab'         => 'opening',
				'tabLabel'    => __( 'The button', 'menuverse' ),
			),
			'trigger'   => array(
				'label'       => __( 'The menu button', 'menuverse' ),
				'description' => __( 'The button people tap to open the menu.', 'menuverse' ),
				'order'       => 30,
				'tab'         => 'opening',
				'tabLabel'    => __( 'The button', 'menuverse' ),
			),
			'panel'     => array(
				'label'       => __( 'The panel that opens', 'menuverse' ),
				'description' => __( 'How the menu itself looks once it is open.', 'menuverse' ),
				'order'       => 40,
				'tab'         => 'inside',
				'tabLabel'    => __( 'The panel', 'menuverse' ),
			),
			'extras'    => array(
				'label'       => __( 'Extras inside the menu', 'menuverse' ),
				'description' => __( 'A search box, a row of icons, and anything else worth putting under the links.', 'menuverse' ),
				'order'       => 50,
				'tab'         => 'inside',
				'tabLabel'    => __( 'The panel', 'menuverse' ),
			),
			'submenus'  => array(
				'label'       => __( 'Nested items', 'menuverse' ),
				'description' => __( 'Only relevant if your menu has items nested under other items.', 'menuverse' ),
				'order'       => 60,
				'tab'         => 'inside',
				'tabLabel'    => __( 'The panel', 'menuverse' ),
			),
			'behaviour' => array(
				'label'       => __( 'How it behaves', 'menuverse' ),
				'description' => __( 'What closes the menu, and how it gets along with the rest of the page.', 'menuverse' ),
				'order'       => 70,
			),
		),
	),
);
