@wordpress/patterns 2.32.0 → 2.32.1-next.47f435fc9.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 (105) hide show
  1. package/build/api/index.js +35 -29
  2. package/build/api/index.js.map +7 -1
  3. package/build/components/allow-overrides-modal.js +149 -112
  4. package/build/components/allow-overrides-modal.js.map +7 -1
  5. package/build/components/category-selector.js +59 -38
  6. package/build/components/category-selector.js.map +7 -1
  7. package/build/components/create-pattern-modal.js +162 -111
  8. package/build/components/create-pattern-modal.js.map +7 -1
  9. package/build/components/duplicate-pattern-modal.js +85 -66
  10. package/build/components/duplicate-pattern-modal.js.map +7 -1
  11. package/build/components/index.js +50 -33
  12. package/build/components/index.js.map +7 -1
  13. package/build/components/overrides-panel.js +44 -39
  14. package/build/components/overrides-panel.js.map +7 -1
  15. package/build/components/pattern-convert-button.js +144 -133
  16. package/build/components/pattern-convert-button.js.map +7 -1
  17. package/build/components/pattern-overrides-block-controls.js +109 -109
  18. package/build/components/pattern-overrides-block-controls.js.map +7 -1
  19. package/build/components/pattern-overrides-controls.js +86 -69
  20. package/build/components/pattern-overrides-controls.js.map +7 -1
  21. package/build/components/patterns-manage-button.js +96 -97
  22. package/build/components/patterns-manage-button.js.map +7 -1
  23. package/build/components/rename-pattern-category-modal.js +122 -111
  24. package/build/components/rename-pattern-category-modal.js.map +7 -1
  25. package/build/components/rename-pattern-modal.js +95 -73
  26. package/build/components/rename-pattern-modal.js.map +7 -1
  27. package/build/components/reset-overrides-control.js +61 -57
  28. package/build/components/reset-overrides-control.js.map +7 -1
  29. package/build/constants.js +57 -23
  30. package/build/constants.js.map +7 -1
  31. package/build/index.js +27 -24
  32. package/build/index.js.map +7 -1
  33. package/build/lock-unlock.js +31 -15
  34. package/build/lock-unlock.js.map +7 -1
  35. package/build/private-apis.js +71 -48
  36. package/build/private-apis.js.map +7 -1
  37. package/build/private-hooks.js +57 -69
  38. package/build/private-hooks.js.map +7 -1
  39. package/build/store/actions.js +72 -85
  40. package/build/store/actions.js.map +7 -1
  41. package/build/store/constants.js +27 -10
  42. package/build/store/constants.js.map +7 -1
  43. package/build/store/index.js +50 -44
  44. package/build/store/index.js.map +7 -1
  45. package/build/store/reducer.js +30 -14
  46. package/build/store/reducer.js.map +7 -1
  47. package/build/store/selectors.js +26 -13
  48. package/build/store/selectors.js.map +7 -1
  49. package/build-module/api/index.js +14 -25
  50. package/build-module/api/index.js.map +7 -1
  51. package/build-module/components/allow-overrides-modal.js +131 -103
  52. package/build-module/components/allow-overrides-modal.js.map +7 -1
  53. package/build-module/components/category-selector.js +35 -29
  54. package/build-module/components/category-selector.js.map +7 -1
  55. package/build-module/components/create-pattern-modal.js +137 -99
  56. package/build-module/components/create-pattern-modal.js.map +7 -1
  57. package/build-module/components/duplicate-pattern-modal.js +53 -58
  58. package/build-module/components/duplicate-pattern-modal.js.map +7 -1
  59. package/build-module/components/index.js +22 -26
  60. package/build-module/components/index.js.map +7 -1
  61. package/build-module/components/overrides-panel.js +30 -34
  62. package/build-module/components/overrides-panel.js.map +7 -1
  63. package/build-module/components/pattern-convert-button.js +120 -125
  64. package/build-module/components/pattern-convert-button.js.map +7 -1
  65. package/build-module/components/pattern-overrides-block-controls.js +100 -103
  66. package/build-module/components/pattern-overrides-block-controls.js.map +7 -1
  67. package/build-module/components/pattern-overrides-controls.js +69 -58
  68. package/build-module/components/pattern-overrides-controls.js.map +7 -1
  69. package/build-module/components/patterns-manage-button.js +78 -91
  70. package/build-module/components/patterns-manage-button.js.map +7 -1
  71. package/build-module/components/rename-pattern-category-modal.js +106 -101
  72. package/build-module/components/rename-pattern-category-modal.js.map +7 -1
  73. package/build-module/components/rename-pattern-modal.js +80 -64
  74. package/build-module/components/rename-pattern-modal.js.map +7 -1
  75. package/build-module/components/reset-overrides-control.js +46 -51
  76. package/build-module/components/reset-overrides-control.js.map +7 -1
  77. package/build-module/constants.js +29 -18
  78. package/build-module/constants.js.map +7 -1
  79. package/build-module/index.js +6 -6
  80. package/build-module/index.js.map +7 -1
  81. package/build-module/lock-unlock.js +8 -7
  82. package/build-module/lock-unlock.js.map +7 -1
  83. package/build-module/private-apis.js +31 -18
  84. package/build-module/private-apis.js.map +7 -1
  85. package/build-module/private-hooks.js +35 -64
  86. package/build-module/private-hooks.js.map +7 -1
  87. package/build-module/store/actions.js +44 -74
  88. package/build-module/store/actions.js.map +7 -1
  89. package/build-module/store/constants.js +5 -5
  90. package/build-module/store/constants.js.map +7 -1
  91. package/build-module/store/index.js +13 -32
  92. package/build-module/store/index.js.map +7 -1
  93. package/build-module/store/reducer.js +9 -8
  94. package/build-module/store/reducer.js.map +7 -1
  95. package/build-module/store/selectors.js +5 -9
  96. package/build-module/store/selectors.js.map +7 -1
  97. package/build-style/style-rtl.css +3 -138
  98. package/build-style/style.css +3 -138
  99. package/package.json +24 -17
  100. package/src/components/style.scss +5 -0
  101. package/src/style.scss +2 -1
  102. package/build/index.native.js +0 -18
  103. package/build/index.native.js.map +0 -1
  104. package/build-module/index.native.js +0 -11
  105. package/build-module/index.native.js.map +0 -1
@@ -1,130 +1,130 @@
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 pattern_overrides_block_controls_exports = {};
19
+ __export(pattern_overrides_block_controls_exports, {
20
+ default: () => PatternOverridesBlockControls
5
21
  });
6
- exports.default = PatternOverridesBlockControls;
7
- var _element = require("@wordpress/element");
8
- var _i18n = require("@wordpress/i18n");
9
- var _components = require("@wordpress/components");
10
- var _blocks = require("@wordpress/blocks");
11
- var _data = require("@wordpress/data");
12
- var _icons = require("@wordpress/icons");
13
- var _blockEditor = require("@wordpress/block-editor");
14
- var _lockUnlock = require("../lock-unlock");
15
- var _constants = require("../constants");
16
- var _jsxRuntime = require("react/jsx-runtime");
17
- /**
18
- * WordPress dependencies
19
- */
20
-
21
- /**
22
- * Internal dependencies
23
- */
24
-
25
- const {
26
- useBlockDisplayTitle
27
- } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
28
- function PatternOverridesToolbarIndicator({
29
- clientIds
30
- }) {
22
+ module.exports = __toCommonJS(pattern_overrides_block_controls_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_element = require("@wordpress/element");
25
+ var import_i18n = require("@wordpress/i18n");
26
+ var import_components = require("@wordpress/components");
27
+ var import_blocks = require("@wordpress/blocks");
28
+ var import_data = require("@wordpress/data");
29
+ var import_icons = require("@wordpress/icons");
30
+ var import_block_editor = require("@wordpress/block-editor");
31
+ var import_lock_unlock = require("../lock-unlock");
32
+ var import_constants = require("../constants");
33
+ const { useBlockDisplayTitle } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
34
+ function PatternOverridesToolbarIndicator({ clientIds }) {
31
35
  const isSingleBlockSelected = clientIds.length === 1;
32
- const {
33
- icon,
34
- firstBlockName
35
- } = (0, _data.useSelect)(select => {
36
- const {
37
- getBlockAttributes,
38
- getBlockNamesByClientId
39
- } = select(_blockEditor.store);
40
- const {
41
- getBlockType,
42
- getActiveBlockVariation
43
- } = select(_blocks.store);
44
- const blockTypeNames = getBlockNamesByClientId(clientIds);
45
- const _firstBlockTypeName = blockTypeNames[0];
46
- const firstBlockType = getBlockType(_firstBlockTypeName);
47
- let _icon;
48
- if (isSingleBlockSelected) {
49
- const match = getActiveBlockVariation(_firstBlockTypeName, getBlockAttributes(clientIds[0]));
50
- // Take into account active block variations.
51
- _icon = match?.icon || firstBlockType.icon;
52
- } else {
53
- const isSelectionOfSameType = new Set(blockTypeNames).size === 1;
54
- // When selection consists of blocks of multiple types, display an
55
- // appropriate icon to communicate the non-uniformity.
56
- _icon = isSelectionOfSameType ? firstBlockType.icon : _icons.copy;
57
- }
58
- return {
59
- icon: _icon,
60
- firstBlockName: getBlockAttributes(clientIds[0]).metadata.name
61
- };
62
- }, [clientIds, isSingleBlockSelected]);
36
+ const { icon, firstBlockName } = (0, import_data.useSelect)(
37
+ (select) => {
38
+ const { getBlockAttributes, getBlockNamesByClientId } = select(import_block_editor.store);
39
+ const { getBlockType, getActiveBlockVariation } = select(import_blocks.store);
40
+ const blockTypeNames = getBlockNamesByClientId(clientIds);
41
+ const _firstBlockTypeName = blockTypeNames[0];
42
+ const firstBlockType = getBlockType(_firstBlockTypeName);
43
+ let _icon;
44
+ if (isSingleBlockSelected) {
45
+ const match = getActiveBlockVariation(
46
+ _firstBlockTypeName,
47
+ getBlockAttributes(clientIds[0])
48
+ );
49
+ _icon = match?.icon || firstBlockType.icon;
50
+ } else {
51
+ const isSelectionOfSameType = new Set(blockTypeNames).size === 1;
52
+ _icon = isSelectionOfSameType ? firstBlockType.icon : import_icons.copy;
53
+ }
54
+ return {
55
+ icon: _icon,
56
+ firstBlockName: getBlockAttributes(clientIds[0]).metadata.name
57
+ };
58
+ },
59
+ [clientIds, isSingleBlockSelected]
60
+ );
63
61
  const firstBlockTitle = useBlockDisplayTitle({
64
62
  clientId: clientIds[0],
65
63
  maximumLength: 35
66
64
  });
67
- const blockDescription = isSingleBlockSelected ? (0, _i18n.sprintf)(/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */
68
- (0, _i18n.__)('This %1$s is editable using the "%2$s" override.'), firstBlockTitle.toLowerCase(), firstBlockName) : (0, _i18n.__)('These blocks are editable using overrides.');
69
- const descriptionId = (0, _element.useId)();
70
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarItem, {
71
- children: toggleProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
65
+ const blockDescription = isSingleBlockSelected ? (0, import_i18n.sprintf)(
66
+ /* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */
67
+ (0, import_i18n.__)('This %1$s is editable using the "%2$s" override.'),
68
+ firstBlockTitle.toLowerCase(),
69
+ firstBlockName
70
+ ) : (0, import_i18n.__)("These blocks are editable using overrides.");
71
+ const descriptionId = (0, import_element.useId)();
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ import_components.DropdownMenu,
74
+ {
72
75
  className: "patterns-pattern-overrides-toolbar-indicator",
73
76
  label: firstBlockTitle,
74
77
  popoverProps: {
75
- placement: 'bottom-start',
76
- className: 'patterns-pattern-overrides-toolbar-indicator__popover'
78
+ placement: "bottom-start",
79
+ className: "patterns-pattern-overrides-toolbar-indicator__popover"
77
80
  },
78
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockIcon, {
80
- icon: icon,
81
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ import_block_editor.BlockIcon,
83
+ {
84
+ icon,
81
85
  className: "patterns-pattern-overrides-toolbar-indicator-icon",
82
86
  showColors: true
83
- })
84
- }),
87
+ }
88
+ ) }),
85
89
  toggleProps: {
86
90
  description: blockDescription,
87
91
  ...toggleProps
88
92
  },
89
93
  menuProps: {
90
- orientation: 'both',
91
- 'aria-describedby': descriptionId
94
+ orientation: "both",
95
+ "aria-describedby": descriptionId
92
96
  },
93
- children: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
94
- id: descriptionId,
95
- children: blockDescription
96
- })
97
- })
98
- });
97
+ children: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { id: descriptionId, children: blockDescription })
98
+ }
99
+ ) });
99
100
  }
100
101
  function PatternOverridesBlockControls() {
101
- const {
102
- clientIds,
103
- hasPatternOverrides,
104
- hasParentPattern
105
- } = (0, _data.useSelect)(select => {
106
- const {
107
- getBlockAttributes,
108
- getSelectedBlockClientIds,
109
- getBlockParentsByBlockName
110
- } = select(_blockEditor.store);
111
- const selectedClientIds = getSelectedBlockClientIds();
112
- const _hasPatternOverrides = selectedClientIds.every(clientId => {
113
- var _getBlockAttributes$m;
114
- return Object.values((_getBlockAttributes$m = getBlockAttributes(clientId)?.metadata?.bindings) !== null && _getBlockAttributes$m !== void 0 ? _getBlockAttributes$m : {}).some(binding => binding?.source === _constants.PATTERN_OVERRIDES_BINDING_SOURCE);
115
- });
116
- const _hasParentPattern = selectedClientIds.every(clientId => getBlockParentsByBlockName(clientId, 'core/block', true).length > 0);
117
- return {
118
- clientIds: selectedClientIds,
119
- hasPatternOverrides: _hasPatternOverrides,
120
- hasParentPattern: _hasParentPattern
121
- };
122
- }, []);
123
- return hasPatternOverrides && hasParentPattern ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
124
- group: "parent",
125
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PatternOverridesToolbarIndicator, {
126
- clientIds: clientIds
127
- })
128
- }) : null;
102
+ const { clientIds, hasPatternOverrides, hasParentPattern } = (0, import_data.useSelect)(
103
+ (select) => {
104
+ const {
105
+ getBlockAttributes,
106
+ getSelectedBlockClientIds,
107
+ getBlockParentsByBlockName
108
+ } = select(import_block_editor.store);
109
+ const selectedClientIds = getSelectedBlockClientIds();
110
+ const _hasPatternOverrides = selectedClientIds.every(
111
+ (clientId) => Object.values(
112
+ getBlockAttributes(clientId)?.metadata?.bindings ?? {}
113
+ ).some(
114
+ (binding) => binding?.source === import_constants.PATTERN_OVERRIDES_BINDING_SOURCE
115
+ )
116
+ );
117
+ const _hasParentPattern = selectedClientIds.every(
118
+ (clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0
119
+ );
120
+ return {
121
+ clientIds: selectedClientIds,
122
+ hasPatternOverrides: _hasPatternOverrides,
123
+ hasParentPattern: _hasParentPattern
124
+ };
125
+ },
126
+ []
127
+ );
128
+ return hasPatternOverrides && hasParentPattern ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "parent", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PatternOverridesToolbarIndicator, { clientIds }) }) : null;
129
129
  }
130
- //# sourceMappingURL=pattern-overrides-block-controls.js.map
130
+ //# sourceMappingURL=pattern-overrides-block-controls.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_blocks","_data","_icons","_blockEditor","_lockUnlock","_constants","_jsxRuntime","useBlockDisplayTitle","unlock","blockEditorPrivateApis","PatternOverridesToolbarIndicator","clientIds","isSingleBlockSelected","length","icon","firstBlockName","useSelect","select","getBlockAttributes","getBlockNamesByClientId","blockEditorStore","getBlockType","getActiveBlockVariation","blocksStore","blockTypeNames","_firstBlockTypeName","firstBlockType","_icon","match","isSelectionOfSameType","Set","size","copy","metadata","name","firstBlockTitle","clientId","maximumLength","blockDescription","sprintf","__","toLowerCase","descriptionId","useId","jsx","ToolbarItem","children","toggleProps","DropdownMenu","className","label","popoverProps","placement","Fragment","BlockIcon","showColors","description","menuProps","orientation","__experimentalText","id","PatternOverridesBlockControls","hasPatternOverrides","hasParentPattern","getSelectedBlockClientIds","getBlockParentsByBlockName","selectedClientIds","_hasPatternOverrides","every","_getBlockAttributes$m","Object","values","bindings","some","binding","source","PATTERN_OVERRIDES_BINDING_SOURCE","_hasParentPattern","BlockControls","group"],"sources":["@wordpress/patterns/src/components/pattern-overrides-block-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useId } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarItem,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport {\n\tstore as blockEditorStore,\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockControls,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { PATTERN_OVERRIDES_BINDING_SOURCE } from '../constants';\n\nconst { useBlockDisplayTitle } = unlock( blockEditorPrivateApis );\n\nfunction PatternOverridesToolbarIndicator( { clientIds } ) {\n\tconst isSingleBlockSelected = clientIds.length === 1;\n\tconst { icon, firstBlockName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getBlockNamesByClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockTypeNames = getBlockNamesByClientId( clientIds );\n\t\t\tconst _firstBlockTypeName = blockTypeNames[ 0 ];\n\t\t\tconst firstBlockType = getBlockType( _firstBlockTypeName );\n\t\t\tlet _icon;\n\t\t\tif ( isSingleBlockSelected ) {\n\t\t\t\tconst match = getActiveBlockVariation(\n\t\t\t\t\t_firstBlockTypeName,\n\t\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t\t);\n\t\t\t\t// Take into account active block variations.\n\t\t\t\t_icon = match?.icon || firstBlockType.icon;\n\t\t\t} else {\n\t\t\t\tconst isSelectionOfSameType =\n\t\t\t\t\tnew Set( blockTypeNames ).size === 1;\n\t\t\t\t// When selection consists of blocks of multiple types, display an\n\t\t\t\t// appropriate icon to communicate the non-uniformity.\n\t\t\t\t_icon = isSelectionOfSameType ? firstBlockType.icon : copy;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ticon: _icon,\n\t\t\t\tfirstBlockName: getBlockAttributes( clientIds[ 0 ] ).metadata\n\t\t\t\t\t.name,\n\t\t\t};\n\t\t},\n\t\t[ clientIds, isSingleBlockSelected ]\n\t);\n\tconst firstBlockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst blockDescription = isSingleBlockSelected\n\t\t? sprintf(\n\t\t\t\t/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */\n\t\t\t\t__( 'This %1$s is editable using the \"%2$s\" override.' ),\n\t\t\t\tfirstBlockTitle.toLowerCase(),\n\t\t\t\tfirstBlockName\n\t\t )\n\t\t: __( 'These blocks are editable using overrides.' );\n\n\tconst descriptionId = useId();\n\n\treturn (\n\t\t<ToolbarItem>\n\t\t\t{ ( toggleProps ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\tclassName=\"patterns-pattern-overrides-toolbar-indicator\"\n\t\t\t\t\tlabel={ firstBlockTitle }\n\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t'patterns-pattern-overrides-toolbar-indicator__popover',\n\t\t\t\t\t} }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\tclassName=\"patterns-pattern-overrides-toolbar-indicator-icon\"\n\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tdescription: blockDescription,\n\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t} }\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\torientation: 'both',\n\t\t\t\t\t\t'aria-describedby': descriptionId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<Text id={ descriptionId }>{ blockDescription }</Text>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\nexport default function PatternOverridesBlockControls() {\n\tconst { clientIds, hasPatternOverrides, hasParentPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedClientIds = getSelectedBlockClientIds();\n\t\t\tconst _hasPatternOverrides = selectedClientIds.every(\n\t\t\t\t( clientId ) =>\n\t\t\t\t\tObject.values(\n\t\t\t\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings ?? {}\n\t\t\t\t\t).some(\n\t\t\t\t\t\t( binding ) =>\n\t\t\t\t\t\t\tbinding?.source === PATTERN_OVERRIDES_BINDING_SOURCE\n\t\t\t\t\t)\n\t\t\t);\n\t\t\tconst _hasParentPattern = selectedClientIds.every(\n\t\t\t\t( clientId ) =>\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t\t.length > 0\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tclientIds: selectedClientIds,\n\t\t\t\thasPatternOverrides: _hasPatternOverrides,\n\t\t\t\thasParentPattern: _hasParentPattern,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn hasPatternOverrides && hasParentPattern ? (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<PatternOverridesToolbarIndicator clientIds={ clientIds } />\n\t\t</BlockControls>\n\t) : null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAA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GAAA,EAACzC,YAAA,CAAA2E,aAAa;IAACC,KAAK,EAAC,QAAQ;IAAAjC,QAAA,eAC5B,IAAAxC,WAAA,CAAAsC,GAAA,EAAClC,gCAAgC;MAACC,SAAS,EAAGA;IAAW,CAAE;EAAC,CAC9C,CAAC,GACb,IAAI;AACT","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/pattern-overrides-block-controls.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useId } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarItem,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport {\n\tstore as blockEditorStore,\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockControls,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { PATTERN_OVERRIDES_BINDING_SOURCE } from '../constants';\n\nconst { useBlockDisplayTitle } = unlock( blockEditorPrivateApis );\n\nfunction PatternOverridesToolbarIndicator( { clientIds } ) {\n\tconst isSingleBlockSelected = clientIds.length === 1;\n\tconst { icon, firstBlockName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getBlockNamesByClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst blockTypeNames = getBlockNamesByClientId( clientIds );\n\t\t\tconst _firstBlockTypeName = blockTypeNames[ 0 ];\n\t\t\tconst firstBlockType = getBlockType( _firstBlockTypeName );\n\t\t\tlet _icon;\n\t\t\tif ( isSingleBlockSelected ) {\n\t\t\t\tconst match = getActiveBlockVariation(\n\t\t\t\t\t_firstBlockTypeName,\n\t\t\t\t\tgetBlockAttributes( clientIds[ 0 ] )\n\t\t\t\t);\n\t\t\t\t// Take into account active block variations.\n\t\t\t\t_icon = match?.icon || firstBlockType.icon;\n\t\t\t} else {\n\t\t\t\tconst isSelectionOfSameType =\n\t\t\t\t\tnew Set( blockTypeNames ).size === 1;\n\t\t\t\t// When selection consists of blocks of multiple types, display an\n\t\t\t\t// appropriate icon to communicate the non-uniformity.\n\t\t\t\t_icon = isSelectionOfSameType ? firstBlockType.icon : copy;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ticon: _icon,\n\t\t\t\tfirstBlockName: getBlockAttributes( clientIds[ 0 ] ).metadata\n\t\t\t\t\t.name,\n\t\t\t};\n\t\t},\n\t\t[ clientIds, isSingleBlockSelected ]\n\t);\n\tconst firstBlockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst blockDescription = isSingleBlockSelected\n\t\t? sprintf(\n\t\t\t\t/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */\n\t\t\t\t__( 'This %1$s is editable using the \"%2$s\" override.' ),\n\t\t\t\tfirstBlockTitle.toLowerCase(),\n\t\t\t\tfirstBlockName\n\t\t )\n\t\t: __( 'These blocks are editable using overrides.' );\n\n\tconst descriptionId = useId();\n\n\treturn (\n\t\t<ToolbarItem>\n\t\t\t{ ( toggleProps ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\tclassName=\"patterns-pattern-overrides-toolbar-indicator\"\n\t\t\t\t\tlabel={ firstBlockTitle }\n\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t'patterns-pattern-overrides-toolbar-indicator__popover',\n\t\t\t\t\t} }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\tclassName=\"patterns-pattern-overrides-toolbar-indicator-icon\"\n\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tdescription: blockDescription,\n\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t} }\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\torientation: 'both',\n\t\t\t\t\t\t'aria-describedby': descriptionId,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ () => (\n\t\t\t\t\t\t<Text id={ descriptionId }>{ blockDescription }</Text>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\nexport default function PatternOverridesBlockControls() {\n\tconst { clientIds, hasPatternOverrides, hasParentPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedClientIds = getSelectedBlockClientIds();\n\t\t\tconst _hasPatternOverrides = selectedClientIds.every(\n\t\t\t\t( clientId ) =>\n\t\t\t\t\tObject.values(\n\t\t\t\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings ?? {}\n\t\t\t\t\t).some(\n\t\t\t\t\t\t( binding ) =>\n\t\t\t\t\t\t\tbinding?.source === PATTERN_OVERRIDES_BINDING_SOURCE\n\t\t\t\t\t)\n\t\t\t);\n\t\t\tconst _hasParentPattern = selectedClientIds.every(\n\t\t\t\t( clientId ) =>\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true )\n\t\t\t\t\t\t.length > 0\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tclientIds: selectedClientIds,\n\t\t\t\thasPatternOverrides: _hasPatternOverrides,\n\t\t\t\thasParentPattern: _hasParentPattern,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn hasPatternOverrides &&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D;AAAA,IACA,CAAC;AAAA,EACF;AAEA,SAAO,uBAAuB,mBAC7B,4CAAC,qCAAc,OAAM,UACpB,sDAAC,oCAAiC,WAAwB,GAC3D,IACG;AACL;",
6
+ "names": ["blockEditorPrivateApis", "blockEditorStore", "blocksStore", "Text"]
7
+ }
@@ -1,39 +1,45 @@
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 pattern_overrides_controls_exports = {};
19
+ __export(pattern_overrides_controls_exports, {
20
+ default: () => pattern_overrides_controls_default
5
21
  });
6
- exports.default = void 0;
7
- var _element = require("@wordpress/element");
8
- var _blockEditor = require("@wordpress/block-editor");
9
- var _components = require("@wordpress/components");
10
- var _i18n = require("@wordpress/i18n");
11
- var _constants = require("../constants");
12
- var _allowOverridesModal = require("./allow-overrides-modal");
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- /**
15
- * WordPress dependencies
16
- */
17
-
18
- /**
19
- * Internal dependencies
20
- */
21
-
22
+ module.exports = __toCommonJS(pattern_overrides_controls_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_element = require("@wordpress/element");
25
+ var import_block_editor = require("@wordpress/block-editor");
26
+ var import_components = require("@wordpress/components");
27
+ var import_i18n = require("@wordpress/i18n");
28
+ var import_constants = require("../constants");
29
+ var import_allow_overrides_modal = require("./allow-overrides-modal");
22
30
  function PatternOverridesControls({
23
31
  attributes,
24
32
  setAttributes,
25
33
  name: blockName
26
34
  }) {
27
- const controlId = (0, _element.useId)();
28
- const [showAllowOverridesModal, setShowAllowOverridesModal] = (0, _element.useState)(false);
29
- const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0, _element.useState)(false);
35
+ const controlId = (0, import_element.useId)();
36
+ const [showAllowOverridesModal, setShowAllowOverridesModal] = (0, import_element.useState)(false);
37
+ const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0, import_element.useState)(false);
30
38
  const hasName = !!attributes.metadata?.name;
31
39
  const defaultBindings = attributes.metadata?.bindings?.__default;
32
- const hasOverrides = hasName && defaultBindings?.source === _constants.PATTERN_OVERRIDES_BINDING_SOURCE;
33
- const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== _constants.PATTERN_OVERRIDES_BINDING_SOURCE;
34
- const {
35
- updateBlockBindings
36
- } = (0, _blockEditor.useBlockBindingsUtils)();
40
+ const hasOverrides = hasName && defaultBindings?.source === import_constants.PATTERN_OVERRIDES_BINDING_SOURCE;
41
+ const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== import_constants.PATTERN_OVERRIDES_BINDING_SOURCE;
42
+ const { updateBlockBindings } = (0, import_block_editor.useBlockBindingsUtils)();
37
43
  function updateBindings(isChecked, customName) {
38
44
  if (customName) {
39
45
  setAttributes({
@@ -44,54 +50,65 @@ function PatternOverridesControls({
44
50
  });
45
51
  }
46
52
  updateBlockBindings({
47
- __default: isChecked ? {
48
- source: _constants.PATTERN_OVERRIDES_BINDING_SOURCE
49
- } : undefined
53
+ __default: isChecked ? { source: import_constants.PATTERN_OVERRIDES_BINDING_SOURCE } : void 0
50
54
  });
51
55
  }
52
-
53
- // Avoid overwriting other (e.g. meta) bindings.
54
56
  if (isConnectedToOtherSources) {
55
57
  return null;
56
58
  }
57
- const hasUnsupportedImageAttributes = blockName === 'core/image' && (!!attributes.caption?.length || !!attributes.href?.length);
58
- const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0, _i18n.__)(`Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.`) : (0, _i18n.__)('Allow changes to this block throughout instances of this pattern.');
59
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
60
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
61
- group: "advanced",
62
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.BaseControl, {
59
+ const hasUnsupportedImageAttributes = blockName === "core/image" && (!!attributes.caption?.length || !!attributes.href?.length);
60
+ const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0, import_i18n.__)(
61
+ `Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.`
62
+ ) : (0, import_i18n.__)(
63
+ "Allow changes to this block throughout instances of this pattern."
64
+ );
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
+ import_components.BaseControl,
68
+ {
63
69
  __nextHasNoMarginBottom: true,
64
70
  id: controlId,
65
- label: (0, _i18n.__)('Overrides'),
71
+ label: (0, import_i18n.__)("Overrides"),
66
72
  help: helpText,
67
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
68
- __next40pxDefaultSize: true,
69
- className: "pattern-overrides-control__allow-overrides-button",
70
- variant: "secondary",
71
- "aria-haspopup": "dialog",
72
- onClick: () => {
73
- if (hasOverrides) {
74
- setShowDisallowOverridesModal(true);
75
- } else {
76
- setShowAllowOverridesModal(true);
77
- }
78
- },
79
- disabled: !hasOverrides && hasUnsupportedImageAttributes,
80
- accessibleWhenDisabled: true,
81
- children: hasOverrides ? (0, _i18n.__)('Disable overrides') : (0, _i18n.__)('Enable overrides')
82
- })
83
- })
84
- }), showAllowOverridesModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_allowOverridesModal.AllowOverridesModal, {
85
- initialName: attributes.metadata?.name,
86
- onClose: () => setShowAllowOverridesModal(false),
87
- onSave: newName => {
88
- updateBindings(true, newName);
73
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_components.Button,
75
+ {
76
+ __next40pxDefaultSize: true,
77
+ className: "pattern-overrides-control__allow-overrides-button",
78
+ variant: "secondary",
79
+ "aria-haspopup": "dialog",
80
+ onClick: () => {
81
+ if (hasOverrides) {
82
+ setShowDisallowOverridesModal(true);
83
+ } else {
84
+ setShowAllowOverridesModal(true);
85
+ }
86
+ },
87
+ disabled: !hasOverrides && hasUnsupportedImageAttributes,
88
+ accessibleWhenDisabled: true,
89
+ children: hasOverrides ? (0, import_i18n.__)("Disable overrides") : (0, import_i18n.__)("Enable overrides")
90
+ }
91
+ )
92
+ }
93
+ ) }),
94
+ showAllowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
+ import_allow_overrides_modal.AllowOverridesModal,
96
+ {
97
+ initialName: attributes.metadata?.name,
98
+ onClose: () => setShowAllowOverridesModal(false),
99
+ onSave: (newName) => {
100
+ updateBindings(true, newName);
101
+ }
102
+ }
103
+ ),
104
+ showDisallowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
+ import_allow_overrides_modal.DisallowOverridesModal,
106
+ {
107
+ onClose: () => setShowDisallowOverridesModal(false),
108
+ onSave: () => updateBindings(false)
89
109
  }
90
- }), showDisallowOverridesModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_allowOverridesModal.DisallowOverridesModal, {
91
- onClose: () => setShowDisallowOverridesModal(false),
92
- onSave: () => updateBindings(false)
93
- })]
94
- });
110
+ )
111
+ ] });
95
112
  }
96
- var _default = exports.default = PatternOverridesControls;
97
- //# sourceMappingURL=pattern-overrides-controls.js.map
113
+ var pattern_overrides_controls_default = PatternOverridesControls;
114
+ //# sourceMappingURL=pattern-overrides-controls.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_element","require","_blockEditor","_components","_i18n","_constants","_allowOverridesModal","_jsxRuntime","PatternOverridesControls","attributes","setAttributes","name","blockName","controlId","useId","showAllowOverridesModal","setShowAllowOverridesModal","useState","showDisallowOverridesModal","setShowDisallowOverridesModal","hasName","metadata","defaultBindings","bindings","__default","hasOverrides","source","PATTERN_OVERRIDES_BINDING_SOURCE","isConnectedToOtherSources","updateBlockBindings","useBlockBindingsUtils","updateBindings","isChecked","customName","undefined","hasUnsupportedImageAttributes","caption","length","href","helpText","__","jsxs","Fragment","children","jsx","InspectorControls","group","BaseControl","__nextHasNoMarginBottom","id","label","help","Button","__next40pxDefaultSize","className","variant","onClick","disabled","accessibleWhenDisabled","AllowOverridesModal","initialName","onClose","onSave","newName","DisallowOverridesModal","_default","exports","default"],"sources":["@wordpress/patterns/src/components/pattern-overrides-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useId } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tuseBlockBindingsUtils,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_OVERRIDES_BINDING_SOURCE } from '../constants';\nimport {\n\tAllowOverridesModal,\n\tDisallowOverridesModal,\n} from './allow-overrides-modal';\n\nfunction PatternOverridesControls( {\n\tattributes,\n\tsetAttributes,\n\tname: blockName,\n} ) {\n\tconst controlId = useId();\n\tconst [ showAllowOverridesModal, setShowAllowOverridesModal ] =\n\t\tuseState( false );\n\tconst [ showDisallowOverridesModal, setShowDisallowOverridesModal ] =\n\t\tuseState( false );\n\n\tconst hasName = !! attributes.metadata?.name;\n\tconst defaultBindings = attributes.metadata?.bindings?.__default;\n\tconst hasOverrides =\n\t\thasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE;\n\tconst isConnectedToOtherSources =\n\t\tdefaultBindings?.source &&\n\t\tdefaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE;\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\n\tfunction updateBindings( isChecked, customName ) {\n\t\tif ( customName ) {\n\t\t\tsetAttributes( {\n\t\t\t\tmetadata: {\n\t\t\t\t\t...attributes.metadata,\n\t\t\t\t\tname: customName,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tupdateBlockBindings( {\n\t\t\t__default: isChecked\n\t\t\t\t? { source: PATTERN_OVERRIDES_BINDING_SOURCE }\n\t\t\t\t: undefined,\n\t\t} );\n\t}\n\n\t// Avoid overwriting other (e.g. meta) bindings.\n\tif ( isConnectedToOtherSources ) {\n\t\treturn null;\n\t}\n\n\tconst hasUnsupportedImageAttributes =\n\t\tblockName === 'core/image' &&\n\t\t( !! attributes.caption?.length || !! attributes.href?.length );\n\n\tconst helpText =\n\t\t! hasOverrides && hasUnsupportedImageAttributes\n\t\t\t? __(\n\t\t\t\t\t`Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.`\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'Allow changes to this block throughout instances of this pattern.'\n\t\t\t );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<BaseControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tid={ controlId }\n\t\t\t\t\tlabel={ __( 'Overrides' ) }\n\t\t\t\t\thelp={ helpText }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"pattern-overrides-control__allow-overrides-button\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( hasOverrides ) {\n\t\t\t\t\t\t\t\tsetShowDisallowOverridesModal( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetShowAllowOverridesModal( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t! hasOverrides && hasUnsupportedImageAttributes\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ hasOverrides\n\t\t\t\t\t\t\t? __( 'Disable overrides' )\n\t\t\t\t\t\t\t: __( 'Enable overrides' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</BaseControl>\n\t\t\t</InspectorControls>\n\n\t\t\t{ showAllowOverridesModal && (\n\t\t\t\t<AllowOverridesModal\n\t\t\t\t\tinitialName={ attributes.metadata?.name }\n\t\t\t\t\tonClose={ () => setShowAllowOverridesModal( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\tupdateBindings( true, newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showDisallowOverridesModal && (\n\t\t\t\t<DisallowOverridesModal\n\t\t\t\t\tonClose={ () => setShowDisallowOverridesModal( false ) }\n\t\t\t\t\tonSave={ () => updateBindings( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PatternOverridesControls;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AAGiC,IAAAM,WAAA,GAAAN,OAAA;AAlBjC;AACA;AACA;;AASA;AACA;AACA;;AAOA,SAASO,wBAAwBA,CAAE;EAClCC,UAAU;EACVC,aAAa;EACbC,IAAI,EAAEC;AACP,CAA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ChC;IAAG,CACH,CACD,EACC7C,0BAA0B,iBAC3B,IAAAX,WAAA,CAAAqC,GAAA,EAACtC,oBAAA,CAAA0D,sBAAsB;MACtBH,OAAO,EAAGA,CAAA,KAAM1C,6BAA6B,CAAE,KAAM,CAAG;MACxD2C,MAAM,EAAGA,CAAA,KAAM/B,cAAc,CAAE,KAAM;IAAG,CACxC,CACD;EAAA,CACA,CAAC;AAEL;AAAC,IAAAkC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc3D,wBAAwB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/pattern-overrides-controls.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useId } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tuseBlockBindingsUtils,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_OVERRIDES_BINDING_SOURCE } from '../constants';\nimport {\n\tAllowOverridesModal,\n\tDisallowOverridesModal,\n} from './allow-overrides-modal';\n\nfunction PatternOverridesControls( {\n\tattributes,\n\tsetAttributes,\n\tname: blockName,\n} ) {\n\tconst controlId = useId();\n\tconst [ showAllowOverridesModal, setShowAllowOverridesModal ] =\n\t\tuseState( false );\n\tconst [ showDisallowOverridesModal, setShowDisallowOverridesModal ] =\n\t\tuseState( false );\n\n\tconst hasName = !! attributes.metadata?.name;\n\tconst defaultBindings = attributes.metadata?.bindings?.__default;\n\tconst hasOverrides =\n\t\thasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE;\n\tconst isConnectedToOtherSources =\n\t\tdefaultBindings?.source &&\n\t\tdefaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE;\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\n\tfunction updateBindings( isChecked, customName ) {\n\t\tif ( customName ) {\n\t\t\tsetAttributes( {\n\t\t\t\tmetadata: {\n\t\t\t\t\t...attributes.metadata,\n\t\t\t\t\tname: customName,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tupdateBlockBindings( {\n\t\t\t__default: isChecked\n\t\t\t\t? { source: PATTERN_OVERRIDES_BINDING_SOURCE }\n\t\t\t\t: undefined,\n\t\t} );\n\t}\n\n\t// Avoid overwriting other (e.g. meta) bindings.\n\tif ( isConnectedToOtherSources ) {\n\t\treturn null;\n\t}\n\n\tconst hasUnsupportedImageAttributes =\n\t\tblockName === 'core/image' &&\n\t\t( !! attributes.caption?.length || !! attributes.href?.length );\n\n\tconst helpText =\n\t\t! hasOverrides && hasUnsupportedImageAttributes\n\t\t\t? __(\n\t\t\t\t\t`Overrides currently don't support image captions or links. Remove the caption or link first before enabling overrides.`\n\t\t\t )\n\t\t\t: __(\n\t\t\t\t\t'Allow changes to this block throughout instances of this pattern.'\n\t\t\t );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<BaseControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tid={ controlId }\n\t\t\t\t\tlabel={ __( 'Overrides' ) }\n\t\t\t\t\thelp={ helpText }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tclassName=\"pattern-overrides-control__allow-overrides-button\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( hasOverrides ) {\n\t\t\t\t\t\t\t\tsetShowDisallowOverridesModal( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetShowAllowOverridesModal( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t! hasOverrides && hasUnsupportedImageAttributes\n\t\t\t\t\t\t}\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ hasOverrides\n\t\t\t\t\t\t\t? __( 'Disable overrides' )\n\t\t\t\t\t\t\t: __( 'Enable overrides' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</BaseControl>\n\t\t\t</InspectorControls>\n\n\t\t\t{ showAllowOverridesModal && (\n\t\t\t\t<AllowOverridesModal\n\t\t\t\t\tinitialName={ attributes.metadata?.name }\n\t\t\t\t\tonClose={ () => setShowAllowOverridesModal( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\tupdateBindings( true, newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showDisallowOverridesModal && (\n\t\t\t\t<DisallowOverridesModal\n\t\t\t\t\tonClose={ () => setShowDisallowOverridesModal( false ) }\n\t\t\t\t\tonSave={ () => updateBindings( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PatternOverridesControls;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4EE;AAzEF,qBAAgC;AAChC,0BAGO;AACP,wBAAoC;AACpC,kBAAmB;AAKnB,uBAAiD;AACjD,mCAGO;AAEP,SAAS,yBAA0B;AAAA,EAClC;AAAA,EACA;AAAA,EACA,MAAM;AACP,GAAI;AACH,QAAM,gBAAY,sBAAM;AACxB,QAAM,CAAE,yBAAyB,0BAA2B,QAC3D,yBAAU,KAAM;AACjB,QAAM,CAAE,4BAA4B,6BAA8B,QACjE,yBAAU,KAAM;AAEjB,QAAM,UAAU,CAAC,CAAE,WAAW,UAAU;AACxC,QAAM,kBAAkB,WAAW,UAAU,UAAU;AACvD,QAAM,eACL,WAAW,iBAAiB,WAAW;AACxC,QAAM,4BACL,iBAAiB,UACjB,gBAAgB,WAAW;AAC5B,QAAM,EAAE,oBAAoB,QAAI,2CAAsB;AAEtD,WAAS,eAAgB,WAAW,YAAa;AAChD,QAAK,YAAa;A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