@wordpress/customize-widgets 6.2.0 → 6.3.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 (147) hide show
  1. package/build/components/block-appender/index.cjs.map +1 -1
  2. package/build/components/customize-widgets/index.cjs +13 -11
  3. package/build/components/customize-widgets/index.cjs.map +1 -1
  4. package/build/components/customize-widgets/use-clear-selected-block.cjs.map +1 -1
  5. package/build/components/error-boundary/index.cjs.map +1 -1
  6. package/build/components/focus-control/index.cjs.map +1 -1
  7. package/build/components/focus-control/use-blocks-focus-control.cjs.map +1 -1
  8. package/build/components/header/index.cjs +23 -16
  9. package/build/components/header/index.cjs.map +1 -1
  10. package/build/components/inserter/use-inserter.cjs.map +1 -1
  11. package/build/components/keyboard-shortcut-help-modal/config.cjs +5 -0
  12. package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -1
  13. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +9 -7
  14. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -1
  15. package/build/components/keyboard-shortcut-help-modal/index.cjs +12 -11
  16. package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -1
  17. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +34 -13
  18. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -1
  19. package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
  20. package/build/components/more-menu/index.cjs +14 -9
  21. package/build/components/more-menu/index.cjs.map +1 -1
  22. package/build/components/sidebar-block-editor/index.cjs +15 -13
  23. package/build/components/sidebar-block-editor/index.cjs.map +1 -1
  24. package/build/components/sidebar-block-editor/sidebar-adapter.cjs.map +1 -1
  25. package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs +10 -8
  26. package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs.map +1 -1
  27. package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs +9 -7
  28. package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs.map +1 -1
  29. package/build/controls/inserter-outer-section.cjs +2 -2
  30. package/build/controls/inserter-outer-section.cjs.map +1 -1
  31. package/build/controls/sidebar-control.cjs +10 -8
  32. package/build/controls/sidebar-control.cjs.map +1 -1
  33. package/build/controls/sidebar-section.cjs +8 -6
  34. package/build/controls/sidebar-section.cjs.map +1 -1
  35. package/build/index.cjs +12 -11
  36. package/build/index.cjs.map +1 -1
  37. package/build/store/index.cjs +11 -9
  38. package/build/store/index.cjs.map +1 -1
  39. package/build/utils.cjs.map +1 -1
  40. package/build-module/components/focus-control/use-blocks-focus-control.mjs.map +1 -1
  41. package/build-module/components/header/index.mjs +12 -7
  42. package/build-module/components/header/index.mjs.map +1 -1
  43. package/build-module/components/keyboard-shortcut-help-modal/config.mjs +5 -0
  44. package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -1
  45. package/build-module/components/keyboard-shortcut-help-modal/index.mjs +1 -2
  46. package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -1
  47. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +34 -13
  48. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -1
  49. package/build-module/components/more-menu/index.mjs +6 -3
  50. package/build-module/components/more-menu/index.mjs.map +1 -1
  51. package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs.map +1 -1
  52. package/build-module/controls/inserter-outer-section.mjs +3 -3
  53. package/build-module/controls/inserter-outer-section.mjs.map +1 -1
  54. package/build-module/index.mjs +1 -2
  55. package/build-module/index.mjs.map +1 -1
  56. package/build-module/utils.mjs.map +1 -1
  57. package/build-style/style-rtl.css +30 -29
  58. package/build-style/style.css +30 -29
  59. package/build-types/components/block-appender/index.d.ts +2 -0
  60. package/build-types/components/block-appender/index.d.ts.map +1 -0
  61. package/build-types/components/block-inspector-button/index.d.ts +7 -0
  62. package/build-types/components/block-inspector-button/index.d.ts.map +1 -0
  63. package/build-types/components/customize-widgets/index.d.ts +6 -0
  64. package/build-types/components/customize-widgets/index.d.ts.map +1 -0
  65. package/build-types/components/customize-widgets/use-clear-selected-block.d.ts +18 -0
  66. package/build-types/components/customize-widgets/use-clear-selected-block.d.ts.map +1 -0
  67. package/build-types/components/error-boundary/index.d.ts +14 -0
  68. package/build-types/components/error-boundary/index.d.ts.map +1 -0
  69. package/build-types/components/focus-control/index.d.ts +7 -0
  70. package/build-types/components/focus-control/index.d.ts.map +1 -0
  71. package/build-types/components/focus-control/use-blocks-focus-control.d.ts +2 -0
  72. package/build-types/components/focus-control/use-blocks-focus-control.d.ts.map +1 -0
  73. package/build-types/components/header/index.d.ts +9 -0
  74. package/build-types/components/header/index.d.ts.map +1 -0
  75. package/build-types/components/inserter/index.d.ts +5 -0
  76. package/build-types/components/inserter/index.d.ts.map +1 -0
  77. package/build-types/components/inserter/use-inserter.d.ts +2 -0
  78. package/build-types/components/inserter/use-inserter.d.ts.map +1 -0
  79. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +3 -0
  80. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
  81. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
  82. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
  83. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +5 -0
  84. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
  85. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +25 -0
  86. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
  87. package/build-types/components/keyboard-shortcuts/index.d.ts +11 -0
  88. package/build-types/components/keyboard-shortcuts/index.d.ts.map +1 -0
  89. package/build-types/components/more-menu/index.d.ts +2 -0
  90. package/build-types/components/more-menu/index.d.ts.map +1 -0
  91. package/build-types/components/sidebar-block-editor/index.d.ts +7 -0
  92. package/build-types/components/sidebar-block-editor/index.d.ts.map +1 -0
  93. package/build-types/components/sidebar-block-editor/sidebar-adapter.d.ts +37 -0
  94. package/build-types/components/sidebar-block-editor/sidebar-adapter.d.ts.map +1 -0
  95. package/build-types/components/sidebar-block-editor/sidebar-editor-provider.d.ts +6 -0
  96. package/build-types/components/sidebar-block-editor/sidebar-editor-provider.d.ts.map +1 -0
  97. package/build-types/components/sidebar-block-editor/use-sidebar-block-editor.d.ts +2 -0
  98. package/build-types/components/sidebar-block-editor/use-sidebar-block-editor.d.ts.map +1 -0
  99. package/build-types/components/sidebar-controls/index.d.ts +9 -0
  100. package/build-types/components/sidebar-controls/index.d.ts.map +1 -0
  101. package/build-types/components/welcome-guide/index.d.ts +4 -0
  102. package/build-types/components/welcome-guide/index.d.ts.map +1 -0
  103. package/build-types/controls/inserter-outer-section.d.ts +9 -0
  104. package/build-types/controls/inserter-outer-section.d.ts.map +1 -0
  105. package/build-types/controls/inspector-section.d.ts +17 -0
  106. package/build-types/controls/inspector-section.d.ts.map +1 -0
  107. package/build-types/controls/sidebar-control.d.ts +19 -0
  108. package/build-types/controls/sidebar-control.d.ts.map +1 -0
  109. package/build-types/controls/sidebar-section.d.ts +22 -0
  110. package/build-types/controls/sidebar-section.d.ts.map +1 -0
  111. package/build-types/filters/index.d.ts +4 -0
  112. package/build-types/filters/index.d.ts.map +1 -0
  113. package/build-types/filters/move-to-sidebar.d.ts +2 -0
  114. package/build-types/filters/move-to-sidebar.d.ts.map +1 -0
  115. package/build-types/filters/replace-media-upload.d.ts +2 -0
  116. package/build-types/filters/replace-media-upload.d.ts.map +1 -0
  117. package/build-types/filters/wide-widget-display.d.ts +2 -0
  118. package/build-types/filters/wide-widget-display.d.ts.map +1 -0
  119. package/build-types/index.d.ts +10 -0
  120. package/build-types/index.d.ts.map +1 -0
  121. package/build-types/lock-unlock.d.ts +2 -0
  122. package/build-types/lock-unlock.d.ts.map +1 -0
  123. package/build-types/store/actions.d.ts +39 -0
  124. package/build-types/store/actions.d.ts.map +1 -0
  125. package/build-types/store/constants.d.ts +5 -0
  126. package/build-types/store/constants.d.ts.map +1 -0
  127. package/build-types/store/index.d.ts +9 -0
  128. package/build-types/store/index.d.ts.map +1 -0
  129. package/build-types/store/reducer.d.ts +14 -0
  130. package/build-types/store/reducer.d.ts.map +1 -0
  131. package/build-types/store/selectors.d.ts +35 -0
  132. package/build-types/store/selectors.d.ts.map +1 -0
  133. package/build-types/utils.d.ts +32 -0
  134. package/build-types/utils.d.ts.map +1 -0
  135. package/package.json +28 -28
  136. package/src/components/header/index.jsx +1 -1
  137. package/src/components/header/style.scss +12 -9
  138. package/src/components/header/test/index.jsdom.test.tsx +5 -0
  139. package/src/components/inserter/style.scss +6 -4
  140. package/src/components/keyboard-shortcut-help-modal/config.js +3 -0
  141. package/src/components/keyboard-shortcut-help-modal/index.jsx +0 -2
  142. package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +38 -25
  143. package/src/components/more-menu/index.jsx +3 -7
  144. package/src/components/sidebar-block-editor/style.scss +9 -0
  145. package/src/controls/inserter-outer-section.js +3 -3
  146. package/src/index.jsx +1 -4
  147. package/src/utils.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["unlock","blockEditorPrivateApis","useDispatch","keyboardShortcutsStore","__","isAppleOS"],"sources":["../../../src/components/keyboard-shortcuts/index.js"],"sourcesContent":["import { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { usesNativeUndo } = unlock( blockEditorPrivateApis );\n\nfunction KeyboardShortcuts( { undo, redo, save } ) {\n\tuseShortcut( 'core/customize-widgets/undo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/redo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsave();\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunregisterShortcut( 'core/customize-widgets/undo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/redo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/save' );\n\t\t};\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,EAAE,oBAAA,G,+BAAmBA,CAAAA,CAAAA,OAAAA,CAAQC,wBAAAA,WAAuB;AAE1D,SAAS,kBAAmB,EAAE,MAAM,MAAM,QAAS;CAClD,CAAA,GAAA,8BAAA,YAAA,CAAa,gCAAiC,UAAW;EACxD,IAAK,eAAgB,KAAM,GAC1B;EAED,KAAK;EACL,MAAM,eAAe;CACtB,CAAE;CAEF,CAAA,GAAA,8BAAA,YAAA,CAAa,gCAAiC,UAAW;EACxD,IAAK,eAAgB,KAAM,GAC1B;EAED,KAAK;EACL,MAAM,eAAe;CACtB,CAAE;CAEF,CAAA,GAAA,8BAAA,YAAA,CAAa,gCAAiC,UAAW;EACxD,MAAM,eAAe;EACrB,KAAK;CACN,CAAE;CAEF,OAAO;AACR;AAEA,SAAS,4BAA4B;CACpC,MAAM,EAAE,kBAAkB,wBAAA,GAAuBC,gBAAAA,YAAAA,CAChDC,8BAAAA,KACD;CAEA,CAAA,GAAA,mBAAA,UAAA,OAAiB;EAChB,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,cAAA,GAAaC,gBAAAA,GAAAA,CAAI,yBAA0B;GAC3C,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;EACD,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,cAAA,GAAaA,gBAAAA,GAAAA,CAAI,sBAAuB;GACxC,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;GAKA,UAAA,GAASC,oBAAAA,UAAAA,CAAU,IAChB,CAAC,IACD,CACA;IACC,UAAU;IACV,WAAW;GACZ,CACD;EACH,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,cAAA,GAAaD,gBAAAA,GAAAA,CAAI,oBAAqB;GACtC,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;EACD,CAAE;EAEF,aAAa;GACZ,mBAAoB,6BAA8B;GAClD,mBAAoB,6BAA8B;GAClD,mBAAoB,6BAA8B;EACnD;CACD,GAAG,CAAE,gBAAiB,CAAE;CAExB,OAAO;AACR;AAEA,kBAAkB,WAAW"}
1
+ {"version":3,"file":"index.cjs","names":["unlock","blockEditorPrivateApis","useShortcut","useDispatch","keyboardShortcutsStore","useEffect","__","isAppleOS"],"sources":["../../../src/components/keyboard-shortcuts/index.js"],"sourcesContent":["import { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { usesNativeUndo } = unlock( blockEditorPrivateApis );\n\nfunction KeyboardShortcuts( { undo, redo, save } ) {\n\tuseShortcut( 'core/customize-widgets/undo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/redo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/customize-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsave();\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/customize-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunregisterShortcut( 'core/customize-widgets/undo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/redo' );\n\t\t\tunregisterShortcut( 'core/customize-widgets/save' );\n\t\t};\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,EAAE,oBAAA,G,+BAAmBA,CAAAA,CAAAA,OAAAA,CAAQC,wBAAAA,WAAuB;AAE1D,SAAS,kBAAmB,EAAE,MAAM,MAAM,QAAS;CAClDC,CAAAA,G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toOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -34,15 +36,15 @@ let _wordpress_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
34
36
  let _wordpress_preferences = require("@wordpress/preferences");
35
37
  let _wordpress_ui = require("@wordpress/ui");
36
38
  let ___keyboard_shortcut_help_modal_index_jsx = require("../keyboard-shortcut-help-modal/index.cjs");
37
- ___keyboard_shortcut_help_modal_index_jsx = __toESM(___keyboard_shortcut_help_modal_index_jsx);
38
39
  let react_jsx_runtime = require("react/jsx-runtime");
40
+ ___keyboard_shortcut_help_modal_index_jsx = __toESM(___keyboard_shortcut_help_modal_index_jsx);
39
41
  // packages/customize-widgets/src/components/more-menu/index.jsx
40
42
  function MoreMenu() {
41
43
  const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = (0, _wordpress_element.useState)(false);
42
44
  const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
43
45
  (0, _wordpress_keyboard_shortcuts.useShortcut)("core/customize-widgets/keyboard-shortcuts", toggleKeyboardShortcutsModal);
44
46
  const { toggle } = (0, _wordpress_data.useDispatch)(_wordpress_preferences.store);
45
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.ToolbarDropdownMenu, {
47
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.DropdownMenu, {
46
48
  icon: _wordpress_icons.moreVertical,
47
49
  label: (0, _wordpress_i18n.__)("Options"),
48
50
  popoverProps: {
@@ -86,7 +88,10 @@ function MoreMenu() {
86
88
  target: "_blank",
87
89
  children: [(0, _wordpress_i18n.__)("Help"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_ui.VisuallyHidden, {
88
90
  render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {}),
89
- children: (0, _wordpress_i18n.__)("(opens in a new tab)")
91
+ children: (0, _wordpress_i18n.__)(
92
+ /** translators: accessibility text */
93
+ "(opens in a new tab)"
94
+ )
90
95
  })]
91
96
  })
92
97
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useState","useDispatch","preferencesStore","ToolbarDropdownMenu","moreVertical","__","MenuGroup","_x","PreferenceToggleMenuItem","MenuItem","displayShortcut","external","VisuallyHidden","KeyboardShortcutHelpModal"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import {\n\tMenuGroup,\n\tMenuItem,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarDropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ToolbarDropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAwB,WAAW;CAClC,MAAM,CACL,gCACA,uCAAA,GACGA,mBAAAA,SAAAA,CAAU,KAAM;CACpB,MAAM,qCACL,mCAAoC,CAAE,8BAA+B;CAEtE,CAAA,GAAA,8BAAA,YAAA,CACC,6CACA,4BACD;CAEA,MAAM,EAAE,YAAA,GAAWC,gBAAAA,YAAAA,CAAaC,uBAAAA,KAAiB;CAEjD,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,qBAAD;EACC,MAAOC,iBAAAA;EACP,QAAA,GAAQC,gBAAAA,GAAAA,CAAI,SAAU;EACtB,cAAe;GACd,WAAW;GACX,WAA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A,kBAAA,IAAA,CAAC,QAAD,CAAO,CAAA;OAG9BP,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,sBAAuB;MAEb,CAAA,CACP;;IACA;;GACX,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;IAAW,QAAA,GAAQD,gBAAAA,GAAAA,CAAI,aAAc;IACpC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACG,uBAAAA,0BAAD;KACC,OAAM;KACN,MAAK;KACL,QAAA,GAAQH,gBAAAA,GAAAA,CACP,kCACD;KACA,OAAA,GAAOA,gBAAAA,GAAAA,CACN,iEACD;KACA,mBAAA,GAAmBA,gBAAAA,GAAAA,CAClB,4CACD;KACA,qBAAA,GAAqBA,gBAAAA,GAAAA,CACpB,8CACD;IACA,CAAA;GACS,CAAA;EACV,EAAA,CAAA;CAEiB,CAAA,GACrB,iBAAA,GAAA,kBAAA,IAAA,CAACQ,0CAAAA,SAAD;EACC,eAAgB;EAChB,aAAc;CACd,CAAA,CACA,EAAA,CAAA;AAEJ"}
1
+ {"version":3,"file":"index.cjs","names":["useState","useShortcut","useDispatch","preferencesStore","DropdownMenu","moreVertical","__","MenuGroup","_x","PreferenceToggleMenuItem","MenuItem","displayShortcut","external","VisuallyHidden","KeyboardShortcutHelpModal"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/customize-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/customize-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAwB,WAAW;CAClC,MAAM,CACL,gCACA,uCAAA,GACGA,mBAAAA,SAAAA,CAAU,KAAM;CACpB,MAAM,qCACL,mCAAoC,CAAE,8BAA+B;CAEtEC,CAAAA,GAAAA,8BAAAA,YAAAA,CACC,6CACA,4BACD;CAEA,MAAM,EAAE,YAAA,GAAWC,gBAAAA,YAAAA,CAAaC,uBAAAA,KAAiB;CAEjD,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,cAAD;EACC,MAAOC,iBAAAA;EACP,QAAA,GAAQC,gBAAAA,GAAAA,CAAI,SAAU;EACtB,cAAe;GACd,WAAW;GACX,WAAW;EACZ;EACA,aAAc;GACb,iBAAiB;GACjB,MAAM;EACP;EAGC,gBAAA,iBAA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AA,GAAAA;;QAAI;OAAuB;MAEb,CAAA,CACP;;IACA;;GACX,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,WAAD;IAAW,QAAA,GAAQD,gBAAAA,GAAAA,CAAI,aAAc;IACpC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACG,uBAAAA,0BAAD;KACC,OAAM;KACN,MAAK;KACL,QAAA,GAAQH,gBAAAA,GAAAA,CACP,kCACD;KACA,OAAA,GAAOA,gBAAAA,GAAAA,CACN,iEACD;KACA,mBAAA,GAAmBA,gBAAAA,GAAAA,CAClB,4CACD;KACA,qBAAA,GAAqBA,gBAAAA,GAAAA,CACpB,8CACD;IACA,CAAA;GACS,CAAA;EACV,EAAA,CAAA;CAEU,CAAA,GACd,iBAAA,GAAA,kBAAA,IAAA,CAACQ,0CAAAA,SAAD;EACC,eAAgB;EAChB,aAAc;CACd,CAAA,CACA,EAAA,CAAA;AAEJ"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -32,21 +34,21 @@ let _wordpress_block_editor = require("@wordpress/block-editor");
32
34
  let _wordpress_media_utils = require("@wordpress/media-utils");
33
35
  let _wordpress_preferences = require("@wordpress/preferences");
34
36
  let ___block_inspector_button_index_jsx = require("../block-inspector-button/index.cjs");
35
- ___block_inspector_button_index_jsx = __toESM(___block_inspector_button_index_jsx);
36
37
  let ___header_index_jsx = require("../header/index.cjs");
37
- ___header_index_jsx = __toESM(___header_index_jsx);
38
38
  let ___inserter_use_inserter_js = require("../inserter/use-inserter.cjs");
39
- ___inserter_use_inserter_js = __toESM(___inserter_use_inserter_js);
40
39
  let __sidebar_editor_provider_jsx = require("./sidebar-editor-provider.cjs");
41
- __sidebar_editor_provider_jsx = __toESM(__sidebar_editor_provider_jsx);
42
40
  let ___welcome_guide_index_jsx = require("../welcome-guide/index.cjs");
43
- ___welcome_guide_index_jsx = __toESM(___welcome_guide_index_jsx);
44
41
  let ___keyboard_shortcuts_index_js = require("../keyboard-shortcuts/index.cjs");
45
- ___keyboard_shortcuts_index_js = __toESM(___keyboard_shortcuts_index_js);
46
42
  let ___block_appender_index_jsx = require("../block-appender/index.cjs");
47
- ___block_appender_index_jsx = __toESM(___block_appender_index_jsx);
48
43
  let ______lock_unlock_js = require("../../lock-unlock.cjs");
49
44
  let react_jsx_runtime = require("react/jsx-runtime");
45
+ ___block_inspector_button_index_jsx = __toESM(___block_inspector_button_index_jsx);
46
+ ___header_index_jsx = __toESM(___header_index_jsx);
47
+ ___inserter_use_inserter_js = __toESM(___inserter_use_inserter_js);
48
+ __sidebar_editor_provider_jsx = __toESM(__sidebar_editor_provider_jsx);
49
+ ___welcome_guide_index_jsx = __toESM(___welcome_guide_index_jsx);
50
+ ___keyboard_shortcuts_index_js = __toESM(___keyboard_shortcuts_index_js);
51
+ ___block_appender_index_jsx = __toESM(___block_appender_index_jsx);
50
52
  // packages/customize-widgets/src/components/sidebar-block-editor/index.jsx
51
53
  const { ExperimentalBlockCanvas: BlockCanvas } = (0, ______lock_unlock_js.unlock)(_wordpress_block_editor.privateApis);
52
54
  function SidebarBlockEditor({ blockEditorSettings, sidebar, inserter, inspector }) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["unlock","blockEditorPrivateApis","useInserter","useViewportMatch","useSelect","preferencesStore","coreStore","useMemo","WelcomeGuide","KeyboardShortcuts","SidebarEditorProvider","Header","BlockToolbar","BlockList","BlockAppender","createPortal","BlockInspector","__unstableBlockSettingsMenuFirstItem","BlockInspectorButton"],"sources":["../../../src/components/sidebar-block-editor/index.jsx"],"sourcesContent":["import { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\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';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\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', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'attachment',\n\t\t\t\t} ) ?? 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 || ! isMediumViewport,\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\tisMediumViewport,\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<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={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,EAAE,yBAAyB,iBAAA,GAAgBA,qBAAAA,OAAAA,CAChDC,wBAAAA,WACD;AAEA,SAAwB,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AAD;GAAiC;GAAqB;GAAtD,UAAA;IACC,iBAAA,GAAA,kBAAA,IAAA,CAACD,+BAAAA,SAAD;KACC,MAAO,QAAQ;KACf,MAAO,QAAQ;KACf,MAAO,QAAQ;IACf,CAAA;IAED,iBAAA,GAAA,kBAAA,IAAA,CAACE,oBAAAA,SAAD;KACW;KACC;KACQ;KACG;KACtB,sBACC,wBAAwB,CAAE;IAE3B,CAAA;KACG,wBAAwB,CAAE,qBAC7B,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,cAAD,EAAc,gBAAA,KAAgB,CAAA;IAE/B,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;KACC,cAAe;KACf,QAAS,SAAS;KAClB,QAAO;KAEP,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,WAAD,EAAW,gBAAiBC,4BAAAA,QAAiB,CAAA;IACjC,CAAA;KAEXC,GAAAA,mBAAAA,aAAAA,CAGD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAa,UAAW,MAAM,eAAe;KAClD,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,gBAAD,CAAiB,CAAA;IACZ,CAAA,GACN,UAAU,iBAAkB,EAC7B;GACsB;;EAEvB,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,sCAAD,EAAA,WACK,EAAE,cACL,iBAAA,GAAA,kBAAA,IAAA,CAACC,oCAAAA,SAAD;GACa;GACZ,WAAY;EACZ,CAAA,EAEmC,CAAA;CACrC,EAAA,CAAA;AAEJ"}
1
+ {"version":3,"file":"index.cjs","names":["unlock","blockEditorPrivateApis","useInserter","useViewportMatch","useSelect","preferencesStore","coreStore","useMemo","uploadMedia","WelcomeGuide","KeyboardShortcuts","SidebarEditorProvider","Header","BlockToolbar","BlockList","BlockAppender","createPortal","BlockInspector","__unstableBlockSettingsMenuFirstItem","BlockInspectorButton"],"sources":["../../../src/components/sidebar-block-editor/index.jsx"],"sourcesContent":["import { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\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';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\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', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'attachment',\n\t\t\t\t} ) ?? 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 || ! isMediumViewport,\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\tisMediumViewport,\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<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={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,EAAE,yBAAyB,iBAAA,GAAgBA,qBAAAA,OAAAA,CAChDC,wBAAAA,WACD;AAEA,SAAwB,mBAAoB,EAC3C,qBACA,SACA,UACA,aACG;CACH,MAAM,CAAE,kBAAkB,wBAAA,GAAwBC,4BAAAA,QAAAA,CAAa,QAAS;CACxE,MAAM,oBAAA,GAAmBC,mBAAAA,iBAAAA,CAAkB,OAAQ;CACnD,MAAM,EACL,sBACA,sBACA,sBACA,0BAAA,GACGC,gBAAAA,UAAAA,EAAa,WAAY;EAC5B,MAAM,EAAE,QAAQ,OAAQC,uBAAAA,KAAiB;EACzC,OAAO;GACN,sBACC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AAA,IAAA,CAACC,wBAAAA,cAAD,EAAc,gBAAA,KAAgB,CAAA;IAE/B,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD;KACC,cAAe;KACf,QAAS,SAAS;KAClB,QAAO;KAEP,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,WAAD,EAAW,gBAAiBC,4BAAAA,QAAiB,CAAA;IACjC,CAAA;KAEXC,GAAAA,mBAAAA,aAAAA,CAGD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAa,UAAW,MAAM,eAAe;KAClD,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,gBAAD,CAAiB,CAAA;IACZ,CAAA,GACN,UAAU,iBAAkB,EAC7B;GACsB;;EAEvB,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,sCAAD,EAAA,WACK,EAAE,cACL,iBAAA,GAAA,kBAAA,IAAA,CAACC,oCAAAA,SAAD;GACa;GACZ,WAAY;EACZ,CAAA,EAEmC,CAAA;CACrC,EAAA,CAAA;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-adapter.cjs","names":["settingIdToWidgetId"],"sources":["../../../src/components/sidebar-block-editor/sidebar-adapter.js"],"sourcesContent":["import { 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"],"mappings":";;;;;;;AAEA,MAAM,EAAE,OAAO;AAEf,SAAS,cAAe,UAAW;CAClC,MAAM,UAAU,SAAS,MAAO,cAAe;CAC/C,IAAK,SACJ,OAAO;EACN,QAAQ,QAAS;EACjB,QAAQ,SAAU,QAAS,IAAK,EAAG;CACpC;CAID,OAAO,EAAE,QAAQ,SAAS;AAC3B;AAEA,SAAS,oBAAqB,UAAW;CACxC,MAAM,EAAE,QAAQ,WAAW,cAAe,QAAS;CACnD,IAAK,QACJ,OAAO,UAAW,OAAQ,GAAI,OAAQ;CAGvC,OAAO,UAAW;AACnB;;;;;;;;;;AAWA,SAAS,SAAU,SAAS,UAAU,SAAU;CAC/C,IAAI,YAAY;CAChB,IAAI;CAEJ,SAAS,UAAW,GAAG,MAAO;EAC7B,MAAM,UAAW,YAAY,WAAW,QAAA,CAAU,MAAO,MAAM,IAAK;EAEpE,YAAY;EAEZ,aAAc,OAAQ;EAEtB,UAAU,iBAAkB;GAC3B,YAAY;EACb,GAAG,OAAQ;EAEX,OAAO;CACR;CAEA,UAAU,eAAe;EACxB,YAAY;EACZ,aAAc,OAAQ;CACvB;CAEA,OAAO;AACR;AAEA,IAAqB,iBAArB,MAAoC;CACnC,YAAa,SAAS,KAAM;EAC3B,KAAK,UAAU;EACf,KAAK,MAAM;EAEX,KAAK,SAAS;EACd,KAAK,+BAAe,IAAI,QAAQ;EAChC,KAAK,8BAAc,IAAI,IAAI;EAE3B,KAAK,UAAU,CACd,KAAK,cAAc,CAAC,CAAC,KAAO,aAC3B,KA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,QAAQ,SAAS;CAClD;CAEA,MAAO,cAAe;EACrB,MAAM,iBAAiB,KAAK,WAAW;EAEvC,KAAK,eAAe;EAEpB,MAAM,UAAU,KAAK,QAAS,KAAK;EAEnC,KAAK,eAAgB,OAAQ;EAE7B,KAAK,MAAO,gBAAgB,KAAK,WAAW,CAAE;EAE9C,KAAK,mBAAmB,SAAW,aAAc,SAAS,CAAE;EAC5D,KAAK,oBAAoB,OAAO;CACjC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,iBAAkB,UAAW;EAC5B,KAAK,mBAAmB,IAAK,QAAS;EAEtC,aAAa;GACZ,KAAK,mBAAmB,OAAQ,QAAS;EAC1C;CACD;CAEA,OAAO;EACN,KAAK,IAAI,UAAU,KAAK;CACzB;AACD"}
1
+ {"version":3,"file":"sidebar-adapter.cjs","names":["settingIdToWidgetId"],"sources":["../../../src/components/sidebar-block-editor/sidebar-adapter.js"],"sourcesContent":["import { 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"],"mappings":";;;;;;;AAEA,MAAM,EAAE,OAAO;AAEf,SAAS,cAAe,UAAW;CAClC,MAAM,UAAU,SAAS,MAAO,cAAe;CAC/C,IAAK,SACJ,OAAO;EACN,QAAQ,QAAS;EACjB,QAAQ,SAAU,QAAS,IAAK,EAAG;CACpC;CAID,OAAO,EAAE,QAAQ,SAAS;AAC3B;AAEA,SAAS,oBAAqB,UAAW;CACxC,MAAM,EAAE,QAAQ,WAAW,cAAe,QAAS;CACnD,IAAK,QACJ,OAAO,UAAW,OAAQ,GAAI,OAAQ;CAGvC,OAAO,UAAW;AACnB;;;;;;;;;;AAWA,SAAS,SAAU,SAAS,UAAU,SAAU;CAC/C,IAAI,YAAY;CAChB,IAAI;CAEJ,SAAS,UAAW,GAAG,MAAO;EAC7B,MAAM,UAAW,YAAY,WAAW,QAAA,CAAU,MAAO,MAAM,IAAK;EAEpE,YAAY;EAEZ,aAAc,OAAQ;EAEtB,UAAU,iBAAkB;GAC3B,YAAY;EACb,GAAG,OAAQ;EAEX,OAAO;CACR;CAEA,UAAU,eAAe;EACxB,YAAY;EACZ,aAAc,OAAQ;CACvB;CAEA,OAAO;AACR;AAEA,IAAqB,iBAArB,MAAoC;CACnC,YAAa,SAAS,KAAM;EAC3B,KAAK,UAAU;EACf,KAAK,MAAM;EAEX,KAAK,SAAS;EACd,KAAK,+BAAe,IAAI,QAAQ;EAChC,KAAK,8BAAc,IAAI,IAAI;EAE3B,KAAK,UAAU,CACd,KAAK,cAAc,CAAC,CAAC,KAAO,aAC3B,KAAK,UAAW,QAAS,CAC1B,CACD;EACA,KAAK,eAAe;EACpB,KAA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AiB,KAAK,WAAW;EAEvC,KAAK,eAAe;EAEpB,MAAM,UAAU,KAAK,QAAS,KAAK;EAEnC,KAAK,eAAgB,OAAQ;EAE7B,KAAK,MAAO,gBAAgB,KAAK,WAAW,CAAE;EAE9C,KAAK,mBAAmB,SAAW,aAAc,SAAS,CAAE;EAC5D,KAAK,oBAAoB,OAAO;CACjC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,iBAAkB,UAAW;EAC5B,KAAK,mBAAmB,IAAK,QAAS;EAEtC,aAAa;GACZ,KAAK,mBAAmB,OAAQ,QAAS;EAC1C;CACD;CAEA,OAAO;EACN,KAAK,IAAI,UAAU,KAAK;CACzB;AACD"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -26,11 +28,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
28
  }) : target, mod));
27
29
  let _wordpress_block_editor = require("@wordpress/block-editor");
28
30
  let __use_sidebar_block_editor_js = require("./use-sidebar-block-editor.cjs");
29
- __use_sidebar_block_editor_js = __toESM(__use_sidebar_block_editor_js);
30
31
  let ___focus_control_use_blocks_focus_control_js = require("../focus-control/use-blocks-focus-control.cjs");
31
- ___focus_control_use_blocks_focus_control_js = __toESM(___focus_control_use_blocks_focus_control_js);
32
32
  let ______lock_unlock_js = require("../../lock-unlock.cjs");
33
33
  let react_jsx_runtime = require("react/jsx-runtime");
34
+ __use_sidebar_block_editor_js = __toESM(__use_sidebar_block_editor_js);
35
+ ___focus_control_use_blocks_focus_control_js = __toESM(___focus_control_use_blocks_focus_control_js);
34
36
  // packages/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.jsx
35
37
  const { ExperimentalBlockEditorProvider } = (0, ______lock_unlock_js.unlock)(_wordpress_block_editor.privateApis);
36
38
  function SidebarEditorProvider({ sidebar, settings, children }) {
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-editor-provider.cjs","names":["unlock","blockEditorPrivateApis","useSidebarBlockEditor"],"sources":["../../../src/components/sidebar-block-editor/sidebar-editor-provider.jsx"],"sourcesContent":["import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport useSidebarBlockEditor from './use-sidebar-block-editor';\nimport useBlocksFocusControl from '../focus-control/use-blocks-focus-control';\nimport { unlock } from '../../lock-unlock';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,EAAE,qCAAA,GAAoCA,qBAAAA,OAAAA,CAAQC,wBAAAA,WAAuB;AAE3E,SAAwB,sBAAuB,EAC9C,SACA,UACA,YACG;CACH,MAAM,CAAE,QAAQ,SAAS,aAAA,GAAaC,8BAAAA,QAAAA,CAAuB,OAAQ;CAErE,CAAA,GAAA,6CAAA,QAAA,CAAuB,MAAO;CAE9B,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,iCAAD;EACC,OAAQ;EACE;EACC;EACA;EACX,gBAAiB;EAEf;CAC8B,CAAA;AAEnC"}
1
+ {"version":3,"file":"sidebar-editor-provider.cjs","names":["unlock","blockEditorPrivateApis","useSidebarBlockEditor","useBlocksFocusControl"],"sources":["../../../src/components/sidebar-block-editor/sidebar-editor-provider.jsx"],"sourcesContent":["import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport useSidebarBlockEditor from './use-sidebar-block-editor';\nimport useBlocksFocusControl from '../focus-control/use-blocks-focus-control';\nimport { unlock } from '../../lock-unlock';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,EAAE,qCAAA,GAAoCA,qBAAAA,OAAAA,CAAQC,wBAAAA,WAAuB;AAE3E,SAAwB,sBAAuB,EAC9C,SACA,UACA,YACG;CACH,MAAM,CAAE,QAAQ,SAAS,aAAA,GAAaC,8BAAAA,QAAAA,CAAuB,OAAQ;CAErEC,CAAAA,GAAAA,6CAAAA,QAAAA,CAAuB,MAAO;CAE9B,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,iCAAD;EACC,OAAQ;EACE;EACC;EACA;EACX,gBAAiB;EAEf;CAC8B,CAAA;AAEnC"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -25,11 +27,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
27
  enumerable: true
26
28
  }) : target, mod));
27
29
  let fast_deep_equal_es6_index_js = require("fast-deep-equal/es6/index.js");
28
- fast_deep_equal_es6_index_js = __toESM(fast_deep_equal_es6_index_js);
29
30
  let _wordpress_element = require("@wordpress/element");
30
31
  let _wordpress_is_shallow_equal = require("@wordpress/is-shallow-equal");
31
32
  let _wordpress_widgets = require("@wordpress/widgets");
32
33
  let ______utils_js = require("../../utils.cjs");
34
+ fast_deep_equal_es6_index_js = __toESM(fast_deep_equal_es6_index_js);
33
35
  // packages/customize-widgets/src/components/sidebar-block-editor/use-sidebar-block-editor.js
34
36
  function widgetsToBlocks(widgets) {
35
37
  return widgets.map((widget) => (0, ______utils_js.widgetToBlock)(widget));
@@ -1 +1 @@
1
- {"version":3,"file":"use-sidebar-block-editor.cjs","names":["widgetToBlock","useState","getWidgetIdFromBlock","isShallowEqual","useCallback","fastDeepEqual","blockToWidget","addWidgetIdToBlock"],"sources":["../../../src/components/sidebar-block-editor/use-sidebar-block-editor.js"],"sourcesContent":["import fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\nimport { getWidgetIdFromBlock, addWidgetIdToBlock } from '@wordpress/widgets';\nimport { blockToWidget, widgetToBlock } from '../../utils';\n\nfunction widgetsToBlocks( widgets ) {\n\treturn widgets.map( ( widget ) => widgetToBlock( widget ) );\n}\n\nexport default function useSidebarBlockEditor( sidebar ) {\n\tconst [ blocks, setBlocks ] = useState( () =>\n\t\twidgetsToBlocks( sidebar.getWidgets() )\n\t);\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribe( ( prevWidgets, nextWidgets ) => {\n\t\t\tsetBlocks( ( prevBlocks ) => {\n\t\t\t\tconst prevWidgetsMap = new Map(\n\t\t\t\t\tprevWidgets.map( ( widget ) => [ widget.id, widget ] )\n\t\t\t\t);\n\t\t\t\tconst prevBlocksMap = new Map(\n\t\t\t\t\tprevBlocks.map( ( block ) => [\n\t\t\t\t\t\tgetWidgetIdFromBlock( block ),\n\t\t\t\t\t\tblock,\n\t\t\t\t\t] )\n\t\t\t\t);\n\n\t\t\t\tconst nextBlocks = nextWidgets.map( ( nextWidget ) => {\n\t\t\t\t\tconst prevWidget = prevWidgetsMap.get( nextWidget.id );\n\n\t\t\t\t\t// Bail out updates.\n\t\t\t\t\tif ( prevWidget && prevWidget === nextWidget ) {\n\t\t\t\t\t\treturn prevBlocksMap.get( nextWidget.id );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn widgetToBlock( nextWidget );\n\t\t\t\t} );\n\n\t\t\t\t// Bail out updates.\n\t\t\t\tif ( isShallowEqual( prevBlocks, nextBlocks ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\treturn nextBlocks;\n\t\t\t} );\n\t\t} );\n\t}, [ sidebar ] );\n\n\tconst onChangeBlocks = useCallback(\n\t\t( nextBlocks ) => {\n\t\t\tsetBlocks( ( prevBlocks ) => {\n\t\t\t\tif ( isShallowEqual( prevBlocks, nextBlocks ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\tconst prevBlocksMap = new Map(\n\t\t\t\t\tprevBlocks.map( ( block ) => [\n\t\t\t\t\t\tgetWidgetIdFromBlock( block ),\n\t\t\t\t\t\tblock,\n\t\t\t\t\t] )\n\t\t\t\t);\n\n\t\t\t\tconst nextWidgets = nextBlocks.map( ( nextBlock ) => {\n\t\t\t\t\tconst widgetId = getWidgetIdFromBlock( nextBlock );\n\n\t\t\t\t\t// Update existing widgets.\n\t\t\t\t\tif ( widgetId && prevBlocksMap.has( widgetId ) ) {\n\t\t\t\t\t\tconst prevBlock = prevBlocksMap.get( widgetId );\n\t\t\t\t\t\tconst prevWidget = sidebar.getWidget( widgetId );\n\n\t\t\t\t\t\t// Bail out updates by returning the previous widgets.\n\t\t\t\t\t\t// Deep equality is necessary until the block editor's internals changes.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tfastDeepEqual( nextBlock, prevBlock ) &&\n\t\t\t\t\t\t\tprevWidget\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn prevWidget;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn blockToWidget( nextBlock, prevWidget );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add a new widget.\n\t\t\t\t\treturn blockToWidget( nextBlock );\n\t\t\t\t} );\n\n\t\t\t\t// Bail out updates if the updated widgets are the same.\n\t\t\t\tif ( isShallowEqual( sidebar.getWidgets(), nextWidgets ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\tconst addedWidgetIds = sidebar.setWidgets( nextWidgets );\n\n\t\t\t\treturn nextBlocks.reduce(\n\t\t\t\t\t( updatedNextBlocks, nextBlock, index ) => {\n\t\t\t\t\t\tconst addedWidgetId = addedWidgetIds[ index ];\n\n\t\t\t\t\t\tif ( addedWidgetId !== null ) {\n\t\t\t\t\t\t\t// Only create a new instance if necessary to prevent\n\t\t\t\t\t\t\t// the whole editor from re-rendering on every edit.\n\t\t\t\t\t\t\tif ( updatedNextBlocks === nextBlocks ) {\n\t\t\t\t\t\t\t\tupdatedNextBlocks = nextBlocks.slice();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tupdatedNextBlocks[ index ] = addWidgetIdToBlock(\n\t\t\t\t\t\t\t\tnextBlock,\n\t\t\t\t\t\t\t\taddedWidgetId\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn updatedNextBlocks;\n\t\t\t\t\t},\n\t\t\t\t\tnextBlocks\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ sidebar ]\n\t);\n\n\treturn [ blocks, onChangeBlocks, onChangeBlocks ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,gBAAiB,SAAU;CACnC,OAAO,QAAQ,KAAO,YAAA,GAAYA,eAAAA,cAAAA,CAAe,MAAO,CAAE;AAC3D;AAEA,SAAwB,sBAAuB,SAAU;CACxD,MAAM,CAAE,QAAQ,cAAA,GAAcC,mBAAAA,SAAAA,OAC7B,gBAAiB,QAAQ,WAAW,CAAE,CACvC;CAEA,CAAA,GAAA,mBAAA,UAAA,OAAiB;EAChB,OAAO,QAAQ,WAAa,aAAa,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AA,GAAKH,4BAAAA,eAAAA,CAAgB,QAAQ,WAAW,GAAG,WAAY,GACtD,OAAO;GAGR,MAAM,iBAAiB,QAAQ,WAAY,WAAY;GAEvD,OAAO,WAAW,QACf,mBAAmB,WAAW,UAAW;IAC1C,MAAM,gBAAgB,eAAgB;IAEtC,IAAK,kBAAkB,MAAO;KAG7B,IAAK,sBAAsB,YAC1B,oBAAoB,WAAW,MAAM;KAGtC,kBAAmB,UAAA,GAAUI,mBAAAA,mBAAAA,CAC5B,WACA,aACD;IACD;IAEA,OAAO;GACR,GACA,UACD;EACD,CAAE;CACH,GACA,CAAE,OAAQ,CACX;CAEA,OAAO;EAAE;EAAQ;EAAgB;CAAe;AACjD"}
1
+ {"version":3,"file":"use-sidebar-block-editor.cjs","names":["widgetToBlock","useState","useEffect","getWidgetIdFromBlock","isShallowEqual","useCallback","fastDeepEqual","blockToWidget","addWidgetIdToBlock"],"sources":["../../../src/components/sidebar-block-editor/use-sidebar-block-editor.js"],"sourcesContent":["import fastDeepEqual from 'fast-deep-equal/es6/index.js';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\nimport { getWidgetIdFromBlock, addWidgetIdToBlock } from '@wordpress/widgets';\nimport { blockToWidget, widgetToBlock } from '../../utils';\n\nfunction widgetsToBlocks( widgets ) {\n\treturn widgets.map( ( widget ) => widgetToBlock( widget ) );\n}\n\nexport default function useSidebarBlockEditor( sidebar ) {\n\tconst [ blocks, setBlocks ] = useState( () =>\n\t\twidgetsToBlocks( sidebar.getWidgets() )\n\t);\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribe( ( prevWidgets, nextWidgets ) => {\n\t\t\tsetBlocks( ( prevBlocks ) => {\n\t\t\t\tconst prevWidgetsMap = new Map(\n\t\t\t\t\tprevWidgets.map( ( widget ) => [ widget.id, widget ] )\n\t\t\t\t);\n\t\t\t\tconst prevBlocksMap = new Map(\n\t\t\t\t\tprevBlocks.map( ( block ) => [\n\t\t\t\t\t\tgetWidgetIdFromBlock( block ),\n\t\t\t\t\t\tblock,\n\t\t\t\t\t] )\n\t\t\t\t);\n\n\t\t\t\tconst nextBlocks = nextWidgets.map( ( nextWidget ) => {\n\t\t\t\t\tconst prevWidget = prevWidgetsMap.get( nextWidget.id );\n\n\t\t\t\t\t// Bail out updates.\n\t\t\t\t\tif ( prevWidget && prevWidget === nextWidget ) {\n\t\t\t\t\t\treturn prevBlocksMap.get( nextWidget.id );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn widgetToBlock( nextWidget );\n\t\t\t\t} );\n\n\t\t\t\t// Bail out updates.\n\t\t\t\tif ( isShallowEqual( prevBlocks, nextBlocks ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\treturn nextBlocks;\n\t\t\t} );\n\t\t} );\n\t}, [ sidebar ] );\n\n\tconst onChangeBlocks = useCallback(\n\t\t( nextBlocks ) => {\n\t\t\tsetBlocks( ( prevBlocks ) => {\n\t\t\t\tif ( isShallowEqual( prevBlocks, nextBlocks ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\tconst prevBlocksMap = new Map(\n\t\t\t\t\tprevBlocks.map( ( block ) => [\n\t\t\t\t\t\tgetWidgetIdFromBlock( block ),\n\t\t\t\t\t\tblock,\n\t\t\t\t\t] )\n\t\t\t\t);\n\n\t\t\t\tconst nextWidgets = nextBlocks.map( ( nextBlock ) => {\n\t\t\t\t\tconst widgetId = getWidgetIdFromBlock( nextBlock );\n\n\t\t\t\t\t// Update existing widgets.\n\t\t\t\t\tif ( widgetId && prevBlocksMap.has( widgetId ) ) {\n\t\t\t\t\t\tconst prevBlock = prevBlocksMap.get( widgetId );\n\t\t\t\t\t\tconst prevWidget = sidebar.getWidget( widgetId );\n\n\t\t\t\t\t\t// Bail out updates by returning the previous widgets.\n\t\t\t\t\t\t// Deep equality is necessary until the block editor's internals changes.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tfastDeepEqual( nextBlock, prevBlock ) &&\n\t\t\t\t\t\t\tprevWidget\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn prevWidget;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn blockToWidget( nextBlock, prevWidget );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Add a new widget.\n\t\t\t\t\treturn blockToWidget( nextBlock );\n\t\t\t\t} );\n\n\t\t\t\t// Bail out updates if the updated widgets are the same.\n\t\t\t\tif ( isShallowEqual( sidebar.getWidgets(), nextWidgets ) ) {\n\t\t\t\t\treturn prevBlocks;\n\t\t\t\t}\n\n\t\t\t\tconst addedWidgetIds = sidebar.setWidgets( nextWidgets );\n\n\t\t\t\treturn nextBlocks.reduce(\n\t\t\t\t\t( updatedNextBlocks, nextBlock, index ) => {\n\t\t\t\t\t\tconst addedWidgetId = addedWidgetIds[ index ];\n\n\t\t\t\t\t\tif ( addedWidgetId !== null ) {\n\t\t\t\t\t\t\t// Only create a new instance if necessary to prevent\n\t\t\t\t\t\t\t// the whole editor from re-rendering on every edit.\n\t\t\t\t\t\t\tif ( updatedNextBlocks === nextBlocks ) {\n\t\t\t\t\t\t\t\tupdatedNextBlocks = nextBlocks.slice();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tupdatedNextBlocks[ index ] = addWidgetIdToBlock(\n\t\t\t\t\t\t\t\tnextBlock,\n\t\t\t\t\t\t\t\taddedWidgetId\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn updatedNextBlocks;\n\t\t\t\t\t},\n\t\t\t\t\tnextBlocks\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ sidebar ]\n\t);\n\n\treturn [ blocks, onChangeBlocks, onChangeBlocks ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,gBAAiB,SAAU;CACnC,OAAO,QAAQ,KAAO,YAAA,GAAYA,eAAAA,cA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,MAAM,aAAa,QAAQ,UAAW,QAAS;KAI/C,KAAA,GACCG,6BAAAA,QAAAA,CAAe,WAAW,SAAU,KACpC,YAEA,OAAO;KAGR,QAAA,GAAOC,eAAAA,cAAAA,CAAe,WAAW,UAAW;IAC7C;IAGA,QAAA,GAAOA,eAAAA,cAAAA,CAAe,SAAU;GACjC,CAAE;GAGF,KAAA,GAAKH,4BAAAA,eAAAA,CAAgB,QAAQ,WAAW,GAAG,WAAY,GACtD,OAAO;GAGR,MAAM,iBAAiB,QAAQ,WAAY,WAAY;GAEvD,OAAO,WAAW,QACf,mBAAmB,WAAW,UAAW;IAC1C,MAAM,gBAAgB,eAAgB;IAEtC,IAAK,kBAAkB,MAAO;KAG7B,IAAK,sBAAsB,YAC1B,oBAAoB,WAAW,MAAM;KAGtC,kBAAmB,UAAA,GAAUI,mBAAAA,mBAAAA,CAC5B,WACA,aACD;IACD;IAEA,OAAO;GACR,GACA,UACD;EACD,CAAE;CACH,GACA,CAAE,OAAQ,CACX;CAEA,OAAO;EAAE;EAAQ;EAAgB;CAAe;AACjD"}
@@ -27,13 +27,13 @@ function getInserterOuterSection() {
27
27
  super(...args);
28
28
  this.params.type = "outer";
29
29
  this.activeElementBeforeExpanded = null;
30
- this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown", (event) => {
30
+ this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown", (0, _wordpress_keycodes.withIgnoreIMEEvents)((event) => {
31
31
  if (this.expanded() && (event.keyCode === _wordpress_keycodes.ESCAPE || event.code === "Escape") && !event.defaultPrevented) {
32
32
  event.preventDefault();
33
33
  event.stopPropagation();
34
34
  (0, _wordpress_data.dispatch)(___store_index_js.store).setIsInserterOpened(false);
35
35
  }
36
- }, true);
36
+ }), true);
37
37
  this.contentContainer.addClass("widgets-inserter");
38
38
  this.isFromInternalAction = false;
39
39
  this.expanded.bind(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"inserter-outer-section.cjs","names":["ESCAPE","customizeWidgetsStore","focus"],"sources":["../../src/controls/inserter-outer-section.js"],"sourcesContent":["import { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\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"],"mappings":";;;;;;;;;;AAKA,SAAwB,0BAA0B;CACjD,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,MAAM,eAAe,UAAU;CAI/B,UAAU,eAAe,cAAc,aAAa;EACnD,iBAAkB,UAAU,MAAO;GAClC,IAAK,UACJ,UAAU,QAAQ,MAAQ,YAAa;IACtC,IACC,QAAQ,OAAO,SAAS,WACxB,QAAQ,OAAO,KAAK,IAEf;SAAA,QAAQ,SAAS,GACrB,QAAQ,SAAS;IAAA;GAGpB,CAAE;GAGH,OAAO,MAAM,iBAAkB,UAAU,IAAK;EAC/C;CACD;CAEA,UAAU,mBAAmB,QAAQ,UAAU;CAE/C,OAAO,MAAM,6BAA6B,UAAU,aAAa;EAChE,YAAa,GAAG,MAA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CAPE","dispatch","customizeWidgetsStore","focus"],"sources":["../../src/controls/inserter-outer-section.js"],"sourcesContent":["import { ESCAPE, withIgnoreIMEEvents } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\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\twithIgnoreIMEEvents( ( 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"],"mappings":";;;;;;;;;;AAKA,SAAwB,0BAA0B;CACjD,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,MAAM,eAAe,UAAU;CAI/B,UAAU,eAAe,cAAc,aAAa;EACnD,iBAAkB,UAAU,MAAO;GAClC,IAAK,UACJ,UAAU,QAAQ,MAAQ,YAAa;IACtC,IACC,QAAQ,OAAO,SAAS,WACxB,QAAQ,OAAO,KAAK,IAEf;SAAA,QAAQ,SAAS,GACrB,QAAQ,SAAS;IAAA;GAGpB,CAAE;GAGH,OAAO,MAAM,iBAAkB,UAAU,IAAK;EAC/C;CACD;CAEA,UAAU,mBAAmB,QAAQ,UAAU;CAE/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MAAM;KAAA;IAG1C,EACD,CAAE;GACH;EACD;CACD;AACD"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -26,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
28
  }) : target, mod));
27
29
  let _wordpress_data = require("@wordpress/data");
28
30
  let ___components_sidebar_block_editor_sidebar_adapter_js = require("../components/sidebar-block-editor/sidebar-adapter.cjs");
29
- ___components_sidebar_block_editor_sidebar_adapter_js = __toESM(___components_sidebar_block_editor_sidebar_adapter_js);
30
31
  let __inserter_outer_section_js = require("./inserter-outer-section.cjs");
31
- __inserter_outer_section_js = __toESM(__inserter_outer_section_js);
32
32
  let ___store_index_js = require("../store/index.cjs");
33
+ ___components_sidebar_block_editor_sidebar_adapter_js = __toESM(___components_sidebar_block_editor_sidebar_adapter_js);
34
+ __inserter_outer_section_js = __toESM(__inserter_outer_section_js);
33
35
  // packages/customize-widgets/src/controls/sidebar-control.js
34
36
  const getInserterId = (controlId) => `widgets-inserter-${controlId}`;
35
37
  function getSidebarControl() {
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-control.cjs","names":["getInserterOuterSection","SidebarAdapter","customizeWidgetsStore"],"sources":["../../src/controls/sidebar-control.js"],"sourcesContent":["import { dispatch } from '@wordpress/data';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iBAAkB,cAAe,oBAAqB;AAE5D,SAAwB,oBAAoB;CAC3C,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,OAAO,MAAM,uBAAuB,UAAU,QAAQ;EACrD,YAAa,GAAG,MAAO;GACtB,MAAO,GAAG,IAAK;GAEf,KAAK,8BAAc,IAAI,IAAI;EAC5B;EAEA,QAAQ;GACP,MAAM,wBAAA,GAAuBA,4BAAAA,QAAAA,CAAwB;GACrD,KAAK,WAAW,IAAI,qBACnB,cAAe,KAAK,EAAG,GACvB,CAAC,CACF;GACA,UAAU,QAAQ,IAAK,KAAK,QAAS;GAErC,KAAK,kBAAkB,UAAU,QAAS,KAAK,QAAQ,CAAE;GAEzD,KAAK,YAAY,KAAK,gBAAgB;GAEtC,KAAK,iBAAiB,IAAIC,sDAAAA,QAAgB,KAAK,SAAS,SAAU;EACnE;EAEA,UAAW,UAAW;GACrB,KAAK,YAAY,IAAK,QAAS;GAE/B,aAAa;IACZ,KAAK,YAAY,OAAQ,QAAS;GACnC;EACD;EAEA,wBAAyB,UAAU,MAAO;GACzC,IAAK,CAAE,KAAK,WAAY;IAEvB,IAAK,CAAE,UACN,CAAA,GAAA,gBAAA,SAAA,CAAUC,kBAAAA,KAAsB,CAAC,CAAC,oBACjC,KACD;IAGD,KAAK,YAAY,SAAW,eAC3B,WAAY,UAAU,IAAK,CAC5B;GACD;EACD;CACD;AACD"}
1
+ {"version":3,"file":"sidebar-control.cjs","names":["getInserterOuterSection","SidebarAdapter","dispatch","customizeWidgetsStore"],"sources":["../../src/controls/sidebar-control.js"],"sourcesContent":["import { dispatch } from '@wordpress/data';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iBAAkB,cAAe,oBAAqB;AAE5D,SAAwB,oBAAoB;CAC3C,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,OAAO,MAAM,uBAAuB,UAAU,QAAQ;EACrD,YAAa,GAAG,MAAO;GACtB,MAAO,GAAG,IAAK;GAEf,KAAK,8BAAc,IAAI,IAAI;EAC5B;EAEA,QAAQ;GACP,MAAM,wBAAA,GAAuBA,4BAAAA,QAAAA,CAAwB;GACrD,KAAK,WAAW,IAAI,qBACnB,cAAe,KAAK,EAAG,GACvB,CAAC,CACF;GACA,UAAU,QAAQ,IAAK,KAAK,QAAS;GAErC,KAAK,kBAAkB,UAAU,QAAS,KAAK,QAAQ,CAAE;GAEzD,KAAK,YAAY,KAAK,gBAAgB;GAEtC,KAAK,iBAAiB,IAAIC,sDAAAA,QAAgB,KAAK,SAAS,SAAU;EACnE;EAEA,UAAW,UAAW;GACrB,KAAK,YAAY,IAAK,QAAS;GAE/B,aAAa;IACZ,KAAK,YAAY,OAAQ,QAAS;GACnC;EACD;EAEA,wBAAyB,UAAU,MAAO;GACzC,IAAK,CAAE,KAAK,WAAY;IAEvB,IAAK,CAAE,UACNC,CAAAA,GAAAA,gBAAAA,SAAAA,CAAUC,kBAAAA,KAAsB,CAAC,CAAC,oBACjC,KACD;IAGD,KAAK,YAAY,SAAW,eAC3B,WAAY,UAAU,IAAK,CAC5B;GACD;EACD;CACD;AACD"}
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sidebar-section.cjs","names":["getInspectorSection","__"],"sources":["../../src/controls/sidebar-section.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,yBAA0B,cAC/B,qBAAsB;AAEvB,SAAwB,oBAAoB;CAC3C,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,MAAM,yBAAyB,OAAO,WACrC,kCACD;CACA,IAAI,kBAAkB,uBAAuB;CAC7C,uBAAuB,iBAAkB,WAAY,UAAW;EAC/D,kBAAkB,MAAM;CACzB,CAAE;CAEF,OAAO,MAAM,uBAAuB,UAAU,QAAQ;EACrD,QAAQ;GACP,MAAM,oBAAA,GAAmBA,uBAAAA,QAAAA,CAAoB;GAC7C,KAAK,YAAY,IAAI,iBACpB,sBAAuB,KAAK,EAAG,GAC/B;IACC,QAAA,GAAOC,gBAAAA,GAAAA,CAAI,gBAAiB;IAC5B,eAAe;IACf,iBAAiB;MAChBA,GAAAA,gBAAAA,GAAAA,CAAI,aAAc;MAClBA,GAAAA,gBAAAA,GAAAA,CAAI,SAAU;KACd,KAAK,OAAO;IACb,CAAC,CAAC,KAAM,KAAM;GACf,CACD;GACA,UAAU,QAAQ,IAAK,KAAK,SAAU;GACtC,KAAK,iBAAkB,EAAG,CAAC,UAAU,IACpC,oCACD;EACD;EACA,sBAAsB;GACrB,OAAO,KAAK,UAAU,SAAS;EAChC;EACA,iBAAkB,UAAU,OAAQ;GACnC,MAAM,WAAW,KAAK,SAAS;GAC/B,MAAM,OAAO;IACZ,GAAG;IACH,mBAAmB;KAClB,SAAS,SAAW,YAAa;MAChC,QAAQ,0BAA2B,UAAU,IAAK;KACnD,CAAE;KACF,MAAM,mBAAmB;IAC1B;GACD;GAEA,IAAK,KAAK,kBAAmB;IAC5B,IAAK,UAAW;KACf,KAAK,iBAAiB,SAAU,CAAE,QAAQ,MAAO,CAAE;KACnD,KAAK,iBAAiB,YAAa,qBAAsB;KACzD,KAAK,iBACH,QAAS,kBAAmB,CAAC,CAC7B,SAAU,cAAe;IAC5B,OAAO;KACN,KAAK,iBAAiB,SAAU,CAC/B,QACA,qBACD,CAAE;KACF,KAAK,iBACH,QAAS,kBAAmB,CAAC,CAC7B,SAAU,cAAe;KAC3B,KAAK,iBAAiB,YAAa,MAAO;IAC3C;IAEA,MAAM,4BAA4B;KACjC,KAAK,iBAAiB,YAAa,MAAO;KAC1C,KAAK,iBAAiB;IACvB;IAEA,IAAK,iBACJ,oBAAoB;SAEpB,KAAK,iBAAiB,IACrB,iBACA,mBACD;GAEF,OACC,MAAM,iBAAkB,UAAU,IAAK;EAEzC;CACD;AACD"}
1
+ {"version":3,"file":"sidebar-section.cjs","names":["getInspectorSection","__"],"sources":["../../src/controls/sidebar-section.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,yBAA0B,cAC/B,qBAAsB;AAEvB,SAAwB,oBAAoB;CAC3C,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,MAAM,yBAAyB,OAAO,WACrC,kCACD;CACA,IAAI,kBAAkB,uBAAuB;CAC7C,uBAAuB,iBAAkB,WAAY,UAAW;EAC/D,kBAAkB,MAAM;CACzB,CAAE;CAEF,OAAO,MAAM,uBAAuB,UAAU,QAAQ;EACrD,QAAQ;GACP,MAAM,oBAAA,GAAmBA,uBAAAA,QAAAA,CAAoB;GAC7C,KAAK,YAAY,IAAI,iBACpB,sBAAuB,KAAK,EAAG,GAC/B;IACC,QAAA,GAAOC,gBAAAA,GAAAA,CAAI,gBAAiB;IAC5B,eAAe;IACf,iBAAiB;MAChBA,GAAAA,gBAAAA,GAAAA,CAAI,aAAc;MAClBA,GAAAA,gBAAAA,GAAAA,CAAI,SAAU;KACd,KAAK,OAAO;IACb,CAAC,CAAC,KAAM,KAAM;GACf,CACD;GACA,UAAU,QAAQ,IAAK,KAAK,SAAU;GACtC,KAAK,iBAAkB,EAAG,CAAC,UAAU,IACpC,oCACD;EACD;EACA,sBAAsB;GACrB,OAAO,KAAK,UAAU,SAAS;EAChC;EACA,iBAAkB,UAAU,OAAQ;GACnC,MAAM,WAAW,KAAK,SAAS;GAC/B,MAAM,OAAO;IACZ,GAAG;IACH,mBAAmB;KAClB,SAAS,SAAW,YAAa;MAChC,QAAQ,0BAA2B,UAAU,IAAK;KACnD,CAAE;KACF,MAAM,mBAAmB;IAC1B;GACD;GAEA,IAAK,KAAK,kBAAmB;IAC5B,IAAK,UAAW;KACf,KAAK,iBAAiB,SAAU,CAAE,QAAQ,MAAO,CAAE;KACnD,KAAK,iBAAiB,YAAa,qBAAsB;KACzD,KAAK,iBACH,QAAS,kBAAmB,CAAC,CAC7B,SAAU,cAAe;IAC5B,OAAO;KACN,KAAK,iBAAiB,SAAU,CAC/B,QACA,qBACD,CAAE;KACF,KAAK,iBACH,QAAS,kBAAmB,CAAC,CAC7B,SAAU,cAAe;KAC3B,KAAK,iBAAiB,YAAa,MAAO;IAC3C;IAEA,MAAM,4BAA4B;KACjC,KAAK,iBAAiB,YAAa,MAAO;KAC1C,KAAK,iBAAiB;IACvB;IAEA,IAAK,iBACJ,oBAAoB;SAEpB,KAAK,iBAAiB,IACrB,iBACA,mBACD;GAEF,OACC,MAAM,iBAAkB,UAAU,IAAK;EAEzC;CACD;AACD"}
package/build/index.cjs CHANGED
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
11
11
  var __getProtoOf = Object.getPrototypeOf;
12
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
16
+ desc = __getOwnPropDesc(from, key);
17
+ __defProp(to, key, {
18
+ get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
19
+ enumerable: !desc || desc.enumerable
20
+ });
21
+ }
20
22
  }
21
23
  return to;
22
24
  };
@@ -31,14 +33,14 @@ let _wordpress_blocks = require("@wordpress/blocks");
31
33
  let _wordpress_data = require("@wordpress/data");
32
34
  let _wordpress_preferences = require("@wordpress/preferences");
33
35
  let __components_customize_widgets_index_jsx = require("./components/customize-widgets/index.cjs");
34
- __components_customize_widgets_index_jsx = __toESM(__components_customize_widgets_index_jsx);
35
36
  let __controls_sidebar_section_js = require("./controls/sidebar-section.cjs");
36
- __controls_sidebar_section_js = __toESM(__controls_sidebar_section_js);
37
37
  let __controls_sidebar_control_js = require("./controls/sidebar-control.cjs");
38
- __controls_sidebar_control_js = __toESM(__controls_sidebar_control_js);
39
38
  require("./filters/index.cjs");
40
39
  let react_jsx_runtime = require("react/jsx-runtime");
41
40
  let __store_index_js = require("./store/index.cjs");
41
+ __components_customize_widgets_index_jsx = __toESM(__components_customize_widgets_index_jsx);
42
+ __controls_sidebar_section_js = __toESM(__controls_sidebar_section_js);
43
+ __controls_sidebar_control_js = __toESM(__controls_sidebar_control_js);
42
44
  // packages/customize-widgets/src/index.jsx
43
45
  const { wp } = window;
44
46
  const DISABLED_BLOCKS = [
@@ -47,7 +49,6 @@ const DISABLED_BLOCKS = [
47
49
  "core/freeform",
48
50
  "core/template-part"
49
51
  ];
50
- const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
51
52
  /**
52
53
  * Initializes the widgets block editor in the customizer.
53
54
  *
@@ -65,7 +66,7 @@ function initialize(editorName, blockEditorSettings) {
65
66
  });
66
67
  (0, _wordpress_block_library.registerCoreBlocks)(coreBlocks);
67
68
  (0, _wordpress_widgets.registerLegacyWidgetBlock)();
68
- if (globalThis.IS_GUTENBERG_PLUGIN) (0, _wordpress_block_library.__experimentalRegisterExperimentalCoreBlocks)({ enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS });
69
+ if (globalThis.IS_GUTENBERG_PLUGIN) (0, _wordpress_block_library.__experimentalRegisterExperimentalCoreBlocks)();
69
70
  (0, _wordpress_widgets.registerLegacyWidgetVariations)(blockEditorSettings);
70
71
  (0, _wordpress_widgets.registerWidgetGroupBlock)();
71
72
  (0, _wordpress_blocks.setFreeformContentHandlerName)("core/html");