@wordpress/customize-widgets 5.32.0 → 5.32.1-next.ff1cebbba.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 (164) hide show
  1. package/build/components/block-appender/index.js +33 -27
  2. package/build/components/block-appender/index.js.map +7 -1
  3. package/build/components/block-inspector-button/index.js +51 -36
  4. package/build/components/block-inspector-button/index.js.map +7 -1
  5. package/build/components/customize-widgets/index.js +83 -61
  6. package/build/components/customize-widgets/index.js.map +7 -1
  7. package/build/components/customize-widgets/use-clear-selected-block.js +56 -63
  8. package/build/components/customize-widgets/use-clear-selected-block.js.map +7 -1
  9. package/build/components/error-boundary/index.js +46 -45
  10. package/build/components/error-boundary/index.js.map +7 -1
  11. package/build/components/focus-control/index.js +69 -57
  12. package/build/components/focus-control/index.js.map +7 -1
  13. package/build/components/focus-control/use-blocks-focus-control.js +38 -31
  14. package/build/components/focus-control/use-blocks-focus-control.js.map +7 -1
  15. package/build/components/header/index.js +110 -71
  16. package/build/components/header/index.js.map +7 -1
  17. package/build/components/inserter/index.js +77 -53
  18. package/build/components/inserter/index.js.map +7 -1
  19. package/build/components/inserter/use-inserter.js +46 -29
  20. package/build/components/inserter/use-inserter.js.map +7 -1
  21. package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
  22. package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  23. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
  24. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  25. package/build/components/keyboard-shortcut-help-modal/index.js +155 -110
  26. package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  27. package/build/components/keyboard-shortcut-help-modal/shortcut.js +76 -56
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  29. package/build/components/keyboard-shortcuts/index.js +60 -51
  30. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  31. package/build/components/more-menu/index.js +151 -90
  32. package/build/components/more-menu/index.js.map +7 -1
  33. package/build/components/sidebar-block-editor/index.js +133 -105
  34. package/build/components/sidebar-block-editor/index.js.map +7 -1
  35. package/build/components/sidebar-block-editor/sidebar-adapter.js +73 -67
  36. package/build/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
  37. package/build/components/sidebar-block-editor/sidebar-editor-provider.js +51 -33
  38. package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
  39. package/build/components/sidebar-block-editor/use-sidebar-block-editor.js +100 -79
  40. package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
  41. package/build/components/sidebar-controls/index.js +45 -31
  42. package/build/components/sidebar-controls/index.js.map +7 -1
  43. package/build/components/welcome-guide/index.js +86 -58
  44. package/build/components/welcome-guide/index.js.map +7 -1
  45. package/build/controls/inserter-outer-section.js +49 -58
  46. package/build/controls/inserter-outer-section.js.map +7 -1
  47. package/build/controls/inspector-section.js +30 -36
  48. package/build/controls/inspector-section.js.map +7 -1
  49. package/build/controls/sidebar-control.js +51 -30
  50. package/build/controls/sidebar-control.js.map +7 -1
  51. package/build/controls/sidebar-section.js +71 -39
  52. package/build/controls/sidebar-section.js.map +7 -1
  53. package/build/filters/index.js +4 -6
  54. package/build/filters/index.js.map +7 -1
  55. package/build/filters/move-to-sidebar.js +77 -79
  56. package/build/filters/move-to-sidebar.js.map +7 -1
  57. package/build/filters/replace-media-upload.js +9 -11
  58. package/build/filters/replace-media-upload.js.map +7 -1
  59. package/build/filters/wide-widget-display.js +20 -25
  60. package/build/filters/wide-widget-display.js.map +7 -1
  61. package/build/index.js +81 -70
  62. package/build/index.js.map +7 -1
  63. package/build/lock-unlock.js +31 -15
  64. package/build/lock-unlock.js.map +7 -1
  65. package/build/store/actions.js +27 -44
  66. package/build/store/actions.js.map +7 -1
  67. package/build/store/constants.js +27 -10
  68. package/build/store/constants.js.map +7 -1
  69. package/build/store/index.js +44 -40
  70. package/build/store/index.js.map +7 -1
  71. package/build/store/reducer.js +25 -19
  72. package/build/store/reducer.js.map +7 -1
  73. package/build/store/selectors.js +31 -44
  74. package/build/store/selectors.js.map +7 -1
  75. package/build/utils.js +45 -73
  76. package/build/utils.js.map +7 -1
  77. package/build-module/components/block-appender/index.js +17 -20
  78. package/build-module/components/block-appender/index.js.map +7 -1
  79. package/build-module/components/block-inspector-button/index.js +33 -30
  80. package/build-module/components/block-inspector-button/index.js.map +7 -1
  81. package/build-module/components/customize-widgets/index.js +52 -51
  82. package/build-module/components/customize-widgets/index.js.map +7 -1
  83. package/build-module/components/customize-widgets/use-clear-selected-block.js +38 -58
  84. package/build-module/components/customize-widgets/use-clear-selected-block.js.map +7 -1
  85. package/build-module/components/error-boundary/index.js +27 -37
  86. package/build-module/components/error-boundary/index.js.map +7 -1
  87. package/build-module/components/focus-control/index.js +50 -45
  88. package/build-module/components/focus-control/index.js.map +7 -1
  89. package/build-module/components/focus-control/use-blocks-focus-control.js +17 -22
  90. package/build-module/components/focus-control/use-blocks-focus-control.js.map +7 -1
  91. package/build-module/components/header/index.js +81 -63
  92. package/build-module/components/header/index.js.map +7 -1
  93. package/build-module/components/inserter/index.js +59 -47
  94. package/build-module/components/inserter/index.js.map +7 -1
  95. package/build-module/components/inserter/use-inserter.js +28 -23
  96. package/build-module/components/inserter/use-inserter.js.map +7 -1
  97. package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
  98. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  99. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
  100. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  101. package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -103
  102. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  103. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -50
  104. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  105. package/build-module/components/keyboard-shortcuts/index.js +44 -44
  106. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  107. package/build-module/components/more-menu/index.js +129 -84
  108. package/build-module/components/more-menu/index.js.map +7 -1
  109. package/build-module/components/sidebar-block-editor/index.js +109 -96
  110. package/build-module/components/sidebar-block-editor/index.js.map +7 -1
  111. package/build-module/components/sidebar-block-editor/sidebar-adapter.js +54 -59
  112. package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
  113. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +22 -25
  114. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
  115. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js +70 -70
  116. package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
  117. package/build-module/components/sidebar-controls/index.js +24 -25
  118. package/build-module/components/sidebar-controls/index.js.map +7 -1
  119. package/build-module/components/welcome-guide/index.js +68 -52
  120. package/build-module/components/welcome-guide/index.js.map +7 -1
  121. package/build-module/controls/inserter-outer-section.js +31 -52
  122. package/build-module/controls/inserter-outer-section.js.map +7 -1
  123. package/build-module/controls/inspector-section.js +13 -32
  124. package/build-module/controls/inspector-section.js.map +7 -1
  125. package/build-module/controls/sidebar-control.js +22 -22
  126. package/build-module/controls/sidebar-control.js.map +7 -1
  127. package/build-module/controls/sidebar-section.js +43 -32
  128. package/build-module/controls/sidebar-section.js.map +7 -1
  129. package/build-module/filters/index.js +4 -7
  130. package/build-module/filters/index.js.map +7 -1
  131. package/build-module/filters/move-to-sidebar.js +83 -76
  132. package/build-module/filters/move-to-sidebar.js.map +7 -1
  133. package/build-module/filters/replace-media-upload.js +8 -7
  134. package/build-module/filters/replace-media-upload.js.map +7 -1
  135. package/build-module/filters/wide-widget-display.js +20 -22
  136. package/build-module/filters/wide-widget-display.js.map +7 -1
  137. package/build-module/index.js +53 -51
  138. package/build-module/index.js.map +7 -1
  139. package/build-module/lock-unlock.js +8 -7
  140. package/build-module/lock-unlock.js.map +7 -1
  141. package/build-module/store/actions.js +6 -40
  142. package/build-module/store/actions.js.map +7 -1
  143. package/build-module/store/constants.js +5 -5
  144. package/build-module/store/constants.js.map +7 -1
  145. package/build-module/store/index.js +10 -30
  146. package/build-module/store/index.js.map +7 -1
  147. package/build-module/store/reducer.js +7 -14
  148. package/build-module/store/reducer.js.map +7 -1
  149. package/build-module/store/selectors.js +10 -40
  150. package/build-module/store/selectors.js.map +7 -1
  151. package/build-module/utils.js +21 -66
  152. package/build-module/utils.js.map +7 -1
  153. package/build-style/style-rtl.css +14 -149
  154. package/build-style/style.css +14 -149
  155. package/package.json +30 -23
  156. package/src/components/block-inspector-button/style.scss +3 -0
  157. package/src/components/header/style.scss +5 -0
  158. package/src/components/inserter/style.scss +3 -0
  159. package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
  160. package/src/components/more-menu/style.scss +2 -0
  161. package/src/components/sidebar-block-editor/style.scss +2 -0
  162. package/src/components/welcome-guide/style.scss +2 -0
  163. package/src/controls/style.scss +2 -0
  164. package/src/style.scss +10 -8
@@ -1,100 +1,121 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ 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
+ 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;
18
+ };
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
+ var use_sidebar_block_editor_exports = {};
29
+ __export(use_sidebar_block_editor_exports, {
30
+ default: () => useSidebarBlockEditor
6
31
  });
7
- exports.default = useSidebarBlockEditor;
8
- var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
9
- var _element = require("@wordpress/element");
10
- var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
11
- var _widgets = require("@wordpress/widgets");
12
- var _utils = require("../../utils");
13
- /**
14
- * External dependencies
15
- */
16
-
17
- /**
18
- * WordPress dependencies
19
- */
20
-
21
- /**
22
- * Internal dependencies
23
- */
24
-
32
+ module.exports = __toCommonJS(use_sidebar_block_editor_exports);
33
+ var import_es6 = __toESM(require("fast-deep-equal/es6"));
34
+ var import_element = require("@wordpress/element");
35
+ var import_is_shallow_equal = __toESM(require("@wordpress/is-shallow-equal"));
36
+ var import_widgets = require("@wordpress/widgets");
37
+ var import_utils = require("../../utils");
25
38
  function widgetsToBlocks(widgets) {
26
- return widgets.map(widget => (0, _utils.widgetToBlock)(widget));
39
+ return widgets.map((widget) => (0, import_utils.widgetToBlock)(widget));
27
40
  }
28
41
  function useSidebarBlockEditor(sidebar) {
29
- const [blocks, setBlocks] = (0, _element.useState)(() => widgetsToBlocks(sidebar.getWidgets()));
30
- (0, _element.useEffect)(() => {
42
+ const [blocks, setBlocks] = (0, import_element.useState)(
43
+ () => widgetsToBlocks(sidebar.getWidgets())
44
+ );
45
+ (0, import_element.useEffect)(() => {
31
46
  return sidebar.subscribe((prevWidgets, nextWidgets) => {
32
- setBlocks(prevBlocks => {
33
- const prevWidgetsMap = new Map(prevWidgets.map(widget => [widget.id, widget]));
34
- const prevBlocksMap = new Map(prevBlocks.map(block => [(0, _widgets.getWidgetIdFromBlock)(block), block]));
35
- const nextBlocks = nextWidgets.map(nextWidget => {
47
+ setBlocks((prevBlocks) => {
48
+ const prevWidgetsMap = new Map(
49
+ prevWidgets.map((widget) => [widget.id, widget])
50
+ );
51
+ const prevBlocksMap = new Map(
52
+ prevBlocks.map((block) => [
53
+ (0, import_widgets.getWidgetIdFromBlock)(block),
54
+ block
55
+ ])
56
+ );
57
+ const nextBlocks = nextWidgets.map((nextWidget) => {
36
58
  const prevWidget = prevWidgetsMap.get(nextWidget.id);
37
-
38
- // Bail out updates.
39
59
  if (prevWidget && prevWidget === nextWidget) {
40
60
  return prevBlocksMap.get(nextWidget.id);
41
61
  }
42
- return (0, _utils.widgetToBlock)(nextWidget);
62
+ return (0, import_utils.widgetToBlock)(nextWidget);
43
63
  });
44
-
45
- // Bail out updates.
46
- if ((0, _isShallowEqual.default)(prevBlocks, nextBlocks)) {
64
+ if ((0, import_is_shallow_equal.default)(prevBlocks, nextBlocks)) {
47
65
  return prevBlocks;
48
66
  }
49
67
  return nextBlocks;
50
68
  });
51
69
  });
52
70
  }, [sidebar]);
53
- const onChangeBlocks = (0, _element.useCallback)(nextBlocks => {
54
- setBlocks(prevBlocks => {
55
- if ((0, _isShallowEqual.default)(prevBlocks, nextBlocks)) {
56
- return prevBlocks;
57
- }
58
- const prevBlocksMap = new Map(prevBlocks.map(block => [(0, _widgets.getWidgetIdFromBlock)(block), block]));
59
- const nextWidgets = nextBlocks.map(nextBlock => {
60
- const widgetId = (0, _widgets.getWidgetIdFromBlock)(nextBlock);
61
-
62
- // Update existing widgets.
63
- if (widgetId && prevBlocksMap.has(widgetId)) {
64
- const prevBlock = prevBlocksMap.get(widgetId);
65
- const prevWidget = sidebar.getWidget(widgetId);
66
-
67
- // Bail out updates by returning the previous widgets.
68
- // Deep equality is necessary until the block editor's internals changes.
69
- if ((0, _es.default)(nextBlock, prevBlock) && prevWidget) {
70
- return prevWidget;
71
- }
72
- return (0, _utils.blockToWidget)(nextBlock, prevWidget);
71
+ const onChangeBlocks = (0, import_element.useCallback)(
72
+ (nextBlocks) => {
73
+ setBlocks((prevBlocks) => {
74
+ if ((0, import_is_shallow_equal.default)(prevBlocks, nextBlocks)) {
75
+ return prevBlocks;
73
76
  }
74
-
75
- // Add a new widget.
76
- return (0, _utils.blockToWidget)(nextBlock);
77
- });
78
-
79
- // Bail out updates if the updated widgets are the same.
80
- if ((0, _isShallowEqual.default)(sidebar.getWidgets(), nextWidgets)) {
81
- return prevBlocks;
82
- }
83
- const addedWidgetIds = sidebar.setWidgets(nextWidgets);
84
- return nextBlocks.reduce((updatedNextBlocks, nextBlock, index) => {
85
- const addedWidgetId = addedWidgetIds[index];
86
- if (addedWidgetId !== null) {
87
- // Only create a new instance if necessary to prevent
88
- // the whole editor from re-rendering on every edit.
89
- if (updatedNextBlocks === nextBlocks) {
90
- updatedNextBlocks = nextBlocks.slice();
77
+ const prevBlocksMap = new Map(
78
+ prevBlocks.map((block) => [
79
+ (0, import_widgets.getWidgetIdFromBlock)(block),
80
+ block
81
+ ])
82
+ );
83
+ const nextWidgets = nextBlocks.map((nextBlock) => {
84
+ const widgetId = (0, import_widgets.getWidgetIdFromBlock)(nextBlock);
85
+ if (widgetId && prevBlocksMap.has(widgetId)) {
86
+ const prevBlock = prevBlocksMap.get(widgetId);
87
+ const prevWidget = sidebar.getWidget(widgetId);
88
+ if ((0, import_es6.default)(nextBlock, prevBlock) && prevWidget) {
89
+ return prevWidget;
90
+ }
91
+ return (0, import_utils.blockToWidget)(nextBlock, prevWidget);
91
92
  }
92
- updatedNextBlocks[index] = (0, _widgets.addWidgetIdToBlock)(nextBlock, addedWidgetId);
93
+ return (0, import_utils.blockToWidget)(nextBlock);
94
+ });
95
+ if ((0, import_is_shallow_equal.default)(sidebar.getWidgets(), nextWidgets)) {
96
+ return prevBlocks;
93
97
  }
94
- return updatedNextBlocks;
95
- }, nextBlocks);
96
- });
97
- }, [sidebar]);
98
+ const addedWidgetIds = sidebar.setWidgets(nextWidgets);
99
+ return nextBlocks.reduce(
100
+ (updatedNextBlocks, nextBlock, index) => {
101
+ const addedWidgetId = addedWidgetIds[index];
102
+ if (addedWidgetId !== null) {
103
+ if (updatedNextBlocks === nextBlocks) {
104
+ updatedNextBlocks = nextBlocks.slice();
105
+ }
106
+ updatedNextBlocks[index] = (0, import_widgets.addWidgetIdToBlock)(
107
+ nextBlock,
108
+ addedWidgetId
109
+ );
110
+ }
111
+ return updatedNextBlocks;
112
+ },
113
+ nextBlocks
114
+ );
115
+ });
116
+ },
117
+ [sidebar]
118
+ );
98
119
  return [blocks, onChangeBlocks, onChangeBlocks];
99
120
  }
100
- //# sourceMappingURL=use-sidebar-block-editor.js.map
121
+ //# sourceMappingURL=use-sidebar-block-editor.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_es","_interopRequireDefault","require","_element","_isShallowEqual","_widgets","_utils","widgetsToBlocks","widgets","map","widget","widgetToBlock","useSidebarBlockEditor","sidebar","blocks","setBlocks","useState","getWidgets","useEffect","subscribe","prevWidgets","nextWidgets","prevBlocks","prevWidgetsMap","Map","id","prevBlocksMap","block","getWidgetIdFromBlock","nextBlocks","nextWidget","prevWidget","get","isShallowEqual","onChangeBlocks","useCallback","nextBlock","widgetId","has","prevBlock","getWidget","fastDeepEqual","blockToWidget","addedWidgetIds","setWidgets","reduce","updatedNextBlocks","index","addedWidgetId","slice","addWidgetIdToBlock"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/use-sidebar-block-editor.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { getWidgetIdFromBlock, addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\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":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASK,eAAeA,CAAEC,OAAO,EAAG;EACnC,OAAOA,OAAO,CAACC,GAAG,CAAIC,MAAM,IAAM,IAAAC,oBAAa,EAAED,MAAO,CAAE,CAAC;AAC5D;AAEe,SAASE,qBAAqBA,CAAEC,OAAO,EAAG;EACxD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAC,iBAAQ,EAAE,MACvCT,eAAe,CAAEM,OAAO,CAACI,UAAU,CAAC,CAAE,CACvC,CAAC;EAED,IAAAC,kBAAS,EAAE,MAAM;IAChB,OAAOL,OAAO,CAACM,SAAS,CAAE,CAAEC,WAAW,EAAEC,WAAW,KAAM;MACzDN,SAAS,CAAIO,UAAU,IAAM;QAC5B,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAC7BJ,WAAW,CAACX,GAAG,CAAIC,MAAM,IAAM,CAAEA,MAAM,CAACe,EAAE,EAAEf,MAAM,CA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-editor.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { getWidgetIdFromBlock, addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\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;AAGA,iBAA0B;AAK1B,qBAAiD;AACjD,8BAA2B;AAC3B,qBAAyD;AAKzD,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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AAM,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": ["isShallowEqual", "fastDeepEqual"]
7
+ }
@@ -1,44 +1,58 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
+ var sidebar_controls_exports = {};
19
+ __export(sidebar_controls_exports, {
20
+ SidebarControlsContext: () => SidebarControlsContext,
21
+ default: () => SidebarControls,
22
+ useActiveSidebarControl: () => useActiveSidebarControl,
23
+ useSidebarControls: () => useSidebarControls
5
24
  });
6
- exports.SidebarControlsContext = void 0;
7
- exports.default = SidebarControls;
8
- exports.useActiveSidebarControl = useActiveSidebarControl;
9
- exports.useSidebarControls = useSidebarControls;
10
- var _element = require("@wordpress/element");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- const SidebarControlsContext = exports.SidebarControlsContext = (0, _element.createContext)();
17
- SidebarControlsContext.displayName = 'SidebarControlsContext';
25
+ module.exports = __toCommonJS(sidebar_controls_exports);
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ var import_element = require("@wordpress/element");
28
+ const SidebarControlsContext = (0, import_element.createContext)();
29
+ SidebarControlsContext.displayName = "SidebarControlsContext";
18
30
  function SidebarControls({
19
31
  sidebarControls,
20
32
  activeSidebarControl,
21
33
  children
22
34
  }) {
23
- const context = (0, _element.useMemo)(() => ({
24
- sidebarControls,
25
- activeSidebarControl
26
- }), [sidebarControls, activeSidebarControl]);
27
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(SidebarControlsContext.Provider, {
28
- value: context,
29
- children: children
30
- });
35
+ const context = (0, import_element.useMemo)(
36
+ () => ({
37
+ sidebarControls,
38
+ activeSidebarControl
39
+ }),
40
+ [sidebarControls, activeSidebarControl]
41
+ );
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarControlsContext.Provider, { value: context, children });
31
43
  }
32
44
  function useSidebarControls() {
33
- const {
34
- sidebarControls
35
- } = (0, _element.useContext)(SidebarControlsContext);
45
+ const { sidebarControls } = (0, import_element.useContext)(SidebarControlsContext);
36
46
  return sidebarControls;
37
47
  }
38
48
  function useActiveSidebarControl() {
39
- const {
40
- activeSidebarControl
41
- } = (0, _element.useContext)(SidebarControlsContext);
49
+ const { activeSidebarControl } = (0, import_element.useContext)(SidebarControlsContext);
42
50
  return activeSidebarControl;
43
51
  }
44
- //# sourceMappingURL=index.js.map
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ SidebarControlsContext,
55
+ useActiveSidebarControl,
56
+ useSidebarControls
57
+ });
58
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_jsxRuntime","SidebarControlsContext","exports","createContext","displayName","SidebarControls","sidebarControls","activeSidebarControl","children","context","useMemo","jsx","Provider","value","useSidebarControls","useContext","useActiveSidebarControl"],"sources":["@wordpress/customize-widgets/src/components/sidebar-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAAwE,IAAAC,WAAA,GAAAD,OAAA;AAHxE;AACA;AACA;;AAGO,MAAME,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,sBAAa,EAAC,CAAC;AACrDF,sBAAsB,CAACG,WAAW,GAAG,wBAAwB;AAE9C,SAASC,eAAeA,CAAE;EACxCC,eAAe;EACfC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EACtB,OAAQ;IACPJ,eAAe;IACfC;EACD,CAAC,CAAE,EACH,CAAED,eAAe,EAAEC,oBAAoB,CACxC,CAAC;EAED,oBACC,IAAAP,WAAA,CAAAW,GAAA,EAACV,sBAAsB,CAACW,QAAQ;IAACC,KAAK,EAAGJ,OAAS;IAAAD,QAAA,EAC/CA;EAAQ,CACsB,CAAC;AAEpC;AAEO,SAASM,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAER;EAAgB,CAAC,GAAG,IAAAS,mBAAU,EAAEd,sBAAuB,CAAC;EAEhE,OAAOK,eAAe;AACvB;AAEO,SAASU,uBAAuBA,CAAA,EAAG;EACzC,MAAM;IAAET;EAAqB,CAAC,GAAG,IAAAQ,mBAAU,EAAEd,sBAAuB,CAAC;EAErE,OAAOM,oBAAoB;AAC5B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/sidebar-controls/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { 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;AAsBE;AAnBF,qBAAmD;AAE5C,MAAM,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,67 +1,95 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
+ var welcome_guide_exports = {};
19
+ __export(welcome_guide_exports, {
20
+ default: () => WelcomeGuide
5
21
  });
6
- exports.default = WelcomeGuide;
7
- var _i18n = require("@wordpress/i18n");
8
- var _components = require("@wordpress/components");
9
- var _data = require("@wordpress/data");
10
- var _preferences = require("@wordpress/preferences");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- function WelcomeGuide({
17
- sidebar
18
- }) {
19
- const {
20
- toggle
21
- } = (0, _data.useDispatch)(_preferences.store);
22
- const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
23
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
24
- className: "customize-widgets-welcome-guide",
25
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
26
- className: "customize-widgets-welcome-guide__image__wrapper",
27
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("picture", {
28
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
22
+ module.exports = __toCommonJS(welcome_guide_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_i18n = require("@wordpress/i18n");
25
+ var import_components = require("@wordpress/components");
26
+ var import_data = require("@wordpress/data");
27
+ var import_preferences = require("@wordpress/preferences");
28
+ function WelcomeGuide({ sidebar }) {
29
+ const { toggle } = (0, import_data.useDispatch)(import_preferences.store);
30
+ const isEntirelyBlockWidgets = sidebar.getWidgets().every((widget) => widget.id.startsWith("block-"));
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "customize-widgets-welcome-guide", children: [
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "customize-widgets-welcome-guide__image__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("picture", { children: [
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
34
+ "source",
35
+ {
29
36
  srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg",
30
37
  media: "(prefers-reduced-motion: reduce)"
31
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
38
+ }
39
+ ),
40
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
41
+ "img",
42
+ {
32
43
  className: "customize-widgets-welcome-guide__image",
33
44
  src: "https://s.w.org/images/block-editor/welcome-editor.gif",
34
45
  width: "312",
35
46
  height: "240",
36
47
  alt: ""
37
- })]
38
- })
39
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
40
- className: "customize-widgets-welcome-guide__heading",
41
- children: (0, _i18n.__)('Welcome to block Widgets')
42
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
43
- className: "customize-widgets-welcome-guide__text",
44
- children: isEntirelyBlockWidgets ? (0, _i18n.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0, _i18n.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')
45
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
46
- size: "compact",
47
- variant: "primary",
48
- onClick: () => toggle('core/customize-widgets', 'welcomeGuide'),
49
- children: (0, _i18n.__)('Got it')
50
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
51
- className: "customize-widgets-welcome-guide__separator"
52
- }), !isEntirelyBlockWidgets && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
53
- className: "customize-widgets-welcome-guide__more-info",
54
- children: [(0, _i18n.__)('Want to stick with the old widgets?'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
55
- href: (0, _i18n.__)('https://wordpress.org/plugins/classic-widgets/'),
56
- children: (0, _i18n.__)('Get the Classic Widgets plugin.')
57
- })]
58
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
59
- className: "customize-widgets-welcome-guide__more-info",
60
- children: [(0, _i18n.__)('New to the block editor?'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
61
- href: (0, _i18n.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'),
62
- children: (0, _i18n.__)("Here's a detailed guide.")
63
- })]
64
- })]
65
- });
48
+ }
49
+ )
50
+ ] }) }),
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "customize-widgets-welcome-guide__heading", children: (0, import_i18n.__)("Welcome to block Widgets") }),
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "customize-widgets-welcome-guide__text", children: isEntirelyBlockWidgets ? (0, import_i18n.__)(
53
+ "Your theme provides different \u201Cblock\u201D areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site."
54
+ ) : (0, import_i18n.__)(
55
+ "You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly."
56
+ ) }),
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
+ import_components.Button,
59
+ {
60
+ size: "compact",
61
+ variant: "primary",
62
+ onClick: () => toggle("core/customize-widgets", "welcomeGuide"),
63
+ children: (0, import_i18n.__)("Got it")
64
+ }
65
+ ),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("hr", { className: "customize-widgets-welcome-guide__separator" }),
67
+ !isEntirelyBlockWidgets && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [
68
+ (0, import_i18n.__)("Want to stick with the old widgets?"),
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
+ import_components.ExternalLink,
72
+ {
73
+ href: (0, import_i18n.__)(
74
+ "https://wordpress.org/plugins/classic-widgets/"
75
+ ),
76
+ children: (0, import_i18n.__)("Get the Classic Widgets plugin.")
77
+ }
78
+ )
79
+ ] }),
80
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [
81
+ (0, import_i18n.__)("New to the block editor?"),
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
84
+ import_components.ExternalLink,
85
+ {
86
+ href: (0, import_i18n.__)(
87
+ "https://wordpress.org/documentation/article/wordpress-block-editor/"
88
+ ),
89
+ children: (0, import_i18n.__)("Here's a detailed guide.")
90
+ }
91
+ )
92
+ ] })
93
+ ] });
66
94
  }
67
- //# sourceMappingURL=index.js.map
95
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_preferences","_jsxRuntime","WelcomeGuide","sidebar","toggle","useDispatch","preferencesStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith","jsxs","className","children","jsx","srcSet","media","src","width","height","alt","__","Button","size","variant","onClick","ExternalLink","href"],"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAA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AAA,EAAClB,WAAA,CAAA0B,MAAM;MACNC,IAAI,EAAC,SAAS;MACdC,OAAO,EAAC,SAAS;MACjBC,OAAO,EAAGA,CAAA,KACTvB,MAAM,CAAE,wBAAwB,EAAE,cAAe,CACjD;MAAAW,QAAA,EAEC,IAAAQ,QAAE,EAAE,QAAS;IAAC,CACT,CAAC,eACT,IAAAtB,WAAA,CAAAe,GAAA;MAAIF,SAAS,EAAC;IAA4C,CAAE,CAAC,EAC3D,CAAEP,sBAAsB,iBACzB,IAAAN,WAAA,CAAAY,IAAA;MAAGC,SAAS,EAAC,4CAA4C;MAAAC,QAAA,GACtD,IAAAQ,QAAE,EAAE,qCAAsC,CAAC,eAC7C,IAAAtB,WAAA,CAAAe,GAAA,UAAK,CAAC,eACN,IAAAf,WAAA,CAAAe,GAAA,EAAClB,WAAA,CAAA8B,YAAY;QACZC,IAAI,EAAG,IAAAN,QAAE,EACR,gDACD,CAAG;QAAAR,QAAA,EAED,IAAAQ,QAAE,EAAE,iCAAkC;MAAC,CAC5B,CAAC;IAAA,CACb,CACH,eACD,IAAAtB,WAAA,CAAAY,IAAA;MAAGC,SAAS,EAAC,4CAA4C;MAAAC,QAAA,GACtD,IAAAQ,QAAE,EAAE,0BAA2B,CAAC,eAClC,IAAAtB,WAAA,CAAAe,GAAA,UAAK,CAAC,eACN,IAAAf,WAAA,CAAAe,GAAA,EAAClB,WAAA,CAAA8B,YAAY;QACZC,IAAI,EAAG,IAAAN,QAAE,EACR,qEACD,CAAG;QAAAR,QAAA,EAED,IAAAQ,QAAE,EAAE,0BAA2B;MAAC,CACrB,CAAC;IAAA,CACb,CAAC;EAAA,CACA,CAAC;AAER","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/welcome-guide/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different \u201Cblock\u201D areas for you to add and edit content.\u00A0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBI;AAfJ,kBAAmB;AACnB,wBAAqC;AACrC,kBAA4B;AAC5B,yBAA0C;AAE3B,SAAR,aAA+B,EAAE,QAAQ,GAAI;AACnD,QAAM,EAAE,OAAO,QAAI,yBAAa,mBAAAA,KAAiB;AAEjD,QAAM,yBAAyB,QAC7B,WAAW,EACX,MAAO,CAAE,WAAY,OAAO,GAAG,WAAY,QAAS,CAAE;AAExD,SACC,6CAAC,SAAI,WAAU,mCACd;AAAA,gDAAC,SAAI,WAAU,mDACd,uDAAC,aACA;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,QAAO;AAAA,UACP,OAAM;AAAA;AAAA,MACP;AAAA,MACA;AAAA,QAAC;AAAA;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