@wordpress/customize-widgets 4.11.0 → 4.12.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.
Files changed (98) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-inspector-button/index.js +5 -6
  3. package/build/components/block-inspector-button/index.js.map +1 -1
  4. package/build/components/customize-widgets/index.js +5 -6
  5. package/build/components/customize-widgets/index.js.map +1 -1
  6. package/build/components/error-boundary/index.js +4 -5
  7. package/build/components/error-boundary/index.js.map +1 -1
  8. package/build/components/focus-control/index.js +5 -6
  9. package/build/components/focus-control/index.js.map +1 -1
  10. package/build/components/focus-control/use-blocks-focus-control.js +1 -1
  11. package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
  12. package/build/components/header/index.js +7 -8
  13. package/build/components/header/index.js.map +1 -1
  14. package/build/components/inserter/index.js +3 -4
  15. package/build/components/inserter/index.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  17. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  18. package/build/components/keyboard-shortcut-help-modal/index.js +41 -50
  19. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  20. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  21. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/index.js +5 -6
  23. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  24. package/build/components/sidebar-block-editor/index.js +19 -27
  25. package/build/components/sidebar-block-editor/index.js.map +1 -1
  26. package/build/components/sidebar-block-editor/sidebar-adapter.js +3 -7
  27. package/build/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
  28. package/build/components/sidebar-block-editor/sidebar-editor-provider.js +5 -6
  29. package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
  30. package/build/components/sidebar-controls/index.js +5 -6
  31. package/build/components/sidebar-controls/index.js.map +1 -1
  32. package/build/components/welcome-guide/index.js +3 -4
  33. package/build/components/welcome-guide/index.js.map +1 -1
  34. package/build/controls/inserter-outer-section.js +2 -2
  35. package/build/controls/inserter-outer-section.js.map +1 -1
  36. package/build/controls/inspector-section.js +3 -4
  37. package/build/controls/inspector-section.js.map +1 -1
  38. package/build/controls/sidebar-control.js +2 -2
  39. package/build/controls/sidebar-control.js.map +1 -1
  40. package/build/controls/sidebar-section.js +2 -6
  41. package/build/controls/sidebar-section.js.map +1 -1
  42. package/build/filters/move-to-sidebar.js +2 -2
  43. package/build/filters/move-to-sidebar.js.map +1 -1
  44. package/build/filters/wide-widget-display.js +2 -2
  45. package/build/filters/wide-widget-display.js.map +1 -1
  46. package/build/store/reducer.js +1 -4
  47. package/build/store/reducer.js.map +1 -1
  48. package/build/utils.js +8 -10
  49. package/build/utils.js.map +1 -1
  50. package/build-module/components/block-inspector-button/index.js +5 -6
  51. package/build-module/components/block-inspector-button/index.js.map +1 -1
  52. package/build-module/components/customize-widgets/index.js +5 -6
  53. package/build-module/components/customize-widgets/index.js.map +1 -1
  54. package/build-module/components/error-boundary/index.js +4 -5
  55. package/build-module/components/error-boundary/index.js.map +1 -1
  56. package/build-module/components/focus-control/index.js +5 -6
  57. package/build-module/components/focus-control/index.js.map +1 -1
  58. package/build-module/components/focus-control/use-blocks-focus-control.js +1 -1
  59. package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
  60. package/build-module/components/header/index.js +7 -8
  61. package/build-module/components/header/index.js.map +1 -1
  62. package/build-module/components/inserter/index.js +3 -4
  63. package/build-module/components/inserter/index.js.map +1 -1
  64. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  65. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  66. package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -48
  67. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  68. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  69. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  70. package/build-module/components/keyboard-shortcuts/index.js +5 -6
  71. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  72. package/build-module/components/sidebar-block-editor/index.js +19 -27
  73. package/build-module/components/sidebar-block-editor/index.js.map +1 -1
  74. package/build-module/components/sidebar-block-editor/sidebar-adapter.js +3 -7
  75. package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
  76. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +5 -6
  77. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
  78. package/build-module/components/sidebar-controls/index.js +5 -6
  79. package/build-module/components/sidebar-controls/index.js.map +1 -1
  80. package/build-module/components/welcome-guide/index.js +3 -4
  81. package/build-module/components/welcome-guide/index.js.map +1 -1
  82. package/build-module/controls/inserter-outer-section.js +2 -2
  83. package/build-module/controls/inserter-outer-section.js.map +1 -1
  84. package/build-module/controls/inspector-section.js +3 -4
  85. package/build-module/controls/inspector-section.js.map +1 -1
  86. package/build-module/controls/sidebar-control.js +2 -2
  87. package/build-module/controls/sidebar-control.js.map +1 -1
  88. package/build-module/controls/sidebar-section.js +2 -6
  89. package/build-module/controls/sidebar-section.js.map +1 -1
  90. package/build-module/filters/move-to-sidebar.js +2 -2
  91. package/build-module/filters/move-to-sidebar.js.map +1 -1
  92. package/build-module/filters/wide-widget-display.js +2 -2
  93. package/build-module/filters/wide-widget-display.js.map +1 -1
  94. package/build-module/store/reducer.js +1 -4
  95. package/build-module/store/reducer.js.map +1 -1
  96. package/build-module/utils.js +8 -10
  97. package/build-module/utils.js.map +1 -1
  98. package/package.json +22 -22
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.12.0 (2023-06-07)
6
+
5
7
  ## 4.11.0 (2023-05-24)
6
8
 
7
9
  ## 4.10.0 (2023-05-10)
@@ -22,12 +22,11 @@ var _blockEditor = require("@wordpress/block-editor");
22
22
  /**
23
23
  * WordPress dependencies
24
24
  */
25
- function BlockInspectorButton(_ref) {
26
- let {
27
- inspector,
28
- closeMenu,
29
- ...props
30
- } = _ref;
25
+ function BlockInspectorButton({
26
+ inspector,
27
+ closeMenu,
28
+ ...props
29
+ }) {
31
30
  const selectedBlockClientId = (0, _data.useSelect)(select => select(_blockEditor.store).getSelectedBlockClientId(), []);
32
31
  const selectedBlock = (0, _element.useMemo)(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
33
32
  return (0, _element.createElement)(_components.MenuItem, (0, _extends2.default)({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"names":["BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","blockEditorStore","getSelectedBlockClientId","selectedBlock","document","getElementById","open","returnFocusWhenClose"],"mappings":";;;;;;;;;AAGA;;;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,SAASA,oBAAT,OAAoE;AAAA,MAArC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwB,OAAGC;AAA3B,GAAqC;AACnE,QAAMC,qBAAqB,GAAG,qBAC3BC,MAAF,IAAcA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,wBAA3B,EADe,EAE7B,EAF6B,CAA9B;AAKA,QAAMC,aAAa,GAAG,sBACrB,MAAMC,QAAQ,CAACC,cAAT,CAA0B,SAASN,qBAAuB,EAA1D,CADe,EAErB,CAAEA,qBAAF,CAFqB,CAAtB;AAKA,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf;AACAH,MAAAA,SAAS,CAACU,IAAV,CAAgB;AACfC,QAAAA,oBAAoB,EAAEJ;AADP,OAAhB,EAFe,CAKf;;AACAN,MAAAA,SAAS;AACT;AARF,KASMC,KATN,GAWG,cAAI,oBAAJ,CAXH,CADD;AAeA;;eAEcH,oB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"names":["BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","blockEditorStore","getSelectedBlockClientId","selectedBlock","document","getElementById","open","returnFocusWhenClose"],"mappings":";;;;;;;;;AAGA;;;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,SAASA,oBAAT,CAA+B;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,SAAb;AAAwB,KAAGC;AAA3B,CAA/B,EAAoE;AACnE,QAAMC,qBAAqB,GAAG,qBAC3BC,MAAF,IAAcA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,wBAA3B,EADe,EAE7B,EAF6B,CAA9B;AAKA,QAAMC,aAAa,GAAG,sBACrB,MAAMC,QAAQ,CAACC,cAAT,CAA0B,SAASN,qBAAuB,EAA1D,CADe,EAErB,CAAEA,qBAAF,CAFqB,CAAtB;AAKA,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf;AACAH,MAAAA,SAAS,CAACU,IAAV,CAAgB;AACfC,QAAAA,oBAAoB,EAAEJ;AADP,OAAhB,EAFe,CAKf;;AACAN,MAAAA,SAAS;AACT;AARF,KASMC,KATN,GAWG,cAAI,oBAAJ,CAXH,CADD;AAeA;;eAEcH,oB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"]}
@@ -30,12 +30,11 @@ var _useClearSelectedBlock = _interopRequireDefault(require("./use-clear-selecte
30
30
  /**
31
31
  * Internal dependencies
32
32
  */
33
- function CustomizeWidgets(_ref) {
34
- let {
35
- api,
36
- sidebarControls,
37
- blockEditorSettings
38
- } = _ref;
33
+ function CustomizeWidgets({
34
+ api,
35
+ sidebarControls,
36
+ blockEditorSettings
37
+ }) {
39
38
  const [activeSidebarControl, setActiveSidebarControl] = (0, _element.useState)(null);
40
39
  const parentContainer = document.getElementById('customize-theme-controls');
41
40
  const popoverRef = (0, _element.useRef)();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","id","sidebarAdapter","inserter","inspector","container","popover"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOe,SAASA,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA,GADyC;AAEzCC,IAAAA,eAFyC;AAGzCC,IAAAA;AAHyC,GAItC;AACH,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,IAAoD,uBAAU,IAAV,CAA1D;AACA,QAAMC,eAAe,GAAGC,QAAQ,CAACC,cAAT,CACvB,0BADuB,CAAxB;AAGA,QAAMC,UAAU,GAAG,sBAAnB;AAEA,sCAAuBL,oBAAvB,EAA6CK,UAA7C;AAEA,0BAAW,MAAM;AAChB,UAAMC,aAAa,GAAGR,eAAe,CAACS,GAAhB,CAAuBC,cAAF,IAC1CA,cAAc,CAACC,SAAf,CAA4BC,QAAF,IAAgB;AACzC,UAAKA,QAAL,EAAgB;AACfT,QAAAA,uBAAuB,CAAEO,cAAF,CAAvB;AACA;AACD,KAJD,CADqB,CAAtB;AAQA,WAAO,MAAM;AACZF,MAAAA,aAAa,CAACK,OAAd,CAAyBC,YAAF,IAAoBA,YAAY,EAAvD;AACA,KAFD;AAGA,GAZD,EAYG,CAAEd,eAAF,CAZH;AAcA,QAAMe,aAAa,GAClBb,oBAAoB,IACpB,2BACC,4BAAC,sBAAD,QACC,4BAAC,2BAAD;AACC,IAAA,GAAG,EAAGA,oBAAoB,CAACc,EAD5B;AAEC,IAAA,mBAAmB,EAAGf,mBAFvB;AAGC,IAAA,OAAO,EAAGC,oBAAoB,CAACe,cAHhC;AAIC,IAAA,QAAQ,EAAGf,oBAAoB,CAACgB,QAJjC;AAKC,IAAA,SAAS,EAAGhB,oBAAoB,CAACiB;AALlC,IADD,CADD,EAUCjB,oBAAoB,CAACkB,SAArB,CAAgC,CAAhC,CAVD,CAFD,CAvBG,CAsCH;AACA;;AACA,QAAMC,OAAO,GACZjB,eAAe,IACf,2BACC;AAAK,IAAA,SAAS,EAAC,2BAAf;AAA2C,IAAA,GAAG,EAAGG;AAAjD,KACC,4BAAC,mBAAD,CAAS,IAAT,OADD,CADD,EAICH,eAJD,CAFD;AASA,SACC,4BAAC,mCAAD,QACC,4BAAC,4BAAD,QACC,4BAAC,wBAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,4BAAC,qBAAD;AACC,IAAA,GAAG,EAAGH,GADP;AAEC,IAAA,eAAe,EAAGC;AAFnB,KAIGe,aAJH,EAKGM,OALH,CAJD,CADD,CADD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<SidebarControls\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t\t>\n\t\t\t\t\t<FocusControl\n\t\t\t\t\t\tapi={ api }\n\t\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t\t{ popover }\n\t\t\t\t\t</FocusControl>\n\t\t\t\t</SidebarControls>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","id","sidebarAdapter","inserter","inspector","container","popover"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOe,SAASA,gBAAT,CAA2B;AACzCC,EAAAA,GADyC;AAEzCC,EAAAA,eAFyC;AAGzCC,EAAAA;AAHyC,CAA3B,EAIX;AACH,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,IAAoD,uBAAU,IAAV,CAA1D;AACA,QAAMC,eAAe,GAAGC,QAAQ,CAACC,cAAT,CACvB,0BADuB,CAAxB;AAGA,QAAMC,UAAU,GAAG,sBAAnB;AAEA,sCAAuBL,oBAAvB,EAA6CK,UAA7C;AAEA,0BAAW,MAAM;AAChB,UAAMC,aAAa,GAAGR,eAAe,CAACS,GAAhB,CAAuBC,cAAF,IAC1CA,cAAc,CAACC,SAAf,CAA4BC,QAAF,IAAgB;AACzC,UAAKA,QAAL,EAAgB;AACfT,QAAAA,uBAAuB,CAAEO,cAAF,CAAvB;AACA;AACD,KAJD,CADqB,CAAtB;AAQA,WAAO,MAAM;AACZF,MAAAA,aAAa,CAACK,OAAd,CAAyBC,YAAF,IAAoBA,YAAY,EAAvD;AACA,KAFD;AAGA,GAZD,EAYG,CAAEd,eAAF,CAZH;AAcA,QAAMe,aAAa,GAClBb,oBAAoB,IACpB,2BACC,4BAAC,sBAAD,QACC,4BAAC,2BAAD;AACC,IAAA,GAAG,EAAGA,oBAAoB,CAACc,EAD5B;AAEC,IAAA,mBAAmB,EAAGf,mBAFvB;AAGC,IAAA,OAAO,EAAGC,oBAAoB,CAACe,cAHhC;AAIC,IAAA,QAAQ,EAAGf,oBAAoB,CAACgB,QAJjC;AAKC,IAAA,SAAS,EAAGhB,oBAAoB,CAACiB;AALlC,IADD,CADD,EAUCjB,oBAAoB,CAACkB,SAArB,CAAgC,CAAhC,CAVD,CAFD,CAvBG,CAsCH;AACA;;AACA,QAAMC,OAAO,GACZjB,eAAe,IACf,2BACC;AAAK,IAAA,SAAS,EAAC,2BAAf;AAA2C,IAAA,GAAG,EAAGG;AAAjD,KACC,4BAAC,mBAAD,CAAS,IAAT,OADD,CADD,EAICH,eAJD,CAFD;AASA,SACC,4BAAC,mCAAD,QACC,4BAAC,4BAAD,QACC,4BAAC,wBAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,4BAAC,qBAAD;AACC,IAAA,GAAG,EAAGH,GADP;AAEC,IAAA,eAAe,EAAGC;AAFnB,KAIGe,aAJH,EAKGM,OALH,CAJD,CADD,CADD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<SidebarControls\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t\t>\n\t\t\t\t\t<FocusControl\n\t\t\t\t\t\tapi={ api }\n\t\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t\t{ popover }\n\t\t\t\t\t</FocusControl>\n\t\t\t\t</SidebarControls>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
@@ -20,11 +20,10 @@ var _hooks = require("@wordpress/hooks");
20
20
  /**
21
21
  * WordPress dependencies
22
22
  */
23
- function CopyButton(_ref) {
24
- let {
25
- text,
26
- children
27
- } = _ref;
23
+ function CopyButton({
24
+ text,
25
+ children
26
+ }) {
28
27
  const ref = (0, _compose.useCopyToClipboard)(text);
29
28
  return (0, _element.createElement)(_components.Button, {
30
29
  variant: "secondary",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","ErrorBoundary","Component","constructor","arguments","state","error","componentDidCatch","setState","render","props","stack"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAQA,SAASA,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAG,iCAAoBF,IAApB,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAEc,MAAME,aAAN,SAA4BC,kBAA5B,CAAsC;AACpDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAEDC,EAAAA,iBAAiB,CAAED,KAAF,EAAU;AAC1B,SAAKE,QAAL,CAAe;AAAEF,MAAAA;AAAF,KAAf;AAEA,yBAAU,kCAAV,EAA8CA,KAA9C;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEH,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKI,KAAL,CAAWX,QAAlB;AACA;;AAED,WACC,4BAAC,oBAAD;AACC,MAAA,SAAS,EAAC,kCADX;AAEC,MAAA,OAAO,EAAG,CACT,4BAAC,UAAD;AAAY,QAAA,GAAG,EAAC,YAAhB;AAA6B,QAAA,IAAI,EAAGO,KAAK,CAACK;AAA1C,SACG,cAAI,YAAJ,CADH,CADS;AAFX,OAQG,cAAI,iDAAJ,CARH,CADD;AAYA;;AAhCmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"names":["CopyButton","text","children","ref","ErrorBoundary","Component","constructor","arguments","state","error","componentDidCatch","setState","render","props","stack"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAQA,SAASA,UAAT,CAAqB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAArB,EAA0C;AACzC,QAAMC,GAAG,GAAG,iCAAoBF,IAApB,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAEc,MAAME,aAAN,SAA4BC,kBAA5B,CAAsC;AACpDC,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAEDC,EAAAA,iBAAiB,CAAED,KAAF,EAAU;AAC1B,SAAKE,QAAL,CAAe;AAAEF,MAAAA;AAAF,KAAf;AAEA,yBAAU,kCAAV,EAA8CA,KAA9C;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEH,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKI,KAAL,CAAWX,QAAlB;AACA;;AAED,WACC,4BAAC,oBAAD;AACC,MAAA,SAAS,EAAC,kCADX;AAEC,MAAA,OAAO,EAAG,CACT,4BAAC,UAAD;AAAY,QAAA,GAAG,EAAC,YAAhB;AAA6B,QAAA,IAAI,EAAGO,KAAK,CAACK;AAA1C,SACG,cAAI,YAAJ,CADH,CADS;AAFX,OAQG,cAAI,iDAAJ,CARH,CADD;AAYA;;AAhCmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"]}
@@ -19,12 +19,11 @@ var _utils = require("../../utils");
19
19
  */
20
20
  const FocusControlContext = (0, _element.createContext)();
21
21
 
22
- function FocusControl(_ref) {
23
- let {
24
- api,
25
- sidebarControls,
26
- children
27
- } = _ref;
22
+ function FocusControl({
23
+ api,
24
+ sidebarControls,
25
+ children
26
+ }) {
28
27
  const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0, _element.useState)({
29
28
  current: null
30
29
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/index.js"],"names":["FocusControlContext","FocusControl","api","sidebarControls","children","focusedWidgetIdRef","setFocusedWidgetIdRef","current","focusWidget","widgetId","sidebarControl","widgets","setting","get","includes","sectionInstance","expand","completeCallback","handleFocus","settingId","previewBound","handleReady","previewer","preview","bind","unbind","context","useFocusControl"],"mappings":";;;;;;;;AAGA;;AAYA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG,6BAA5B;;AAEe,SAASC,YAAT,OAA4D;AAAA,MAArC;AAAEC,IAAAA,GAAF;AAAOC,IAAAA,eAAP;AAAwBC,IAAAA;AAAxB,GAAqC;AAC1E,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,uBAAU;AAC/DC,IAAAA,OAAO,EAA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GAAG,sBACf,MAAM,CAAErB,kBAAF,EAAsBG,WAAtB,CADS,EAEf,CAAEH,kBAAF,EAAsBG,WAAtB,CAFe,CAAhB;AAKA,SACC,4BAAC,mBAAD,CAAqB,QAArB;AAA8B,IAAA,KAAK,EAAGkB;AAAtC,KACGtB,QADH,CADD;AAKA;;AAEM,MAAMuB,eAAe,GAAG,MAAM,yBAAY3B,mBAAZ,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst FocusControlContext = createContext();\n\nexport default function FocusControl( { api, sidebarControls, children } ) {\n\tconst [ focusedWidgetIdRef, setFocusedWidgetIdRef ] = useState( {\n\t\tcurrent: null,\n\t} );\n\n\tconst focusWidget = useCallback(\n\t\t( widgetId ) => {\n\t\t\tfor ( const sidebarControl of sidebarControls ) {\n\t\t\t\tconst widgets = sidebarControl.setting.get();\n\n\t\t\t\tif ( widgets.includes( widgetId ) ) {\n\t\t\t\t\tsidebarControl.sectionInstance.expand( {\n\t\t\t\t\t\t// Schedule it after the complete callback so that\n\t\t\t\t\t\t// it won't be overridden by the \"Back\" button focus.\n\t\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t\t// Create a \"ref-like\" object every time to ensure\n\t\t\t\t\t\t\t// the same widget id can also triggers the focus control.\n\t\t\t\t\t\t\tsetFocusedWidgetIdRef( { current: widgetId } );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ sidebarControls ]\n\t);\n\n\tuseEffect( () => {\n\t\tfunction handleFocus( settingId ) {\n\t\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\tlet previewBound = false;\n\n\t\tfunction handleReady() {\n\t\t\tapi.previewer.preview.bind(\n\t\t\t\t'focus-control-for-setting',\n\t\t\t\thandleFocus\n\t\t\t);\n\t\t\tpreviewBound = true;\n\t\t}\n\n\t\tapi.previewer.bind( 'ready', handleReady );\n\n\t\treturn () => {\n\t\t\tapi.previewer.unbind( 'ready', handleReady );\n\t\t\tif ( previewBound ) {\n\t\t\t\tapi.previewer.preview.unbind(\n\t\t\t\t\t'focus-control-for-setting',\n\t\t\t\t\thandleFocus\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, [ api, focusWidget ] );\n\n\tconst context = useMemo(\n\t\t() => [ focusedWidgetIdRef, focusWidget ],\n\t\t[ focusedWidgetIdRef, focusWidget ]\n\t);\n\n\treturn (\n\t\t<FocusControlContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</FocusControlContext.Provider>\n\t);\n}\n\nexport const useFocusControl = () => useContext( FocusControlContext );\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/index.js"],"names":["FocusControlContext","FocusControl","api","sidebarControls","children","focusedWidgetIdRef","setFocusedWidgetIdRef","current","focusWidget","widgetId","sidebarControl","widgets","setting","get","includes","sectionInstance","expand","completeCallback","handleFocus","settingId","previewBound","handleReady","previewer","preview","bind","unbind","context","useFocusControl"],"mappings":";;;;;;;;AAGA;;AAYA;;AAfA;AACA;AACA;;AAUA;AACA;AACA;AAGA,MAAMA,mBAAmB,GAAG,6BAA5B;;AAEe,SAASC,YAAT,CAAuB;AAAEC,EAAAA,GAAF;AAAOC,EAAAA,eAAP;AAAwBC,EAAAA;AAAxB,CAAvB,EAA4D;AAC1E,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,uBAAU;AAC/DC,IAAAA,OAAO,EAAE;AADsD,GAAV,CAAtD;AAIA,QAAMC,WAAW,GAAG,0BACjBC,QAAF,IAAgB;AACf,SAAM,MAAMC,cAAZ,IAA8BP,eAA9B,EAAgD;AAC/C,YAAMQ,OAAO,GAAGD,c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,IAAA,KAAK,EAAGkB;AAAtC,KACGtB,QADH,CADD;AAKA;;AAEM,MAAMuB,eAAe,GAAG,MAAM,yBAAY3B,mBAAZ,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst FocusControlContext = createContext();\n\nexport default function FocusControl( { api, sidebarControls, children } ) {\n\tconst [ focusedWidgetIdRef, setFocusedWidgetIdRef ] = useState( {\n\t\tcurrent: null,\n\t} );\n\n\tconst focusWidget = useCallback(\n\t\t( widgetId ) => {\n\t\t\tfor ( const sidebarControl of sidebarControls ) {\n\t\t\t\tconst widgets = sidebarControl.setting.get();\n\n\t\t\t\tif ( widgets.includes( widgetId ) ) {\n\t\t\t\t\tsidebarControl.sectionInstance.expand( {\n\t\t\t\t\t\t// Schedule it after the complete callback so that\n\t\t\t\t\t\t// it won't be overridden by the \"Back\" button focus.\n\t\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t\t// Create a \"ref-like\" object every time to ensure\n\t\t\t\t\t\t\t// the same widget id can also triggers the focus control.\n\t\t\t\t\t\t\tsetFocusedWidgetIdRef( { current: widgetId } );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ sidebarControls ]\n\t);\n\n\tuseEffect( () => {\n\t\tfunction handleFocus( settingId ) {\n\t\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\tlet previewBound = false;\n\n\t\tfunction handleReady() {\n\t\t\tapi.previewer.preview.bind(\n\t\t\t\t'focus-control-for-setting',\n\t\t\t\thandleFocus\n\t\t\t);\n\t\t\tpreviewBound = true;\n\t\t}\n\n\t\tapi.previewer.bind( 'ready', handleReady );\n\n\t\treturn () => {\n\t\t\tapi.previewer.unbind( 'ready', handleReady );\n\t\t\tif ( previewBound ) {\n\t\t\t\tapi.previewer.preview.unbind(\n\t\t\t\t\t'focus-control-for-setting',\n\t\t\t\t\thandleFocus\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, [ api, focusWidget ] );\n\n\tconst context = useMemo(\n\t\t() => [ focusedWidgetIdRef, focusWidget ],\n\t\t[ focusedWidgetIdRef, focusWidget ]\n\t);\n\n\treturn (\n\t\t<FocusControlContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</FocusControlContext.Provider>\n\t);\n}\n\nexport const useFocusControl = () => useContext( FocusControlContext );\n"]}
@@ -41,7 +41,7 @@ function useBlocksFocusControl(blocks) {
41
41
  // We select the DOM and focus it manually here.
42
42
 
43
43
  const blockNode = document.querySelector(`[data-block="${focusedBlock.clientId}"]`);
44
- blockNode === null || blockNode === void 0 ? void 0 : blockNode.focus();
44
+ blockNode?.focus();
45
45
  }
46
46
  }
47
47
  }, [focusedWidgetIdRef, selectBlock]);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/use-blocks-focus-control.js"],"names":["useBlocksFocusControl","blocks","selectBlock","blockEditorStore","focusedWidgetIdRef","blocksRef","current","focusedBlock","find","block","clientId","blockNode","document","querySelector","focus"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,qBAAT,CAAgCC,MAAhC,EAAyC;AACvD,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,kBAAb,CAAxB;AACA,QAAM,CAAEC,kBAAF,IAAyB,wBAA/B;AAEA,QAAMC,SAAS,GAAG,qBAAQJ,MAAR,CAAlB;AAEA,0BAAW,MAAM;AAChBI,IAAAA,SAAS,CAACC,OAAV,GAAoBL,MAApB;AACA,GAFD,EAEG,CAAEA,MAAF,CAFH;AAIA,0BAAW,MAAM;AAChB,QAAKG,kBAAkB,CAACE,OAAxB,EAAkC;AACjC,YAAMC,YAAY,GAAGF,SAAS,CAACC,OAAV,CAAkBE,IAAlB,CAClBC,KAAF,IACC,mCAAsBA,KAAtB,MAAkCL,kBAAkB,CAACE,OAFlC,CAArB;;AAKA,UAAKC,YAAL,EAAoB;AACnBL,QAAAA,WAAW,CAAEK,YAAY,CAACG,QAAf,CAAX,CADmB,CAEnB;AACA;AACA;;AACA,cAAMC,SAAS,GAAGC,QAAQ,CAACC,aAAT,CAChB,gBAAgBN,YAAY,CAACG,QAAU,IADvB,CAAlB;AAGAC,QAAAA,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEG,KAAX;AACA;AACD;AACD,GAlBD,EAkBG,CAAEV,kBAAF,EAAsBF,WAAtB,CAlBH;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { useFocusControl } from '.';\n\nexport default function useBlocksFocusControl( blocks ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst [ focusedWidgetIdRef ] = useFocusControl();\n\n\tconst blocksRef = useRef( blocks );\n\n\tuseEffect( () => {\n\t\tblocksRef.current = blocks;\n\t}, [ blocks ] );\n\n\tuseEffect( () => {\n\t\tif ( focusedWidgetIdRef.current ) {\n\t\t\tconst focusedBlock = blocksRef.current.find(\n\t\t\t\t( block ) =>\n\t\t\t\t\tgetWidgetIdFromBlock( block ) === focusedWidgetIdRef.current\n\t\t\t);\n\n\t\t\tif ( focusedBlock ) {\n\t\t\t\tselectBlock( focusedBlock.clientId );\n\t\t\t\t// If the block is already being selected, the DOM node won't\n\t\t\t\t// get focused again automatically.\n\t\t\t\t// We select the DOM and focus it manually here.\n\t\t\t\tconst blockNode = document.querySelector(\n\t\t\t\t\t`[data-block=\"${ focusedBlock.clientId }\"]`\n\t\t\t\t);\n\t\t\t\tblockNode?.focus();\n\t\t\t}\n\t\t}\n\t}, [ focusedWidgetIdRef, selectBlock ] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/use-blocks-focus-control.js"],"names":["useBlocksFocusControl","blocks","selectBlock","blockEditorStore","focusedWidgetIdRef","blocksRef","current","focusedBlock","find","block","clientId","blockNode","document","querySelector","focus"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,qBAAT,CAAgCC,MAAhC,EAAyC;AACvD,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaC,kBAAb,CAAxB;AACA,QAAM,CAAEC,kBAAF,IAAyB,wBAA/B;AAEA,QAAMC,SAAS,GAAG,qBAAQJ,MAAR,CAAlB;AAEA,0BAAW,MAAM;AAChBI,IAAAA,SAAS,CAACC,OAAV,GAAoBL,MAApB;AACA,GAFD,EAEG,CAAEA,MAAF,CAFH;AAIA,0BAAW,MAAM;AAChB,QAAKG,kBAAkB,CAACE,OAAxB,EAAkC;AACjC,YAAMC,YAAY,GAAGF,SAAS,CAACC,OAAV,CAAkBE,IAAlB,CAClBC,KAAF,IACC,mCAAsBA,KAAtB,MAAkCL,kBAAkB,CAACE,OAFlC,CAArB;;AAKA,UAAKC,YAAL,EAAoB;AACnBL,QAAAA,WAAW,CAAEK,YAAY,CAACG,QAAf,CAAX,CADmB,CAEnB;AACA;AACA;;AACA,cAAMC,SAAS,GAAGC,QAAQ,CAACC,aAAT,CAChB,gBAAgBN,YAAY,CAACG,QAAU,IADvB,CAAlB;AAGAC,QAAAA,SAAS,EAAEG,KAAX;AACA;AACD;AACD,GAlBD,EAkBG,CAAEV,kBAAF,EAAsBF,WAAtB,CAlBH;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { useFocusControl } from '.';\n\nexport default function useBlocksFocusControl( blocks ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst [ focusedWidgetIdRef ] = useFocusControl();\n\n\tconst blocksRef = useRef( blocks );\n\n\tuseEffect( () => {\n\t\tblocksRef.current = blocks;\n\t}, [ blocks ] );\n\n\tuseEffect( () => {\n\t\tif ( focusedWidgetIdRef.current ) {\n\t\t\tconst focusedBlock = blocksRef.current.find(\n\t\t\t\t( block ) =>\n\t\t\t\t\tgetWidgetIdFromBlock( block ) === focusedWidgetIdRef.current\n\t\t\t);\n\n\t\t\tif ( focusedBlock ) {\n\t\t\t\tselectBlock( focusedBlock.clientId );\n\t\t\t\t// If the block is already being selected, the DOM node won't\n\t\t\t\t// get focused again automatically.\n\t\t\t\t// We select the DOM and focus it manually here.\n\t\t\t\tconst blockNode = document.querySelector(\n\t\t\t\t\t`[data-block=\"${ focusedBlock.clientId }\"]`\n\t\t\t\t);\n\t\t\t\tblockNode?.focus();\n\t\t\t}\n\t\t}\n\t}, [ focusedWidgetIdRef, selectBlock ] );\n}\n"]}
@@ -36,14 +36,13 @@ var _moreMenu = _interopRequireDefault(require("../more-menu"));
36
36
  /**
37
37
  * Internal dependencies
38
38
  */
39
- function Header(_ref) {
40
- let {
41
- sidebar,
42
- inserter,
43
- isInserterOpened,
44
- setIsInserterOpened,
45
- isFixedToolbarActive
46
- } = _ref;
39
+ function Header({
40
+ sidebar,
41
+ inserter,
42
+ isInserterOpened,
43
+ setIsInserterOpened,
44
+ isFixedToolbarActive
45
+ }) {
47
46
  const [[hasUndo, hasRedo], setUndoRedo] = (0, _element.useState)([sidebar.hasUndo(), sidebar.hasRedo()]);
48
47
  const shortcut = (0, _keycodes.isAppleOS)() ? _keycodes.displayShortcut.primaryShift('z') : _keycodes.displayShortcut.primary('y');
49
48
  (0, _element.useEffect)(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"names":["Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","shortcut","displayShortcut","primaryShift","primary","subscribeHistory","undoIcon","redoIcon","undo","redo","plus","isOpen","contentContainer"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAIA,SAASA,MAAT,OAMI;AAAA,MANa;AAChBC,IAAAA,OADgB;AAEhBC,IAAAA,QAFgB;AAGhBC,IAAAA,gBAHgB;AAIhBC,IAAAA,mBAJgB;AAKhBC,IAAAA;AALgB,GAMb;AACH,QAAM,CAAE,CAAEC,OAAF,EAAWC,OAAX,CAAF,EAAwBC,WAAxB,IAAwC,uBAAU,CACvDP,OAAO,CAACK,OAAR,EADuD,EAEvDL,OAAO,CAACM,OAAR,EAFuD,CAAV,CAA9C;AAKA,QAAME,QAAQ,GAAG,6BACdC,0BAAgBC,YAAhB,CAA8B,GAA9B,CADc,GAEdD,0BAAgBE,OAAhB,CAAyB,GAAzB,CAFH;AAIA,0BAAW,MAAM;AAChB,WAAOX,OAAO,CAACY,gBAAR,CAA0B,MAAM;AACtCL,MAAAA,WAAW,CAAE,CAAEP,OAAO,CAACK,OAAR,EAAF,EAAqBL,OAAO,CAACM,OAAR,EAArB,CAAF,CAAX;AACA,KAFM,CAAP;AAGA,GAJD,EAIG,CAAEN,OAAF,CAJH;AAMA,SACC,qDACC;AACC,IAAA,SAAS,EAAG,yBAAY,0BAAZ,EAAwC;AACnD,iCAA2BI;AADwB,KAAxC;AADb,KAKC,4BAAC,6BAAD;AACC,IAAA,SAAS,EAAC,kCADX;AAEC,kBAAa,cAAI,gBAAJ;AAFd,KAIC,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAG,CAAE,kBAAF,GAAYS,WAAZ,GAAuBC;AAC9B;AAFD;AAGC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAHT;AAIC,IAAA,QAAQ,EAAGL,0BAAgBE,OAAhB,CAAyB,GAAzB,CAJZ,CAKC;AACA;AACA;AAPD;AAQC,qBAAgB,CAAEN,OARnB;AASC,IAAA,OAAO,EAAGL,OAAO,CAACe,IATnB;AAUC,IAAA,SAAS,EAAC;AAVX,IAJD,EAgBC,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAG,CAAE,kBAAF,GAAYD,WAAZ,GAAuBD;AAC9B;AAFD;AAGC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAHT;AAIC,IAAA,QAAQ,EAAGL,QAJZ,CAKC;AACA;AACA;AAPD;AAQC,qBAAgB,CAAEF,OARnB;AASC,IAAA,OAAO,EAAGN,OAAO,CAACgB,IATnB;AAUC,IAAA,SAAS,EAAC;AAVX,IAhBD,EA6BC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,SAAS,EAAGd,gBAFb;AAGC,IAAA,OAAO,EAAC,SAHT;AAIC,IAAA,IAAI,EAAGe,WAJR;AAKC,IAAA,KAAK,EAAG,cACP,WADO,EAEP,yCAFO,CALT;AASC,IAAA,OAAO,EAAG,MAAM;AACfd,MAAAA,mBAAmB,CAAIe,MAAF,IAAc,CAAEA,MAAlB,CAAnB;AACA;AAXF,IA7BD,EA0CC,4BAAC,iBAAD,OA1CD,CALD,CADD,EAoDG,2BACD,4BAAC,iBAAD;AAAU,IAAA,WAAW,EAAGf;AAAxB,IADC,EAEDF,QAAQ,CAACkB,gBAAT,CAA2B,CAA3B,CAFC,CApDH,CADD;AA2DA;;eAEcpB,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useState, useEffect } from '@wordpress/element';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"names":["Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","shortcut","displayShortcut","primaryShift","primary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gB,CAAEN,OARnB;AASC,IAAA,OAAO,EAAGL,OAAO,CAACe,IATnB;AAUC,IAAA,SAAS,EAAC;AAVX,IAJD,EAgBC,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAG,CAAE,kBAAF,GAAYD,WAAZ,GAAuBD;AAC9B;AAFD;AAGC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAHT;AAIC,IAAA,QAAQ,EAAGL,QAJZ,CAKC;AACA;AACA;AAPD;AAQC,qBAAgB,CAAEF,OARnB;AASC,IAAA,OAAO,EAAGN,OAAO,CAACgB,IATnB;AAUC,IAAA,SAAS,EAAC;AAVX,IAhBD,EA6BC,4BAAC,yBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,SAAS,EAAGd,gBAFb;AAGC,IAAA,OAAO,EAAC,SAHT;AAIC,IAAA,IAAI,EAAGe,WAJR;AAKC,IAAA,KAAK,EAAG,cACP,WADO,EAEP,yCAFO,CALT;AASC,IAAA,OAAO,EAAG,MAAM;AACfd,MAAAA,mBAAmB,CAAIe,MAAF,IAAc,CAAEA,MAAlB,CAAnB;AACA;AAXF,IA7BD,EA0CC,4BAAC,iBAAD,OA1CD,CALD,CADD,EAoDG,2BACD,4BAAC,iBAAD;AAAU,IAAA,WAAW,EAAGf;AAAxB,IADC,EAEDF,QAAQ,CAACkB,gBAAT,CAA2B,CAA3B,CAFC,CApDH,CADD;AA2DA;;eAEcpB,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useState, useEffect } from '@wordpress/element';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
@@ -28,10 +28,9 @@ var _store = require("../../store");
28
28
  /**
29
29
  * Internal dependencies
30
30
  */
31
- function Inserter(_ref) {
32
- let {
33
- setIsOpened
34
- } = _ref;
31
+ function Inserter({
32
+ setIsOpened
33
+ }) {
35
34
  const inserterTitleId = (0, _compose.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title');
36
35
  const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint(), []);
37
36
  return (0, _element.createElement)("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["Inserter","setIsOpened","inserterTitleId","insertionPoint","select","customizeWidgetsStore","__experimentalGetInsertionPoint","closeSmall","rootClientId","insertionIndex"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,SAASA,QAAT,OAAqC;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;AACpC,QAAMC,eAAe,GAAG,4BACvBF,QADuB,EAEvB,+CAFuB,CAAxB;AAIA,QAAMG,cAAc,GAAG,qBACpBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAgCC,+BAAhC,EAFqB,EAGtB,EAHsB,CAAvB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,uBAAkBJ;AAFnB,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,EAAE,EAAGA,eADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG,cAAI,aAAJ,CAJH,CADD,EAOC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8DADX;AAEC,IAAA,IAAI,EAAGK,iBAFR;AAGC,IAAA,OAAO,EAAG,MAAMN,WAAW,CAAE,KAAF,CAH5B;AAIC,kBAAa,cAAI,gBAAJ;AAJd,IAPD,CAJD,EAkBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,YAAY,EAAGE,cAAc,CAACK,YAD/B;AAEC,IAAA,4BAA4B,EAC3BL,cAAc,CAACM,cAHjB;AAKC,IAAA,qBAAqB,MALtB;AAMC,IAAA,QAAQ,EAAG,MAAMR,WAAW,CAAE,KAAF;AAN7B,IADD,CAlBD,CADD;AA+BA;;eAEcD,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\n\t);\n\tconst insertionPoint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"customize-widgets-layout__inserter-panel\"\n\t\t\taria-labelledby={ inserterTitleId }\n\t\t>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-header\">\n\t\t\t\t<h2\n\t\t\t\t\tid={ inserterTitleId }\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-title\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add a block' ) }\n\t\t\t\t</h2>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tonClick={ () => setIsOpened( false ) }\n\t\t\t\t\taria-label={ __( 'Close inserter' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tonSelect={ () => setIsOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default Inserter;\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["Inserter","setIsOpened","inserterTitleId","insertionPoint","select","customizeWidgetsStore","__experimentalGetInsertionPoint","closeSmall","rootClientId","insertionIndex"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,SAASA,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAG,4BACvBF,QADuB,EAEvB,+CAFuB,CAAxB;AAIA,QAAMG,cAAc,GAAG,qBACpBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAAgCC,+BAAhC,EAFqB,EAGtB,EAHsB,CAAvB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,uBAAkBJ;AAFnB,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,EAAE,EAAGA,eADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG,cAAI,aAAJ,CAJH,CADD,EAOC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8DADX;AAEC,IAAA,IAAI,EAAGK,iBAFR;AAGC,IAAA,OAAO,EAAG,MAAMN,WAAW,CAAE,KAAF,CAH5B;AAIC,kBAAa,cAAI,gBAAJ;AAJd,IAPD,CAJD,EAkBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kCAAD;AACC,IAAA,YAAY,EAAGE,cAAc,CAACK,YAD/B;AAEC,IAAA,4BAA4B,EAC3BL,cAAc,CAACM,cAHjB;AAKC,IAAA,qBAAqB,MALtB;AAMC,IAAA,QAAQ,EAAG,MAAMR,WAAW,CAAE,KAAF;AAN7B,IADD,CAlBD,CADD;AA+BA;;eAEcD,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\n\t);\n\tconst insertionPoint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"customize-widgets-layout__inserter-panel\"\n\t\t\taria-labelledby={ inserterTitleId }\n\t\t>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-header\">\n\t\t\t\t<h2\n\t\t\t\t\tid={ inserterTitleId }\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-title\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add a block' ) }\n\t\t\t\t</h2>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tonClick={ () => setIsOpened( false ) }\n\t\t\t\t\taria-label={ __( 'Close inserter' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tonSelect={ () => setIsOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default Inserter;\n"]}
@@ -22,10 +22,9 @@ var _shortcut = _interopRequireDefault(require("./shortcut"));
22
22
  /**
23
23
  * Internal dependencies
24
24
  */
25
- function DynamicShortcut(_ref) {
26
- let {
27
- name
28
- } = _ref;
25
+ function DynamicShortcut({
26
+ name
27
+ }) {
29
28
  const {
30
29
  keyCombination,
31
30
  description,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2C,qBAC9CC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,wBAAF,CAJV;AAMA,WAAO;AACNP,MAAAA,cAAc,EAAEI,yBAAyB,CAAEL,IAAF,CADnC;AAENG,MAAAA,OAAO,EAAEI,kBAAkB,CAAEP,IAAF,CAFrB;AAGNE,MAAAA,WAAW,EAAEI,sBAAsB,CAAEN,IAAF;AAH7B,KAAP;AAKA,GAb+C,EAchD,CAAEA,IAAF,CAdgD,CAAjD;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA;;eAEcJ,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nfunction DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n\nexport default DynamicShortcut;\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2C,qBAC9CC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEI,wBAAF,CAJV;AAMA,WAAO;AACNP,MAAAA,cAAc,EAAEI,yBAAyB,CAAEL,IAAF,CADnC;AAENG,MAAAA,OAAO,EAAEI,kBAAkB,CAAEP,IAAF,CAFrB;AAGNE,MAAAA,WAAW,EAAEI,sBAAsB,CAAEN,IAAF;AAH7B,KAAP;AAKA,GAb+C,EAchD,CAAEA,IAAF,CAdgD,CAAjD;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA;;eAEcJ,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nfunction DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n\nexport default DynamicShortcut;\n"]}
@@ -36,52 +36,44 @@ var _dynamicShortcut = _interopRequireDefault(require("./dynamic-shortcut"));
36
36
  /**
37
37
  * Internal dependencies
38
38
  */
39
- const ShortcutList = _ref => {
40
- let {
41
- shortcuts
42
- } = _ref;
43
- return (
44
- /*
45
- * Disable reason: The `list` ARIA role is redundant but
46
- * Safari+VoiceOver won't announce the list otherwise.
47
- */
48
-
49
- /* eslint-disable jsx-a11y/no-redundant-roles */
50
- (0, _element.createElement)("ul", {
51
- className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list",
52
- role: "list"
53
- }, shortcuts.map((shortcut, index) => (0, _element.createElement)("li", {
54
- className: "customize-widgets-keyboard-shortcut-help-modal__shortcut",
55
- key: index
56
- }, typeof shortcut === 'string' ? (0, _element.createElement)(_dynamicShortcut.default, {
57
- name: shortcut
58
- }) : (0, _element.createElement)(_shortcut.default, shortcut))))
59
- /* eslint-enable jsx-a11y/no-redundant-roles */
60
-
61
- );
62
- };
63
-
64
- const ShortcutSection = _ref2 => {
65
- let {
66
- title,
67
- shortcuts,
68
- className
69
- } = _ref2;
70
- return (0, _element.createElement)("section", {
71
- className: (0, _classnames.default)('customize-widgets-keyboard-shortcut-help-modal__section', className)
72
- }, !!title && (0, _element.createElement)("h2", {
73
- className: "customize-widgets-keyboard-shortcut-help-modal__section-title"
74
- }, title), (0, _element.createElement)(ShortcutList, {
75
- shortcuts: shortcuts
76
- }));
77
- };
39
+ const ShortcutList = ({
40
+ shortcuts
41
+ }) =>
42
+ /*
43
+ * Disable reason: The `list` ARIA role is redundant but
44
+ * Safari+VoiceOver won't announce the list otherwise.
45
+ */
78
46
 
79
- const ShortcutCategorySection = _ref3 => {
80
- let {
81
- title,
82
- categoryName,
83
- additionalShortcuts = []
84
- } = _ref3;
47
+ /* eslint-disable jsx-a11y/no-redundant-roles */
48
+ (0, _element.createElement)("ul", {
49
+ className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list",
50
+ role: "list"
51
+ }, shortcuts.map((shortcut, index) => (0, _element.createElement)("li", {
52
+ className: "customize-widgets-keyboard-shortcut-help-modal__shortcut",
53
+ key: index
54
+ }, typeof shortcut === 'string' ? (0, _element.createElement)(_dynamicShortcut.default, {
55
+ name: shortcut
56
+ }) : (0, _element.createElement)(_shortcut.default, shortcut))))
57
+ /* eslint-enable jsx-a11y/no-redundant-roles */
58
+ ;
59
+
60
+ const ShortcutSection = ({
61
+ title,
62
+ shortcuts,
63
+ className
64
+ }) => (0, _element.createElement)("section", {
65
+ className: (0, _classnames.default)('customize-widgets-keyboard-shortcut-help-modal__section', className)
66
+ }, !!title && (0, _element.createElement)("h2", {
67
+ className: "customize-widgets-keyboard-shortcut-help-modal__section-title"
68
+ }, title), (0, _element.createElement)(ShortcutList, {
69
+ shortcuts: shortcuts
70
+ }));
71
+
72
+ const ShortcutCategorySection = ({
73
+ title,
74
+ categoryName,
75
+ additionalShortcuts = []
76
+ }) => {
85
77
  const categoryShortcuts = (0, _data.useSelect)(select => {
86
78
  return select(_keyboardShortcuts.store).getCategoryShortcuts(categoryName);
87
79
  }, [categoryName]);
@@ -91,11 +83,10 @@ const ShortcutCategorySection = _ref3 => {
91
83
  });
92
84
  };
93
85
 
94
- function KeyboardShortcutHelpModal(_ref4) {
95
- let {
96
- isModalActive,
97
- toggleModal
98
- } = _ref4;
86
+ function KeyboardShortcutHelpModal({
87
+ isModalActive,
88
+ toggleModal
89
+ }) {
99
90
  const {
100
91
  registerShortcut
101
92
  } = (0, _data.useDispatch)(_keyboardShortcuts.store);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","name","category","description","keyCombination","modifier","character","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,MAAA,SAAS,EAAC,+DADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,MAAA,SAAS,EAAC,0DADX;AAEC,MAAA,GAAG,EAAGA;AAFP,OAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,4BAAC,wBAAD;AAAiB,MAAA,IAAI,EAAGA;AAAxB,MADC,GAGD,4BAAC,iBAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAi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;AAEA,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,KAAK,EAAG,cAAI,oBAAJ,CAFT;AAGC,IAAA,cAAc,EAAGC;AAHlB,KAKC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,gEADX;AAEC,IAAA,SAAS,EAAG,CAAE,2CAAF;AAFb,IALD,EASC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IATD,EAcC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,qBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAdD,EAmBC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACCK,MAAAA,cAAc,EAAE;AAAEE,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECH,MAAAA,WAAW,EAAE,cACZ,qDADY,CAFd;;AAKC;AACAI,MAAAA,SAAS,EAAE,cAAI,eAAJ;AANZ,KADqB;AAHvB,IAnBD,EAiCC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'customize-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"customize-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tregisterShortcut( {\n\t\tname: 'core/customize-widgets/keyboard-shortcuts',\n\t\tcategory: 'main',\n\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'h',\n\t\t},\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/customize-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","registerShortcut","name","category","description","keyCombination","modifier","character","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,EAAA,SAAS,EAAC,+DADX;AAEC,EAAA,IAAI,EAAC;AAFN,GAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,EAAA,SAAS,EAAC,0DADX;AAEC,EAAA,GAAG,EAAGA;AAFP,GAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,4BAAC,wBAAD;AAAiB,EAAA,IAAI,EAAGA;AAAxB,EADC,GAGD,4BAAC,iBAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAiBA;AAvBD;;AA0BA,MAAME,eAAe,GAAG,CAAE;AAAEC,EAAAA,KAAF;AAASL,EAAAA,SAAT;AAAoBM,EAAAA;AAApB,CAAF,KACvB;AACC,EAAA,SAAS,EAAG,yBACX,yDADW,EAEXA,SAFW;AADb,GAMG,CAAC,CAAED,KAAH,IACD;AAAI,EAAA,SAAS,EAAC;AAAd,GACGA,KADH,CAPF,EAWC,4BAAC,YAAD;AAAc,EAAA,SAAS,EAAGL;AAA1B,EAXD,CADD;;AAgBA,MAAMO,uBAAuB,GAAG,CAAE;AACjCF,EAAAA,KADiC;AAEjCG,EAAAA,YAFiC;AAGjCC,EAAAA,mBAA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AAFd,IAdD,EAmBC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACCK,MAAAA,cAAc,EAAE;AAAEE,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECH,MAAAA,WAAW,EAAE,cACZ,qDADY,CAFd;;AAKC;AACAI,MAAAA,SAAS,EAAE,cAAI,eAAJ;AANZ,KADqB;AAHvB,IAnBD,EAiCC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'customize-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"customize-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tregisterShortcut( {\n\t\tname: 'core/customize-widgets/keyboard-shortcuts',\n\t\tcategory: 'main',\n\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: 'h',\n\t\t},\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/customize-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
@@ -12,11 +12,10 @@ var _keycodes = require("@wordpress/keycodes");
12
12
  /**
13
13
  * WordPress dependencies
14
14
  */
15
- function KeyCombination(_ref) {
16
- let {
17
- keyCombination,
18
- forceAriaLabel
19
- } = _ref;
15
+ function KeyCombination({
16
+ keyCombination,
17
+ forceAriaLabel
18
+ }) {
20
19
  const shortcut = keyCombination.modifier ? _keycodes.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
21
20
  const ariaLabel = keyCombination.modifier ? _keycodes.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
22
21
  return (0, _element.createElement)("kbd", {
@@ -36,13 +35,12 @@ function KeyCombination(_ref) {
36
35
  }));
37
36
  }
38
37
 
39
- function Shortcut(_ref2) {
40
- let {
41
- description,
42
- keyCombination,
43
- aliases = [],
44
- ariaLabel
45
- } = _ref2;
38
+ function Shortcut({
39
+ description,
40
+ keyCombination,
41
+ aliases = [],
42
+ ariaLabel
43
+ }) {
46
44
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
47
45
  className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description"
48
46
  }, description), (0, _element.createElement)("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,cAAT,OAA8D;AAAA,MAArC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAqC;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdC,8BAAqBJ,cAAc,CAACG,QAApC,EACAH,cAAc,CAACK,SADf,CADc,GAIdL,cAAc,CAACK,SAJlB;AAKA,QAAMC,SAAS,GAAGN,cAAc,CAACG,QAAf,GACfI,4BAAmBP,cAAc,CAACG,QAAlC,EACAH,cAAc,CAACK,SADf,CADe,GAIfL,cAAc,CAACK,SAJlB;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0EADX;AAEC,kBAAaJ,cAAc,IAAIK;AAFhC,KAIG,CAAEE,KAAK,CAACC,OAAN,CAAeP,QAAf,IAA4BA,QAA5B,GAAuC,CAAEA,QAAF,CAAzC,EAAwDQ,GAAxD,CACD,CAAEL,SAAF,EAAaM,KAAb,KAAwB;AACvB,QAAKN,SAAS,KAAK,GAAnB,EAAyB;AACxB,aAAO,4BAAC,iBAAD;AAAU,QAAA,GAAG,EAAGM;AAAhB,SAA0BN,SAA1B,CAAP;AACA;;AAED,WACC;AACC,MAAA,GAAG,EAAGM,KADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGN,SAJH,CADD;AAQA,GAdA,CAJH,CADD;AAuBA;;AAED,SAASO,QAAT,QAA8E;AAAA,MAA3D;AAAEC,IAAAA,WAAF;AAAeb,IAAAA,cAAf;AAA+Bc,IAAAA,OAAO,GAAG,EAAzC;AAA6CR,IAAAA;AAA7C,GAA2D;AAC7E,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGO,WADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGb,cADlB;AAEC,IAAA,cAAc,EAAGM;AAFlB,IADD,EAKGQ,OAAO,CAACJ,GAAR,CAAa,CAAEK,KAAF,EAASJ,KAAT,KACd,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGI,KADlB;AAEC,IAAA,cAAc,EAAGT,SAFlB;AAGC,IAAA,GAAG,EAAGK;AAHP,IADC,CALH,CAJD,CADD;AAoBA;;eAEcC,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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 )\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 )\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"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/shortcut.js"],"names":["KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","Array","isArray","map","index","Shortcut","description","aliases","alias"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,cAAT,CAAyB;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAAzB,EAA8D;AAC7D,QAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAf,GACdC,8BAAqBJ,cAAc,CAACG,QAApC,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ordpress/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 )\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 )\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"]}
@@ -22,12 +22,11 @@ var _blocks = require("@wordpress/blocks");
22
22
  /**
23
23
  * WordPress dependencies
24
24
  */
25
- function KeyboardShortcuts(_ref) {
26
- let {
27
- undo,
28
- redo,
29
- save
30
- } = _ref;
25
+ function KeyboardShortcuts({
26
+ undo,
27
+ redo,
28
+ save
29
+ }) {
31
30
  const {
32
31
  replaceBlocks
33
32
  } = (0, _data.useDispatch)(_blockEditor.store);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","undo","redo","save","replaceBlocks","blockEditorStore","getBlockName","getSelectedBlockClientId","getBlockAttributes","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","forEach","KeyboardShortcutsRegister","registerShortcut","unregisterShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","aliases","Register"],"mappings":";;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,SAASA,iBAAT,OAAmD;AAAA,MAAvB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA;AAAd,GAAuB;AAClD,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,kBAAb,CAA1B;AACA,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,wBAAhB;AAA0CC,IAAAA;AAA1C,MACL,qBAAWH,kBAAX,CADD;;AAGA,QAAMI,uBAAuB,GAAG,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACnDD,IAAAA,KAAK,CAACE,cAAN;AACA,UAAMC,oBAAoB,GACzBF,KAAK,KAAK,CAAV,GAAc,gBAAd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AE,eAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,iCAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,QADK;AAEfC,QAAAA,SAAS,EAAG;AAFG;AAJC,KAAF,CAAhB;AAUA,KAAE,CAAF,EAAK,CAAL,EAAQ,CAAR,EAAW,CAAX,EAAc,CAAd,EAAiB,CAAjB,EAAqBV,OAArB,CAAgCT,KAAF,IAAa;AAC1CW,MAAAA,gBAAgB,CAAE;AACjBG,QAAAA,IAAI,EAAG,yDAAyDd,KAAO,EADtD;AAEjBe,QAAAA,QAAQ,EAAE,eAFO;AAGjBC,QAAAA,WAAW,EAAE,cAAI,iCAAJ,CAHI;AAIjBC,QAAAA,cAAc,EAAE;AACfC,UAAAA,QAAQ,EAAE,QADK;AAEfC,UAAAA,SAAS,EAAG,GAAGnB,KAAO;AAFP;AAJC,OAAF,CAAhB;AASA,KAVD;AAYA,WAAO,MAAM;AACZY,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACA,KAJD;AAKA,GAtED,EAsEG,CAAED,gBAAF,CAtEH;AAwEA,SAAO,IAAP;AACA;;AAEDtB,iBAAiB,CAACgC,QAAlB,GAA6BX,yBAA7B;eACerB,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nfunction KeyboardShortcuts( { undo, redo, save } ) {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseShortcut( 'core/customize-widgets/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsave();\n\t} );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/transform-heading-to-paragraph',\n\t\t( event ) => handleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/customize-widgets/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: `core/customize-widgets/transform-heading-to-paragraph`,\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: `0`,\n\t\t\t},\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/customize-widgets/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunregisterShortcut( 'core/customize-widgets/undo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/redo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/save' );\n\t\t};\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcuts/index.js"],"names":["KeyboardShortcuts","undo","redo","save","replaceBlocks","blockEditorStore","getBlockName","getSelectedBlockClientId","getBlockAttributes","handleTextLevelShortcut","event","level","preventDefault","destinationBlockName","currentClientId","blockName","attributes","textAlign","destinationTextAlign","content","forEach","KeyboardShortcutsRegister","registerShortcut","unregisterShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","aliases","Register"],"mappings":";;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,IAAR;AAAcC,EAAAA;AAAd,CAA5B,EAAmD;AAClD,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,kBAAb,CAA1B;AACA,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,wBAAhB;AAA0CC,IAAAA;AAA1C,MACL,qBAAWH,kBAAX,CADD;;AAGA,QAAMI,uBAAuB,GAAG,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACnDD,IAAAA,KAAK,CAACE,cAAN;AACA,UAAMC,o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,IAAI,EAAG,uDADU;AAEjBC,MAAAA,QAAQ,EAAE,eAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,iCAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,QADK;AAEfC,QAAAA,SAAS,EAAG;AAFG;AAJC,KAAF,CAAhB;AAUA,KAAE,CAAF,EAAK,CAAL,EAAQ,CAAR,EAAW,CAAX,EAAc,CAAd,EAAiB,CAAjB,EAAqBV,OAArB,CAAgCT,KAAF,IAAa;AAC1CW,MAAAA,gBAAgB,CAAE;AACjBG,QAAAA,IAAI,EAAG,yDAAyDd,KAAO,EADtD;AAEjBe,QAAAA,QAAQ,EAAE,eAFO;AAGjBC,QAAAA,WAAW,EAAE,cAAI,iCAAJ,CAHI;AAIjBC,QAAAA,cAAc,EAAE;AACfC,UAAAA,QAAQ,EAAE,QADK;AAEfC,UAAAA,SAAS,EAAG,GAAGnB,KAAO;AAFP;AAJC,OAAF,CAAhB;AASA,KAVD;AAYA,WAAO,MAAM;AACZY,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACAA,MAAAA,kBAAkB,CAAE,6BAAF,CAAlB;AACA,KAJD;AAKA,GAtED,EAsEG,CAAED,gBAAF,CAtEH;AAwEA,SAAO,IAAP;AACA;;AAEDtB,iBAAiB,CAACgC,QAAlB,GAA6BX,yBAA7B;eACerB,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nfunction KeyboardShortcuts( { undo, redo, save } ) {\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { getBlockName, getSelectedBlockClientId, getBlockAttributes } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst handleTextLevelShortcut = ( event, level ) => {\n\t\tevent.preventDefault();\n\t\tconst destinationBlockName =\n\t\t\tlevel === 0 ? 'core/paragraph' : 'core/heading';\n\t\tconst currentClientId = getSelectedBlockClientId();\n\t\tif ( currentClientId === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst blockName = getBlockName( currentClientId );\n\t\tif ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {\n\t\t\treturn;\n\t\t}\n\t\tconst attributes = getBlockAttributes( currentClientId );\n\t\tconst textAlign =\n\t\t\tblockName === 'core/paragraph' ? 'align' : 'textAlign';\n\t\tconst destinationTextAlign =\n\t\t\tdestinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';\n\n\t\treplaceBlocks(\n\t\t\tcurrentClientId,\n\t\t\tcreateBlock( destinationBlockName, {\n\t\t\t\tlevel,\n\t\t\t\tcontent: attributes.content,\n\t\t\t\t...{ [ destinationTextAlign ]: attributes[ textAlign ] },\n\t\t\t} )\n\t\t);\n\t};\n\n\tuseShortcut( 'core/customize-widgets/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsave();\n\t} );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/transform-heading-to-paragraph',\n\t\t( event ) => handleTextLevelShortcut( event, 0 )\n\t);\n\n\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t//the loop is based off on a constant therefore\n\t\t//the hook will execute the same way every time\n\t\t//eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseShortcut(\n\t\t\t`core/customize-widgets/transform-paragraph-to-heading-${ level }`,\n\t\t\t( event ) => handleTextLevelShortcut( event, level )\n\t\t);\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: `core/customize-widgets/transform-heading-to-paragraph`,\n\t\t\tcategory: 'block-library',\n\t\t\tdescription: __( 'Transform heading to paragraph.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: `0`,\n\t\t\t},\n\t\t} );\n\n\t\t[ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {\n\t\t\tregisterShortcut( {\n\t\t\t\tname: `core/customize-widgets/transform-paragraph-to-heading-${ level }`,\n\t\t\t\tcategory: 'block-library',\n\t\t\t\tdescription: __( 'Transform paragraph to heading.' ),\n\t\t\t\tkeyCombination: {\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: `${ level }`,\n\t\t\t\t},\n\t\t\t} );\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunregisterShortcut( 'core/customize-widgets/undo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/redo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/save' );\n\t\t};\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"]}