@wordpress/customize-widgets 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/build/components/block-appender/index.cjs +24 -41
  2. package/build/components/block-appender/index.cjs.map +1 -7
  3. package/build/components/block-inspector-button/index.cjs +24 -52
  4. package/build/components/block-inspector-button/index.cjs.map +1 -7
  5. package/build/components/customize-widgets/index.cjs +76 -97
  6. package/build/components/customize-widgets/index.cjs.map +1 -7
  7. package/build/components/customize-widgets/use-clear-selected-block.cjs +58 -67
  8. package/build/components/customize-widgets/use-clear-selected-block.cjs.map +1 -7
  9. package/build/components/error-boundary/index.cjs +115 -155
  10. package/build/components/error-boundary/index.cjs.map +1 -7
  11. package/build/components/focus-control/index.cjs +44 -84
  12. package/build/components/focus-control/index.cjs.map +1 -7
  13. package/build/components/focus-control/use-blocks-focus-control.cjs +28 -49
  14. package/build/components/focus-control/use-blocks-focus-control.cjs.map +1 -7
  15. package/build/components/header/index.cjs +84 -122
  16. package/build/components/header/index.cjs.map +1 -7
  17. package/build/components/inserter/index.cjs +43 -78
  18. package/build/components/inserter/index.cjs.map +1 -7
  19. package/build/components/inserter/use-inserter.cjs +22 -54
  20. package/build/components/inserter/use-inserter.cjs.map +1 -7
  21. package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
  22. package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
  23. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
  24. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
  25. package/build/components/keyboard-shortcut-help-modal/index.cjs +103 -165
  26. package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
  27. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +38 -76
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
  29. package/build/components/keyboard-shortcuts/index.cjs +70 -100
  30. package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
  31. package/build/components/more-menu/index.cjs +102 -151
  32. package/build/components/more-menu/index.cjs.map +1 -7
  33. package/build/components/sidebar-block-editor/index.cjs +122 -155
  34. package/build/components/sidebar-block-editor/index.cjs.map +1 -7
  35. package/build/components/sidebar-block-editor/sidebar-adapter.cjs +207 -270
  36. package/build/components/sidebar-block-editor/sidebar-adapter.cjs.map +1 -7
  37. package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs +40 -50
  38. package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs.map +1 -7
  39. package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs +75 -110
  40. package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs.map +1 -7
  41. package/build/components/sidebar-controls/index.cjs +27 -53
  42. package/build/components/sidebar-controls/index.cjs.map +1 -7
  43. package/build/components/welcome-guide/index.cjs +70 -94
  44. package/build/components/welcome-guide/index.cjs.map +1 -7
  45. package/build/controls/inserter-outer-section.cjs +68 -110
  46. package/build/controls/inserter-outer-section.cjs.map +1 -7
  47. package/build/controls/inspector-section.cjs +57 -90
  48. package/build/controls/inspector-section.cjs.map +1 -7
  49. package/build/controls/sidebar-control.cjs +55 -69
  50. package/build/controls/sidebar-control.cjs.map +1 -7
  51. package/build/controls/sidebar-section.cjs +79 -103
  52. package/build/controls/sidebar-section.cjs.map +1 -7
  53. package/build/filters/index.cjs +8 -5
  54. package/build/filters/move-to-sidebar.cjs +62 -78
  55. package/build/filters/move-to-sidebar.cjs.map +1 -7
  56. package/build/filters/replace-media-upload.cjs +11 -9
  57. package/build/filters/replace-media-upload.cjs.map +1 -7
  58. package/build/filters/wide-widget-display.cjs +20 -20
  59. package/build/filters/wide-widget-display.cjs.map +1 -7
  60. package/build/index.cjs +84 -91
  61. package/build/index.cjs.map +1 -7
  62. package/build/lock-unlock.cjs +10 -35
  63. package/build/lock-unlock.cjs.map +1 -7
  64. package/build/store/actions.cjs +49 -32
  65. package/build/store/actions.cjs.map +1 -7
  66. package/build/store/constants.cjs +12 -29
  67. package/build/store/constants.cjs.map +1 -7
  68. package/build/store/index.cjs +49 -41
  69. package/build/store/index.cjs.map +1 -7
  70. package/build/store/reducer.cjs +20 -33
  71. package/build/store/reducer.cjs.map +1 -7
  72. package/build/store/selectors.cjs +47 -38
  73. package/build/store/selectors.cjs.map +1 -7
  74. package/build/utils.cjs +81 -108
  75. package/build/utils.cjs.map +1 -7
  76. package/build-module/components/block-appender/index.mjs +18 -23
  77. package/build-module/components/block-appender/index.mjs.map +1 -7
  78. package/build-module/components/block-inspector-button/index.mjs +15 -28
  79. package/build-module/components/block-inspector-button/index.mjs.map +1 -7
  80. package/build-module/components/customize-widgets/index.mjs +45 -73
  81. package/build-module/components/customize-widgets/index.mjs.map +1 -7
  82. package/build-module/components/customize-widgets/use-clear-selected-block.mjs +52 -46
  83. package/build-module/components/customize-widgets/use-clear-selected-block.mjs.map +1 -7
  84. package/build-module/components/error-boundary/index.mjs +104 -129
  85. package/build-module/components/error-boundary/index.mjs.map +1 -7
  86. package/build-module/components/focus-control/index.mjs +37 -66
  87. package/build-module/components/focus-control/index.mjs.map +1 -7
  88. package/build-module/components/focus-control/use-blocks-focus-control.mjs +21 -27
  89. package/build-module/components/focus-control/use-blocks-focus-control.mjs.map +1 -7
  90. package/build-module/components/header/index.mjs +55 -92
  91. package/build-module/components/header/index.mjs.map +1 -7
  92. package/build-module/components/inserter/index.mjs +33 -53
  93. package/build-module/components/inserter/index.mjs.map +1 -7
  94. package/build-module/components/inserter/use-inserter.mjs +17 -34
  95. package/build-module/components/inserter/use-inserter.mjs.map +1 -7
  96. package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
  97. package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
  98. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
  99. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
  100. package/build-module/components/keyboard-shortcut-help-modal/index.mjs +75 -139
  101. package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
  102. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +32 -55
  103. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
  104. package/build-module/components/keyboard-shortcuts/index.mjs +62 -79
  105. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
  106. package/build-module/components/more-menu/index.mjs +75 -128
  107. package/build-module/components/more-menu/index.mjs.map +1 -7
  108. package/build-module/components/sidebar-block-editor/index.mjs +86 -128
  109. package/build-module/components/sidebar-block-editor/index.mjs.map +1 -7
  110. package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs +202 -250
  111. package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs.map +1 -7
  112. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs +17 -25
  113. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs.map +1 -7
  114. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs +54 -86
  115. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs.map +1 -7
  116. package/build-module/components/sidebar-controls/index.mjs +19 -27
  117. package/build-module/components/sidebar-controls/index.mjs.map +1 -7
  118. package/build-module/components/welcome-guide/index.mjs +62 -71
  119. package/build-module/components/welcome-guide/index.mjs.map +1 -7
  120. package/build-module/controls/inserter-outer-section.mjs +61 -88
  121. package/build-module/controls/inserter-outer-section.mjs.map +1 -7
  122. package/build-module/controls/inspector-section.mjs +52 -70
  123. package/build-module/controls/inspector-section.mjs.map +1 -7
  124. package/build-module/controls/sidebar-control.mjs +33 -45
  125. package/build-module/controls/sidebar-control.mjs.map +1 -7
  126. package/build-module/controls/sidebar-section.mjs +59 -80
  127. package/build-module/controls/sidebar-section.mjs.map +1 -7
  128. package/build-module/filters/index.mjs +0 -2
  129. package/build-module/filters/move-to-sidebar.mjs +52 -79
  130. package/build-module/filters/move-to-sidebar.mjs.map +1 -7
  131. package/build-module/filters/replace-media-upload.mjs +5 -8
  132. package/build-module/filters/replace-media-upload.mjs.map +1 -7
  133. package/build-module/filters/wide-widget-display.mjs +13 -18
  134. package/build-module/filters/wide-widget-display.mjs.map +1 -7
  135. package/build-module/index.mjs +53 -71
  136. package/build-module/index.mjs.map +1 -7
  137. package/build-module/lock-unlock.mjs +5 -10
  138. package/build-module/lock-unlock.mjs.map +1 -7
  139. package/build-module/store/actions.mjs +44 -8
  140. package/build-module/store/actions.mjs.map +1 -7
  141. package/build-module/store/constants.mjs +7 -5
  142. package/build-module/store/constants.mjs.map +1 -7
  143. package/build-module/store/index.mjs +15 -11
  144. package/build-module/store/index.mjs.map +1 -7
  145. package/build-module/store/reducer.mjs +15 -13
  146. package/build-module/store/reducer.mjs.map +1 -7
  147. package/build-module/store/selectors.mjs +41 -13
  148. package/build-module/store/selectors.mjs.map +1 -7
  149. package/build-module/utils.mjs +74 -82
  150. package/build-module/utils.mjs.map +1 -7
  151. package/build-style/style-rtl.css +23 -5
  152. package/build-style/style.css +23 -5
  153. package/package.json +27 -27
  154. package/src/components/customize-widgets/index.jsx +2 -2
  155. package/src/components/error-boundary/index.jsx +2 -2
  156. package/src/components/header/style.scss +16 -5
  157. package/src/components/inserter/style.scss +8 -0
  158. package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +1 -0
  159. package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
  160. package/src/components/more-menu/index.jsx +0 -1
  161. package/src/components/welcome-guide/index.jsx +6 -2
  162. package/build/filters/index.cjs.map +0 -7
  163. package/build-module/filters/index.mjs.map +0 -7
@@ -1,60 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
1
7
  var __create = Object.create;
2
8
  var __defProp = Object.defineProperty;
3
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
11
  var __getProtoOf = Object.getPrototypeOf;
6
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
13
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
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
+ });
20
+ }
21
+ return to;
18
22
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let _wordpress_block_editor = require("@wordpress/block-editor");
28
+ 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
+ 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
+ let ______lock_unlock_js = require("../../lock-unlock.cjs");
33
+ let react_jsx_runtime = require("react/jsx-runtime");
29
34
  // packages/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.jsx
30
- var sidebar_editor_provider_exports = {};
31
- __export(sidebar_editor_provider_exports, {
32
- default: () => SidebarEditorProvider
33
- });
34
- module.exports = __toCommonJS(sidebar_editor_provider_exports);
35
- var import_block_editor = require("@wordpress/block-editor");
36
- var import_use_sidebar_block_editor = __toESM(require("./use-sidebar-block-editor.cjs"));
37
- var import_use_blocks_focus_control = __toESM(require("../focus-control/use-blocks-focus-control.cjs"));
38
- var import_lock_unlock = require("../../lock-unlock.cjs");
39
- var import_jsx_runtime = require("react/jsx-runtime");
40
- var { ExperimentalBlockEditorProvider } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
41
- function SidebarEditorProvider({
42
- sidebar,
43
- settings,
44
- children
45
- }) {
46
- const [blocks, onInput, onChange] = (0, import_use_sidebar_block_editor.default)(sidebar);
47
- (0, import_use_blocks_focus_control.default)(blocks);
48
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
- ExperimentalBlockEditorProvider,
50
- {
51
- value: blocks,
52
- onInput,
53
- onChange,
54
- settings,
55
- useSubRegistry: false,
56
- children
57
- }
58
- );
35
+ const { ExperimentalBlockEditorProvider } = (0, ______lock_unlock_js.unlock)(_wordpress_block_editor.privateApis);
36
+ function SidebarEditorProvider({ sidebar, settings, children }) {
37
+ const [blocks, onInput, onChange] = (0, __use_sidebar_block_editor_js.default)(sidebar);
38
+ (0, ___focus_control_use_blocks_focus_control_js.default)(blocks);
39
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExperimentalBlockEditorProvider, {
40
+ value: blocks,
41
+ onInput,
42
+ onChange,
43
+ settings,
44
+ useSubRegistry: false,
45
+ children
46
+ });
59
47
  }
60
- //# sourceMappingURL=sidebar-editor-provider.cjs.map
48
+ exports.default = SidebarEditorProvider;
49
+
50
+ //# sourceMappingURL=sidebar-editor-provider.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar-block-editor/sidebar-editor-provider.jsx"],
4
- "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAsD;AACtD,sCAAkC;AAClC,sCAAkC;AAClC,yBAAuB;AAcrB;AAZF,IAAM,EAAE,gCAAgC,QAAI,2BAAQ,oBAAAA,WAAuB;AAE5D,SAAR,sBAAwC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,QAAQ,SAAS,QAAS,QAAI,gCAAAC,SAAuB,OAAQ;AAErE,sCAAAC,SAAuB,MAAO;AAE9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAiB;AAAA,MAEf;AAAA;AAAA,EACH;AAEF;",
6
- "names": ["blockEditorPrivateApis", "useSidebarBlockEditor", "useBlocksFocusControl"]
7
- }
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,123 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
1
7
  var __create = Object.create;
2
8
  var __defProp = Object.defineProperty;
3
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
11
  var __getProtoOf = Object.getPrototypeOf;
6
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
13
  var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
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
+ });
20
+ }
21
+ return to;
18
22
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ 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
+ let _wordpress_element = require("@wordpress/element");
30
+ let _wordpress_is_shallow_equal = require("@wordpress/is-shallow-equal");
31
+ let _wordpress_widgets = require("@wordpress/widgets");
32
+ let ______utils_js = require("../../utils.cjs");
29
33
  // packages/customize-widgets/src/components/sidebar-block-editor/use-sidebar-block-editor.js
30
- var use_sidebar_block_editor_exports = {};
31
- __export(use_sidebar_block_editor_exports, {
32
- default: () => useSidebarBlockEditor
33
- });
34
- module.exports = __toCommonJS(use_sidebar_block_editor_exports);
35
- var import_es6 = __toESM(require("fast-deep-equal/es6/index.js"));
36
- var import_element = require("@wordpress/element");
37
- var import_is_shallow_equal = require("@wordpress/is-shallow-equal");
38
- var import_widgets = require("@wordpress/widgets");
39
- var import_utils = require("../../utils.cjs");
40
34
  function widgetsToBlocks(widgets) {
41
- return widgets.map((widget) => (0, import_utils.widgetToBlock)(widget));
35
+ return widgets.map((widget) => (0, ______utils_js.widgetToBlock)(widget));
42
36
  }
43
37
  function useSidebarBlockEditor(sidebar) {
44
- const [blocks, setBlocks] = (0, import_element.useState)(
45
- () => widgetsToBlocks(sidebar.getWidgets())
46
- );
47
- (0, import_element.useEffect)(() => {
48
- return sidebar.subscribe((prevWidgets, nextWidgets) => {
49
- setBlocks((prevBlocks) => {
50
- const prevWidgetsMap = new Map(
51
- prevWidgets.map((widget) => [widget.id, widget])
52
- );
53
- const prevBlocksMap = new Map(
54
- prevBlocks.map((block) => [
55
- (0, import_widgets.getWidgetIdFromBlock)(block),
56
- block
57
- ])
58
- );
59
- const nextBlocks = nextWidgets.map((nextWidget) => {
60
- const prevWidget = prevWidgetsMap.get(nextWidget.id);
61
- if (prevWidget && prevWidget === nextWidget) {
62
- return prevBlocksMap.get(nextWidget.id);
63
- }
64
- return (0, import_utils.widgetToBlock)(nextWidget);
65
- });
66
- if ((0, import_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) {
67
- return prevBlocks;
68
- }
69
- return nextBlocks;
70
- });
71
- });
72
- }, [sidebar]);
73
- const onChangeBlocks = (0, import_element.useCallback)(
74
- (nextBlocks) => {
75
- setBlocks((prevBlocks) => {
76
- if ((0, import_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) {
77
- return prevBlocks;
78
- }
79
- const prevBlocksMap = new Map(
80
- prevBlocks.map((block) => [
81
- (0, import_widgets.getWidgetIdFromBlock)(block),
82
- block
83
- ])
84
- );
85
- const nextWidgets = nextBlocks.map((nextBlock) => {
86
- const widgetId = (0, import_widgets.getWidgetIdFromBlock)(nextBlock);
87
- if (widgetId && prevBlocksMap.has(widgetId)) {
88
- const prevBlock = prevBlocksMap.get(widgetId);
89
- const prevWidget = sidebar.getWidget(widgetId);
90
- if ((0, import_es6.default)(nextBlock, prevBlock) && prevWidget) {
91
- return prevWidget;
92
- }
93
- return (0, import_utils.blockToWidget)(nextBlock, prevWidget);
94
- }
95
- return (0, import_utils.blockToWidget)(nextBlock);
96
- });
97
- if ((0, import_is_shallow_equal.isShallowEqual)(sidebar.getWidgets(), nextWidgets)) {
98
- return prevBlocks;
99
- }
100
- const addedWidgetIds = sidebar.setWidgets(nextWidgets);
101
- return nextBlocks.reduce(
102
- (updatedNextBlocks, nextBlock, index) => {
103
- const addedWidgetId = addedWidgetIds[index];
104
- if (addedWidgetId !== null) {
105
- if (updatedNextBlocks === nextBlocks) {
106
- updatedNextBlocks = nextBlocks.slice();
107
- }
108
- updatedNextBlocks[index] = (0, import_widgets.addWidgetIdToBlock)(
109
- nextBlock,
110
- addedWidgetId
111
- );
112
- }
113
- return updatedNextBlocks;
114
- },
115
- nextBlocks
116
- );
117
- });
118
- },
119
- [sidebar]
120
- );
121
- return [blocks, onChangeBlocks, onChangeBlocks];
38
+ const [blocks, setBlocks] = (0, _wordpress_element.useState)(() => widgetsToBlocks(sidebar.getWidgets()));
39
+ (0, _wordpress_element.useEffect)(() => {
40
+ return sidebar.subscribe((prevWidgets, nextWidgets) => {
41
+ setBlocks((prevBlocks) => {
42
+ const prevWidgetsMap = new Map(prevWidgets.map((widget) => [widget.id, widget]));
43
+ const prevBlocksMap = new Map(prevBlocks.map((block) => [(0, _wordpress_widgets.getWidgetIdFromBlock)(block), block]));
44
+ const nextBlocks = nextWidgets.map((nextWidget) => {
45
+ const prevWidget = prevWidgetsMap.get(nextWidget.id);
46
+ if (prevWidget && prevWidget === nextWidget) return prevBlocksMap.get(nextWidget.id);
47
+ return (0, ______utils_js.widgetToBlock)(nextWidget);
48
+ });
49
+ if ((0, _wordpress_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) return prevBlocks;
50
+ return nextBlocks;
51
+ });
52
+ });
53
+ }, [sidebar]);
54
+ const onChangeBlocks = (0, _wordpress_element.useCallback)((nextBlocks) => {
55
+ setBlocks((prevBlocks) => {
56
+ if ((0, _wordpress_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) return prevBlocks;
57
+ const prevBlocksMap = new Map(prevBlocks.map((block) => [(0, _wordpress_widgets.getWidgetIdFromBlock)(block), block]));
58
+ const nextWidgets = nextBlocks.map((nextBlock) => {
59
+ const widgetId = (0, _wordpress_widgets.getWidgetIdFromBlock)(nextBlock);
60
+ if (widgetId && prevBlocksMap.has(widgetId)) {
61
+ const prevBlock = prevBlocksMap.get(widgetId);
62
+ const prevWidget = sidebar.getWidget(widgetId);
63
+ if ((0, fast_deep_equal_es6_index_js.default)(nextBlock, prevBlock) && prevWidget) return prevWidget;
64
+ return (0, ______utils_js.blockToWidget)(nextBlock, prevWidget);
65
+ }
66
+ return (0, ______utils_js.blockToWidget)(nextBlock);
67
+ });
68
+ if ((0, _wordpress_is_shallow_equal.isShallowEqual)(sidebar.getWidgets(), nextWidgets)) return prevBlocks;
69
+ const addedWidgetIds = sidebar.setWidgets(nextWidgets);
70
+ return nextBlocks.reduce((updatedNextBlocks, nextBlock, index) => {
71
+ const addedWidgetId = addedWidgetIds[index];
72
+ if (addedWidgetId !== null) {
73
+ if (updatedNextBlocks === nextBlocks) updatedNextBlocks = nextBlocks.slice();
74
+ updatedNextBlocks[index] = (0, _wordpress_widgets.addWidgetIdToBlock)(nextBlock, addedWidgetId);
75
+ }
76
+ return updatedNextBlocks;
77
+ }, nextBlocks);
78
+ });
79
+ }, [sidebar]);
80
+ return [
81
+ blocks,
82
+ onChangeBlocks,
83
+ onChangeBlocks
84
+ ];
122
85
  }
123
- //# sourceMappingURL=use-sidebar-block-editor.cjs.map
86
+ exports.default = useSidebarBlockEditor;
87
+
88
+ //# sourceMappingURL=use-sidebar-block-editor.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar-block-editor/use-sidebar-block-editor.js"],
4
- "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA0B;AAC1B,qBAAiD;AACjD,8BAA+B;AAC/B,qBAAyD;AACzD,mBAA6C;AAE7C,SAAS,gBAAiB,SAAU;AACnC,SAAO,QAAQ,IAAK,CAAE,eAAY,4BAAe,MAAO,CAAE;AAC3D;AAEe,SAAR,sBAAwC,SAAU;AACxD,QAAM,CAAE,QAAQ,SAAU,QAAI;AAAA,IAAU,MACvC,gBAAiB,QAAQ,WAAW,CAAE;AAAA,EACvC;AAEA,gCAAW,MAAM;AAChB,WAAO,QAAQ,UAAW,CAAE,aAAa,gBAAiB;AACzD,gBAAW,CAAE,eAAgB;AAC5B,cAAM,iBAAiB,IAAI;AAAA,UAC1B,YAAY,IAAK,CAAE,WAAY,CAAE,OAAO,IAAI,MAAO,CAAE;AAAA,QACtD;AACA,cAAM,gBAAgB,IAAI;AAAA,UACzB,WAAW,IAAK,CAAE,UAAW;AAAA,gBAC5B,qCAAsB,KAAM;AAAA,YAC5B;AAAA,UACD,CAAE;AAAA,QACH;AAEA,cAAM,aAAa,YAAY,IAAK,CAAE,eAAgB;AACrD,gBAAM,aAAa,eAAe,IAAK,WAAW,EAAG;AAGrD,cAAK,cAAc,eAAe,YAAa;AAC9C,mBAAO,cAAc,IAAK,WAAW,EAAG;AAAA,UACzC;AAEA,qBAAO,4BAAe,UAAW;AAAA,QAClC,CAAE;AAGF,gBAAK,wCAAgB,YAAY,UAAW,GAAI;AAC/C,iBAAO;AAAA,QACR;AAEA,eAAO;AAAA,MACR,CAAE;AAAA,IACH,CAAE;AAAA,EACH,GAAG,CAAE,OAAQ,CAAE;AAEf,QAAM,qBAAiB;AAAA,IACtB,CAAE,eAAgB;AACjB,gBAAW,CAAE,eAAgB;AAC5B,gBAAK,wCAAgB,YAAY,UAAW,GAAI;AAC/C,iBAAO;AAAA,QACR;AAEA,cAAM,gBAAgB,IAAI;AAAA,UACzB,WAAW,IAAK,CAAE,UAAW;AAAA,gBAC5B,qCAAsB,KAAM;AAAA,YAC5B;AAAA,UACD,CAAE;AAAA,QACH;AAEA,cAAM,cAAc,WAAW,IAAK,CAAE,cAAe;AACpD,gBAAM,eAAW,qCAAsB,SAAU;AAGjD,cAAK,YAAY,cAAc,IAAK,QAAS,GAAI;AAChD,kBAAM,YAAY,cAAc,IAAK,QAAS;AAC9C,kBAAM,aAAa,QAAQ,UAAW,QAAS;AAI/C,oBACC,WAAAA,SAAe,WAAW,SAAU,KACpC,YACC;AACD,qBAAO;AAAA,YACR;AAEA,uBAAO,4BAAe,WAAW,UAAW;AAAA,UAC7C;AAGA,qBAAO,4BAAe,SAAU;AAAA,QACjC,CAAE;AAGF,gBAAK,wCAAgB,QAAQ,WAAW,GAAG,WAAY,GAAI;AAC1D,iBAAO;AAAA,QACR;AAEA,cAAM,iBAAiB,QAAQ,WAAY,WAAY;AAEvD,eAAO,WAAW;AAAA,UACjB,CAAE,mBAAmB,WAAW,UAAW;AAC1C,kBAAM,gBAAgB,eAAgB,KAAM;AAE5C,gBAAK,kBAAkB,MAAO;AAG7B,kBAAK,sBAAsB,YAAa;AACvC,oCAAoB,WAAW,MAAM;AAAA,cACtC;AAEA,gCAAmB,KAAM,QAAI;AAAA,gBAC5B;AAAA,gBACA;AAAA,cACD;AAAA,YACD;AAEA,mBAAO;AAAA,UACR;AAAA,UACA;AAAA,QACD;AAAA,MACD,CAAE;AAAA,IACH;AAAA,IACA,CAAE,OAAQ;AAAA,EACX;AAEA,SAAO,CAAE,QAAQ,gBAAgB,cAAe;AACjD;",
6
- "names": ["fastDeepEqual"]
7
- }
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,gBAAiB;GACzD,WAAa,eAAgB;IAC5B,MAAM,iBAAiB,IAAI,IAC1B,YAAY,KAAO,WAAY,CAAE,OAAO,IAAI,MAAO,CAAE,CACtD;IACA,MAAM,gBAAgB,IAAI,IACzB,WAAW,KAAO,UAAW,EAAA,GAC5BC,mBAAAA,qBAAAA,CAAsB,KAAM,GAC5B,KACD,CAAE,CACH;IAEA,MAAM,aAAa,YAAY,KAAO,eAAgB;KACrD,MAAM,aAAa,eAAe,IAAK,WAAW,EAAG;KAGrD,IAAK,cAAc,eAAe,YACjC,OAAO,cAAc,IAAK,WAAW,EAAG;KAGzC,QAAA,GAAOF,eAAAA,cAAAA,CAAe,UAAW;IAClC,CAAE;IAGF,KAAA,GAAKG,4BAAAA,eAAAA,CAAgB,YAAY,UAAW,GAC3C,OAAO;IAGR,OAAO;GACR,CAAE;EACH,CAAE;CACH,GAAG,CAAE,OAAQ,CAAE;CAEf,MAAM,kBAAA,GAAiBC,mBAAAA,YAAAA,EACpB,eAAgB;EACjB,WAAa,eAAgB;GAC5B,KAAA,GAAKD,4BAAAA,eAAAA,CAAgB,YAAY,UAAW,GAC3C,OAAO;GAGR,MAAM,gBAAgB,IAAI,IACzB,WAAW,KAAO,UAAW,EAAA,GAC5BD,mBAAAA,qBAAAA,CAAsB,KAAM,GAC5B,KACD,CAAE,CACH;GAEA,MAAM,cAAc,WAAW,KAAO,cAAe;IACpD,MAAM,YAAA,GAAWA,mBAAAA,qBAAAA,CAAsB,SAAU;IAGjD,IAAK,YAAY,cAAc,IAAK,QAAS,GAAI;KAChD,MAAM,YAAY,cAAc,IAAK,QAAS;KAC9C,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"}
@@ -1,60 +1,34 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/customize-widgets/src/components/sidebar-controls/index.jsx
20
- var sidebar_controls_exports = {};
21
- __export(sidebar_controls_exports, {
22
- SidebarControlsContext: () => SidebarControlsContext,
23
- default: () => SidebarControls,
24
- useActiveSidebarControl: () => useActiveSidebarControl,
25
- useSidebarControls: () => useSidebarControls
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
26
5
  });
27
- module.exports = __toCommonJS(sidebar_controls_exports);
28
- var import_element = require("@wordpress/element");
29
- var import_jsx_runtime = require("react/jsx-runtime");
30
- var SidebarControlsContext = (0, import_element.createContext)();
6
+ let _wordpress_element = require("@wordpress/element");
7
+ let react_jsx_runtime = require("react/jsx-runtime");
8
+ // packages/customize-widgets/src/components/sidebar-controls/index.jsx
9
+ const SidebarControlsContext = (0, _wordpress_element.createContext)();
31
10
  SidebarControlsContext.displayName = "SidebarControlsContext";
32
- function SidebarControls({
33
- sidebarControls,
34
- activeSidebarControl,
35
- children
36
- }) {
37
- const context = (0, import_element.useMemo)(
38
- () => ({
39
- sidebarControls,
40
- activeSidebarControl
41
- }),
42
- [sidebarControls, activeSidebarControl]
43
- );
44
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarControlsContext.Provider, { value: context, children });
11
+ function SidebarControls({ sidebarControls, activeSidebarControl, children }) {
12
+ const context = (0, _wordpress_element.useMemo)(() => ({
13
+ sidebarControls,
14
+ activeSidebarControl
15
+ }), [sidebarControls, activeSidebarControl]);
16
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarControlsContext.Provider, {
17
+ value: context,
18
+ children
19
+ });
45
20
  }
46
21
  function useSidebarControls() {
47
- const { sidebarControls } = (0, import_element.useContext)(SidebarControlsContext);
48
- return sidebarControls;
22
+ const { sidebarControls } = (0, _wordpress_element.useContext)(SidebarControlsContext);
23
+ return sidebarControls;
49
24
  }
50
25
  function useActiveSidebarControl() {
51
- const { activeSidebarControl } = (0, import_element.useContext)(SidebarControlsContext);
52
- return activeSidebarControl;
26
+ const { activeSidebarControl } = (0, _wordpress_element.useContext)(SidebarControlsContext);
27
+ return activeSidebarControl;
53
28
  }
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- SidebarControlsContext,
57
- useActiveSidebarControl,
58
- useSidebarControls
59
- });
60
- //# sourceMappingURL=index.cjs.map
29
+ exports.SidebarControlsContext = SidebarControlsContext;
30
+ exports.default = SidebarControls;
31
+ exports.useActiveSidebarControl = useActiveSidebarControl;
32
+ exports.useSidebarControls = useSidebarControls;
33
+
34
+ //# sourceMappingURL=index.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar-controls/index.jsx"],
4
- "sourcesContent": ["import { createContext, useMemo, useContext } from '@wordpress/element';\n\nexport const SidebarControlsContext = createContext();\nSidebarControlsContext.displayName = 'SidebarControlsContext';\n\nexport default function SidebarControls( {\n\tsidebarControls,\n\tactiveSidebarControl,\n\tchildren,\n} ) {\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tsidebarControls,\n\t\t\tactiveSidebarControl,\n\t\t} ),\n\t\t[ sidebarControls, activeSidebarControl ]\n\t);\n\n\treturn (\n\t\t<SidebarControlsContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</SidebarControlsContext.Provider>\n\t);\n}\n\nexport function useSidebarControls() {\n\tconst { sidebarControls } = useContext( SidebarControlsContext );\n\n\treturn sidebarControls;\n}\n\nexport function useActiveSidebarControl() {\n\tconst { activeSidebarControl } = useContext( SidebarControlsContext );\n\n\treturn activeSidebarControl;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmD;AAmBjD;AAjBK,IAAM,6BAAyB,8BAAc;AACpD,uBAAuB,cAAc;AAEtB,SAAR,gBAAkC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,cAAU;AAAA,IACf,OAAQ;AAAA,MACP;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAE,iBAAiB,oBAAqB;AAAA,EACzC;AAEA,SACC,4CAAC,uBAAuB,UAAvB,EAAgC,OAAQ,SACtC,UACH;AAEF;AAEO,SAAS,qBAAqB;AACpC,QAAM,EAAE,gBAAgB,QAAI,2BAAY,sBAAuB;AAE/D,SAAO;AACR;AAEO,SAAS,0BAA0B;AACzC,QAAM,EAAE,qBAAqB,QAAI,2BAAY,sBAAuB;AAEpE,SAAO;AACR;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.cjs","names":["createContext","useMemo","useContext"],"sources":["../../../src/components/sidebar-controls/index.jsx"],"sourcesContent":["import { createContext, useMemo, useContext } from '@wordpress/element';\n\nexport const SidebarControlsContext = createContext();\nSidebarControlsContext.displayName = 'SidebarControlsContext';\n\nexport default function SidebarControls( {\n\tsidebarControls,\n\tactiveSidebarControl,\n\tchildren,\n} ) {\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tsidebarControls,\n\t\t\tactiveSidebarControl,\n\t\t} ),\n\t\t[ sidebarControls, activeSidebarControl ]\n\t);\n\n\treturn (\n\t\t<SidebarControlsContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</SidebarControlsContext.Provider>\n\t);\n}\n\nexport function useSidebarControls() {\n\tconst { sidebarControls } = useContext( SidebarControlsContext );\n\n\treturn sidebarControls;\n}\n\nexport function useActiveSidebarControl() {\n\tconst { activeSidebarControl } = useContext( SidebarControlsContext );\n\n\treturn activeSidebarControl;\n}\n"],"mappings":";;;;;;;;AAEA,MAAa,0BAAA,GAAyBA,mBAAAA,cAAAA,CAAc;AACpD,uBAAuB,cAAc;AAErC,SAAwB,gBAAiB,EACxC,iBACA,sBACA,YACG;CACH,MAAM,WAAA,GAAUC,mBAAAA,QAAAA,QACP;EACP;EACA;CACD,IACA,CAAE,iBAAiB,oBAAqB,CACzC;CAEA,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,uBAAuB,UAAxB;EAAiC,OAAQ;EACtC;CAC8B,CAAA;AAEnC;AAEA,SAAgB,qBAAqB;CACpC,MAAM,EAAE,qBAAA,GAAoBC,mBAAAA,WAAAA,CAAY,sBAAuB;CAE/D,OAAO;AACR;AAEA,SAAgB,0BAA0B;CACzC,MAAM,EAAE,0BAAA,GAAyBA,mBAAAA,WAAAA,CAAY,sBAAuB;CAEpE,OAAO;AACR"}