@wordpress/reusable-blocks 5.50.0 → 5.51.1-next.v.202607070741.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.51.0-next.0 (2026-07-07)
6
+
7
+ ### Deprecations
8
+
9
+ - Deprecated the `wp.reusableBlocks.ReusableBlocksMenuItems` component and the `core/reusable-blocks` store actions (`__experimentalConvertBlockToStatic`, `__experimentalConvertBlocksToReusable`, `__experimentalDeleteReusableBlock`, `__experimentalSetEditingReusableBlock`) and selector (`__experimentalIsEditingReusableBlock`). The package is unused by core and will become a no-op compatibility package in a future release.
10
+
5
11
  ## 5.50.0 (2026-07-01)
6
12
 
7
13
  ## 5.49.0 (2026-06-24)
@@ -33,10 +33,14 @@ __export(reusable_blocks_menu_items_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(reusable_blocks_menu_items_exports);
35
35
  var import_block_editor = require("@wordpress/block-editor");
36
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
36
37
  var import_reusable_block_convert_button = __toESM(require("./reusable-block-convert-button.cjs"));
37
38
  var import_reusable_blocks_manage_button = __toESM(require("./reusable-blocks-manage-button.cjs"));
38
39
  var import_jsx_runtime = require("react/jsx-runtime");
39
40
  function ReusableBlocksMenuItems({ rootClientId }) {
41
+ (0, import_deprecated.default)("wp.reusableBlocks.ReusableBlocksMenuItems", {
42
+ since: "7.1"
43
+ });
40
44
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockSettingsMenuControls, { children: ({ onClose, selectedClientIds }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
41
45
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
46
  import_reusable_block_convert_button.default,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/reusable-blocks-menu-items/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ReusableBlockConvertButton from './reusable-block-convert-button';\nimport ReusableBlocksManageButton from './reusable-blocks-manage-button';\n\nexport default function ReusableBlocksMenuItems( { rootClientId } ) {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { onClose, selectedClientIds } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<ReusableBlockConvertButton\n\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t<ReusableBlocksManageButton\n\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAK1C,2CAAuC;AACvC,2CAAuC;AAMnC;AAJW,SAAR,wBAA0C,EAAE,aAAa,GAAI;AACnE,SACC,4CAAC,iDACE,WAAE,EAAE,SAAS,kBAAkB,MAChC,4EACC;AAAA;AAAA,MAAC,qCAAAA;AAAA,MAAA;AAAA,QACA,WAAY;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACE,kBAAkB,WAAW,KAC9B;AAAA,MAAC,qCAAAC;AAAA,MAAA;AAAA,QACA,UAAW,kBAAmB,CAAE;AAAA;AAAA,IACjC;AAAA,KAEF,GAEF;AAEF;",
6
- "names": ["ReusableBlockConvertButton", "ReusableBlocksManageButton"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport ReusableBlockConvertButton from './reusable-block-convert-button';\nimport ReusableBlocksManageButton from './reusable-blocks-manage-button';\n\nexport default function ReusableBlocksMenuItems( { rootClientId } ) {\n\tdeprecated( 'wp.reusableBlocks.ReusableBlocksMenuItems', {\n\t\tsince: '7.1',\n\t} );\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { onClose, selectedClientIds } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<ReusableBlockConvertButton\n\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t<ReusableBlocksManageButton\n\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,wBAAuB;AAKvB,2CAAuC;AACvC,2CAAuC;AASnC;AAPW,SAAR,wBAA0C,EAAE,aAAa,GAAI;AACnE,wBAAAA,SAAY,6CAA6C;AAAA,IACxD,OAAO;AAAA,EACR,CAAE;AACF,SACC,4CAAC,iDACE,WAAE,EAAE,SAAS,kBAAkB,MAChC,4EACC;AAAA;AAAA,MAAC,qCAAAC;AAAA,MAAA;AAAA,QACA,WAAY;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACE,kBAAkB,WAAW,KAC9B;AAAA,MAAC,qCAAAC;AAAA,MAAA;AAAA,QACA,UAAW,kBAAmB,CAAE;AAAA;AAAA,IACjC;AAAA,KAEF,GAEF;AAEF;",
6
+ "names": ["deprecated", "ReusableBlockConvertButton", "ReusableBlocksManageButton"]
7
7
  }
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
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
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // packages/reusable-blocks/src/store/actions.js
@@ -28,7 +38,14 @@ module.exports = __toCommonJS(actions_exports);
28
38
  var import_block_editor = require("@wordpress/block-editor");
29
39
  var import_blocks = require("@wordpress/blocks");
30
40
  var import_i18n = require("@wordpress/i18n");
41
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
31
42
  var __experimentalConvertBlockToStatic = (clientId) => ({ registry }) => {
43
+ (0, import_deprecated.default)(
44
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlockToStatic",
45
+ {
46
+ since: "7.1"
47
+ }
48
+ );
32
49
  const oldBlock = registry.select(import_block_editor.store).getBlock(clientId);
33
50
  const reusableBlock = registry.select("core").getEditedEntityRecord(
34
51
  "postType",
@@ -41,6 +58,12 @@ var __experimentalConvertBlockToStatic = (clientId) => ({ registry }) => {
41
58
  registry.dispatch(import_block_editor.store).replaceBlocks(oldBlock.clientId, newBlocks);
42
59
  };
43
60
  var __experimentalConvertBlocksToReusable = (clientIds, title, syncType) => async ({ registry, dispatch }) => {
61
+ (0, import_deprecated.default)(
62
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlocksToReusable",
63
+ {
64
+ since: "7.1"
65
+ }
66
+ );
44
67
  const meta = syncType === "unsynced" ? {
45
68
  wp_pattern_sync_status: syncType
46
69
  } : void 0;
@@ -66,6 +89,12 @@ var __experimentalConvertBlocksToReusable = (clientIds, title, syncType) => asyn
66
89
  );
67
90
  };
68
91
  var __experimentalDeleteReusableBlock = (id) => async ({ registry }) => {
92
+ (0, import_deprecated.default)(
93
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalDeleteReusableBlock",
94
+ {
95
+ since: "7.1"
96
+ }
97
+ );
69
98
  const reusableBlock = registry.select("core").getEditedEntityRecord("postType", "wp_block", id);
70
99
  if (!reusableBlock) {
71
100
  return;
@@ -83,6 +112,12 @@ var __experimentalDeleteReusableBlock = (id) => async ({ registry }) => {
83
112
  await registry.dispatch("core").deleteEntityRecord("postType", "wp_block", id);
84
113
  };
85
114
  function __experimentalSetEditingReusableBlock(clientId, isEditing) {
115
+ (0, import_deprecated.default)(
116
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalSetEditingReusableBlock",
117
+ {
118
+ since: "7.1"
119
+ }
120
+ );
86
121
  return {
87
122
  type: "SET_EDITING_REUSABLE_BLOCK",
88
123
  clientId,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/actions.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tcreateBlock,\n\tisReusableBlock,\n\tparse,\n\tserialize,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Returns a generator converting a reusable block into a static block.\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const __experimentalConvertBlockToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tconst oldBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\toldBlock.attributes.ref\n\t\t\t);\n\n\t\tconst newBlocks = parse(\n\t\t\ttypeof reusableBlock.content === 'function'\n\t\t\t\t? reusableBlock.content( reusableBlock )\n\t\t\t\t: reusableBlock.content\n\t\t);\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( oldBlock.clientId, newBlocks );\n\t};\n\n/**\n * Returns a generator converting one or more static blocks into a pattern.\n *\n * @param {string[]} clientIds The client IDs of the block to detach.\n * @param {string} title Pattern title.\n * @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.\n */\nexport const __experimentalConvertBlocksToReusable =\n\t( clientIds, title, syncType ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst meta =\n\t\t\tsyncType === 'unsynced'\n\t\t\t\t? {\n\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst reusableBlock = {\n\t\t\ttitle: title || __( 'Untitled pattern block' ),\n\t\t\tcontent: serialize(\n\t\t\t\tregistry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlocksByClientId( clientIds )\n\t\t\t),\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\tif ( syncType === 'unsynced' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlock = createBlock( 'core/block', {\n\t\t\tref: updatedRecord.id,\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( clientIds, newBlock );\n\t\tdispatch.__experimentalSetEditingReusableBlock(\n\t\t\tnewBlock.clientId,\n\t\t\ttrue\n\t\t);\n\t};\n\n/**\n * Returns a generator deleting a reusable block.\n *\n * @param {string} id The ID of the reusable block to delete.\n */\nexport const __experimentalDeleteReusableBlock =\n\t( id ) =>\n\tasync ( { registry } ) => {\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord( 'postType', 'wp_block', id );\n\n\t\t// Don't allow a reusable block with a temporary ID to be deleted.\n\t\tif ( ! reusableBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove any other blocks that reference this reusable block.\n\t\tconst allBlocks = registry.select( blockEditorStore ).getBlocks();\n\t\tconst associatedBlocks = allBlocks.filter(\n\t\t\t( block ) => isReusableBlock( block ) && block.attributes.ref === id\n\t\t);\n\t\tconst associatedBlockClientIds = associatedBlocks.map(\n\t\t\t( block ) => block.clientId\n\t\t);\n\n\t\t// Remove the parsed block.\n\t\tif ( associatedBlockClientIds.length ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.removeBlocks( associatedBlockClientIds );\n\t\t}\n\n\t\tawait registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.deleteEntityRecord( 'postType', 'wp_block', id );\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action.\n *\n * @param {string} clientId The clientID of the reusable block to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function __experimentalSetEditingReusableBlock( clientId, isEditing ) {\n\treturn {\n\t\ttype: 'SET_EDITING_REUSABLE_BLOCK',\n\t\tclientId,\n\t\tisEditing,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BA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QAAM,YAAY,SAAS,OAAQ,oBAAAA,KAAiB,EAAE,UAAU;AAChE,QAAM,mBAAmB,UAAU;AAAA,IAClC,CAAE,cAAW,+BAAiB,KAAM,KAAK,MAAM,WAAW,QAAQ;AAAA,EACnE;AACA,QAAM,2BAA2B,iBAAiB;AAAA,IACjD,CAAE,UAAW,MAAM;AAAA,EACpB;AAGA,MAAK,yBAAyB,QAAS;AACtC,aACE,SAAU,oBAAAA,KAAiB,EAC3B,aAAc,wBAAyB;AAAA,EAC1C;AAEA,QAAM,SACJ,SAAU,MAAO,EACjB,mBAAoB,YAAY,YAAY,EAAG;AAClD;AASM,SAAS,sCAAuC,UAAU,WAAY;AAC5E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
- "names": ["blockEditorStore"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tcreateBlock,\n\tisReusableBlock,\n\tparse,\n\tserialize,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns a generator converting a reusable block into a static block.\n *\n * @deprecated\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const __experimentalConvertBlockToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlockToStatic\",\n\t\t\t{\n\t\t\t\tsince: '7.1',\n\t\t\t}\n\t\t);\n\t\tconst oldBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\toldBlock.attributes.ref\n\t\t\t);\n\n\t\tconst newBlocks = parse(\n\t\t\ttypeof reusableBlock.content === 'function'\n\t\t\t\t? reusableBlock.content( reusableBlock )\n\t\t\t\t: reusableBlock.content\n\t\t);\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( oldBlock.clientId, newBlocks );\n\t};\n\n/**\n * Returns a generator converting one or more static blocks into a pattern.\n *\n * @deprecated\n *\n * @param {string[]} clientIds The client IDs of the block to detach.\n * @param {string} title Pattern title.\n * @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.\n */\nexport const __experimentalConvertBlocksToReusable =\n\t( clientIds, title, syncType ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tdeprecated(\n\t\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlocksToReusable\",\n\t\t\t{\n\t\t\t\tsince: '7.1',\n\t\t\t}\n\t\t);\n\t\tconst meta =\n\t\t\tsyncType === 'unsynced'\n\t\t\t\t? {\n\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst reusableBlock = {\n\t\t\ttitle: title || __( 'Untitled pattern block' ),\n\t\t\tcontent: serialize(\n\t\t\t\tregistry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlocksByClientId( clientIds )\n\t\t\t),\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\tif ( syncType === 'unsynced' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlock = createBlock( 'core/block', {\n\t\t\tref: updatedRecord.id,\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( clientIds, newBlock );\n\t\tdispatch.__experimentalSetEditingReusableBlock(\n\t\t\tnewBlock.clientId,\n\t\t\ttrue\n\t\t);\n\t};\n\n/**\n * Returns a generator deleting a reusable block.\n *\n * @deprecated\n *\n * @param {string} id The ID of the reusable block to delete.\n */\nexport const __experimentalDeleteReusableBlock =\n\t( id ) =>\n\tasync ( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalDeleteReusableBlock\",\n\t\t\t{\n\t\t\t\tsince: '7.1',\n\t\t\t}\n\t\t);\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord( 'postType', 'wp_block', id );\n\n\t\t// Don't allow a reusable block with a temporary ID to be deleted.\n\t\tif ( ! reusableBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove any other blocks that reference this reusable block.\n\t\tconst allBlocks = registry.select( blockEditorStore ).getBlocks();\n\t\tconst associatedBlocks = allBlocks.filter(\n\t\t\t( block ) => isReusableBlock( block ) && block.attributes.ref === id\n\t\t);\n\t\tconst associatedBlockClientIds = associatedBlocks.map(\n\t\t\t( block ) => block.clientId\n\t\t);\n\n\t\t// Remove the parsed block.\n\t\tif ( associatedBlockClientIds.length ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.removeBlocks( associatedBlockClientIds );\n\t\t}\n\n\t\tawait registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.deleteEntityRecord( 'postType', 'wp_block', id );\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action.\n *\n * @deprecated\n *\n * @param {string} clientId The clientID of the reusable block to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function __experimentalSetEditingReusableBlock( clientId, isEditing ) {\n\tdeprecated(\n\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalSetEditingReusableBlock\",\n\t\t{\n\t\t\tsince: '7.1',\n\t\t}\n\t);\n\treturn {\n\t\ttype: 'SET_EDITING_REUSABLE_BLOCK',\n\t\tclientId,\n\t\tisEditing,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;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AACrC,WAAS;AAAA,IACR,SAAS;AAAA,IACT;AAAA,EACD;AACD;AASM,IAAM,oCACZ,CAAE,OACF,OAAQ,EAAE,SAAS,MAAO;AACzB,wBAAAD;AAAA,IACC;AAAA,IACA;AAAA,MACC,OAAO;AAAA,IACR;AAAA,EACD;AACA,QAAM,gBAAgB,SACpB,OAAQ,MAAO,EACf,sBAAuB,YAAY,YAAY,EAAG;AAGpD,MAAK,CAAE,eAAgB;AACtB;AAAA,EACD;AAGA,QAAM,YAAY,SAAS,OAAQ,oBAAAC,KAAiB,EAAE,UAAU;AAChE,QAAM,mBAAmB,UAAU;AAAA,IAClC,CAAE,cAAW,+BAAiB,KAAM,KAAK,MAAM,WAAW,QAAQ;AAAA,EACnE;AACA,QAAM,2BAA2B,iBAAiB;AAAA,IACjD,CAAE,UAAW,MAAM;AAAA,EACpB;AAGA,MAAK,yBAAyB,QAAS;AACtC,aACE,SAAU,oBAAAA,KAAiB,EAC3B,aAAc,wBAAyB;AAAA,EAC1C;AAEA,QAAM,SACJ,SAAU,MAAO,EACjB,mBAAoB,YAAY,YAAY,EAAG;AAClD;AAWM,SAAS,sCAAuC,UAAU,WAAY;AAC5E,wBAAAD;AAAA,IACC;AAAA,IACA;AAAA,MACC,OAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
+ "names": ["deprecated", "blockEditorStore"]
7
7
  }
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
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
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // packages/reusable-blocks/src/store/selectors.js
@@ -22,7 +32,14 @@ __export(selectors_exports, {
22
32
  __experimentalIsEditingReusableBlock: () => __experimentalIsEditingReusableBlock
23
33
  });
24
34
  module.exports = __toCommonJS(selectors_exports);
35
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
25
36
  function __experimentalIsEditingReusableBlock(state, clientId) {
37
+ (0, import_deprecated.default)(
38
+ "wp.data.select( 'core/reusable-blocks' ).__experimentalIsEditingReusableBlock",
39
+ {
40
+ since: "7.1"
41
+ }
42
+ );
26
43
  return state.isEditingReusableBlock[clientId];
27
44
  }
28
45
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/selectors.js"],
4
- "sourcesContent": ["/**\n * Returns true if reusable block is in the editing state.\n *\n * @param {Object} state Global application state.\n * @param {number} clientId the clientID of the block.\n * @return {boolean} Whether the reusable block is in the editing state.\n */\nexport function __experimentalIsEditingReusableBlock( state, clientId ) {\n\treturn state.isEditingReusableBlock[ clientId ];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,qCAAsC,OAAO,UAAW;AACvE,SAAO,MAAM,uBAAwB,QAAS;AAC/C;",
6
- "names": []
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns true if reusable block is in the editing state.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n * @param {number} clientId the clientID of the block.\n * @return {boolean} Whether the reusable block is in the editing state.\n */\nexport function __experimentalIsEditingReusableBlock( state, clientId ) {\n\tdeprecated(\n\t\t\"wp.data.select( 'core/reusable-blocks' ).__experimentalIsEditingReusableBlock\",\n\t\t{\n\t\t\tsince: '7.1',\n\t\t}\n\t);\n\treturn state.isEditingReusableBlock[ clientId ];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AAWhB,SAAS,qCAAsC,OAAO,UAAW;AACvE,wBAAAA;AAAA,IACC;AAAA,IACA;AAAA,MACC,OAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO,MAAM,uBAAwB,QAAS;AAC/C;",
6
+ "names": ["deprecated"]
7
7
  }
@@ -1,9 +1,13 @@
1
1
  // packages/reusable-blocks/src/components/reusable-blocks-menu-items/index.js
2
2
  import { BlockSettingsMenuControls } from "@wordpress/block-editor";
3
+ import deprecated from "@wordpress/deprecated";
3
4
  import ReusableBlockConvertButton from "./reusable-block-convert-button.mjs";
4
5
  import ReusableBlocksManageButton from "./reusable-blocks-manage-button.mjs";
5
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
7
  function ReusableBlocksMenuItems({ rootClientId }) {
8
+ deprecated("wp.reusableBlocks.ReusableBlocksMenuItems", {
9
+ since: "7.1"
10
+ });
7
11
  return /* @__PURE__ */ jsx(BlockSettingsMenuControls, { children: ({ onClose, selectedClientIds }) => /* @__PURE__ */ jsxs(Fragment, { children: [
8
12
  /* @__PURE__ */ jsx(
9
13
  ReusableBlockConvertButton,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/reusable-blocks-menu-items/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ReusableBlockConvertButton from './reusable-block-convert-button';\nimport ReusableBlocksManageButton from './reusable-blocks-manage-button';\n\nexport default function ReusableBlocksMenuItems( { rootClientId } ) {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { onClose, selectedClientIds } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<ReusableBlockConvertButton\n\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t<ReusableBlocksManageButton\n\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,iCAAiC;AAK1C,OAAO,gCAAgC;AACvC,OAAO,gCAAgC;AAMnC,mBACC,KADD;AAJW,SAAR,wBAA0C,EAAE,aAAa,GAAI;AACnE,SACC,oBAAC,6BACE,WAAE,EAAE,SAAS,kBAAkB,MAChC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAY;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACE,kBAAkB,WAAW,KAC9B;AAAA,MAAC;AAAA;AAAA,QACA,UAAW,kBAAmB,CAAE;AAAA;AAAA,IACjC;AAAA,KAEF,GAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport ReusableBlockConvertButton from './reusable-block-convert-button';\nimport ReusableBlocksManageButton from './reusable-blocks-manage-button';\n\nexport default function ReusableBlocksMenuItems( { rootClientId } ) {\n\tdeprecated( 'wp.reusableBlocks.ReusableBlocksMenuItems', {\n\t\tsince: '7.1',\n\t} );\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { onClose, selectedClientIds } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<ReusableBlockConvertButton\n\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t<ReusableBlocksManageButton\n\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,iCAAiC;AAC1C,OAAO,gBAAgB;AAKvB,OAAO,gCAAgC;AACvC,OAAO,gCAAgC;AASnC,mBACC,KADD;AAPW,SAAR,wBAA0C,EAAE,aAAa,GAAI;AACnE,aAAY,6CAA6C;AAAA,IACxD,OAAO;AAAA,EACR,CAAE;AACF,SACC,oBAAC,6BACE,WAAE,EAAE,SAAS,kBAAkB,MAChC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAY;AAAA,QACZ;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IACE,kBAAkB,WAAW,KAC9B;AAAA,MAAC;AAAA;AAAA,QACA,UAAW,kBAAmB,CAAE;AAAA;AAAA,IACjC;AAAA,KAEF,GAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -7,7 +7,14 @@ import {
7
7
  serialize
8
8
  } from "@wordpress/blocks";
9
9
  import { __ } from "@wordpress/i18n";
10
+ import deprecated from "@wordpress/deprecated";
10
11
  var __experimentalConvertBlockToStatic = (clientId) => ({ registry }) => {
12
+ deprecated(
13
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlockToStatic",
14
+ {
15
+ since: "7.1"
16
+ }
17
+ );
11
18
  const oldBlock = registry.select(blockEditorStore).getBlock(clientId);
12
19
  const reusableBlock = registry.select("core").getEditedEntityRecord(
13
20
  "postType",
@@ -20,6 +27,12 @@ var __experimentalConvertBlockToStatic = (clientId) => ({ registry }) => {
20
27
  registry.dispatch(blockEditorStore).replaceBlocks(oldBlock.clientId, newBlocks);
21
28
  };
22
29
  var __experimentalConvertBlocksToReusable = (clientIds, title, syncType) => async ({ registry, dispatch }) => {
30
+ deprecated(
31
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlocksToReusable",
32
+ {
33
+ since: "7.1"
34
+ }
35
+ );
23
36
  const meta = syncType === "unsynced" ? {
24
37
  wp_pattern_sync_status: syncType
25
38
  } : void 0;
@@ -45,6 +58,12 @@ var __experimentalConvertBlocksToReusable = (clientIds, title, syncType) => asyn
45
58
  );
46
59
  };
47
60
  var __experimentalDeleteReusableBlock = (id) => async ({ registry }) => {
61
+ deprecated(
62
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalDeleteReusableBlock",
63
+ {
64
+ since: "7.1"
65
+ }
66
+ );
48
67
  const reusableBlock = registry.select("core").getEditedEntityRecord("postType", "wp_block", id);
49
68
  if (!reusableBlock) {
50
69
  return;
@@ -62,6 +81,12 @@ var __experimentalDeleteReusableBlock = (id) => async ({ registry }) => {
62
81
  await registry.dispatch("core").deleteEntityRecord("postType", "wp_block", id);
63
82
  };
64
83
  function __experimentalSetEditingReusableBlock(clientId, isEditing) {
84
+ deprecated(
85
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalSetEditingReusableBlock",
86
+ {
87
+ since: "7.1"
88
+ }
89
+ );
65
90
  return {
66
91
  type: "SET_EDITING_REUSABLE_BLOCK",
67
92
  clientId,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/actions.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tcreateBlock,\n\tisReusableBlock,\n\tparse,\n\tserialize,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Returns a generator converting a reusable block into a static block.\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const __experimentalConvertBlockToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tconst oldBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\toldBlock.attributes.ref\n\t\t\t);\n\n\t\tconst newBlocks = parse(\n\t\t\ttypeof reusableBlock.content === 'function'\n\t\t\t\t? reusableBlock.content( reusableBlock )\n\t\t\t\t: reusableBlock.content\n\t\t);\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( oldBlock.clientId, newBlocks );\n\t};\n\n/**\n * Returns a generator converting one or more static blocks into a pattern.\n *\n * @param {string[]} clientIds The client IDs of the block to detach.\n * @param {string} title Pattern title.\n * @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.\n */\nexport const __experimentalConvertBlocksToReusable =\n\t( clientIds, title, syncType ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst meta =\n\t\t\tsyncType === 'unsynced'\n\t\t\t\t? {\n\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst reusableBlock = {\n\t\t\ttitle: title || __( 'Untitled pattern block' ),\n\t\t\tcontent: serialize(\n\t\t\t\tregistry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlocksByClientId( clientIds )\n\t\t\t),\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\tif ( syncType === 'unsynced' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlock = createBlock( 'core/block', {\n\t\t\tref: updatedRecord.id,\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( clientIds, newBlock );\n\t\tdispatch.__experimentalSetEditingReusableBlock(\n\t\t\tnewBlock.clientId,\n\t\t\ttrue\n\t\t);\n\t};\n\n/**\n * Returns a generator deleting a reusable block.\n *\n * @param {string} id The ID of the reusable block to delete.\n */\nexport const __experimentalDeleteReusableBlock =\n\t( id ) =>\n\tasync ( { registry } ) => {\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord( 'postType', 'wp_block', id );\n\n\t\t// Don't allow a reusable block with a temporary ID to be deleted.\n\t\tif ( ! reusableBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove any other blocks that reference this reusable block.\n\t\tconst allBlocks = registry.select( blockEditorStore ).getBlocks();\n\t\tconst associatedBlocks = allBlocks.filter(\n\t\t\t( block ) => isReusableBlock( block ) && block.attributes.ref === id\n\t\t);\n\t\tconst associatedBlockClientIds = associatedBlocks.map(\n\t\t\t( block ) => block.clientId\n\t\t);\n\n\t\t// Remove the parsed block.\n\t\tif ( associatedBlockClientIds.length ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.removeBlocks( associatedBlockClientIds );\n\t\t}\n\n\t\tawait registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.deleteEntityRecord( 'postType', 'wp_block', id );\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action.\n *\n * @param {string} clientId The clientID of the reusable block to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function __experimentalSetEditingReusableBlock( clientId, isEditing ) {\n\treturn {\n\t\ttype: 'SET_EDITING_REUSABLE_BLOCK',\n\t\tclient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O,EACf,sBAAuB,YAAY,YAAY,EAAG;AAGpD,MAAK,CAAE,eAAgB;AACtB;AAAA,EACD;AAGA,QAAM,YAAY,SAAS,OAAQ,gBAAiB,EAAE,UAAU;AAChE,QAAM,mBAAmB,UAAU;AAAA,IAClC,CAAE,UAAW,gBAAiB,KAAM,KAAK,MAAM,WAAW,QAAQ;AAAA,EACnE;AACA,QAAM,2BAA2B,iBAAiB;AAAA,IACjD,CAAE,UAAW,MAAM;AAAA,EACpB;AAGA,MAAK,yBAAyB,QAAS;AACtC,aACE,SAAU,gBAAiB,EAC3B,aAAc,wBAAyB;AAAA,EAC1C;AAEA,QAAM,SACJ,SAAU,MAAO,EACjB,mBAAoB,YAAY,YAAY,EAAG;AAClD;AASM,SAAS,sCAAuC,UAAU,WAAY;AAC5E,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tcreateBlock,\n\tisReusableBlock,\n\tparse,\n\tserialize,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns a generator converting a reusable block into a static block.\n *\n * @deprecated\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const __experimentalConvertBlockToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlockToStatic\",\n\t\t\t{\n\t\t\t\tsince: '7.1',\n\t\t\t}\n\t\t);\n\t\tconst oldBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\toldBlock.attributes.ref\n\t\t\t);\n\n\t\tconst newBlocks = parse(\n\t\t\ttypeof reusableBlock.content === 'function'\n\t\t\t\t? reusableBlock.content( reusableBlock )\n\t\t\t\t: reusableBlock.content\n\t\t);\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( oldBlock.clientId, newBlocks );\n\t};\n\n/**\n * Returns a generator converting one or more static blocks into a pattern.\n *\n * @deprecated\n *\n * @param {string[]} clientIds The client IDs of the block to detach.\n * @param {string} title Pattern title.\n * @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.\n */\nexport const __experimentalConvertBlocksToReusable =\n\t( clientIds, title, syncType ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tdeprecated(\n\t\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlocksToReusable\",\n\t\t\t{\n\t\t\t\tsince: '7.1',\n\t\t\t}\n\t\t);\n\t\tconst meta =\n\t\t\tsyncType === 'unsynced'\n\t\t\t\t? {\n\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst reusableBlock = {\n\t\t\ttitle: title || __( 'Untitled pattern block' ),\n\t\t\tcontent: serialize(\n\t\t\t\tregistry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlocksByClientId( clientIds )\n\t\t\t),\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\tif ( syncType === 'unsynced' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newBlock = createBlock( 'core/block', {\n\t\t\tref: updatedRecord.id,\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( clientIds, newBlock );\n\t\tdispatch.__experimentalSetEditingReusableBlock(\n\t\t\tnewBlock.clientId,\n\t\t\ttrue\n\t\t);\n\t};\n\n/**\n * Returns a generator deleting a reusable block.\n *\n * @deprecated\n *\n * @param {string} id The ID of the reusable block to delete.\n */\nexport const __experimentalDeleteReusableBlock =\n\t( id ) =>\n\tasync ( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalDeleteReusableBlock\",\n\t\t\t{\n\t\t\t\tsince: '7.1',\n\t\t\t}\n\t\t);\n\t\tconst reusableBlock = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord( 'postType', 'wp_block', id );\n\n\t\t// Don't allow a reusable block with a temporary ID to be deleted.\n\t\tif ( ! reusableBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remove any other blocks that reference this reusable block.\n\t\tconst allBlocks = registry.select( blockEditorStore ).getBlocks();\n\t\tconst associatedBlocks = allBlocks.filter(\n\t\t\t( block ) => isReusableBlock( block ) && block.attributes.ref === id\n\t\t);\n\t\tconst associatedBlockClientIds = associatedBlocks.map(\n\t\t\t( block ) => block.clientId\n\t\t);\n\n\t\t// Remove the parsed block.\n\t\tif ( associatedBlockClientIds.length ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t.removeBlocks( associatedBlockClientIds );\n\t\t}\n\n\t\tawait registry\n\t\t\t.dispatch( 'core' )\n\t\t\t.deleteEntityRecord( 'postType', 'wp_block', id );\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action.\n *\n * @deprecated\n *\n * @param {string} clientId The clientID of the reusable block to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function __experimentalSetEditingReusableBlock( clientId, isEditing ) {\n\tdeprecated(\n\t\t\"wp.data.dispatch( 'core/reusable-blocks' ).__experimentalSetEditingReusableBlock\",\n\t\t{\n\t\t\tsince: '7.1',\n\t\t}\n\t);\n\treturn {\n\t\ttype: 'SET_EDITING_REUSABLE_BLOCK',\n\t\tclientId,\n\t\tisEditing,\n\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A,IACR,SAAS;AAAA,IACT;AAAA,EACD;AACD;AASM,IAAM,oCACZ,CAAE,OACF,OAAQ,EAAE,SAAS,MAAO;AACzB;AAAA,IACC;AAAA,IACA;AAAA,MACC,OAAO;AAAA,IACR;AAAA,EACD;AACA,QAAM,gBAAgB,SACpB,OAAQ,MAAO,EACf,sBAAuB,YAAY,YAAY,EAAG;AAGpD,MAAK,CAAE,eAAgB;AACtB;AAAA,EACD;AAGA,QAAM,YAAY,SAAS,OAAQ,gBAAiB,EAAE,UAAU;AAChE,QAAM,mBAAmB,UAAU;AAAA,IAClC,CAAE,UAAW,gBAAiB,KAAM,KAAK,MAAM,WAAW,QAAQ;AAAA,EACnE;AACA,QAAM,2BAA2B,iBAAiB;AAAA,IACjD,CAAE,UAAW,MAAM;AAAA,EACpB;AAGA,MAAK,yBAAyB,QAAS;AACtC,aACE,SAAU,gBAAiB,EAC3B,aAAc,wBAAyB;AAAA,EAC1C;AAEA,QAAM,SACJ,SAAU,MAAO,EACjB,mBAAoB,YAAY,YAAY,EAAG;AAClD;AAWM,SAAS,sCAAuC,UAAU,WAAY;AAC5E;AAAA,IACC;AAAA,IACA;AAAA,MACC,OAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,12 @@
1
1
  // packages/reusable-blocks/src/store/selectors.js
2
+ import deprecated from "@wordpress/deprecated";
2
3
  function __experimentalIsEditingReusableBlock(state, clientId) {
4
+ deprecated(
5
+ "wp.data.select( 'core/reusable-blocks' ).__experimentalIsEditingReusableBlock",
6
+ {
7
+ since: "7.1"
8
+ }
9
+ );
3
10
  return state.isEditingReusableBlock[clientId];
4
11
  }
5
12
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/selectors.js"],
4
- "sourcesContent": ["/**\n * Returns true if reusable block is in the editing state.\n *\n * @param {Object} state Global application state.\n * @param {number} clientId the clientID of the block.\n * @return {boolean} Whether the reusable block is in the editing state.\n */\nexport function __experimentalIsEditingReusableBlock( state, clientId ) {\n\treturn state.isEditingReusableBlock[ clientId ];\n}\n"],
5
- "mappings": ";AAOO,SAAS,qCAAsC,OAAO,UAAW;AACvE,SAAO,MAAM,uBAAwB,QAAS;AAC/C;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Returns true if reusable block is in the editing state.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n * @param {number} clientId the clientID of the block.\n * @return {boolean} Whether the reusable block is in the editing state.\n */\nexport function __experimentalIsEditingReusableBlock( state, clientId ) {\n\tdeprecated(\n\t\t\"wp.data.select( 'core/reusable-blocks' ).__experimentalIsEditingReusableBlock\",\n\t\t{\n\t\t\tsince: '7.1',\n\t\t}\n\t);\n\treturn state.isEditingReusableBlock[ clientId ];\n}\n"],
5
+ "mappings": ";AAGA,OAAO,gBAAgB;AAWhB,SAAS,qCAAsC,OAAO,UAAW;AACvE;AAAA,IACC;AAAA,IACA;AAAA,MACC,OAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO,MAAM,uBAAwB,QAAS;AAC/C;",
6
6
  "names": []
7
7
  }
@@ -67,6 +67,12 @@
67
67
  /**
68
68
  * Focus styles.
69
69
  */
70
+ /**
71
+ * Standard focus rings for the WordPress Design System.
72
+ *
73
+ * Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
74
+ * e.g. `&:focus { @include outset-ring__focus(); }`.
75
+ */
70
76
  /**
71
77
  * Applies editor left position to the selector passed as argument
72
78
  */
@@ -67,6 +67,12 @@
67
67
  /**
68
68
  * Focus styles.
69
69
  */
70
+ /**
71
+ * Standard focus rings for the WordPress Design System.
72
+ *
73
+ * Apply `outset-ring__focus` inside the relevant pseudo-class at the call site,
74
+ * e.g. `&:focus { @include outset-ring__focus(); }`.
75
+ */
70
76
  /**
71
77
  * Applies editor left position to the selector passed as argument
72
78
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/reusable-blocks",
3
- "version": "5.50.0",
3
+ "version": "5.51.1-next.v.202607070741.0+a51d59513",
4
4
  "description": "Reusable blocks utilities.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -49,18 +49,23 @@
49
49
  "build-module/store/index.mjs"
50
50
  ],
51
51
  "dependencies": {
52
- "@wordpress/base-styles": "^10.2.0",
53
- "@wordpress/block-editor": "^15.23.0",
54
- "@wordpress/blocks": "^15.23.0",
55
- "@wordpress/components": "^36.1.0",
56
- "@wordpress/core-data": "^7.50.0",
57
- "@wordpress/data": "^10.50.0",
58
- "@wordpress/element": "^8.2.0",
59
- "@wordpress/i18n": "^6.23.0",
60
- "@wordpress/icons": "^15.1.0",
61
- "@wordpress/notices": "^5.50.0",
62
- "@wordpress/private-apis": "^1.50.0",
63
- "@wordpress/url": "^4.50.0"
52
+ "@wordpress/base-styles": "^10.3.1-next.v.202607070741.0+a51d59513",
53
+ "@wordpress/block-editor": "^16.0.1-next.v.202607070741.0+a51d59513",
54
+ "@wordpress/blocks": "^15.23.1-next.v.202607070741.0+a51d59513",
55
+ "@wordpress/components": "^37.0.1-next.v.202607070741.0+a51d59513",
56
+ "@wordpress/core-data": "^7.50.1-next.v.202607070741.0+a51d59513",
57
+ "@wordpress/data": "^10.50.1-next.v.202607070741.0+a51d59513",
58
+ "@wordpress/deprecated": "^4.50.1-next.v.202607070741.0+a51d59513",
59
+ "@wordpress/element": "^8.2.1-next.v.202607070741.0+a51d59513",
60
+ "@wordpress/i18n": "^6.23.1-next.v.202607070741.0+a51d59513",
61
+ "@wordpress/icons": "^15.1.1-next.v.202607070741.0+a51d59513",
62
+ "@wordpress/notices": "^5.50.1-next.v.202607070741.0+a51d59513",
63
+ "@wordpress/private-apis": "^1.50.1-next.v.202607070741.0+a51d59513",
64
+ "@wordpress/url": "^4.50.1-next.v.202607070741.0+a51d59513"
65
+ },
66
+ "devDependencies": {
67
+ "@wordpress/api-fetch": "^7.50.1-next.v.202607070741.0+a51d59513",
68
+ "@wordpress/preferences": "^4.50.1-next.v.202607070741.0+a51d59513"
64
69
  },
65
70
  "peerDependencies": {
66
71
  "react": "^18.0.0",
@@ -69,5 +74,5 @@
69
74
  "publishConfig": {
70
75
  "access": "public"
71
76
  },
72
- "gitHead": "fee6e24e8e63d36f6bbcf487c193461e9bd79753"
77
+ "gitHead": "f637726e370c8b23695ed9af82adbe171ad235d8"
73
78
  }
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { BlockSettingsMenuControls } from '@wordpress/block-editor';
5
+ import deprecated from '@wordpress/deprecated';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -10,6 +11,9 @@ import ReusableBlockConvertButton from './reusable-block-convert-button';
10
11
  import ReusableBlocksManageButton from './reusable-blocks-manage-button';
11
12
 
12
13
  export default function ReusableBlocksMenuItems( { rootClientId } ) {
14
+ deprecated( 'wp.reusableBlocks.ReusableBlocksMenuItems', {
15
+ since: '7.1',
16
+ } );
13
17
  return (
14
18
  <BlockSettingsMenuControls>
15
19
  { ( { onClose, selectedClientIds } ) => (
@@ -9,15 +9,24 @@ import {
9
9
  serialize,
10
10
  } from '@wordpress/blocks';
11
11
  import { __ } from '@wordpress/i18n';
12
+ import deprecated from '@wordpress/deprecated';
12
13
 
13
14
  /**
14
15
  * Returns a generator converting a reusable block into a static block.
15
16
  *
17
+ * @deprecated
18
+ *
16
19
  * @param {string} clientId The client ID of the block to attach.
17
20
  */
18
21
  export const __experimentalConvertBlockToStatic =
19
22
  ( clientId ) =>
20
23
  ( { registry } ) => {
24
+ deprecated(
25
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlockToStatic",
26
+ {
27
+ since: '7.1',
28
+ }
29
+ );
21
30
  const oldBlock = registry
22
31
  .select( blockEditorStore )
23
32
  .getBlock( clientId );
@@ -42,6 +51,8 @@ export const __experimentalConvertBlockToStatic =
42
51
  /**
43
52
  * Returns a generator converting one or more static blocks into a pattern.
44
53
  *
54
+ * @deprecated
55
+ *
45
56
  * @param {string[]} clientIds The client IDs of the block to detach.
46
57
  * @param {string} title Pattern title.
47
58
  * @param {undefined|'unsynced'} syncType They way block is synced, current undefined (synced) and 'unsynced'.
@@ -49,6 +60,12 @@ export const __experimentalConvertBlockToStatic =
49
60
  export const __experimentalConvertBlocksToReusable =
50
61
  ( clientIds, title, syncType ) =>
51
62
  async ( { registry, dispatch } ) => {
63
+ deprecated(
64
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalConvertBlocksToReusable",
65
+ {
66
+ since: '7.1',
67
+ }
68
+ );
52
69
  const meta =
53
70
  syncType === 'unsynced'
54
71
  ? {
@@ -90,11 +107,19 @@ export const __experimentalConvertBlocksToReusable =
90
107
  /**
91
108
  * Returns a generator deleting a reusable block.
92
109
  *
110
+ * @deprecated
111
+ *
93
112
  * @param {string} id The ID of the reusable block to delete.
94
113
  */
95
114
  export const __experimentalDeleteReusableBlock =
96
115
  ( id ) =>
97
116
  async ( { registry } ) => {
117
+ deprecated(
118
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalDeleteReusableBlock",
119
+ {
120
+ since: '7.1',
121
+ }
122
+ );
98
123
  const reusableBlock = registry
99
124
  .select( 'core' )
100
125
  .getEditedEntityRecord( 'postType', 'wp_block', id );
@@ -128,11 +153,19 @@ export const __experimentalDeleteReusableBlock =
128
153
  /**
129
154
  * Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action.
130
155
  *
156
+ * @deprecated
157
+ *
131
158
  * @param {string} clientId The clientID of the reusable block to target.
132
159
  * @param {boolean} isEditing Whether the block should be in editing state.
133
160
  * @return {Object} Action descriptor.
134
161
  */
135
162
  export function __experimentalSetEditingReusableBlock( clientId, isEditing ) {
163
+ deprecated(
164
+ "wp.data.dispatch( 'core/reusable-blocks' ).__experimentalSetEditingReusableBlock",
165
+ {
166
+ since: '7.1',
167
+ }
168
+ );
136
169
  return {
137
170
  type: 'SET_EDITING_REUSABLE_BLOCK',
138
171
  clientId,
@@ -1,10 +1,23 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import deprecated from '@wordpress/deprecated';
5
+
1
6
  /**
2
7
  * Returns true if reusable block is in the editing state.
3
8
  *
9
+ * @deprecated
10
+ *
4
11
  * @param {Object} state Global application state.
5
12
  * @param {number} clientId the clientID of the block.
6
13
  * @return {boolean} Whether the reusable block is in the editing state.
7
14
  */
8
15
  export function __experimentalIsEditingReusableBlock( state, clientId ) {
16
+ deprecated(
17
+ "wp.data.select( 'core/reusable-blocks' ).__experimentalIsEditingReusableBlock",
18
+ {
19
+ since: '7.1',
20
+ }
21
+ );
9
22
  return state.isEditingReusableBlock[ clientId ];
10
23
  }
@@ -13,6 +13,7 @@ import {
13
13
  import { store as coreStore } from '@wordpress/core-data';
14
14
  import apiFetch from '@wordpress/api-fetch';
15
15
  import { store as preferencesStore } from '@wordpress/preferences';
16
+ import { logged } from '@wordpress/deprecated';
16
17
 
17
18
  /**
18
19
  * Internal dependencies
@@ -75,6 +76,13 @@ describe( 'Actions', () => {
75
76
  unregisterBlockType( 'core/block' );
76
77
  } );
77
78
 
79
+ afterEach( () => {
80
+ // Reset the deprecation cache so each test observes its own warning.
81
+ for ( const key in logged ) {
82
+ delete logged[ key ];
83
+ }
84
+ } );
85
+
78
86
  describe( '__experimentalSetEditingReusableBlock', () => {
79
87
  it( 'should flip the editing state', () => {
80
88
  const registry = createRegistryWithStores();
@@ -96,6 +104,8 @@ describe( 'Actions', () => {
96
104
  .select( reusableBlocksStore )
97
105
  .__experimentalIsEditingReusableBlock( 3 )
98
106
  ).toBe( false );
107
+
108
+ expect( console ).toHaveWarned();
99
109
  } );
100
110
  } );
101
111
 
@@ -146,6 +156,8 @@ describe( 'Actions', () => {
146
156
  .select( reusableBlocksStore )
147
157
  .__experimentalIsEditingReusableBlock( newClientId )
148
158
  ).toBe( true );
159
+
160
+ expect( console ).toHaveWarned();
149
161
  } );
150
162
  } );
151
163
 
@@ -196,6 +208,8 @@ describe( 'Actions', () => {
196
208
  delete updatedBlocks[ 0 ].innerBlocks[ 0 ].clientId;
197
209
  delete updatedBlocks[ 0 ].innerBlocks[ 1 ].clientId;
198
210
  expect( updatedBlocks ).toMatchSnapshot();
211
+
212
+ expect( console ).toHaveWarned();
199
213
  } );
200
214
  } );
201
215
 
@@ -268,6 +282,8 @@ describe( 'Actions', () => {
268
282
  // Check if block instances were removed from the editor.
269
283
  const blocksAfter = registry.select( blockEditorStore ).getBlocks();
270
284
  expect( blocksAfter ).toHaveLength( 3 );
285
+
286
+ expect( console ).toHaveWarned();
271
287
  } );
272
288
  } );
273
289
  } );
@@ -1,9 +1,21 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { logged } from '@wordpress/deprecated';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
4
9
  import { __experimentalIsEditingReusableBlock } from '../selectors';
5
10
 
6
11
  describe( '__experimentalIsEditingReusableBlock', () => {
12
+ afterEach( () => {
13
+ // Reset the deprecation cache so each test observes its own warning.
14
+ for ( const key in logged ) {
15
+ delete logged[ key ];
16
+ }
17
+ } );
18
+
7
19
  it( 'gets the value for clientId', () => {
8
20
  expect(
9
21
  __experimentalIsEditingReusableBlock(
@@ -23,5 +35,7 @@ describe( '__experimentalIsEditingReusableBlock', () => {
23
35
  3
24
36
  )
25
37
  ).toBe( undefined );
38
+
39
+ expect( console ).toHaveWarned();
26
40
  } );
27
41
  } );