@wordpress/customize-widgets 4.10.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 (100) hide show
  1. package/CHANGELOG.md +4 -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/build-style/style-rtl.css +1 -1
  99. package/build-style/style.css +1 -1
  100. package/package.json +22 -22
@@ -40,13 +40,12 @@ var _blockAppender = _interopRequireDefault(require("../block-appender"));
40
40
  /**
41
41
  * Internal dependencies
42
42
  */
43
- function SidebarBlockEditor(_ref) {
44
- let {
45
- blockEditorSettings,
46
- sidebar,
47
- inserter,
48
- inspector
49
- } = _ref;
43
+ function SidebarBlockEditor({
44
+ blockEditorSettings,
45
+ sidebar,
46
+ inserter,
47
+ inspector
48
+ }) {
50
49
  const [isInserterOpened, setIsInserterOpened] = (0, _useInserter.default)(inserter);
51
50
  const {
52
51
  hasUploadPermissions,
@@ -70,19 +69,15 @@ function SidebarBlockEditor(_ref) {
70
69
  let mediaUploadBlockEditor;
71
70
 
72
71
  if (hasUploadPermissions) {
73
- mediaUploadBlockEditor = _ref2 => {
74
- let {
75
- onError,
76
- ...argumentsObject
77
- } = _ref2;
72
+ mediaUploadBlockEditor = ({
73
+ onError,
74
+ ...argumentsObject
75
+ }) => {
78
76
  (0, _mediaUtils.uploadMedia)({
79
77
  wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
80
- onError: _ref3 => {
81
- let {
82
- message
83
- } = _ref3;
84
- return onError(message);
85
- },
78
+ onError: ({
79
+ message
80
+ }) => onError(message),
86
81
  ...argumentsObject
87
82
  });
88
83
  };
@@ -126,14 +121,11 @@ function SidebarBlockEditor(_ref) {
126
121
  // from submitting form when type="button" is not specified.
127
122
  (0, _element.createElement)("form", {
128
123
  onSubmit: event => event.preventDefault()
129
- }, (0, _element.createElement)(_blockEditor.BlockInspector, null)), inspector.contentContainer[0])), (0, _element.createElement)(_blockEditor.__unstableBlockSettingsMenuFirstItem, null, _ref4 => {
130
- let {
131
- onClose
132
- } = _ref4;
133
- return (0, _element.createElement)(_blockInspectorButton.default, {
134
- inspector: inspector,
135
- closeMenu: onClose
136
- });
137
- }));
124
+ }, (0, _element.createElement)(_blockEditor.BlockInspector, null)), inspector.contentContainer[0])), (0, _element.createElement)(_blockEditor.__unstableBlockSettingsMenuFirstItem, null, ({
125
+ onClose
126
+ }) => (0, _element.createElement)(_blockInspectorButton.default, {
127
+ inspector: inspector,
128
+ closeMenu: onClose
129
+ })));
138
130
  }
139
131
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","get","preferencesStore","coreStore","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","defaultEditorStyles","BlockAppender","event","preventDefault","contentContainer","onClose"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAYA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAmBA;AACA;AACA;AASe,SAASA,kBAAT,OAKX;AAAA,MALwC;AAC3CC,IAAAA,mBAD2C;AAE3CC,IAAAA,OAF2C;AAG3CC,IAAAA,QAH2C;AAI3CC,IAAAA;AAJ2C,GAKxC;AACH,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,0BAAaH,QAAb,CAAlD;AACA,QAAM;AACLI,IAAAA,oBADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA;AAJK,MAKF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA;AAAF,QAAUD,MAAM,CAAEE,kBAAF,CAAtB;AACA,WAAO;AACNN,MAAAA,oBAAoB,qBACnBI,MAAM,CAAEG,eAAF,CAAN,CAAoBC,OAApB,CAA6B,QAA7B,EAAuC,OAAvC,CADmB,6DACiC,IAF/C;AAGNP,MAAAA,oBAAoB,EAAE,CAAC,CAAEI,GAAG,CAC3B,wBAD2B,EAE3B,cAF2B,CAHtB;AAONH,MAAAA,oBAAoB,EAAE,CAAC,CAAEG,GAAG,CAC3B,wBAD2B,EAE3B,sBAF2B,CAPtB;AAWNF,MAAAA,oBAAoB,EAAE,CAAC,C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AAG1B,OAAO,CAAC2B;AAHhB,IADD,EAOC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAG3B,OADX;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,gBAAgB,EAAGE,gBAHpB;AAIC,IAAA,mBAAmB,EAAGC,mBAJvB;AAKC,IAAA,oBAAoB,EAAGE;AALxB,IAPD,EAeC,4BAAC,wBAAD,QACC,4BAAC,uBAAD,QACC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGQ,QAAQ,CAACc;AAAhC,IADD,EAEC,4BAAC,kCAAD,QACC,4BAAC,wBAAD;AAAa,IAAA,SAAS,EAAC;AAAvB,KACC,4BAAC,0BAAD,QACC,4BAAC,sBAAD;AACC,IAAA,cAAc,EAAGC;AADlB,IADD,CADD,CADD,CAFD,CADD,CAfD,EA8BG,4BACD;AACA;AACA;AAAM,IAAA,QAAQ,EAAKC,KAAF,IAAaA,KAAK,CAACC,cAAN;AAA9B,KACC,4BAAC,2BAAD,OADD,CAHC,EAMD7B,SAAS,CAAC8B,gBAAV,CAA4B,CAA5B,CANC,CA9BH,CAJD,EA4CC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AACC,MAAA,SAAS,EAAG/B,SADb;AAEC,MAAA,SAAS,EAAG+B;AAFb,MADC;AAAA,GADH,CA5CD,CADD;AAuDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tBlockInspector,\n\tCopyHandler,\n\tObserveTyping,\n\tWritingFlow,\n\tBlockEditorKeyboardShortcuts,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={ isFixedToolbarActive }\n\t\t\t\t/>\n\n\t\t\t\t<CopyHandler>\n\t\t\t\t\t<BlockTools>\n\t\t\t\t\t\t<EditorStyles styles={ settings.defaultEditorStyles } />\n\t\t\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t\t\t<WritingFlow className=\"editor-styles-wrapper\">\n\t\t\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\trenderAppender={ BlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t\t\t</WritingFlow>\n\t\t\t\t\t\t</BlockSelectionClearer>\n\t\t\t\t\t</BlockTools>\n\t\t\t\t</CopyHandler>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"names":["SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","select","get","preferencesStore","coreStore","canUser","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","undo","redo","save","defaultEditorStyles","BlockAppender","event","preventDefault","contentContainer","onClose"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAYA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAmBA;AACA;AACA;AASe,SAASA,kBAAT,CAA6B;AAC3CC,EAAAA,mBAD2C;AAE3CC,EAAAA,OAF2C;AAG3CC,EAAAA,QAH2C;AAI3CC,EAAAA;AAJ2C,CAA7B,EAKX;AACH,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,0BAAaH,QAAb,CAAlD;AACA,QAAM;AACLI,IAAAA,oBADK;AAELC,IAAAA,oBAFK;AAGLC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B,SADb;AAEC,IAAA,SAAS,EAAG+B;AAFb,IAFF,CA5CD,CADD;AAuDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tBlockInspector,\n\tCopyHandler,\n\tObserveTyping,\n\tWritingFlow,\n\tBlockEditorKeyboardShortcuts,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={ isFixedToolbarActive }\n\t\t\t\t/>\n\n\t\t\t\t<CopyHandler>\n\t\t\t\t\t<BlockTools>\n\t\t\t\t\t\t<EditorStyles styles={ settings.defaultEditorStyles } />\n\t\t\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t\t\t<WritingFlow className=\"editor-styles-wrapper\">\n\t\t\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\t\t\trenderAppender={ BlockAppender }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t\t\t</WritingFlow>\n\t\t\t\t\t\t</BlockSelectionClearer>\n\t\t\t\t\t</BlockTools>\n\t\t\t\t</CopyHandler>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"]}
@@ -57,11 +57,7 @@ function debounce(leading, callback, timeout) {
57
57
  let isLeading = false;
58
58
  let timerID;
59
59
 
60
- function debounced() {
61
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
62
- args[_key] = arguments[_key];
63
- }
64
-
60
+ function debounced(...args) {
65
61
  const result = (isLeading ? callback : leading).apply(this, args);
66
62
  isLeading = true;
67
63
  clearTimeout(timerID);
@@ -109,9 +105,9 @@ class SidebarAdapter {
109
105
  return this.history[this.historyIndex];
110
106
  }
111
107
 
112
- _emit() {
108
+ _emit(...args) {
113
109
  for (const callback of this.subscribers) {
114
- callback(...arguments);
110
+ callback(...args);
115
111
  }
116
112
  }
117
113
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/sidebar-adapter.js"],"names":["wp","window","parseWidgetId","widgetId","matches","match","idBase","number","parseInt","widgetIdToSettingId","debounce","leading","callback","timeout","isLeading","timerID","debounced","args","result","apply","clearTimeout","setTimeout","cancel","SidebarAdapter","constructor","setting","api","locked","widgetsCache","WeakMap","subscribers","Set","history","_getWidgetIds","map","getWidget","historyIndex","historySubscribers","_debounceSetHistory","_pushHistory","_replaceHistory","bind","_handleSettingChange","_handleAllSettingsChange","undo","redo","save","subscribe","add","delete","getWidgets","_emit","get","slice","forEach","listener","prevWidgets","id","startsWith","includes","_createWidget","widget","widgetModel","customize","Widgets","availableWidgets","findWhere","id_base","set","settingId","settingArgs","transport","data","selectiveRefreshableWidgets","previewer","create","instance","_removeWidget","remove","_updateWidget","prevWidget","has","_updateWidgets","nextWidgets","addedWidgetIds","nextWidgetIds","nextWidget","push","deletedWidgets","filter","setWidgets","hasUndo","hasRedo","length","_seek","currentWidgets","widgets","subscribeHistory"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAASC,MAAf;;AAEA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,QAAMC,OAAO,GAAGD,QAAQ,CAACE,KAAT,CAAgB,cAAhB,CAAhB;;AACA,MAAKD,OAAL,EAAe;AACd,WAAO;AACNE,MAAAA,MAAM,EAAEF,OAAO,CAAE,CAAF,CADT;AAENG,MAAAA,MAAM,EAAEC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB;AAFV,KAAP;AAIA,GAPiC,CASlC;;;AACA,SAAO;AAAEE,IAAAA,MAAM,EAAEH;AAAV,GAAP;AACA;;AAED,SAASM,mBAAT,CAA8BN,QAA9B,EAAyC;AACx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AAM;AACZ,WAAKlB,kBAAL,CAAwBY,MAAxB,CAAgCM,QAAhC;AACA,KAFD;AAGA;;AAEDT,EAAAA,IAAI,GAAG;AACN,SAAKpB,GAAL,CAASgD,SAAT,CAAmB5B,IAAnB;AACA;;AA7SkC","sourcesContent":["/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst { wp } = window;\n\nfunction parseWidgetId( widgetId ) {\n\tconst matches = widgetId.match( /^(.+)-(\\d+)$/ );\n\tif ( matches ) {\n\t\treturn {\n\t\t\tidBase: matches[ 1 ],\n\t\t\tnumber: parseInt( matches[ 2 ], 10 ),\n\t\t};\n\t}\n\n\t// Likely an old single widget.\n\treturn { idBase: widgetId };\n}\n\nfunction widgetIdToSettingId( widgetId ) {\n\tconst { idBase, number } = parseWidgetId( widgetId );\n\tif ( number ) {\n\t\treturn `widget_${ idBase }[${ number }]`;\n\t}\n\n\treturn `widget_${ idBase }`;\n}\n\n/**\n * This is a custom debounce function to call different callbacks depending on\n * whether it's the _leading_ call or not.\n *\n * @param {Function} leading The callback that gets called first.\n * @param {Function} callback The callback that gets called after the first time.\n * @param {number} timeout The debounced time in milliseconds.\n * @return {Function} The debounced function.\n */\nfunction debounce( leading, callback, timeout ) {\n\tlet isLeading = false;\n\tlet timerID;\n\n\tfunction debounced( ...args ) {\n\t\tconst result = ( isLeading ? callback : leading ).apply( this, args );\n\n\t\tisLeading = true;\n\n\t\tclearTimeout( timerID );\n\n\t\ttimerID = setTimeout( () => {\n\t\t\tisLeading = false;\n\t\t}, timeout );\n\n\t\treturn result;\n\t}\n\n\tdebounced.cancel = () => {\n\t\tisLeading = false;\n\t\tclearTimeout( timerID );\n\t};\n\n\treturn debounced;\n}\n\nexport default class SidebarAdapter {\n\tconstructor( setting, api ) {\n\t\tthis.setting = setting;\n\t\tthis.api = api;\n\n\t\tthis.locked = false;\n\t\tthis.widgetsCache = new WeakMap();\n\t\tthis.subscribers = new Set();\n\n\t\tthis.history = [\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex = 0;\n\t\tthis.historySubscribers = new Set();\n\t\t// Debounce the input for 1 second.\n\t\tthis._debounceSetHistory = debounce(\n\t\t\tthis._pushHistory,\n\t\t\tthis._replaceHistory,\n\t\t\t1000\n\t\t);\n\n\t\tthis.setting.bind( this._handleSettingChange.bind( this ) );\n\t\tthis.api.bind( 'change', this._handleAllSettingsChange.bind( this ) );\n\n\t\tthis.undo = this.undo.bind( this );\n\t\tthis.redo = this.redo.bind( this );\n\t\tthis.save = this.save.bind( this );\n\t}\n\n\tsubscribe( callback ) {\n\t\tthis.subscribers.add( callback );\n\n\t\treturn () => {\n\t\t\tthis.subscribers.delete( callback );\n\t\t};\n\t}\n\n\tgetWidgets() {\n\t\treturn this.history[ this.historyIndex ];\n\t}\n\n\t_emit( ...args ) {\n\t\tfor ( const callback of this.subscribers ) {\n\t\t\tcallback( ...args );\n\t\t}\n\t}\n\n\t_getWidgetIds() {\n\t\treturn this.setting.get();\n\t}\n\n\t_pushHistory() {\n\t\tthis.history = [\n\t\t\t...this.history.slice( 0, this.historyIndex + 1 ),\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex += 1;\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t}\n\n\t_replaceHistory() {\n\t\tthis.history[ this.historyIndex ] = this._getWidgetIds().map(\n\t\t\t( widgetId ) => this.getWidget( widgetId )\n\t\t);\n\t}\n\n\t_handleSettingChange() {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_handleAllSettingsChange( setting ) {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! setting.id.startsWith( 'widget_' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst widgetId = settingIdToWidgetId( setting.id );\n\t\tif ( ! this.setting.get().includes( widgetId ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_createWidget( widget ) {\n\t\tconst widgetModel = wp.customize.Widgets.availableWidgets.findWhere( {\n\t\t\tid_base: widget.idBase,\n\t\t} );\n\n\t\tlet number = widget.number;\n\t\tif ( widgetModel.get( 'is_multi' ) && ! number ) {\n\t\t\twidgetModel.set(\n\t\t\t\t'multi_number',\n\t\t\t\twidgetModel.get( 'multi_number' ) + 1\n\t\t\t);\n\t\t\tnumber = widgetModel.get( 'multi_number' );\n\t\t}\n\n\t\tconst settingId = number\n\t\t\t? `widget_${ widget.idBase }[${ number }]`\n\t\t\t: `widget_${ widget.idBase }`;\n\n\t\tconst settingArgs = {\n\t\t\ttransport: wp.customize.Widgets.data.selectiveRefreshableWidgets[\n\t\t\t\twidgetModel.get( 'id_base' )\n\t\t\t]\n\t\t\t\t? 'postMessage'\n\t\t\t\t: 'refresh',\n\t\t\tpreviewer: this.setting.previewer,\n\t\t};\n\t\tconst setting = this.api.create(\n\t\t\tsettingId,\n\t\t\tsettingId,\n\t\t\t'',\n\t\t\tsettingArgs\n\t\t);\n\t\tsetting.set( widget.instance );\n\n\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\treturn widgetId;\n\t}\n\n\t_removeWidget( widget ) {\n\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( setting ) {\n\t\t\tconst instance = setting.get();\n\t\t\tthis.widgetsCache.delete( instance );\n\t\t}\n\n\t\tthis.api.remove( settingId );\n\t}\n\n\t_updateWidget( widget ) {\n\t\tconst prevWidget = this.getWidget( widget.id );\n\n\t\t// Bail out update if nothing changed.\n\t\tif ( prevWidget === widget ) {\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Update existing setting if only the widget's instance changed.\n\t\tif (\n\t\t\tprevWidget.idBase &&\n\t\t\twidget.idBase &&\n\t\t\tprevWidget.idBase === widget.idBase\n\t\t) {\n\t\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\t\tthis.api( settingId ).set( widget.instance );\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Otherwise delete and re-create.\n\t\tthis._removeWidget( widget );\n\t\treturn this._createWidget( widget );\n\t}\n\n\tgetWidget( widgetId ) {\n\t\tif ( ! widgetId ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { idBase, number } = parseWidgetId( widgetId );\n\t\tconst settingId = widgetIdToSettingId( widgetId );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( ! setting ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst instance = setting.get();\n\n\t\tif ( this.widgetsCache.has( instance ) ) {\n\t\t\treturn this.widgetsCache.get( instance );\n\t\t}\n\n\t\tconst widget = {\n\t\t\tid: widgetId,\n\t\t\tidBase,\n\t\t\tnumber,\n\t\t\tinstance,\n\t\t};\n\n\t\tthis.widgetsCache.set( instance, widget );\n\n\t\treturn widget;\n\t}\n\n\t_updateWidgets( nextWidgets ) {\n\t\tthis.locked = true;\n\n\t\tconst addedWidgetIds = [];\n\n\t\tconst nextWidgetIds = nextWidgets.map( ( nextWidget ) => {\n\t\t\tif ( nextWidget.id && this.getWidget( nextWidget.id ) ) {\n\t\t\t\taddedWidgetIds.push( null );\n\n\t\t\t\treturn this._updateWidget( nextWidget );\n\t\t\t}\n\n\t\t\tconst widgetId = this._createWidget( nextWidget );\n\n\t\t\taddedWidgetIds.push( widgetId );\n\n\t\t\treturn widgetId;\n\t\t} );\n\n\t\tconst deletedWidgets = this.getWidgets().filter(\n\t\t\t( widget ) => ! nextWidgetIds.includes( widget.id )\n\t\t);\n\t\tdeletedWidgets.forEach( ( widget ) => this._removeWidget( widget ) );\n\n\t\tthis.setting.set( nextWidgetIds );\n\n\t\tthis.locked = false;\n\n\t\treturn addedWidgetIds;\n\t}\n\n\tsetWidgets( nextWidgets ) {\n\t\tconst addedWidgetIds = this._updateWidgets( nextWidgets );\n\n\t\tthis._debounceSetHistory();\n\n\t\treturn addedWidgetIds;\n\t}\n\n\t/**\n\t * Undo/Redo related features\n\t */\n\thasUndo() {\n\t\treturn this.historyIndex > 0;\n\t}\n\n\thasRedo() {\n\t\treturn this.historyIndex < this.history.length - 1;\n\t}\n\n\t_seek( historyIndex ) {\n\t\tconst currentWidgets = this.getWidgets();\n\n\t\tthis.historyIndex = historyIndex;\n\n\t\tconst widgets = this.history[ this.historyIndex ];\n\n\t\tthis._updateWidgets( widgets );\n\n\t\tthis._emit( currentWidgets, this.getWidgets() );\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t\tthis._debounceSetHistory.cancel();\n\t}\n\n\tundo() {\n\t\tif ( ! this.hasUndo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex - 1 );\n\t}\n\n\tredo() {\n\t\tif ( ! this.hasRedo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex + 1 );\n\t}\n\n\tsubscribeHistory( listener ) {\n\t\tthis.historySubscribers.add( listener );\n\n\t\treturn () => {\n\t\t\tthis.historySubscribers.delete( listener );\n\t\t};\n\t}\n\n\tsave() {\n\t\tthis.api.previewer.save();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/sidebar-adapter.js"],"names":["wp","window","parseWidgetId","widgetId","matches","match","idBase","number","parseInt","widgetIdToSettingId","debounce","leading","callback","timeout","isLeading","timerID","debounced","args","result","apply","clearTimeout","setTimeout","cancel","SidebarAdapter","constructor","setting","api","locked","widgetsCache","WeakMap","subscribers","Set","history","_getWidgetIds","map","getWidget","historyIndex","historySubscribers","_debounceSetHistory","_pushHistory","_replaceHistory","bind","_handleSettingChange","_handleAllSettingsChange","undo","redo","save","subscribe","add","delete","getWidgets","_emit","get","slice","forEach","listener","prevWidgets","id","startsWith","includes","_createWidget","widget","widgetModel","customize","Widgets","availableWidgets","findWhere","id_base","set","settingId","settingArgs","transport","data","selectiveRefreshableWidgets","previewer","create","instance","_removeWidget","remove","_updateWidget","prevWidget","has","_updateWidgets","nextWidgets","addedWidgetIds","nextWidgetIds","nextWidget","push","deletedWidgets","filter","setWidgets","hasUndo","hasRedo","length","_seek","currentWidgets","widgets","subscribeHistory"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAASC,MAAf;;AAEA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,QAAMC,OAAO,GAAGD,QAAQ,CAACE,KAAT,CAAgB,cAAhB,CAAhB;;AACA,MAAKD,OAAL,EAAe;AACd,WAAO;AACNE,MAAAA,MAAM,EAAEF,OAAO,CAAE,CAAF,CADT;AAENG,MAAAA,MAAM,EAAEC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB;AAFV,KAAP;AAIA,GAPiC,CASlC;;;AACA,SAAO;AAAEE,IAAAA,MAAM,EAAEH;AAAV,GAAP;AACA;;AAED,SAASM,mBAAT,CAA8BN,QAA9B,EAAyC;AACxC,QAAM;AAAEG,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAqBL,aAAa,CAAEC,QAAF,CAAxC;;AACA,MAAKI,MAAL,EAAc;AACb,WAAQ,UAAUD,MAAQ,IAAIC,MAAQ,GAAtC;AACA;;AAED,SAAQ,UAAUD,MAAQ,EAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,QAAT,CAAmBC,OAAnB,EAA4BC,QAA5B,EAAsCC,OAAtC,EAAgD;AAC/C,MAAIC,SAAS,GAAG,KAAhB;AACA,MAAIC,OAAJ;;AAEA,WAASC,SAAT,CAAoB,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,GAAsB,CAAjD;AACA;;AAEDC,EAAAA,KAAK,CAAE1D,YAAF,EAAiB;AACrB,UAAM2D,cAAc,GAAG,KAAK7C,UAAL,EAAvB;AAEA,SAAKd,YAAL,GAAoBA,YAApB;AAEA,UAAM4D,OAAO,GAAG,KAAKhE,OAAL,CAAc,KAAKI,YAAnB,CAAhB;;AAEA,SAAK8C,cAAL,CAAqBc,OAArB;;AAEA,SAAK7C,KAAL,CAAY4C,cAAZ,EAA4B,KAAK7C,UAAL,EAA5B;;AAEA,SAAKb,kBAAL,CAAwBiB,OAAxB,CAAmCC,QAAF,IAAgBA,QAAQ,EAAzD;;AACA,SAAKjB,mBAAL,CAAyBhB,MAAzB;AACA;;AAEDsB,EAAAA,IAAI,GAAG;AACN,QAAK,CAAE,KAAK+C,OAAL,EAAP,EAAwB;AACvB;AACA;;AAED,SAAKG,KAAL,CAAY,KAAK1D,YAAL,GAAoB,CAAhC;AACA;;AAEDS,EAAAA,IAAI,GAAG;AACN,QAAK,CAAE,KAAK+C,OAAL,EAAP,EAAwB;AACvB;AACA;;AAED,SAAKE,KAAL,CAAY,KAAK1D,YAAL,GAAoB,CAAhC;AACA;;AAED6D,EAAAA,gBAAgB,CAAE1C,QAAF,EAAa;AAC5B,SAAKlB,kBAAL,CAAwBW,GAAxB,CAA6BO,QAA7B;AAEA,WAAO,MAAM;AACZ,WAAKlB,kBAAL,CAAwBY,MAAxB,CAAgCM,QAAhC;AACA,KAFD;AAGA;;AAEDT,EAAAA,IAAI,GAAG;AACN,SAAKpB,GAAL,CAASgD,SAAT,CAAmB5B,IAAnB;AACA;;AA7SkC","sourcesContent":["/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst { wp } = window;\n\nfunction parseWidgetId( widgetId ) {\n\tconst matches = widgetId.match( /^(.+)-(\\d+)$/ );\n\tif ( matches ) {\n\t\treturn {\n\t\t\tidBase: matches[ 1 ],\n\t\t\tnumber: parseInt( matches[ 2 ], 10 ),\n\t\t};\n\t}\n\n\t// Likely an old single widget.\n\treturn { idBase: widgetId };\n}\n\nfunction widgetIdToSettingId( widgetId ) {\n\tconst { idBase, number } = parseWidgetId( widgetId );\n\tif ( number ) {\n\t\treturn `widget_${ idBase }[${ number }]`;\n\t}\n\n\treturn `widget_${ idBase }`;\n}\n\n/**\n * This is a custom debounce function to call different callbacks depending on\n * whether it's the _leading_ call or not.\n *\n * @param {Function} leading The callback that gets called first.\n * @param {Function} callback The callback that gets called after the first time.\n * @param {number} timeout The debounced time in milliseconds.\n * @return {Function} The debounced function.\n */\nfunction debounce( leading, callback, timeout ) {\n\tlet isLeading = false;\n\tlet timerID;\n\n\tfunction debounced( ...args ) {\n\t\tconst result = ( isLeading ? callback : leading ).apply( this, args );\n\n\t\tisLeading = true;\n\n\t\tclearTimeout( timerID );\n\n\t\ttimerID = setTimeout( () => {\n\t\t\tisLeading = false;\n\t\t}, timeout );\n\n\t\treturn result;\n\t}\n\n\tdebounced.cancel = () => {\n\t\tisLeading = false;\n\t\tclearTimeout( timerID );\n\t};\n\n\treturn debounced;\n}\n\nexport default class SidebarAdapter {\n\tconstructor( setting, api ) {\n\t\tthis.setting = setting;\n\t\tthis.api = api;\n\n\t\tthis.locked = false;\n\t\tthis.widgetsCache = new WeakMap();\n\t\tthis.subscribers = new Set();\n\n\t\tthis.history = [\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex = 0;\n\t\tthis.historySubscribers = new Set();\n\t\t// Debounce the input for 1 second.\n\t\tthis._debounceSetHistory = debounce(\n\t\t\tthis._pushHistory,\n\t\t\tthis._replaceHistory,\n\t\t\t1000\n\t\t);\n\n\t\tthis.setting.bind( this._handleSettingChange.bind( this ) );\n\t\tthis.api.bind( 'change', this._handleAllSettingsChange.bind( this ) );\n\n\t\tthis.undo = this.undo.bind( this );\n\t\tthis.redo = this.redo.bind( this );\n\t\tthis.save = this.save.bind( this );\n\t}\n\n\tsubscribe( callback ) {\n\t\tthis.subscribers.add( callback );\n\n\t\treturn () => {\n\t\t\tthis.subscribers.delete( callback );\n\t\t};\n\t}\n\n\tgetWidgets() {\n\t\treturn this.history[ this.historyIndex ];\n\t}\n\n\t_emit( ...args ) {\n\t\tfor ( const callback of this.subscribers ) {\n\t\t\tcallback( ...args );\n\t\t}\n\t}\n\n\t_getWidgetIds() {\n\t\treturn this.setting.get();\n\t}\n\n\t_pushHistory() {\n\t\tthis.history = [\n\t\t\t...this.history.slice( 0, this.historyIndex + 1 ),\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex += 1;\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t}\n\n\t_replaceHistory() {\n\t\tthis.history[ this.historyIndex ] = this._getWidgetIds().map(\n\t\t\t( widgetId ) => this.getWidget( widgetId )\n\t\t);\n\t}\n\n\t_handleSettingChange() {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_handleAllSettingsChange( setting ) {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! setting.id.startsWith( 'widget_' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst widgetId = settingIdToWidgetId( setting.id );\n\t\tif ( ! this.setting.get().includes( widgetId ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_createWidget( widget ) {\n\t\tconst widgetModel = wp.customize.Widgets.availableWidgets.findWhere( {\n\t\t\tid_base: widget.idBase,\n\t\t} );\n\n\t\tlet number = widget.number;\n\t\tif ( widgetModel.get( 'is_multi' ) && ! number ) {\n\t\t\twidgetModel.set(\n\t\t\t\t'multi_number',\n\t\t\t\twidgetModel.get( 'multi_number' ) + 1\n\t\t\t);\n\t\t\tnumber = widgetModel.get( 'multi_number' );\n\t\t}\n\n\t\tconst settingId = number\n\t\t\t? `widget_${ widget.idBase }[${ number }]`\n\t\t\t: `widget_${ widget.idBase }`;\n\n\t\tconst settingArgs = {\n\t\t\ttransport: wp.customize.Widgets.data.selectiveRefreshableWidgets[\n\t\t\t\twidgetModel.get( 'id_base' )\n\t\t\t]\n\t\t\t\t? 'postMessage'\n\t\t\t\t: 'refresh',\n\t\t\tpreviewer: this.setting.previewer,\n\t\t};\n\t\tconst setting = this.api.create(\n\t\t\tsettingId,\n\t\t\tsettingId,\n\t\t\t'',\n\t\t\tsettingArgs\n\t\t);\n\t\tsetting.set( widget.instance );\n\n\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\treturn widgetId;\n\t}\n\n\t_removeWidget( widget ) {\n\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( setting ) {\n\t\t\tconst instance = setting.get();\n\t\t\tthis.widgetsCache.delete( instance );\n\t\t}\n\n\t\tthis.api.remove( settingId );\n\t}\n\n\t_updateWidget( widget ) {\n\t\tconst prevWidget = this.getWidget( widget.id );\n\n\t\t// Bail out update if nothing changed.\n\t\tif ( prevWidget === widget ) {\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Update existing setting if only the widget's instance changed.\n\t\tif (\n\t\t\tprevWidget.idBase &&\n\t\t\twidget.idBase &&\n\t\t\tprevWidget.idBase === widget.idBase\n\t\t) {\n\t\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\t\tthis.api( settingId ).set( widget.instance );\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Otherwise delete and re-create.\n\t\tthis._removeWidget( widget );\n\t\treturn this._createWidget( widget );\n\t}\n\n\tgetWidget( widgetId ) {\n\t\tif ( ! widgetId ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { idBase, number } = parseWidgetId( widgetId );\n\t\tconst settingId = widgetIdToSettingId( widgetId );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( ! setting ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst instance = setting.get();\n\n\t\tif ( this.widgetsCache.has( instance ) ) {\n\t\t\treturn this.widgetsCache.get( instance );\n\t\t}\n\n\t\tconst widget = {\n\t\t\tid: widgetId,\n\t\t\tidBase,\n\t\t\tnumber,\n\t\t\tinstance,\n\t\t};\n\n\t\tthis.widgetsCache.set( instance, widget );\n\n\t\treturn widget;\n\t}\n\n\t_updateWidgets( nextWidgets ) {\n\t\tthis.locked = true;\n\n\t\tconst addedWidgetIds = [];\n\n\t\tconst nextWidgetIds = nextWidgets.map( ( nextWidget ) => {\n\t\t\tif ( nextWidget.id && this.getWidget( nextWidget.id ) ) {\n\t\t\t\taddedWidgetIds.push( null );\n\n\t\t\t\treturn this._updateWidget( nextWidget );\n\t\t\t}\n\n\t\t\tconst widgetId = this._createWidget( nextWidget );\n\n\t\t\taddedWidgetIds.push( widgetId );\n\n\t\t\treturn widgetId;\n\t\t} );\n\n\t\tconst deletedWidgets = this.getWidgets().filter(\n\t\t\t( widget ) => ! nextWidgetIds.includes( widget.id )\n\t\t);\n\t\tdeletedWidgets.forEach( ( widget ) => this._removeWidget( widget ) );\n\n\t\tthis.setting.set( nextWidgetIds );\n\n\t\tthis.locked = false;\n\n\t\treturn addedWidgetIds;\n\t}\n\n\tsetWidgets( nextWidgets ) {\n\t\tconst addedWidgetIds = this._updateWidgets( nextWidgets );\n\n\t\tthis._debounceSetHistory();\n\n\t\treturn addedWidgetIds;\n\t}\n\n\t/**\n\t * Undo/Redo related features\n\t */\n\thasUndo() {\n\t\treturn this.historyIndex > 0;\n\t}\n\n\thasRedo() {\n\t\treturn this.historyIndex < this.history.length - 1;\n\t}\n\n\t_seek( historyIndex ) {\n\t\tconst currentWidgets = this.getWidgets();\n\n\t\tthis.historyIndex = historyIndex;\n\n\t\tconst widgets = this.history[ this.historyIndex ];\n\n\t\tthis._updateWidgets( widgets );\n\n\t\tthis._emit( currentWidgets, this.getWidgets() );\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t\tthis._debounceSetHistory.cancel();\n\t}\n\n\tundo() {\n\t\tif ( ! this.hasUndo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex - 1 );\n\t}\n\n\tredo() {\n\t\tif ( ! this.hasRedo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex + 1 );\n\t}\n\n\tsubscribeHistory( listener ) {\n\t\tthis.historySubscribers.add( listener );\n\n\t\treturn () => {\n\t\t\tthis.historySubscribers.delete( listener );\n\t\t};\n\t}\n\n\tsave() {\n\t\tthis.api.previewer.save();\n\t}\n}\n"]}
@@ -28,12 +28,11 @@ const {
28
28
  ExperimentalBlockEditorProvider
29
29
  } = (0, _privateApis.unlock)(_blockEditor.privateApis);
30
30
 
31
- function SidebarEditorProvider(_ref) {
32
- let {
33
- sidebar,
34
- settings,
35
- children
36
- } = _ref;
31
+ function SidebarEditorProvider({
32
+ sidebar,
33
+ settings,
34
+ children
35
+ }) {
37
36
  const [blocks, onInput, onChange] = (0, _useSidebarBlockEditor.default)(sidebar);
38
37
  (0, _useBlocksFocusControl.default)(blocks);
39
38
  return (0, _element.createElement)(ExperimentalBlockEditorProvider, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","SidebarEditorProvider","sidebar","settings","children","blocks","onInput","onChange"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;;AAEe,SAASC,qBAAT,OAIX;AAAA,MAJ2C;AAC9CC,IAAAA,OAD8C;AAE9CC,IAAAA,QAF8C;AAG9CC,IAAAA;AAH8C,GAI3C;AACH,QAAM,CAAEC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCAAuBL,OAAvB,CAAtC;AAEA,sCAAuBG,MAAvB;AAEA,SACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGA,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGJ,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAOGC,QAPH,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useSidebarBlockEditor from './use-sidebar-block-editor';\nimport useBlocksFocusControl from '../focus-control/use-blocks-focus-control';\n\nimport { unlock } from '../../private-apis';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function SidebarEditorProvider( {\n\tsidebar,\n\tsettings,\n\tchildren,\n} ) {\n\tconst [ blocks, onInput, onChange ] = useSidebarBlockEditor( sidebar );\n\n\tuseBlocksFocusControl( blocks );\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tsettings={ settings }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","SidebarEditorProvider","sidebar","settings","children","blocks","onInput","onChange"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;;AAEe,SAASC,qBAAT,CAAgC;AAC9CC,EAAAA,OAD8C;AAE9CC,EAAAA,QAF8C;AAG9CC,EAAAA;AAH8C,CAAhC,EAIX;AACH,QAAM,CAAEC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCAAuBL,OAAvB,CAAtC;AAEA,sCAAuBG,MAAvB;AAEA,SACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGA,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGJ,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAOGC,QAPH,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useSidebarBlockEditor from './use-sidebar-block-editor';\nimport useBlocksFocusControl from '../focus-control/use-blocks-focus-control';\n\nimport { unlock } from '../../private-apis';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function SidebarEditorProvider( {\n\tsidebar,\n\tsettings,\n\tchildren,\n} ) {\n\tconst [ blocks, onInput, onChange ] = useSidebarBlockEditor( sidebar );\n\n\tuseBlocksFocusControl( blocks );\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tsettings={ settings }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
@@ -16,12 +16,11 @@ var _element = require("@wordpress/element");
16
16
  const SidebarControlsContext = (0, _element.createContext)();
17
17
  exports.SidebarControlsContext = SidebarControlsContext;
18
18
 
19
- function SidebarControls(_ref) {
20
- let {
21
- sidebarControls,
22
- activeSidebarControl,
23
- children
24
- } = _ref;
19
+ function SidebarControls({
20
+ sidebarControls,
21
+ activeSidebarControl,
22
+ children
23
+ }) {
25
24
  const context = (0, _element.useMemo)(() => ({
26
25
  sidebarControls,
27
26
  activeSidebarControl
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-controls/index.js"],"names":["SidebarControlsContext","SidebarControls","sidebarControls","activeSidebarControl","children","context","useSidebarControls","useActiveSidebarControl"],"mappings":";;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,sBAAsB,GAAG,6BAA/B;;;AAEQ,SAASC,eAAT,OAIX;AAAA,MAJqC;AACxCC,IAAAA,eADwC;AAExCC,IAAAA,oBAFwC;AAGxCC,IAAAA;AAHwC,GAIrC;AACH,QAAMC,OAAO,GAAG,sBACf,OAAQ;AACPH,IAAAA,eADO;AAEPC,IAAAA;AAFO,GAAR,CADe,EAKf,CAAED,eAAF,EAAmBC,oBAAnB,CALe,CAAhB;AAQA,SACC,4BAAC,sBAAD,CAAwB,QAAxB;AAAiC,IAAA,KAAK,EAAGE;AAAzC,KACGD,QADH,CADD;AAKA;;AAEM,SAASE,kBAAT,GAA8B;AACpC,QAAM;AAAEJ,IAAAA;AAAF,MAAsB,yBAAYF,sBAAZ,CAA5B;AAEA,SAAOE,eAAP;AACA;;AAEM,SAASK,uBAAT,GAAmC;AACzC,QAAM;AAAEJ,IAAAA;AAAF,MAA2B,yBAAYH,sBAAZ,CAAjC;AAEA,SAAOG,oBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useMemo, useContext } from '@wordpress/element';\n\nexport const SidebarControlsContext = createContext();\n\nexport default function SidebarControls( {\n\tsidebarControls,\n\tactiveSidebarControl,\n\tchildren,\n} ) {\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tsidebarControls,\n\t\t\tactiveSidebarControl,\n\t\t} ),\n\t\t[ sidebarControls, activeSidebarControl ]\n\t);\n\n\treturn (\n\t\t<SidebarControlsContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</SidebarControlsContext.Provider>\n\t);\n}\n\nexport function useSidebarControls() {\n\tconst { sidebarControls } = useContext( SidebarControlsContext );\n\n\treturn sidebarControls;\n}\n\nexport function useActiveSidebarControl() {\n\tconst { activeSidebarControl } = useContext( SidebarControlsContext );\n\n\treturn activeSidebarControl;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/sidebar-controls/index.js"],"names":["SidebarControlsContext","SidebarControls","sidebarControls","activeSidebarControl","children","context","useSidebarControls","useActiveSidebarControl"],"mappings":";;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,sBAAsB,GAAG,6BAA/B;;;AAEQ,SAASC,eAAT,CAA0B;AACxCC,EAAAA,eADwC;AAExCC,EAAAA,oBAFwC;AAGxCC,EAAAA;AAHwC,CAA1B,EAIX;AACH,QAAMC,OAAO,GAAG,sBACf,OAAQ;AACPH,IAAAA,eADO;AAEPC,IAAAA;AAFO,GAAR,CADe,EAKf,CAAED,eAAF,EAAmBC,oBAAnB,CALe,CAAhB;AAQA,SACC,4BAAC,sBAAD,CAAwB,QAAxB;AAAiC,IAAA,KAAK,EAAGE;AAAzC,KACGD,QADH,CADD;AAKA;;AAEM,SAASE,kBAAT,GAA8B;AACpC,QAAM;AAAEJ,IAAAA;AAAF,MAAsB,yBAAYF,sBAAZ,CAA5B;AAEA,SAAOE,eAAP;AACA;;AAEM,SAASK,uBAAT,GAAmC;AACzC,QAAM;AAAEJ,IAAAA;AAAF,MAA2B,yBAAYH,sBAAZ,CAAjC;AAEA,SAAOG,oBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useMemo, useContext } from '@wordpress/element';\n\nexport const SidebarControlsContext = createContext();\n\nexport default function SidebarControls( {\n\tsidebarControls,\n\tactiveSidebarControl,\n\tchildren,\n} ) {\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tsidebarControls,\n\t\t\tactiveSidebarControl,\n\t\t} ),\n\t\t[ sidebarControls, activeSidebarControl ]\n\t);\n\n\treturn (\n\t\t<SidebarControlsContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</SidebarControlsContext.Provider>\n\t);\n}\n\nexport function useSidebarControls() {\n\tconst { sidebarControls } = useContext( SidebarControlsContext );\n\n\treturn sidebarControls;\n}\n\nexport function useActiveSidebarControl() {\n\tconst { activeSidebarControl } = useContext( SidebarControlsContext );\n\n\treturn activeSidebarControl;\n}\n"]}
@@ -18,10 +18,9 @@ var _preferences = require("@wordpress/preferences");
18
18
  /**
19
19
  * WordPress dependencies
20
20
  */
21
- function WelcomeGuide(_ref) {
22
- let {
23
- sidebar
24
- } = _ref;
21
+ function WelcomeGuide({
22
+ sidebar
23
+ }) {
25
24
  const {
26
25
  toggle
27
26
  } = (0, _data.useDispatch)(_preferences.store);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","sidebar","toggle","preferencesStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMe,SAASA,YAAT,OAAqC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,QAAMC,sBAAsB,GAAGH,OAAO,CACpCI,UAD6B,GAE7BC,KAF6B,CAEpBC,MAAF,IAAcA,MAAM,CAACC,EAAP,CAAUC,UAAV,CAAsB,QAAtB,CAFQ,CAA/B;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,6CACC;AACC,IAAA,MAAM,EAAC,wDADR;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,GAAG,EAAC,wDAFL;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,MAAM,EAAC,KAJR;AAKC,IAAA,GAAG,EAAC;AALL,IALD,CADD,CADD,EAgBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACG,cAAI,0BAAJ,CADH,CAhBD,EAmBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGL,sBAAsB,GACrB,cACA,0LADA,CADqB,GAIrB,cACA,yHADA,CALJ,CAnBD,EA4BC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAG,MACTF,MAAM,CAAE,wBAAF,EAA4B,cAA5B;AAJR,KAOG,cAAI,QAAJ,CAPH,CA5BD,EAqCC;AAAI,IAAA,SAAS,EAAC;AAAd,IArCD,EAsCG,CAAEE,sBAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,qCAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,gDADM;AADR,KAKG,cAAI,iCAAJ,CALH,CAHD,CAvCF,EAmDC;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,0BAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,qEADM;AADR,KAKG,cAAI,0BAAJ,CALH,CAHD,CAnDD,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"customize-widgets-welcome-guide__button\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","sidebar","toggle","preferencesStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMe,SAASA,YAAT,CAAuB;AAAEC,EAAAA;AAAF,CAAvB,EAAqC;AACnD,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AAEA,QAAMC,sBAAsB,GAAGH,OAAO,CACpCI,UAD6B,GAE7BC,KAF6B,CAEpBC,MAAF,IAAcA,MAAM,CAACC,EAAP,CAAUC,UAAV,CAAsB,QAAtB,CAFQ,CAA/B;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,6CACC;AACC,IAAA,MAAM,EAAC,wDADR;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,GAAG,EAAC,wDAFL;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,MAAM,EAAC,KAJR;AAKC,IAAA,GAAG,EAAC;AALL,IALD,CADD,CADD,EAgBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACG,cAAI,0BAAJ,CADH,CAhBD,EAmBC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGL,sBAAsB,GACrB,cACA,0LADA,CADqB,GAIrB,cACA,yHADA,CALJ,CAnBD,EA4BC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,OAAO,EAAC,SAFT;AAGC,IAAA,OAAO,EAAG,MACTF,MAAM,CAAE,wBAAF,EAA4B,cAA5B;AAJR,KAOG,cAAI,QAAJ,CAPH,CA5BD,EAqCC;AAAI,IAAA,SAAS,EAAC;AAAd,IArCD,EAsCG,CAAEE,sBAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,qCAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,gDADM;AADR,KAKG,cAAI,iCAAJ,CALH,CAHD,CAvCF,EAmDC;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,0BAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAG,cACN,qEADM;AADR,KAKG,cAAI,0BAAJ,CALH,CAHD,CAnDD,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"customize-widgets-welcome-guide__button\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"]}
@@ -49,8 +49,8 @@ function getInserterOuterSection() {
49
49
 
50
50
  customize.sectionConstructor.outer = customize.OuterSection;
51
51
  return class InserterOuterSection extends customize.OuterSection {
52
- constructor() {
53
- super(...arguments); // This is necessary since we're creating a new class which is not identical to the original OuterSection.
52
+ constructor(...args) {
53
+ super(...args); // This is necessary since we're creating a new class which is not identical to the original OuterSection.
54
54
  // @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436
55
55
 
56
56
  this.params.type = 'outer';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"names":["getInserterOuterSection","wp","customize","window","OuterSection","onChangeExpanded","expanded","args","section","each","params","type","id","collapse","sectionConstructor","outer","InserterOuterSection","constructor","activeElementBeforeExpanded","ownerWindow","contentContainer","ownerDocument","defaultView","addEventListener","event","keyCode","ESCAPE","code","defaultPrevented","preventDefault","stopPropagation","customizeWidgetsStore","setIsInserterOpened","addClass","isFromInternalAction","bind","open","activeElement","expand","completeCallback","searchBox","focus","tabbable","find","close","contains"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,uBAAT,GAAmC;AACjD,QAAM;AACLC,I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AgB,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA,gBAAKnB,gBAAgB,CAACyB,QAAjB,CAA2BR,aAA3B,CAAL,EAAkD;AACjD;AACA,kBAAK,KAAKnB,2BAAV,EAAwC;AACvC,qBAAKA,2BAAL,CAAiCuB,KAAjC;AACA;AACD;AACD;;AAba,SAAf;AAeA;AACD;;AA/F+D,GAAjE;AAiGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/inserter-outer-section.js"],"names":["getInserterOuterSection","wp","customize","window","OuterSection","onChangeExpanded","expanded","args","section","each","params","type","id","collapse","sectionConstructor","outer","InserterOuterSection","constructor","activeElementBeforeExpanded","ownerWindow","contentContainer","ownerDocument","defaultView","addEventListener","event","keyCode","ESCAPE","code","defaultPrevented","preventDefault","stopPropagation","customizeWidgetsStore","setIsInserterOpened","addClass","isFromInternalAction","bind","open","activeElement","expand","completeCallback","searchBox","focus","tabbable","find","close","contains"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGe,SAASA,uBAAT,GAAmC;AACjD,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,YAAY,GAAGF,SAAS,CAACE,YAA/B,CALiD,CAMjD;AACA;AACA;;AACAF,EAAAA,SAAS,CAACE,YAAV,GAAyB,cAAcA,YAAd,CAA2B;AACnDC,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,UAAKD,QAAL,EAAgB;AACfJ,QAAAA,SAAS,CAACM,OAAV,CAAkBC,IAAlB,CAA0BD,OAAF,IAAe;AACtC,cACCA,OAAO,CAACE,MAAR,CAAeC,IAAf,KAAwB,OAAxB,IACAH,OAAO,CAACI,EAAR,KAAe,KAAKA,EAFrB,EAGE;AACD,gBAAKJ,OAAO,CAACF,QAAR,EAAL,EAA0B;AACzBE,cAAAA,OAAO,CAACK,QAAR;AACA;AACD;AACD,SATD;AAUA;;AAED,aAAO,MAAMR,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC,CAAP;AACA;;AAhBkD,GAApD,CATiD,CA2BjD;;AACAL,EAAAA,SAAS,CAACY,kBAAV,CAA6BC,KAA7B,GAAqCb,SAAS,CAACE,YAA/C;AAEA,SAAO,MAAMY,oBAAN,SAAmCd,SAAS,CAACE,YAA7C,CAA0D;AAChEa,IAAAA,WAAW,CAAE,GAAGV,IAAL,EAAY;AACtB,YAAO,GAAGA,IAAV,EADsB,CAGtB;AACA;;AACA,WAAKG,MAAL,CAAYC,IAAZ,GAAmB,OAAnB;AAEA,WAAKO,2BAAL,GAAmC,IAAnC;AAEA,YAAMC,WAAW,GAChB,KAA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DG,IAAAA,KAAK,GAAG;AACP,UAAK,KAAKtC,QAAL,EAAL,EAAuB;AACtB,cAAMc,gBAAgB,GAAG,KAAKA,gBAAL,CAAuB,CAAvB,CAAzB;AACA,cAAMiB,aAAa,GAClBjB,gBAAgB,CAACC,aAAjB,CAA+BgB,aADhC;AAGA,aAAKH,oBAAL,GAA4B,IAA5B;AAEA,aAAKrB,QAAL,CAAe;AACd0B,UAAAA,gBAAgB,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA,gBAAKnB,gBAAgB,CAACyB,QAAjB,CAA2BR,aAA3B,CAAL,EAAkD;AACjD;AACA,kBAAK,KAAKnB,2BAAV,EAAwC;AACvC,qBAAKA,2BAAL,CAAiCuB,KAAjC;AACA;AACD;AACD;;AAba,SAAf;AAeA;AACD;;AA/F+D,GAAjE;AAiGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
@@ -58,10 +58,9 @@ function getInspectorSection() {
58
58
  }
59
59
  }
60
60
 
61
- open() {
62
- let {
63
- returnFocusWhenClose
64
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
61
+ open({
62
+ returnFocusWhenClose
63
+ } = {}) {
65
64
  this.isOpen = true;
66
65
  this.returnFocusWhenClose = returnFocusWhenClose;
67
66
  this.expand({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","_isOpen","isOpen","value","triggerActiveCallbacks","ready","contentContainer","classList","add","isContextuallyActive","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close","active","callbacks","fireWith"],"mappings":";;;;;;;AAAe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,gBAAN,SAA+BF,SAAS,CAACG,OAAzC,CAAiD;AACvDC,IAAAA,WAAW,CAAEC,EAAF,EAAMC,OAAN,EAAgB;AAC1B,YAAOD,EAAP,EAAWC,OAAX;AAEA,WAAKC,aAAL,GAAqBD,OAAO,CAACC,aAA7B;AAEA,WAAKC,oBAAL,GAA4B,IAA5B;AACA,WAAKC,OAAL,GAAe,KAAf;AACA;;AACS,QAANC,MAAM,GAAG;AACZ,aAAO,KAAKD,OAAZ;AACA;;AACS,QAANC,MAAM,CAAEC,KAAF,EAAU;AACnB,WAAKF,OAAL,GAAeE,KAAf;AACA,WAAKC,sBAAL;AACA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKC,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCC,GAArC,CACC,qCADD;AAGA;;AACDC,IAAAA,oBAAoB,G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CAAYC,SAAZ,CAAsBC,QAAtB,CAAgC,KAAKF,MAArC,EAA6C,CAAE,KAAF,EAAS,IAAT,CAA7C;AACA;;AA1FsD,GAAxD;AA4FA","sourcesContent":["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false, true ] );\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/inspector-section.js"],"names":["getInspectorSection","wp","customize","window","InspectorSection","Section","constructor","id","options","parentSection","returnFocusWhenClose","_isOpen","isOpen","value","triggerActiveCallbacks","ready","contentContainer","classList","add","isContextuallyActive","onChangeExpanded","expanded","args","unchanged","collapse","manualTransition","expand","completeCallback","contains","focus","open","allowMultiple","close","active","callbacks","fireWith"],"mappings":";;;;;;;AAAe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,gBAAN,SAA+BF,SAAS,CAACG,OAAzC,CAAiD;AACvDC,IAAAA,WAAW,CAAEC,EAAF,EAAMC,OAAN,EAAgB;AAC1B,YAAOD,EAAP,EAAWC,OAAX;AAEA,WAAKC,aAAL,GAAqBD,OAAO,CAACC,aAA7B;AAEA,WAAKC,oBAAL,GAA4B,IAA5B;AACA,WAAKC,OAAL,GAAe,KAAf;AACA;;AACS,QAANC,MAAM,GAAG;AACZ,aAAO,KAAKD,OAAZ;AACA;;AACS,QAANC,MAAM,CAAEC,KAAF,EAAU;AACnB,WAAKF,OAAL,GAAeE,KAAf;AACA,WAAKC,sBAAL;AACA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKC,gBAAL,CAAuB,CAAvB,EAA2BC,SAA3B,CAAqCC,GAArC,CACC,qCADD;AAGA;;AACDC,IAAAA,oBAAoB,GAAG;AACtB,aAAO,KAAKP,MAAZ;AACA;;AACDQ,IAAAA,gBAAgB,CAAEC,QAAF,EAAYC,IAAZ,EAAmB;AAClC,YAAMF,gBAAN,CAAwBC,QAAxB,EAAkCC,IAAlC;;AAEA,UAAK,KAAKb,aAAL,IAAsB,CAAEa,IAAI,CAACC,SAAlC,EAA8C;AAC7C,YAAKF,QAAL,EAAgB;AACf,eAAKZ,aAAL,CAAmBe,QAAnB,CAA6B;AAC5BC,YAAAA,gBAAgB,EAAE;AADU,WAA7B;AAGA,SAJD,MAIO;AACN,eAAKhB,aAAL,CAAmBiB,MAAnB,CAA2B;AAC1BD,YAAAA,gBAAgB,EAAE,IADQ;AAE1BE,YAAAA,gBAAgB,EAAE,MAAM;AACvB;AACA,kBACC,KAAKjB,oBAAL,IACA,CAAE,KAAKM,gBAAL,CAAuB,CAAvB,EAA2BY,QAA3B,CACD,KAAKlB,oBADJ,CAFH,EAKE;AACD,qBAAKA,oBAAL,CAA0BmB,KAA1B;AACA;AACD;AAZyB,WAA3B;AAcA;AACD;AACD;;AACDC,IAAAA,IAAI,CAAE;AAAEpB,MAAAA;AAAF,QAA2B,EAA7B,EAAkC;AACrC,WAAKE,MAAL,GAAc,IAAd;AACA,WAAKF,oBAAL,GAA4BA,oBAA5B;AAEA,WAAKgB,MAAL,CAAa;AACZK,QAAAA,aAAa,EAAE;AADH,OAAb;AAGA;;AACDC,IAAAA,KAAK,GAAG;AACP,WAAKR,QAAL,CAAe;AACdO,QAAAA,aAAa,EAAE;AADD,OAAf;AAGA;;AACDP,IAAAA,QAAQ,CAAEhB,OAAF,EAAY;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAKI,MAAL,GAAc,KAAd;AACA,YAAMY,QAAN,CAAgBhB,OAAhB;AACA;;AACDM,IAAAA,sBAAsB,GAAG;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAKmB,MAAL,CAAYC,SAAZ,CAAsBC,QAAtB,CAAgC,KAAKF,MAArC,EAA6C,CAAE,KAAF,EAAS,IAAT,CAA7C;AACA;;AA1FsD,GAAxD;AA4FA","sourcesContent":["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false, true ] );\n\t\t}\n\t};\n}\n"]}
@@ -31,8 +31,8 @@ function getSidebarControl() {
31
31
  }
32
32
  } = window;
33
33
  return class SidebarControl extends customize.Control {
34
- constructor() {
35
- super(...arguments);
34
+ constructor(...args) {
35
+ super(...args);
36
36
  this.subscribers = new Set();
37
37
  }
38
38
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"names":["getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","SidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","args","unchanged","customizeWidgetsStore","setIsInserterOpened","forEach","subscriber"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKA,MAAMA,aAAa,GAAKC,SAAF,IAAkB,oBAAoBA,SAAW,EAAvE;;AAEe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,I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n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"names":["getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","SidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","customizeWidgetsStore","setIsInserterOpened","forEach","subscriber"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKA,MAAMA,aAAa,GAAKC,SAAF,IAAkB,oBAAoBA,SAAW,EAAvE;;AAEe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,SAAO,MAAMC,cAAN,SAA6BF,SAAS,CAACG,OAAvC,CAA+C;AACrDC,IAAAA,WAAW,CAAE,GAAGC,IAAL,EAAY;AACtB,YAAO,GAAGA,IAAV;AAEA,WAAKC,WAAL,GAAmB,IAAIC,GAAJ,EAAnB;AACA;;AAEDC,IAAAA,KAAK,GAAG;AACP,YAAMC,oBAAoB,GAAG,oCAA7B;AACA,WAAKC,QAAL,GAAgB,IAAID,oBAAJ,CACfb,aAAa,CAAE,KAAKe,EAAP,CADE,EAEf,EAFe,CAAhB;AAIAX,MAAAA,SAAS,CAACY,OAAV,CAAkBC,GAAlB,CAAuB,KAAKH,QAA5B;AAEA,WAAKI,eAAL,GAAuBd,SAAS,CAACY,OAAV,CAAmB,KAAKA,OAAL,EAAnB,CAAvB;AAEA,WAAKG,SAAL,GAAiB,KAAKD,eAAL,CAAqBC,SAAtC;AAEA,WAAKC,cAAL,GAAsB,IAAIC,uBAAJ,CAAoB,KAAKC,OAAzB,EAAkClB,SAAlC,CAAtB;AACA;;AAEDmB,IAAAA,SAAS,CAAEC,QAAF,EAAa;AACrB,WAAKd,WAAL,CAAiBO,GAAjB,CAAsBO,QAAtB;AAEA,aAAO,MAAM;AACZ,aAAKd,WAAL,CAAiBe,MAAjB,CAAyBD,QAAzB;AACA,OAFD;AAGA;;AAEDE,IAAAA,uBAAuB,CAAEC,QAAF,EAAYlB,IAAZ,EAAmB;AACzC,UAAK,CAAEA,IAAI,CAACmB,SAAZ,EAAwB;AACvB;AACA,YAAK,CAAED,QAAP,EAAkB;AACjB,8BAAUE,YAAV,EAAkCC,mBAAlC,CACC,KADD;AAGA;;AAED,aAAKpB,WAAL,CAAiBqB,OAAjB,CAA4BC,UAAF,IACzBA,UAAU,CAAEL,QAAF,EAAYlB,IAAZ,CADX;AAGA;AACD;;AA3CoD,GAAtD;AA6CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
@@ -52,14 +52,10 @@ function getSidebarSection() {
52
52
  const args = { ..._args,
53
53
 
54
54
  completeCallback() {
55
- var _args$completeCallbac;
56
-
57
55
  controls.forEach(control => {
58
- var _control$onChangeSect;
59
-
60
- (_control$onChangeSect = control.onChangeSectionExpanded) === null || _control$onChangeSect === void 0 ? void 0 : _control$onChangeSect.call(control, expanded, args);
56
+ control.onChangeSectionExpanded?.(expanded, args);
61
57
  });
62
- (_args$completeCallbac = _args.completeCallback) === null || _args$completeCallbac === void 0 ? void 0 : _args$completeCallbac.call(_args);
58
+ _args.completeCallback?.();
63
59
  }
64
60
 
65
61
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","handleTransitionEnd","one"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAP,CAC9B,kCAD8B,CAA/B;AAGA,MAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAA7C;AACAH,EAAAA,sBAAsB,CAACI,gBAAvB,CAAyC,QAAzC,EAAqDC,K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H,gBAAL,CAAsBa,QAAtB,CAAgC,CAAE,MAAF,EAAU,MAAV,CAAhC;AACA,eAAKb,gBAAL,CAAsBc,WAAtB,CAAmC,qBAAnC;AACA,eAAKd,gBAAL,CACEe,OADF,CACW,kBADX,EAEEF,QAFF,CAEY,cAFZ;AAGA,SAND,MAMO;AACN,eAAKb,gBAAL,CAAsBa,QAAtB,CAAgC,CAC/B,MAD+B,EAE/B,qBAF+B,CAAhC;AAIA,eAAKb,gBAAL,CACEe,OADF,CACW,kBADX,EAEEF,QAFF,CAEY,cAFZ;AAGA,eAAKb,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACA;;AAED,cAAME,mBAAmB,GAAG,MAAM;AACjC,eAAKhB,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACAP,UAAAA,IAAI,CAACC,gBAAL;AACA,SAHD;;AAKA,YAAKzB,eAAL,EAAuB;AACtBiC,UAAAA,mBAAmB;AACnB,SAFD,MAEO;AACN,eAAKhB,gBAAL,CAAsBiB,GAAtB,CACC,eADD,EAECD,mBAFD;AAIA;AACD,OA/BD,MA+BO;AACN,cAAMZ,gBAAN,CAAwBD,QAAxB,EAAkCI,IAAlC;AACA;AACD;;AArEoD,GAAtD;AAuEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","handleTransitionEnd","one"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAP,CAC9B,kCAD8B,CAA/B;AAGA,MAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAA7C;AACAH,EAAAA,sBAAsB,CAACI,gBAAvB,CAAyC,QAAzC,EAAqDC,KAAF,IAAa;AAC/DH,IAAAA,eAAe,GAAGG,KAAK,CAACF,OAAxB;AACA,GAFD;AAIA,SAAO,MAAMG,cAAN,SAA6BR,SAAS,CAACS,OAAvC,CAA+C;AACrDC,IAAAA,KAAK,GAAG;AACP,YAAMC,gB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AsBa,QAAtB,CAAgC,CAC/B,MAD+B,EAE/B,qBAF+B,CAAhC;AAIA,eAAKb,gBAAL,CACEe,OADF,CACW,kBADX,EAEEF,QAFF,CAEY,cAFZ;AAGA,eAAKb,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACA;;AAED,cAAME,mBAAmB,GAAG,MAAM;AACjC,eAAKhB,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACAP,UAAAA,IAAI,CAACC,gBAAL;AACA,SAHD;;AAKA,YAAKzB,eAAL,EAAuB;AACtBiC,UAAAA,mBAAmB;AACnB,SAFD,MAEO;AACN,eAAKhB,gBAAL,CAAsBiB,GAAtB,CACC,eADD,EAECD,mBAFD;AAIA;AACD,OA/BD,MA+BO;AACN,cAAMZ,gBAAN,CAAwBD,QAAxB,EAAkCI,IAAlC;AACA;AACD;;AArEoD,GAAtD;AAuEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
@@ -29,7 +29,7 @@ const withMoveToSidebarToolbarItem = (0, _compose.createHigherOrderComponent)(Bl
29
29
  let widgetId = (0, _widgets.getWidgetIdFromBlock)(props);
30
30
  const sidebarControls = (0, _sidebarControls.useSidebarControls)();
31
31
  const activeSidebarControl = (0, _sidebarControls.useActiveSidebarControl)();
32
- const hasMultipleSidebars = (sidebarControls === null || sidebarControls === void 0 ? void 0 : sidebarControls.length) > 1;
32
+ const hasMultipleSidebars = sidebarControls?.length > 1;
33
33
  const blockName = props.name;
34
34
  const clientId = props.clientId;
35
35
  const canInsertBlockInSidebar = (0, _data.useSelect)(select => {
@@ -77,7 +77,7 @@ const withMoveToSidebarToolbarItem = (0, _compose.createHigherOrderComponent)(Bl
77
77
  name: sidebarControl.params.label,
78
78
  description: sidebarControl.params.description
79
79
  })),
80
- currentWidgetAreaId: activeSidebarControl === null || activeSidebarControl === void 0 ? void 0 : activeSidebarControl.id,
80
+ currentWidgetAreaId: activeSidebarControl?.id,
81
81
  onSelect: moveToSidebar
82
82
  })));
83
83
  }, 'withMoveToSidebarToolbarItem');
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AAIA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,MAAMA,4BA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AGA,UAAU,EAAf,EAAmBxB,QAAnB,CAAF,CAAV;AACA,KATD,MASO;AACN;AACJ;AACA;AACA;AACA;AACI,YAAM0B,cAAc,GAAGR,iBAAiB,CAACQ,cAAzC;AAEAZ,MAAAA,WAAW,CAAEP,QAAF,CAAX;AACA,YAAMoB,cAAc,GAAGD,cAAc,CAACE,UAAf,CAA2B,CACjD,GAAGF,cAAc,CAACG,UAAf,EAD8C,EAEjD,0BAAejB,KAAf,CAFiD,CAA3B,CAAvB,CATM,CAaN;;AACAZ,MAAAA,QAAQ,GAAG2B,cAAc,CAACG,OAAf,GAAyBX,IAAzB,CAAiCE,EAAF,IAAU,CAAC,CAAEA,EAA5C,CAAX;AACA,KA7ByC,CA+B1C;;;AACAN,IAAAA,WAAW,CAAEf,QAAF,CAAX;AACA;;AAED,SACC,qDACC,4BAAC,SAAD,EAAgBD,KAAhB,CADD,EAEGI,mBAAmB,IAAIK,uBAAvB,IACD,4BAAC,0BAAD,QACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAGP,eAAe,CAAC8B,GAAhB,CACXX,cAAF,KAAwB;AACvBC,MAAAA,EAAE,EAAED,cAAc,CAACC,EADI;AAEvBf,MAAAA,IAAI,EAAEc,cAAc,CAACY,MAAf,CAAsBC,KAFL;AAGvBC,MAAAA,WAAW,EACVd,cAAc,CAACY,MAAf,CAAsBE;AAJA,KAAxB,CADa,CADf;AASC,IAAA,mBAAmB,EAAGhC,oBAAH,aAAGA,oBAAH,uBAAGA,oBAAoB,CAAEmB,EAT7C;AAUC,IAAA,QAAQ,EAAGL;AAVZ,IADD,CAHF,CADD;AAqBA,CAlFmC,EAmFpC,8BAnFoC,CAArC;AAsFA,sBACC,kBADD,EAEC,mCAFD,EAGCnB,4BAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AAIA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,MAAMA,4BAA4B,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,MAAIC,QAAQ,GAAG,mCAAsBD,KAAtB,CAAf;AACA,QAAME,eAAe,GAAG,0CAAxB;AACA,QAAMC,oBAAoB,GAAG,+CAA7B;AACA,QAAMC,mBAAmB,GAAGF,eAAe,EAAEG,MAAjB,GAA0B,CAAtD;AACA,QAAMC,SAAS,GAAGN,KAAK,CAACO,IAAxB;AACA,QAAMC,QAAQ,GAAGR,KAAK,CAACQ,QAAvB;AACA,QAAMC,uBAAuB,GAAG,qBAC7BC,MAAF,IAAc;AACb;AACA;AACA,WAAOA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,kBAA3B,CACNN,SADM,EAEN,EAFM,CAAP;AAIA,GAR8B,EAS/B,CAAEA,SAAF,CAT+B,CAAhC;AAWA,QAAMO,KAAK,GAAG,qBACXH,MAAF,IAAcA,MAAM,CAAEC,kBAAF,CAAN,CAA2BG,QAA3B,CAAqCN,QAArC,CADD,EAEb,CAAEA,QAAF,CAFa,CAAd;AAIA,QAAM;AAAEO,IAAAA;AAAF,MAAkB,uBAAaJ,kBAAb,CAAxB;AACA,QAAM,GAAIK,WAAJ,IAAoB,oCAA1B;;AAEA,WAASC,aAAT,CAAwBC,gBAAxB,EAA2C;AAC1C,UAAMC,iBAAiB,GAAGjB,eAAe,CAACkB,IAAhB,CACvBC,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AAoB,EAAEmB,EAT7C;AAUC,IAAA,QAAQ,EAAGL;AAVZ,IADD,CAHF,CADD;AAqBA,CAlFmC,EAmFpC,8BAnFoC,CAArC;AAsFA,sBACC,kBADD,EAEC,mCAFD,EAGCnB,4BAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
@@ -17,12 +17,12 @@ const {
17
17
  wp
18
18
  } = window;
19
19
  const withWideWidgetDisplay = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
20
- var _wp$customize$Widgets, _wp$customize$Widgets2;
20
+ var _wp$customize$Widgets;
21
21
 
22
22
  const {
23
23
  idBase
24
24
  } = props.attributes;
25
- const isWide = (_wp$customize$Widgets = (_wp$customize$Widgets2 = wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)) === null || _wp$customize$Widgets2 === void 0 ? void 0 : _wp$customize$Widgets2.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
25
+ const isWide = (_wp$customize$Widgets = wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)?.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
26
26
  return (0, _element.createElement)(BlockEdit, (0, _extends2.default)({}, props, {
27
27
  isWide: isWide
28
28
  }));