@wordpress/customize-widgets 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/error-boundary/index.cjs +1 -1
- package/build/components/error-boundary/index.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -1
- package/build/components/more-menu/index.cjs +0 -1
- package/build/components/more-menu/index.cjs.map +1 -1
- package/build-module/components/error-boundary/index.mjs +2 -2
- package/build-module/components/error-boundary/index.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -1
- package/build-module/components/more-menu/index.mjs +0 -1
- package/build-module/components/more-menu/index.mjs.map +1 -1
- package/build-style/style-rtl.css +23 -5
- package/build-style/style.css +23 -5
- package/package.json +27 -27
- package/src/components/error-boundary/index.jsx +2 -2
- package/src/components/header/style.scss +16 -5
- package/src/components/inserter/style.scss +8 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +1 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
- package/src/components/more-menu/index.jsx +0 -1
|
@@ -118,7 +118,7 @@ var ErrorBoundary = class extends _wordpress_element.Component {
|
|
|
118
118
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_ui.Notice.Actions, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, {
|
|
119
119
|
variant: "solid",
|
|
120
120
|
text: () => getErrorReport(error, componentStack),
|
|
121
|
-
children: (0, _wordpress_i18n.
|
|
121
|
+
children: (0, _wordpress_i18n._x)("Copy error", "button label")
|
|
122
122
|
}) })
|
|
123
123
|
]
|
|
124
124
|
}), globalThis.SCRIPT_DEBUG ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorDetails, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["__","useCopyToClipboard","Notice","Stack","Text","CollapsibleCard","Card","Component"],"sources":["../../../src/components/error-boundary/index.jsx"],"sourcesContent":["import { Component } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\nimport { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction getErrorNotice() {\n\treturn {\n\t\ttitle: __( 'The editor has crashed' ),\n\t\tdescription: __(\n\t\t\t'An unknown error occurred. Reload your browser to try again, or copy the error to report the problem or search.'\n\t\t),\n\t};\n}\n\n// A boundary catches whatever was thrown, which is not always an `Error`.\nfunction getErrorName( error ) {\n\treturn ( error instanceof Error && error.name ) || 'Error';\n}\n\nfunction getErrorMessage( error ) {\n\tif ( typeof error === 'string' && error ) {\n\t\treturn error;\n\t}\n\n\tif ( typeof error?.message === 'string' && error.message ) {\n\t\treturn error.message;\n\t}\n\n\treturn 'An unknown error occurred.';\n}\n\n// The sections of the report, shared by the copied Markdown and the details\n// panel so that the two cannot drift apart. Deliberately untranslated: both\n// are developer-facing, and the report is pasted into a bug report.\nfunction getErrorSections( error, componentStack ) {\n\tconst sections = [\n\t\t{ label: getErrorName( error ), content: getErrorMessage( error ) },\n\t];\n\n\tif ( error?.stack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Stack',\n\t\t\tcontent: error.stack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tif ( componentStack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Component stack',\n\t\t\tcontent: componentStack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tsections.push( {\n\t\tlabel: 'Environment',\n\t\tcontent: `User agent: ${ window.navigator.userAgent }`,\n\t\tpreformatted: true,\n\t} );\n\n\treturn sections;\n}\n\n// Markdown, so the report stays readable as plain text and renders when pasted\n// into a bug report.\nfunction getErrorReport( error, componentStack ) {\n\tconst sections = getErrorSections( error, componentStack ).map(\n\t\t( { label, content, preformatted } ) =>\n\t\t\t`**${ label }**\\n\\n${\n\t\t\t\tpreformatted ? `\\`\\`\\`\\n${ content }\\n\\`\\`\\`` : content\n\t\t\t}`\n\t);\n\n\treturn [ '### Error report', ...sections ].join( '\\n\\n' );\n}\n\nfunction CopyButton( { text, children, variant = 'outline' } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Notice.ActionButton variant={ variant } ref={ ref }>\n\t\t\t{ children }\n\t\t</Notice.ActionButton>\n\t);\n}\n\nfunction ErrorReport( { error, componentStack } ) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"customize-widgets-error-boundary__report\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"md\"\n\t\t>\n\t\t\t{ getErrorSections( error, componentStack ).map(\n\t\t\t\t( { label, content } ) => (\n\t\t\t\t\t<Stack key={ label } direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t<Text variant=\"heading-md\">{ label }</Text>\n\t\t\t\t\t\t<pre className=\"customize-widgets-error-boundary__report-section\">\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</Stack>\n\t\t\t\t)\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n\nfunction ErrorDetails( { error, componentStack } ) {\n\treturn (\n\t\t<CollapsibleCard.Root className=\"customize-widgets-error-boundary__details\">\n\t\t\t<CollapsibleCard.Header>\n\t\t\t\t<Card.Title>{ __( 'Error details' ) }</Card.Title>\n\t\t\t</CollapsibleCard.Header>\n\t\t\t<CollapsibleCard.Content>\n\t\t\t\t<ErrorReport\n\t\t\t\t\terror={ error }\n\t\t\t\t\tcomponentStack={ componentStack }\n\t\t\t\t/>\n\t\t\t</CollapsibleCard.Content>\n\t\t</CollapsibleCard.Root>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t\tcomponentStack: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error, errorInfo ) {\n\t\tconst { title, description } = getErrorNotice();\n\t\tspeak( `${ title }. ${ description }`, 'assertive' );\n\t\tthis.setState( { componentStack: errorInfo?.componentStack } );\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error, errorInfo );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error, componentStack } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst { title, description } = getErrorNotice();\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t<Notice.Root intent=\"error\">\n\t\t\t\t\t<Notice.Title>{ title }</Notice.Title>\n\t\t\t\t\t<Notice.Description>{ description }</Notice.Description>\n\t\t\t\t\t<Notice.Actions>\n\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\t\ttext={ () =>\n\t\t\t\t\t\t\t\tgetErrorReport( error, componentStack )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__","useCopyToClipboard","Notice","Stack","Text","CollapsibleCard","Card","Component","_x"],"sources":["../../../src/components/error-boundary/index.jsx"],"sourcesContent":["import { Component } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { __, _x } from '@wordpress/i18n';\nimport { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction getErrorNotice() {\n\treturn {\n\t\ttitle: __( 'The editor has crashed' ),\n\t\tdescription: __(\n\t\t\t'An unknown error occurred. Reload your browser to try again, or copy the error to report the problem or search.'\n\t\t),\n\t};\n}\n\n// A boundary catches whatever was thrown, which is not always an `Error`.\nfunction getErrorName( error ) {\n\treturn ( error instanceof Error && error.name ) || 'Error';\n}\n\nfunction getErrorMessage( error ) {\n\tif ( typeof error === 'string' && error ) {\n\t\treturn error;\n\t}\n\n\tif ( typeof error?.message === 'string' && error.message ) {\n\t\treturn error.message;\n\t}\n\n\treturn 'An unknown error occurred.';\n}\n\n// The sections of the report, shared by the copied Markdown and the details\n// panel so that the two cannot drift apart. Deliberately untranslated: both\n// are developer-facing, and the report is pasted into a bug report.\nfunction getErrorSections( error, componentStack ) {\n\tconst sections = [\n\t\t{ label: getErrorName( error ), content: getErrorMessage( error ) },\n\t];\n\n\tif ( error?.stack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Stack',\n\t\t\tcontent: error.stack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tif ( componentStack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Component stack',\n\t\t\tcontent: componentStack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tsections.push( {\n\t\tlabel: 'Environment',\n\t\tcontent: `User agent: ${ window.navigator.userAgent }`,\n\t\tpreformatted: true,\n\t} );\n\n\treturn sections;\n}\n\n// Markdown, so the report stays readable as plain text and renders when pasted\n// into a bug report.\nfunction getErrorReport( error, componentStack ) {\n\tconst sections = getErrorSections( error, componentStack ).map(\n\t\t( { label, content, preformatted } ) =>\n\t\t\t`**${ label }**\\n\\n${\n\t\t\t\tpreformatted ? `\\`\\`\\`\\n${ content }\\n\\`\\`\\`` : content\n\t\t\t}`\n\t);\n\n\treturn [ '### Error report', ...sections ].join( '\\n\\n' );\n}\n\nfunction CopyButton( { text, children, variant = 'outline' } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Notice.ActionButton variant={ variant } ref={ ref }>\n\t\t\t{ children }\n\t\t</Notice.ActionButton>\n\t);\n}\n\nfunction ErrorReport( { error, componentStack } ) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"customize-widgets-error-boundary__report\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"md\"\n\t\t>\n\t\t\t{ getErrorSections( error, componentStack ).map(\n\t\t\t\t( { label, content } ) => (\n\t\t\t\t\t<Stack key={ label } direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t<Text variant=\"heading-md\">{ label }</Text>\n\t\t\t\t\t\t<pre className=\"customize-widgets-error-boundary__report-section\">\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</Stack>\n\t\t\t\t)\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n\nfunction ErrorDetails( { error, componentStack } ) {\n\treturn (\n\t\t<CollapsibleCard.Root className=\"customize-widgets-error-boundary__details\">\n\t\t\t<CollapsibleCard.Header>\n\t\t\t\t<Card.Title>{ __( 'Error details' ) }</Card.Title>\n\t\t\t</CollapsibleCard.Header>\n\t\t\t<CollapsibleCard.Content>\n\t\t\t\t<ErrorReport\n\t\t\t\t\terror={ error }\n\t\t\t\t\tcomponentStack={ componentStack }\n\t\t\t\t/>\n\t\t\t</CollapsibleCard.Content>\n\t\t</CollapsibleCard.Root>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t\tcomponentStack: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error, errorInfo ) {\n\t\tconst { title, description } = getErrorNotice();\n\t\tspeak( `${ title }. ${ description }`, 'assertive' );\n\t\tthis.setState( { componentStack: errorInfo?.componentStack } );\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error, errorInfo );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error, componentStack } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst { title, description } = getErrorNotice();\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t<Notice.Root intent=\"error\">\n\t\t\t\t\t<Notice.Title>{ title }</Notice.Title>\n\t\t\t\t\t<Notice.Description>{ description }</Notice.Description>\n\t\t\t\t\t<Notice.Actions>\n\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\t\ttext={ () =>\n\t\t\t\t\t\t\t\tgetErrorReport( error, componentStack )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Copy error', 'button label' ) }\n\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t</Notice.Actions>\n\t\t\t\t</Notice.Root>\n\t\t\t\t{ globalThis.SCRIPT_DEBUG ? (\n\t\t\t\t\t<ErrorDetails\n\t\t\t\t\t\terror={ error }\n\t\t\t\t\t\tcomponentStack={ componentStack }\n\t\t\t\t\t/>\n\t\t\t\t) : null }\n\t\t\t</Stack>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,SAAS,iBAAiB;CACzB,OAAO;EACN,QAAA,GAAOA,gBAAAA,GAAAA,CAAI,wBAAyB;EACpC,cAAA,GAAaA,gBAAAA,GAAAA,CACZ,iHACD;CACD;AACD;AAGA,SAAS,aAAc,OAAQ;CAC9B,OAAS,iBAAiB,SAAS,MAAM,QAAU;AACpD;AAEA,SAAS,gBAAiB,OAAQ;CACjC,IAAK,OAAO,UAAU,YAAY,OACjC,OAAO;CAGR,IAAK,OAAO,OAAO,YAAY,YAAY,MAAM,SAChD,OAAO,MAAM;CAGd,OAAO;AACR;AAKA,SAAS,iBAAkB,OAAO,gBAAiB;CAClD,MAAM,WAAW,CAChB;EAAE,OAAO,aAAc,KAAM;EAAG,SAAS,gBAAiB,KAAM;CAAE,CACn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A,kBAAA,IAAA,CAACA,cAAAA,OAAO,OAAR,EAAA,UAAgB,MAAqB,CAAA;KACrC,iBAAA,GAAA,kBAAA,IAAA,CAACA,cAAAA,OAAO,aAAR,EAAA,UAAsB,YAAiC,CAAA;KACvD,iBAAA,GAAA,kBAAA,IAAA,CAACA,cAAAA,OAAO,SAAR,EAAA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,YAAD;MACC,SAAQ;MACR,YACC,eAAgB,OAAO,cAAe;MAGrCM,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,cAAc,cAAe;KACxB,CAAA,EACG,CAAA;IACJ;GACX,CAAA,GAAA,WAAW,eACZ,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;IACS;IACS;GACjB,CAAA,IACE,IACE;;CAET;AACD"}
|
|
@@ -12,6 +12,7 @@ function KeyCombination({ keyCombination, forceAriaLabel }) {
|
|
|
12
12
|
const ariaLabel = keyCombination.modifier ? _wordpress_keycodes.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
13
13
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
|
|
14
14
|
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
15
|
+
dir: "ltr",
|
|
15
16
|
"aria-label": forceAriaLabel || ariaLabel,
|
|
16
17
|
children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
17
18
|
if (character === "+") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_element.Fragment, { children: character }, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcut.cjs","names":["displayShortcutList","shortcutAriaLabel","Fragment"],"sources":["../../../src/components/keyboard-shortcut-help-modal/shortcut.jsx"],"sourcesContent":["import { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }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"shortcut.cjs","names":["displayShortcutList","shortcutAriaLabel","Fragment"],"sources":["../../../src/components/keyboard-shortcut-help-modal/shortcut.jsx"],"sourcesContent":["import { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\tdir=\"ltr\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;;;;;;AAGA,SAAS,eAAgB,EAAE,gBAAgB,kBAAmB;CAC7D,MAAM,WAAW,eAAe,WAC7BA,oBAAAA,oBAAqB,eAAe,SAAU,CAC9C,eAAe,SAChB,IACC,eAAe;CAClB,MAAM,YAAY,eAAe,WAC9BC,oBAAAA,kBAAmB,eAAe,SAAU,CAC5C,eAAe,SAChB,IACC,eAAe;CAElB,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACC,WAAU;EACV,KAAI;EACJ,cAAa,kBAAkB;EAE3B,WAAA,MAAM,QAAS,QAAS,IAAI,WAAW,CAAE,QAAS,EAAA,CAAI,KACvD,WAAW,UAAW;GACvB,IAAK,cAAc,KAClB,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,UAAD,EAAA,UAA0B,UAAqB,GAA/B,KAA+B;GAGvD,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAEC,WAAU;IAER,UAAA;GACE,GAJE,KAIF;EAEP,CACD;CACI,CAAA;AAEP;AAEA,SAAS,SAAU,EAAE,aAAa,gBAAgB,UAAU,CAAC,GAAG,aAAc;CAC7E,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACZ,UAAA;CACE,CAAA,GACL,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;GACkB;GACjB,gBAAiB;EACjB,CAAA,GACC,QAAQ,KAAO,OAAO,UACvB,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD;GACC,gBAAiB;GACjB,gBAAiB;EAEjB,GADM,KACN,CACA,CACE;CACJ,CAAA,CAAA,EAAA,CAAA;AAEJ"}
|
|
@@ -84,7 +84,6 @@ function MoreMenu() {
|
|
|
84
84
|
icon: _wordpress_icons.external,
|
|
85
85
|
href: (0, _wordpress_i18n.__)("https://wordpress.org/documentation/article/block-based-widgets-editor/"),
|
|
86
86
|
target: "_blank",
|
|
87
|
-
rel: "noopener",
|
|
88
87
|
children: [(0, _wordpress_i18n.__)("Help"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_ui.VisuallyHidden, {
|
|
89
88
|
render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {}),
|
|
90
89
|
children: (0, _wordpress_i18n.__)("(opens in a new tab)")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useState","useDispatch","preferencesStore","ToolbarDropdownMenu","moreVertical","__","MenuGroup","_x","PreferenceToggleMenuItem","MenuItem","displayShortcut","external","VisuallyHidden","KeyboardShortcutHelpModal"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useState","useDispatch","preferencesStore","ToolbarDropdownMenu","moreVertical","__","MenuGroup","_x","PreferenceToggleMenuItem","MenuItem","displayShortcut","external","VisuallyHidden","KeyboardShortcutHelpModal"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ToolbarDropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAwB,WAAW;CAClC,MAAM,CACL,gCACA,uCAAA,GACGA,mBAAAA,SAAAA,CAAU,KAAM;CACpB,MAAM,qCACL,mCAAoC,CAAE,8BAA+B;CAEtE,CAAA,GAAA,8BAAA,YAAA,CACC,6CACA,4BACD;CAEA,MAAM,EAAE,YAAA,GAAWC,gBAAAA,YAAAA,CAAaC,uBAAAA,KAAiB;CAEjD,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA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A,gBAAAA,GAAAA,CAAI,MAAO,GACb,iBAAA,GAAA,kBAAA,IAAA,CAACO,cAAAA,gBAAD;OAAgB,QAAS,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,CAAO,CAAA;OAG9BP,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,sBAAuB;MAEb,CAAA,CACP;;IACA;;GACX,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;IAAW,QAAA,GAAQD,gBAAAA,GAAAA,CAAI,aAAc;IACpC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACG,uBAAAA,0BAAD;KACC,OAAM;KACN,MAAK;KACL,QAAA,GAAQH,gBAAAA,GAAAA,CACP,kCACD;KACA,OAAA,GAAOA,gBAAAA,GAAAA,CACN,iEACD;KACA,mBAAA,GAAmBA,gBAAAA,GAAAA,CAClB,4CACD;KACA,qBAAA,GAAqBA,gBAAAA,GAAAA,CACpB,8CACD;IACA,CAAA;GACS,CAAA;EACV,EAAA,CAAA;CAEiB,CAAA,GACrB,iBAAA,GAAA,kBAAA,IAAA,CAACQ,0CAAAA,SAAD;EACC,eAAgB;EAChB,aAAc;CACd,CAAA,CACA,EAAA,CAAA;AAEJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from "@wordpress/element";
|
|
2
2
|
import { speak } from "@wordpress/a11y";
|
|
3
|
-
import { __ } from "@wordpress/i18n";
|
|
3
|
+
import { __, _x } from "@wordpress/i18n";
|
|
4
4
|
import { Card, CollapsibleCard, Notice, Stack, Text } from "@wordpress/ui";
|
|
5
5
|
import { useCopyToClipboard } from "@wordpress/compose";
|
|
6
6
|
import { doAction } from "@wordpress/hooks";
|
|
@@ -113,7 +113,7 @@ var ErrorBoundary = class extends Component {
|
|
|
113
113
|
/* @__PURE__ */ jsx(Notice.Actions, { children: /* @__PURE__ */ jsx(CopyButton, {
|
|
114
114
|
variant: "solid",
|
|
115
115
|
text: () => getErrorReport(error, componentStack),
|
|
116
|
-
children:
|
|
116
|
+
children: _x("Copy error", "button label")
|
|
117
117
|
}) })
|
|
118
118
|
]
|
|
119
119
|
}), globalThis.SCRIPT_DEBUG ? /* @__PURE__ */ jsx(ErrorDetails, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/error-boundary/index.jsx"],"sourcesContent":["import { Component } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\nimport { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction getErrorNotice() {\n\treturn {\n\t\ttitle: __( 'The editor has crashed' ),\n\t\tdescription: __(\n\t\t\t'An unknown error occurred. Reload your browser to try again, or copy the error to report the problem or search.'\n\t\t),\n\t};\n}\n\n// A boundary catches whatever was thrown, which is not always an `Error`.\nfunction getErrorName( error ) {\n\treturn ( error instanceof Error && error.name ) || 'Error';\n}\n\nfunction getErrorMessage( error ) {\n\tif ( typeof error === 'string' && error ) {\n\t\treturn error;\n\t}\n\n\tif ( typeof error?.message === 'string' && error.message ) {\n\t\treturn error.message;\n\t}\n\n\treturn 'An unknown error occurred.';\n}\n\n// The sections of the report, shared by the copied Markdown and the details\n// panel so that the two cannot drift apart. Deliberately untranslated: both\n// are developer-facing, and the report is pasted into a bug report.\nfunction getErrorSections( error, componentStack ) {\n\tconst sections = [\n\t\t{ label: getErrorName( error ), content: getErrorMessage( error ) },\n\t];\n\n\tif ( error?.stack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Stack',\n\t\t\tcontent: error.stack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tif ( componentStack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Component stack',\n\t\t\tcontent: componentStack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tsections.push( {\n\t\tlabel: 'Environment',\n\t\tcontent: `User agent: ${ window.navigator.userAgent }`,\n\t\tpreformatted: true,\n\t} );\n\n\treturn sections;\n}\n\n// Markdown, so the report stays readable as plain text and renders when pasted\n// into a bug report.\nfunction getErrorReport( error, componentStack ) {\n\tconst sections = getErrorSections( error, componentStack ).map(\n\t\t( { label, content, preformatted } ) =>\n\t\t\t`**${ label }**\\n\\n${\n\t\t\t\tpreformatted ? `\\`\\`\\`\\n${ content }\\n\\`\\`\\`` : content\n\t\t\t}`\n\t);\n\n\treturn [ '### Error report', ...sections ].join( '\\n\\n' );\n}\n\nfunction CopyButton( { text, children, variant = 'outline' } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Notice.ActionButton variant={ variant } ref={ ref }>\n\t\t\t{ children }\n\t\t</Notice.ActionButton>\n\t);\n}\n\nfunction ErrorReport( { error, componentStack } ) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"customize-widgets-error-boundary__report\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"md\"\n\t\t>\n\t\t\t{ getErrorSections( error, componentStack ).map(\n\t\t\t\t( { label, content } ) => (\n\t\t\t\t\t<Stack key={ label } direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t<Text variant=\"heading-md\">{ label }</Text>\n\t\t\t\t\t\t<pre className=\"customize-widgets-error-boundary__report-section\">\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</Stack>\n\t\t\t\t)\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n\nfunction ErrorDetails( { error, componentStack } ) {\n\treturn (\n\t\t<CollapsibleCard.Root className=\"customize-widgets-error-boundary__details\">\n\t\t\t<CollapsibleCard.Header>\n\t\t\t\t<Card.Title>{ __( 'Error details' ) }</Card.Title>\n\t\t\t</CollapsibleCard.Header>\n\t\t\t<CollapsibleCard.Content>\n\t\t\t\t<ErrorReport\n\t\t\t\t\terror={ error }\n\t\t\t\t\tcomponentStack={ componentStack }\n\t\t\t\t/>\n\t\t\t</CollapsibleCard.Content>\n\t\t</CollapsibleCard.Root>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t\tcomponentStack: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error, errorInfo ) {\n\t\tconst { title, description } = getErrorNotice();\n\t\tspeak( `${ title }. ${ description }`, 'assertive' );\n\t\tthis.setState( { componentStack: errorInfo?.componentStack } );\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error, errorInfo );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error, componentStack } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst { title, description } = getErrorNotice();\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t<Notice.Root intent=\"error\">\n\t\t\t\t\t<Notice.Title>{ title }</Notice.Title>\n\t\t\t\t\t<Notice.Description>{ description }</Notice.Description>\n\t\t\t\t\t<Notice.Actions>\n\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\t\ttext={ () =>\n\t\t\t\t\t\t\t\tgetErrorReport( error, componentStack )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/error-boundary/index.jsx"],"sourcesContent":["import { Component } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { __, _x } from '@wordpress/i18n';\nimport { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction getErrorNotice() {\n\treturn {\n\t\ttitle: __( 'The editor has crashed' ),\n\t\tdescription: __(\n\t\t\t'An unknown error occurred. Reload your browser to try again, or copy the error to report the problem or search.'\n\t\t),\n\t};\n}\n\n// A boundary catches whatever was thrown, which is not always an `Error`.\nfunction getErrorName( error ) {\n\treturn ( error instanceof Error && error.name ) || 'Error';\n}\n\nfunction getErrorMessage( error ) {\n\tif ( typeof error === 'string' && error ) {\n\t\treturn error;\n\t}\n\n\tif ( typeof error?.message === 'string' && error.message ) {\n\t\treturn error.message;\n\t}\n\n\treturn 'An unknown error occurred.';\n}\n\n// The sections of the report, shared by the copied Markdown and the details\n// panel so that the two cannot drift apart. Deliberately untranslated: both\n// are developer-facing, and the report is pasted into a bug report.\nfunction getErrorSections( error, componentStack ) {\n\tconst sections = [\n\t\t{ label: getErrorName( error ), content: getErrorMessage( error ) },\n\t];\n\n\tif ( error?.stack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Stack',\n\t\t\tcontent: error.stack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tif ( componentStack ) {\n\t\tsections.push( {\n\t\t\tlabel: 'Component stack',\n\t\t\tcontent: componentStack.trim(),\n\t\t\tpreformatted: true,\n\t\t} );\n\t}\n\n\tsections.push( {\n\t\tlabel: 'Environment',\n\t\tcontent: `User agent: ${ window.navigator.userAgent }`,\n\t\tpreformatted: true,\n\t} );\n\n\treturn sections;\n}\n\n// Markdown, so the report stays readable as plain text and renders when pasted\n// into a bug report.\nfunction getErrorReport( error, componentStack ) {\n\tconst sections = getErrorSections( error, componentStack ).map(\n\t\t( { label, content, preformatted } ) =>\n\t\t\t`**${ label }**\\n\\n${\n\t\t\t\tpreformatted ? `\\`\\`\\`\\n${ content }\\n\\`\\`\\`` : content\n\t\t\t}`\n\t);\n\n\treturn [ '### Error report', ...sections ].join( '\\n\\n' );\n}\n\nfunction CopyButton( { text, children, variant = 'outline' } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Notice.ActionButton variant={ variant } ref={ ref }>\n\t\t\t{ children }\n\t\t</Notice.ActionButton>\n\t);\n}\n\nfunction ErrorReport( { error, componentStack } ) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"customize-widgets-error-boundary__report\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"md\"\n\t\t>\n\t\t\t{ getErrorSections( error, componentStack ).map(\n\t\t\t\t( { label, content } ) => (\n\t\t\t\t\t<Stack key={ label } direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t<Text variant=\"heading-md\">{ label }</Text>\n\t\t\t\t\t\t<pre className=\"customize-widgets-error-boundary__report-section\">\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</Stack>\n\t\t\t\t)\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n\nfunction ErrorDetails( { error, componentStack } ) {\n\treturn (\n\t\t<CollapsibleCard.Root className=\"customize-widgets-error-boundary__details\">\n\t\t\t<CollapsibleCard.Header>\n\t\t\t\t<Card.Title>{ __( 'Error details' ) }</Card.Title>\n\t\t\t</CollapsibleCard.Header>\n\t\t\t<CollapsibleCard.Content>\n\t\t\t\t<ErrorReport\n\t\t\t\t\terror={ error }\n\t\t\t\t\tcomponentStack={ componentStack }\n\t\t\t\t/>\n\t\t\t</CollapsibleCard.Content>\n\t\t</CollapsibleCard.Root>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t\tcomponentStack: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error, errorInfo ) {\n\t\tconst { title, description } = getErrorNotice();\n\t\tspeak( `${ title }. ${ description }`, 'assertive' );\n\t\tthis.setState( { componentStack: errorInfo?.componentStack } );\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error, errorInfo );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error, componentStack } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst { title, description } = getErrorNotice();\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap=\"lg\"\n\t\t\t>\n\t\t\t\t<Notice.Root intent=\"error\">\n\t\t\t\t\t<Notice.Title>{ title }</Notice.Title>\n\t\t\t\t\t<Notice.Description>{ description }</Notice.Description>\n\t\t\t\t\t<Notice.Actions>\n\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\t\ttext={ () =>\n\t\t\t\t\t\t\t\tgetErrorReport( error, componentStack )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Copy error', 'button label' ) }\n\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t</Notice.Actions>\n\t\t\t\t</Notice.Root>\n\t\t\t\t{ globalThis.SCRIPT_DEBUG ? (\n\t\t\t\t\t<ErrorDetails\n\t\t\t\t\t\terror={ error }\n\t\t\t\t\t\tcomponentStack={ componentStack }\n\t\t\t\t\t/>\n\t\t\t\t) : null }\n\t\t\t</Stack>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;AAOA,SAAS,iBAAiB;CACzB,OAAO;EACN,OAAO,GAAI,wBAAyB;EACpC,aAAa,GACZ,iHACD;CACD;AACD;AAGA,SAAS,aAAc,OAAQ;CAC9B,OAAS,iBAAiB,SAAS,MAAM,QAAU;AACpD;AAEA,SAAS,gBAAiB,OAAQ;CACjC,IAAK,OAAO,UAAU,YAAY,OACjC,OAAO;CAGR,IAAK,OAAO,OAAO,YAAY,YAAY,MAAM,SAChD,OAAO,MAAM;CAGd,OAAO;AACR;AAKA,SAAS,iBAAkB,OAAO,gBAAiB;CAClD,MAAM,WAAW,CAChB;EAAE,OAAO,aAAc,KAAM;EAAG,SAAS,gBAAiB,K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AA,EAC1B,CAAA,GACxB,oBAAC,gBAAgB,SAAjB,EAAA,UACC,oBAAC,aAAD;GACS;GACS;EACjB,CAAA,EACuB,CAAA,CACJ;;AAExB;AAEA,IAAqB,gBAArB,cAA2C,UAAU;CACpD,cAAc;EACb,MAAO,GAAG,SAAU;EAEpB,KAAK,QAAQ;GACZ,OAAO;GACP,gBAAgB;EACjB;CACD;CAEA,kBAAmB,OAAO,WAAY;EACrC,MAAM,EAAE,OAAO,gBAAgB,eAAe;EAC9C,MAAO,GAAI,MAAO,IAAK,eAAgB,WAAY;EACnD,KAAK,SAAU,EAAE,gBAAgB,WAAW,eAAe,CAAE;EAC7D,SAAU,oCAAoC,OAAO,SAAU;CAChE;CAEA,OAAO,yBAA0B,OAAQ;EACxC,OAAO,EAAE,MAAM;CAChB;CAEA,SAAS;EACR,MAAM,EAAE,OAAO,mBAAmB,KAAK;EACvC,IAAK,CAAE,OACN,OAAO,KAAK,MAAM;EAGnB,MAAM,EAAE,OAAO,gBAAgB,eAAe;EAE9C,OACC,qBAAC,OAAD;GACC,WAAU;GACV,WAAU;GACV,KAAI;GAHL,UAAA,CAKC,qBAAC,OAAO,MAAR;IAAa,QAAO;IAApB,UAAA;KACC,oBAAC,OAAO,OAAR,EAAA,UAAgB,MAAqB,CAAA;KACrC,oBAAC,OAAO,aAAR,EAAA,UAAsB,YAAiC,CAAA;KACvD,oBAAC,OAAO,SAAR,EAAA,UACC,oBAAC,YAAD;MACC,SAAQ;MACR,YACC,eAAgB,OAAO,cAAe;MAGrC,UAAA,GAAI,cAAc,cAAe;KACxB,CAAA,EACG,CAAA;IACJ;GACX,CAAA,GAAA,WAAW,eACZ,oBAAC,cAAD;IACS;IACS;GACjB,CAAA,IACE,IACE;;CAET;AACD"}
|
|
@@ -7,6 +7,7 @@ function KeyCombination({ keyCombination, forceAriaLabel }) {
|
|
|
7
7
|
const ariaLabel = keyCombination.modifier ? shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
8
8
|
return /* @__PURE__ */ jsx("kbd", {
|
|
9
9
|
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
10
|
+
dir: "ltr",
|
|
10
11
|
"aria-label": forceAriaLabel || ariaLabel,
|
|
11
12
|
children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
12
13
|
if (character === "+") return /* @__PURE__ */ jsx(Fragment, { children: character }, index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcut.mjs","names":[],"sources":["../../../src/components/keyboard-shortcut-help-modal/shortcut.jsx"],"sourcesContent":["import { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;AAGA,SAAS,eAAgB,EAAE,gBAAgB,kBAAmB;CAC7D,MAAM,WAAW,eAAe,WAC7B,oBAAqB,eAAe,SAAU,CAC9C,eAAe,SAChB,IACC,eAAe;CAClB,MAAM,YAAY,eAAe,WAC9B,kBAAmB,eAAe,SAAU,CAC5C,eAAe,SAChB,IACC,eAAe;CAElB,OACC,oBAAC,OAAD;EACC,WAAU;EACV,cAAa,kBAAkB;EAE3B,WAAA,MAAM,QAAS,QAAS,IAAI,WAAW,CAAE,QAAS,EAAA,CAAI,KACvD,WAAW,UAAW;GACvB,IAAK,cAAc,KAClB,OAAO,oBAAC,UAAD,EAAA,UAA0B,UAAqB,GAA/B,KAA+B;GAGvD,OACC,oBAAC,OAAD;IAEC,WAAU;IAER,UAAA;GACE,GAJE,KAIF;EAEP,CACD;CACI,CAAA;AAEP;AAEA,SAAS,SAAU,EAAE,aAAa,gBAAgB,UAAU,CAAC,GAAG,aAAc;CAC7E,OACC,qBAAA,YAAA,EAAA,UAAA,CACC,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA;CACE,CAAA,GACL,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,oBAAC,gBAAD;GACkB;GACjB,gBAAiB;EACjB,CAAA,GACC,QAAQ,KAAO,OAAO,UACvB,oBAAC,gBAAD;GACC,gBAAiB;GACjB,gBAAiB;EAEjB,GADM,KACN,CACA,CACE;CACJ,CAAA,CAAA,EAAA,CAAA;AAEJ"}
|
|
1
|
+
{"version":3,"file":"shortcut.mjs","names":[],"sources":["../../../src/components/keyboard-shortcut-help-modal/shortcut.jsx"],"sourcesContent":["import { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\tdir=\"ltr\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;AAGA,SAAS,eAAgB,EAAE,gBAAgB,kBAAmB;CAC7D,MAAM,WAAW,eAAe,WAC7B,oBAAqB,eAAe,SAAU,CAC9C,eAAe,SAChB,IACC,eAAe;CAClB,MAAM,YAAY,eAAe,WAC9B,kBAAmB,eAAe,SAAU,CAC5C,eAAe,SAChB,IACC,eAAe;CAElB,OACC,oBAAC,OAAD;EACC,WAAU;EACV,KAAI;EACJ,cAAa,kBAAkB;EAE3B,WAAA,MAAM,QAAS,QAAS,IAAI,WAAW,CAAE,QAAS,EAAA,CAAI,KACvD,WAAW,UAAW;GACvB,IAAK,cAAc,KAClB,OAAO,oBAAC,UAAD,EAAA,UAA0B,UAAqB,GAA/B,KAA+B;GAGvD,OACC,oBAAC,OAAD;IAEC,WAAU;IAER,UAAA;GACE,GAJE,KAIF;EAEP,CACD;CACI,CAAA;AAEP;AAEA,SAAS,SAAU,EAAE,aAAa,gBAAgB,UAAU,CAAC,GAAG,aAAc;CAC7E,OACC,qBAAA,YAAA,EAAA,UAAA,CACC,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA;CACE,CAAA,GACL,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,oBAAC,gBAAD;GACkB;GACjB,gBAAiB;EACjB,CAAA,GACC,QAAQ,KAAO,OAAO,UACvB,oBAAC,gBAAD;GACC,gBAAiB;GACjB,gBAAiB;EAEjB,GADM,KACN,CACA,CACE;CACJ,CAAA,CAAA,EAAA,CAAA;AAEJ"}
|
|
@@ -57,7 +57,6 @@ function MoreMenu() {
|
|
|
57
57
|
icon: external,
|
|
58
58
|
href: __("https://wordpress.org/documentation/article/block-based-widgets-editor/"),
|
|
59
59
|
target: "_blank",
|
|
60
|
-
rel: "noopener",
|
|
61
60
|
children: [__("Help"), /* @__PURE__ */ jsx(VisuallyHidden, {
|
|
62
61
|
render: /* @__PURE__ */ jsx("span", {}),
|
|
63
62
|
children: __("(opens in a new tab)")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["preferencesStore"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["preferencesStore"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ToolbarDropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAwB,WAAW;CAClC,MAAM,CACL,gCACA,sCACG,SAAU,KAAM;CACpB,MAAM,qCACL,mCAAoC,CAAE,8BAA+B;CAEtE,YACC,6CACA,4BACD;CAEA,MAAM,EAAE,WAAW,YAAaA,KAAiB;CAEjD,OACC,qBAAA,UAAA,EAAA,UAAA,CACC,oBAAC,qBAAD;EACC,MAAO;EACP,OAAQ,GAAI,SAAU;EACtB,cAAe;GACd,WAAW;GACX,WAAW;EACZ;EACA,aAAc;GACb,iBAAiB;GACjB,MAAM;EACP;EAGC,gBAAA,qBAAA,UAAA,EAAA,UAAA;GACC,oBAAC,WAAD;IAAW,OAAQ,GAAI,QAAQ,MAAO;IACrC,UAAA,oBAAC,0BAAD;KACC,OAAM;KACN,MAAK;KACL,OAAQ,GAAI,aAAc;KAC1B,MAAO,GACN,uDACD;KACA,kBAAmB,GAClB,uBACD;KACA,oBAAqB,GACpB,yBACD;IACA,CAAA;GACS,CAAA;GACX,qBAAC,WAAD;IAAW,OAAQ,GAAI,OAAQ;IAA/B,UAAA;KACC,oBAAC,UAAD;MACC,eAAgB;OACf,mCAAoC,IAAK;MAC1C;MACA,UAAW,gBAAgB,OAAQ,GAAI;MAErC,UAAA,GAAI,oBAAqB;KAClB,CAAA;KACV,oBAAC,UAAD;MACC,eACC,OACC,0BACA,cACD;MAGC,UAAA,GAAI,eAAgB;KACb,CAAA;KACV,qBAAC,UAAD;MACC,MAAK;MACL,MAAO;MACP,MAAO,GACN,yEACD;MACA,QAAO;MANR,UAAA,CAQG,GAAI,MAAO,GACb,oBAAC,gBAAD;OAAgB,QAAS,oBAAC,QAAD,CAAO,CAAA;OAG9B,UAAA,GAAI,sBAAuB;MAEb,CAAA,CACP;;IACA;;GACX,oBAAC,WAAD;IAAW,OAAQ,GAAI,aAAc;IACpC,UAAA,oBAAC,0BAAD;KACC,OAAM;KACN,MAAK;KACL,OAAQ,GACP,kCACD;KACA,MAAO,GACN,iEACD;KACA,kBAAmB,GAClB,4CACD;KACA,oBAAqB,GACpB,8CACD;IACA,CAAA;GACS,CAAA;EACV,EAAA,CAAA;CAEiB,CAAA,GACrB,oBAAC,2BAAD;EACC,eAAgB;EAChB,aAAc;CACd,CAAA,CACA,EAAA,CAAA;AAEJ"}
|
|
@@ -174,8 +174,8 @@ body.admin-color-fresh {
|
|
|
174
174
|
display: flex;
|
|
175
175
|
justify-content: flex-end;
|
|
176
176
|
margin: -15px -12px 0 -12px;
|
|
177
|
-
background: #
|
|
178
|
-
border-bottom: 1px solid #
|
|
177
|
+
background: var(--wpds-color-background-surface-neutral, #fcfcfc);
|
|
178
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
179
179
|
z-index: 8;
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -195,7 +195,22 @@ body.admin-color-fresh {
|
|
|
195
195
|
}
|
|
196
196
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
197
197
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
198
|
-
background: #1e1e1e;
|
|
198
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active, #1e1e1e);
|
|
199
|
+
}
|
|
200
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]),
|
|
201
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
|
|
202
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
|
|
203
|
+
}
|
|
204
|
+
@media (forced-colors: active) {
|
|
205
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
206
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
207
|
+
background: SelectedItem !important;
|
|
208
|
+
}
|
|
209
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true],
|
|
210
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:disabled,
|
|
211
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed[aria-disabled=true] {
|
|
212
|
+
background: GrayText !important;
|
|
213
|
+
}
|
|
199
214
|
}
|
|
200
215
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active),
|
|
201
216
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:active) {
|
|
@@ -208,7 +223,6 @@ body.admin-color-fresh {
|
|
|
208
223
|
}
|
|
209
224
|
.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
210
225
|
border-radius: 2px;
|
|
211
|
-
color: #fff;
|
|
212
226
|
margin: 12px auto 12px 0;
|
|
213
227
|
}
|
|
214
228
|
@media not (prefers-reduced-motion) {
|
|
@@ -236,6 +250,10 @@ body.admin-color-fresh {
|
|
|
236
250
|
background: #fff;
|
|
237
251
|
}
|
|
238
252
|
|
|
253
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
254
|
+
display: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
239
257
|
.customize-widgets-layout__inserter-panel-header {
|
|
240
258
|
display: flex;
|
|
241
259
|
justify-content: space-between;
|
|
@@ -297,7 +315,7 @@ body.admin-color-fresh {
|
|
|
297
315
|
margin: 0 0.2rem 0 0.2rem;
|
|
298
316
|
}
|
|
299
317
|
.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
300
|
-
margin: 0
|
|
318
|
+
margin-inline-end: 0;
|
|
301
319
|
}
|
|
302
320
|
|
|
303
321
|
.components-popover.more-menu-dropdown__content {
|
package/build-style/style.css
CHANGED
|
@@ -174,8 +174,8 @@ body.admin-color-fresh {
|
|
|
174
174
|
display: flex;
|
|
175
175
|
justify-content: flex-end;
|
|
176
176
|
margin: -15px -12px 0 -12px;
|
|
177
|
-
background: #
|
|
178
|
-
border-bottom: 1px solid #
|
|
177
|
+
background: var(--wpds-color-background-surface-neutral, #fcfcfc);
|
|
178
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
179
179
|
z-index: 8;
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -195,7 +195,22 @@ body.admin-color-fresh {
|
|
|
195
195
|
}
|
|
196
196
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
197
197
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
198
|
-
background: #1e1e1e;
|
|
198
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active, #1e1e1e);
|
|
199
|
+
}
|
|
200
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]),
|
|
201
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
|
|
202
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
|
|
203
|
+
}
|
|
204
|
+
@media (forced-colors: active) {
|
|
205
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
206
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
207
|
+
background: SelectedItem !important;
|
|
208
|
+
}
|
|
209
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true],
|
|
210
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:disabled,
|
|
211
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed[aria-disabled=true] {
|
|
212
|
+
background: GrayText !important;
|
|
213
|
+
}
|
|
199
214
|
}
|
|
200
215
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active),
|
|
201
216
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:active) {
|
|
@@ -208,7 +223,6 @@ body.admin-color-fresh {
|
|
|
208
223
|
}
|
|
209
224
|
.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
210
225
|
border-radius: 2px;
|
|
211
|
-
color: #fff;
|
|
212
226
|
margin: 12px 0 12px auto;
|
|
213
227
|
}
|
|
214
228
|
@media not (prefers-reduced-motion) {
|
|
@@ -236,6 +250,10 @@ body.admin-color-fresh {
|
|
|
236
250
|
background: #fff;
|
|
237
251
|
}
|
|
238
252
|
|
|
253
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
254
|
+
display: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
239
257
|
.customize-widgets-layout__inserter-panel-header {
|
|
240
258
|
display: flex;
|
|
241
259
|
justify-content: space-between;
|
|
@@ -297,7 +315,7 @@ body.admin-color-fresh {
|
|
|
297
315
|
margin: 0 0.2rem 0 0.2rem;
|
|
298
316
|
}
|
|
299
317
|
.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
300
|
-
margin: 0
|
|
318
|
+
margin-inline-end: 0;
|
|
301
319
|
}
|
|
302
320
|
|
|
303
321
|
.components-popover.more-menu-dropdown__content {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Widgets blocks in Customizer Module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,30 +37,30 @@
|
|
|
37
37
|
},
|
|
38
38
|
"wpScript": true,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wordpress/a11y": "^5.
|
|
41
|
-
"@wordpress/admin-ui": "^3.
|
|
42
|
-
"@wordpress/base-styles": "^15.
|
|
43
|
-
"@wordpress/block-editor": "^20.
|
|
44
|
-
"@wordpress/block-library": "^12.
|
|
45
|
-
"@wordpress/blocks": "^17.
|
|
46
|
-
"@wordpress/components": "^
|
|
47
|
-
"@wordpress/compose": "^9.
|
|
48
|
-
"@wordpress/core-data": "^9.
|
|
49
|
-
"@wordpress/data": "^11.
|
|
50
|
-
"@wordpress/dom": "^5.
|
|
51
|
-
"@wordpress/element": "^10.
|
|
52
|
-
"@wordpress/hooks": "^5.
|
|
53
|
-
"@wordpress/i18n": "^7.
|
|
54
|
-
"@wordpress/icons": "^
|
|
55
|
-
"@wordpress/is-shallow-equal": "^6.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^6.
|
|
57
|
-
"@wordpress/keycodes": "^5.
|
|
58
|
-
"@wordpress/media-utils": "^6.
|
|
59
|
-
"@wordpress/preferences": "^5.
|
|
60
|
-
"@wordpress/private-apis": "^3.
|
|
61
|
-
"@wordpress/theme": "^
|
|
62
|
-
"@wordpress/ui": "^0.
|
|
63
|
-
"@wordpress/widgets": "^5.
|
|
40
|
+
"@wordpress/a11y": "^5.2.0",
|
|
41
|
+
"@wordpress/admin-ui": "^3.2.0",
|
|
42
|
+
"@wordpress/base-styles": "^15.1.0",
|
|
43
|
+
"@wordpress/block-editor": "^20.1.0",
|
|
44
|
+
"@wordpress/block-library": "^12.2.0",
|
|
45
|
+
"@wordpress/blocks": "^17.2.0",
|
|
46
|
+
"@wordpress/components": "^45.0.0",
|
|
47
|
+
"@wordpress/compose": "^9.2.0",
|
|
48
|
+
"@wordpress/core-data": "^9.2.0",
|
|
49
|
+
"@wordpress/data": "^11.2.0",
|
|
50
|
+
"@wordpress/dom": "^5.2.0",
|
|
51
|
+
"@wordpress/element": "^10.2.0",
|
|
52
|
+
"@wordpress/hooks": "^5.2.0",
|
|
53
|
+
"@wordpress/i18n": "^7.2.0",
|
|
54
|
+
"@wordpress/icons": "^21.0.0",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^6.2.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^6.2.0",
|
|
57
|
+
"@wordpress/keycodes": "^5.2.0",
|
|
58
|
+
"@wordpress/media-utils": "^6.2.0",
|
|
59
|
+
"@wordpress/preferences": "^5.2.0",
|
|
60
|
+
"@wordpress/private-apis": "^3.2.0",
|
|
61
|
+
"@wordpress/theme": "^5.0.0",
|
|
62
|
+
"@wordpress/ui": "^0.27.0",
|
|
63
|
+
"@wordpress/widgets": "^5.2.0",
|
|
64
64
|
"clsx": "^2.1.1",
|
|
65
65
|
"fast-deep-equal": "^3.1.3"
|
|
66
66
|
},
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@testing-library/dom": "^10.4.2",
|
|
69
69
|
"@testing-library/react": "^16.3.3",
|
|
70
70
|
"@testing-library/user-event": "^14.6.8",
|
|
71
|
-
"vitest": "^5.0
|
|
71
|
+
"vitest": "^5.1.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"react": "^18 || ^19",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "1000cdf1dffd5b5e69f75cc4360aa76db8252264"
|
|
81
81
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@wordpress/element';
|
|
2
2
|
import { speak } from '@wordpress/a11y';
|
|
3
|
-
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { __, _x } from '@wordpress/i18n';
|
|
4
4
|
import { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';
|
|
5
5
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
6
6
|
import { doAction } from '@wordpress/hooks';
|
|
@@ -168,7 +168,7 @@ export default class ErrorBoundary extends Component {
|
|
|
168
168
|
getErrorReport( error, componentStack )
|
|
169
169
|
}
|
|
170
170
|
>
|
|
171
|
-
{
|
|
171
|
+
{ _x( 'Copy error', 'button label' ) }
|
|
172
172
|
</CopyButton>
|
|
173
173
|
</Notice.Actions>
|
|
174
174
|
</Notice.Root>
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
// Zero bottom margin so that the fixed toolbar is right under the header.
|
|
22
22
|
margin: -15px ( -$grid-unit-15 ) ( 0 ) ( -$grid-unit-15 );
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
border-bottom: 1px solid $gray-200;
|
|
24
|
+
background: var(--wpds-color-background-surface-neutral);
|
|
25
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral);
|
|
27
26
|
|
|
28
27
|
z-index: z-index(".customize-widgets__topbar");
|
|
29
28
|
}
|
|
@@ -49,7 +48,20 @@
|
|
|
49
48
|
padding: 4px;
|
|
50
49
|
|
|
51
50
|
&.is-pressed {
|
|
52
|
-
background:
|
|
51
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active);
|
|
52
|
+
|
|
53
|
+
&:is(:disabled, [aria-disabled="true"]) {
|
|
54
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (forced-colors: active) {
|
|
58
|
+
background: SelectedItem !important;
|
|
59
|
+
|
|
60
|
+
&:disabled,
|
|
61
|
+
&[aria-disabled="true"] {
|
|
62
|
+
background: GrayText !important;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
&:focus:not(:active) {
|
|
@@ -63,7 +75,6 @@
|
|
|
63
75
|
|
|
64
76
|
.customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
65
77
|
border-radius: $radius-small;
|
|
66
|
-
color: $white;
|
|
67
78
|
// Push the inserter toggle and the buttons after it to the end.
|
|
68
79
|
margin: $grid-unit-15 0 $grid-unit-15 auto;
|
|
69
80
|
|
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
background: $white;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// The panel header has its own close button, so with no tabs to show the
|
|
24
|
+
// inserter's tab list and close button row is hidden.
|
|
25
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab {
|
|
26
|
+
.block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
.customize-widgets-layout__inserter-panel-header {
|
|
24
32
|
display: flex;
|
|
25
33
|
justify-content: space-between;
|
|
@@ -16,6 +16,7 @@ function KeyCombination( { keyCombination, forceAriaLabel } ) {
|
|
|
16
16
|
return (
|
|
17
17
|
<kbd
|
|
18
18
|
className="customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
19
|
+
dir="ltr"
|
|
19
20
|
aria-label={ forceAriaLabel || ariaLabel }
|
|
20
21
|
>
|
|
21
22
|
{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(
|