@wordpress/patterns 2.32.0 → 2.32.1-next.ff1cebbba.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/index.js +35 -29
- package/build/api/index.js.map +7 -1
- package/build/components/allow-overrides-modal.js +149 -112
- package/build/components/allow-overrides-modal.js.map +7 -1
- package/build/components/category-selector.js +59 -38
- package/build/components/category-selector.js.map +7 -1
- package/build/components/create-pattern-modal.js +162 -111
- package/build/components/create-pattern-modal.js.map +7 -1
- package/build/components/duplicate-pattern-modal.js +85 -66
- package/build/components/duplicate-pattern-modal.js.map +7 -1
- package/build/components/index.js +50 -33
- package/build/components/index.js.map +7 -1
- package/build/components/overrides-panel.js +44 -39
- package/build/components/overrides-panel.js.map +7 -1
- package/build/components/pattern-convert-button.js +144 -133
- package/build/components/pattern-convert-button.js.map +7 -1
- package/build/components/pattern-overrides-block-controls.js +109 -109
- package/build/components/pattern-overrides-block-controls.js.map +7 -1
- package/build/components/pattern-overrides-controls.js +86 -69
- package/build/components/pattern-overrides-controls.js.map +7 -1
- package/build/components/patterns-manage-button.js +96 -97
- package/build/components/patterns-manage-button.js.map +7 -1
- package/build/components/rename-pattern-category-modal.js +122 -111
- package/build/components/rename-pattern-category-modal.js.map +7 -1
- package/build/components/rename-pattern-modal.js +95 -73
- package/build/components/rename-pattern-modal.js.map +7 -1
- package/build/components/reset-overrides-control.js +61 -57
- package/build/components/reset-overrides-control.js.map +7 -1
- package/build/constants.js +57 -23
- package/build/constants.js.map +7 -1
- package/build/index.js +27 -24
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/private-apis.js +71 -48
- package/build/private-apis.js.map +7 -1
- package/build/private-hooks.js +57 -69
- package/build/private-hooks.js.map +7 -1
- package/build/store/actions.js +72 -85
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -10
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +50 -44
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +30 -14
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +26 -13
- package/build/store/selectors.js.map +7 -1
- package/build-module/api/index.js +14 -25
- package/build-module/api/index.js.map +7 -1
- package/build-module/components/allow-overrides-modal.js +131 -103
- package/build-module/components/allow-overrides-modal.js.map +7 -1
- package/build-module/components/category-selector.js +35 -29
- package/build-module/components/category-selector.js.map +7 -1
- package/build-module/components/create-pattern-modal.js +137 -99
- package/build-module/components/create-pattern-modal.js.map +7 -1
- package/build-module/components/duplicate-pattern-modal.js +53 -58
- package/build-module/components/duplicate-pattern-modal.js.map +7 -1
- package/build-module/components/index.js +22 -26
- package/build-module/components/index.js.map +7 -1
- package/build-module/components/overrides-panel.js +30 -34
- package/build-module/components/overrides-panel.js.map +7 -1
- package/build-module/components/pattern-convert-button.js +120 -125
- package/build-module/components/pattern-convert-button.js.map +7 -1
- package/build-module/components/pattern-overrides-block-controls.js +100 -103
- package/build-module/components/pattern-overrides-block-controls.js.map +7 -1
- package/build-module/components/pattern-overrides-controls.js +69 -58
- package/build-module/components/pattern-overrides-controls.js.map +7 -1
- package/build-module/components/patterns-manage-button.js +78 -91
- package/build-module/components/patterns-manage-button.js.map +7 -1
- package/build-module/components/rename-pattern-category-modal.js +106 -101
- package/build-module/components/rename-pattern-category-modal.js.map +7 -1
- package/build-module/components/rename-pattern-modal.js +80 -64
- package/build-module/components/rename-pattern-modal.js.map +7 -1
- package/build-module/components/reset-overrides-control.js +46 -51
- package/build-module/components/reset-overrides-control.js.map +7 -1
- package/build-module/constants.js +29 -18
- package/build-module/constants.js.map +7 -1
- package/build-module/index.js +6 -6
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/private-apis.js +31 -18
- package/build-module/private-apis.js.map +7 -1
- package/build-module/private-hooks.js +35 -64
- package/build-module/private-hooks.js.map +7 -1
- package/build-module/store/actions.js +44 -74
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -5
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +13 -32
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +9 -8
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +5 -9
- package/build-module/store/selectors.js.map +7 -1
- package/build-style/style-rtl.css +3 -138
- package/build-style/style.css +3 -138
- package/package.json +24 -17
- package/src/components/style.scss +5 -0
- package/src/style.scss +2 -1
- package/build/index.native.js +0 -18
- package/build/index.native.js.map +0 -1
- package/build-module/index.native.js +0 -11
- package/build-module/index.native.js.map +0 -1
package/build/lock-unlock.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lock-unlock.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/patterns'\n\t);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAC1D,MAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/private-apis.js
CHANGED
|
@@ -1,50 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var private_apis_exports = {};
|
|
29
|
+
__export(private_apis_exports, {
|
|
30
|
+
privateApis: () => privateApis
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
PATTERN_TYPES: _constants.PATTERN_TYPES,
|
|
44
|
-
PATTERN_DEFAULT_CATEGORY: _constants.PATTERN_DEFAULT_CATEGORY,
|
|
45
|
-
PATTERN_USER_CATEGORY: _constants.PATTERN_USER_CATEGORY,
|
|
46
|
-
EXCLUDED_PATTERN_SOURCES: _constants.EXCLUDED_PATTERN_SOURCES,
|
|
47
|
-
PATTERN_SYNC_TYPES: _constants.PATTERN_SYNC_TYPES,
|
|
48
|
-
PARTIAL_SYNCING_SUPPORTED_BLOCKS: _constants.PARTIAL_SYNCING_SUPPORTED_BLOCKS
|
|
32
|
+
module.exports = __toCommonJS(private_apis_exports);
|
|
33
|
+
var import_lock_unlock = require("./lock-unlock");
|
|
34
|
+
var import_overrides_panel = __toESM(require("./components/overrides-panel"));
|
|
35
|
+
var import_create_pattern_modal = __toESM(require("./components/create-pattern-modal"));
|
|
36
|
+
var import_duplicate_pattern_modal = __toESM(require("./components/duplicate-pattern-modal"));
|
|
37
|
+
var import_api = require("./api");
|
|
38
|
+
var import_rename_pattern_modal = __toESM(require("./components/rename-pattern-modal"));
|
|
39
|
+
var import_components = __toESM(require("./components"));
|
|
40
|
+
var import_rename_pattern_category_modal = __toESM(require("./components/rename-pattern-category-modal"));
|
|
41
|
+
var import_pattern_overrides_controls = __toESM(require("./components/pattern-overrides-controls"));
|
|
42
|
+
var import_reset_overrides_control = __toESM(require("./components/reset-overrides-control"));
|
|
43
|
+
var import_pattern_overrides_block_controls = __toESM(require("./components/pattern-overrides-block-controls"));
|
|
44
|
+
var import_private_hooks = require("./private-hooks");
|
|
45
|
+
var import_constants = require("./constants");
|
|
46
|
+
const privateApis = {};
|
|
47
|
+
(0, import_lock_unlock.lock)(privateApis, {
|
|
48
|
+
OverridesPanel: import_overrides_panel.default,
|
|
49
|
+
CreatePatternModal: import_create_pattern_modal.default,
|
|
50
|
+
CreatePatternModalContents: import_create_pattern_modal.CreatePatternModalContents,
|
|
51
|
+
DuplicatePatternModal: import_duplicate_pattern_modal.default,
|
|
52
|
+
isOverridableBlock: import_api.isOverridableBlock,
|
|
53
|
+
hasOverridableBlocks: import_api.hasOverridableBlocks,
|
|
54
|
+
useDuplicatePatternProps: import_duplicate_pattern_modal.useDuplicatePatternProps,
|
|
55
|
+
RenamePatternModal: import_rename_pattern_modal.default,
|
|
56
|
+
PatternsMenuItems: import_components.default,
|
|
57
|
+
RenamePatternCategoryModal: import_rename_pattern_category_modal.default,
|
|
58
|
+
PatternOverridesControls: import_pattern_overrides_controls.default,
|
|
59
|
+
ResetOverridesControl: import_reset_overrides_control.default,
|
|
60
|
+
PatternOverridesBlockControls: import_pattern_overrides_block_controls.default,
|
|
61
|
+
useAddPatternCategory: import_private_hooks.useAddPatternCategory,
|
|
62
|
+
PATTERN_TYPES: import_constants.PATTERN_TYPES,
|
|
63
|
+
PATTERN_DEFAULT_CATEGORY: import_constants.PATTERN_DEFAULT_CATEGORY,
|
|
64
|
+
PATTERN_USER_CATEGORY: import_constants.PATTERN_USER_CATEGORY,
|
|
65
|
+
EXCLUDED_PATTERN_SOURCES: import_constants.EXCLUDED_PATTERN_SOURCES,
|
|
66
|
+
PATTERN_SYNC_TYPES: import_constants.PATTERN_SYNC_TYPES,
|
|
67
|
+
PARTIAL_SYNCING_SUPPORTED_BLOCKS: import_constants.PARTIAL_SYNCING_SUPPORTED_BLOCKS
|
|
49
68
|
});
|
|
50
|
-
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
privateApis
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/private-apis.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { lock } from './lock-unlock';\nimport OverridesPanel from './components/overrides-panel';\nimport {\n\tdefault as CreatePatternModal,\n\tCreatePatternModalContents,\n} from './components/create-pattern-modal';\nimport {\n\tdefault as DuplicatePatternModal,\n\tuseDuplicatePatternProps,\n} from './components/duplicate-pattern-modal';\nimport { isOverridableBlock, hasOverridableBlocks } from './api';\nimport RenamePatternModal from './components/rename-pattern-modal';\nimport PatternsMenuItems from './components';\nimport RenamePatternCategoryModal from './components/rename-pattern-category-modal';\nimport PatternOverridesControls from './components/pattern-overrides-controls';\nimport ResetOverridesControl from './components/reset-overrides-control';\nimport PatternOverridesBlockControls from './components/pattern-overrides-block-controls';\nimport { useAddPatternCategory } from './private-hooks';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n} from './constants';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tOverridesPanel,\n\tCreatePatternModal,\n\tCreatePatternModalContents,\n\tDuplicatePatternModal,\n\tisOverridableBlock,\n\thasOverridableBlocks,\n\tuseDuplicatePatternProps,\n\tRenamePatternModal,\n\tPatternsMenuItems,\n\tRenamePatternCategoryModal,\n\tPatternOverridesControls,\n\tResetOverridesControl,\n\tPatternOverridesBlockControls,\n\tuseAddPatternCategory,\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n} );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAqB;AACrB,6BAA2B;AAC3B,kCAGO;AACP,qCAGO;AACP,iBAAyD;AACzD,kCAA+B;AAC/B,wBAA8B;AAC9B,2CAAuC;AACvC,wCAAqC;AACrC,qCAAkC;AAClC,8CAA0C;AAC1C,2BAAsC;AACtC,uBAOO;AAEA,MAAM,cAAc,CAAC;AAAA,IAC5B,yBAAM,aAAa;AAAA,EAClB,uCAAAA;AAAA,EACA,gDAAAC;AAAA,EACA;AAAA,EACA,sDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gDAAAC;AAAA,EACA,qCAAAC;AAAA,EACA,iEAAAC;AAAA,EACA,4DAAAC;AAAA,EACA,sDAAAC;AAAA,EACA,uEAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
|
|
6
|
+
"names": ["OverridesPanel", "CreatePatternModal", "DuplicatePatternModal", "RenamePatternModal", "PatternsMenuItems", "RenamePatternCategoryModal", "PatternOverridesControls", "ResetOverridesControl", "PatternOverridesBlockControls"]
|
|
7
|
+
}
|
package/build/private-hooks.js
CHANGED
|
@@ -1,62 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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 private_hooks_exports = {};
|
|
19
|
+
__export(private_hooks_exports, {
|
|
20
|
+
useAddPatternCategory: () => useAddPatternCategory
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Helper hook that creates a Map with the core and user patterns categories
|
|
21
|
-
* and removes any duplicates. It's used when we need to create new user
|
|
22
|
-
* categories when creating or importing patterns.
|
|
23
|
-
* This hook also provides a function to find or create a pattern category.
|
|
24
|
-
*
|
|
25
|
-
* @return {Object} The merged categories map and the callback function to find or create a category.
|
|
26
|
-
*/
|
|
22
|
+
module.exports = __toCommonJS(private_hooks_exports);
|
|
23
|
+
var import_data = require("@wordpress/data");
|
|
24
|
+
var import_core_data = require("@wordpress/core-data");
|
|
25
|
+
var import_element = require("@wordpress/element");
|
|
26
|
+
var import_category_selector = require("./components/category-selector");
|
|
27
27
|
function useAddPatternCategory() {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
userPatternCategories: getUserPatternCategories()
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
const categoryMap = (0, _element.useMemo)(() => {
|
|
46
|
-
// Merge the user and core pattern categories and remove any duplicates.
|
|
47
|
-
const uniqueCategories = new Map();
|
|
48
|
-
userPatternCategories.forEach(category => {
|
|
28
|
+
const { saveEntityRecord, invalidateResolution } = (0, import_data.useDispatch)(import_core_data.store);
|
|
29
|
+
const { corePatternCategories, userPatternCategories } = (0, import_data.useSelect)(
|
|
30
|
+
(select) => {
|
|
31
|
+
const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data.store);
|
|
32
|
+
return {
|
|
33
|
+
corePatternCategories: getBlockPatternCategories(),
|
|
34
|
+
userPatternCategories: getUserPatternCategories()
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
39
|
+
const categoryMap = (0, import_element.useMemo)(() => {
|
|
40
|
+
const uniqueCategories = /* @__PURE__ */ new Map();
|
|
41
|
+
userPatternCategories.forEach((category) => {
|
|
49
42
|
uniqueCategories.set(category.label.toLowerCase(), {
|
|
50
43
|
label: category.label,
|
|
51
44
|
name: category.name,
|
|
52
45
|
id: category.id
|
|
53
46
|
});
|
|
54
47
|
});
|
|
55
|
-
corePatternCategories.forEach(category => {
|
|
56
|
-
if (!uniqueCategories.has(category.label.toLowerCase()) &&
|
|
57
|
-
// There are two core categories with `Post` label so explicitly remove the one with
|
|
48
|
+
corePatternCategories.forEach((category) => {
|
|
49
|
+
if (!uniqueCategories.has(category.label.toLowerCase()) && // There are two core categories with `Post` label so explicitly remove the one with
|
|
58
50
|
// the `query` slug to avoid any confusion.
|
|
59
|
-
category.name !==
|
|
51
|
+
category.name !== "query") {
|
|
60
52
|
uniqueCategories.set(category.label.toLowerCase(), {
|
|
61
53
|
label: category.label,
|
|
62
54
|
name: category.name
|
|
@@ -71,30 +63,26 @@ function useAddPatternCategory() {
|
|
|
71
63
|
if (existingTerm?.id) {
|
|
72
64
|
return existingTerm.id;
|
|
73
65
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
};
|
|
83
|
-
const newTerm = await saveEntityRecord('taxonomy', _categorySelector.CATEGORY_SLUG, termData, {
|
|
84
|
-
throwOnError: true
|
|
85
|
-
});
|
|
86
|
-
invalidateResolution('getUserPatternCategories');
|
|
66
|
+
const termData = existingTerm ? { name: existingTerm.label, slug: existingTerm.name } : { name: term };
|
|
67
|
+
const newTerm = await saveEntityRecord(
|
|
68
|
+
"taxonomy",
|
|
69
|
+
import_category_selector.CATEGORY_SLUG,
|
|
70
|
+
termData,
|
|
71
|
+
{ throwOnError: true }
|
|
72
|
+
);
|
|
73
|
+
invalidateResolution("getUserPatternCategories");
|
|
87
74
|
return newTerm.id;
|
|
88
75
|
} catch (error) {
|
|
89
|
-
if (error.code !==
|
|
76
|
+
if (error.code !== "term_exists") {
|
|
90
77
|
throw error;
|
|
91
78
|
}
|
|
92
79
|
return error.data.term_id;
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
|
-
return {
|
|
96
|
-
categoryMap,
|
|
97
|
-
findOrCreateTerm
|
|
98
|
-
};
|
|
82
|
+
return { categoryMap, findOrCreateTerm };
|
|
99
83
|
}
|
|
100
|
-
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
useAddPatternCategory
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=private-hooks.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/private-hooks.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { CATEGORY_SLUG } from './components/category-selector';\n\n/**\n * Helper hook that creates a Map with the core and user patterns categories\n * and removes any duplicates. It's used when we need to create new user\n * categories when creating or importing patterns.\n * This hook also provides a function to find or create a pattern category.\n *\n * @return {Object} The merged categories map and the callback function to find or create a category.\n */\nexport function useAddPatternCategory() {\n\tconst { saveEntityRecord, invalidateResolution } = useDispatch( coreStore );\n\tconst { corePatternCategories, userPatternCategories } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUserPatternCategories, getBlockPatternCategories } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tcorePatternCategories: getBlockPatternCategories(),\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst categoryMap = useMemo( () => {\n\t\t// Merge the user and core pattern categories and remove any duplicates.\n\t\tconst uniqueCategories = new Map();\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tuniqueCategories.set( category.label.toLowerCase(), {\n\t\t\t\tlabel: category.label,\n\t\t\t\tname: category.name,\n\t\t\t\tid: category.id,\n\t\t\t} );\n\t\t} );\n\n\t\tcorePatternCategories.forEach( ( category ) => {\n\t\t\tif (\n\t\t\t\t! uniqueCategories.has( category.label.toLowerCase() ) &&\n\t\t\t\t// There are two core categories with `Post` label so explicitly remove the one with\n\t\t\t\t// the `query` slug to avoid any confusion.\n\t\t\t\tcategory.name !== 'query'\n\t\t\t) {\n\t\t\t\tuniqueCategories.set( category.label.toLowerCase(), {\n\t\t\t\t\tlabel: category.label,\n\t\t\t\t\tname: category.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t\treturn uniqueCategories;\n\t}, [ userPatternCategories, corePatternCategories ] );\n\n\tasync function findOrCreateTerm( term ) {\n\t\ttry {\n\t\t\tconst existingTerm = categoryMap.get( term.toLowerCase() );\n\t\t\tif ( existingTerm?.id ) {\n\t\t\t\treturn existingTerm.id;\n\t\t\t}\n\t\t\t// If we have an existing core category we need to match the new user category to the\n\t\t\t// correct slug rather than autogenerating it to prevent duplicates, eg. the core `Headers`\n\t\t\t// category uses the singular `header` as the slug.\n\t\t\tconst termData = existingTerm\n\t\t\t\t? { name: existingTerm.label, slug: existingTerm.name }\n\t\t\t\t: { name: term };\n\t\t\tconst newTerm = await saveEntityRecord(\n\t\t\t\t'taxonomy',\n\t\t\t\tCATEGORY_SLUG,\n\t\t\t\ttermData,\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tinvalidateResolution( 'getUserPatternCategories' );\n\t\t\treturn newTerm.id;\n\t\t} catch ( error ) {\n\t\t\tif ( error.code !== 'term_exists' ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn error.data.term_id;\n\t\t}\n\t}\n\n\treturn { categoryMap, findOrCreateTerm };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,uBAAmC;AACnC,qBAAwB;AAKxB,+BAA8B;AAUvB,SAAS,wBAAwB;AACvC,QAAM,EAAE,kBAAkB,qBAAqB,QAAI,yBAAa,iBAAAA,KAAU;AAC1E,QAAM,EAAE,uBAAuB,sBAAsB,QAAI;AAAA,IACxD,CAAE,WAAY;AACb,YAAM,EAAE,0BAA0B,0BAA0B,IAC3D,OAAQ,iBAAAA,KAAU;AAEnB,aAAO;AAAA,QACN,uBAAuB,0BAA0B;AAAA,QACjD,uBAAuB,yBAAyB;AAAA,MACjD;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AACA,QAAM,kBAAc,wBAAS,MAAM;AAElC,UAAM,mBAAmB,oBAAI,IAAI;AACjC,0BAAsB,QAAS,CAAE,aAAc;AAC9C,uBAAiB,IAAK,SAAS,MAAM,YAAY,GAAG;AAAA,QACnD,OAAO,SAAS;AAAA,QAChB,MAAM,SAAS;AAAA,QACf,IAAI,SAAS;AAAA,MACd,CAAE;AAAA,IACH,CAAE;AAEF,0BAAsB,QAAS,CAAE,aAAc;AAC9C,UACC,CAAE,iBAAiB,IAAK,SAAS,MAAM,YAAY,CAAE;AAAA;AAAA,MAGrD,SAAS,SAAS,SACjB;AACD,yBAAiB,IAAK,SAAS,MAAM,YAAY,GAAG;AAAA,UACnD,OAAO,SAAS;AAAA,UAChB,MAAM,SAAS;AAAA,QAChB,CAAE;AAAA,MACH;AAAA,IACD,CAAE;AACF,WAAO;AAAA,EACR,GAAG,CAAE,uBAAuB,qBAAsB,CAAE;AAEpD,iBAAe,iBAAkB,MAAO;AACvC,QAAI;AACH,YAAM,eAAe,YAAY,IAAK,KAAK,YAAY,CAAE;AACzD,UAAK,cAAc,IAAK;AACvB,eAAO,aAAa;AAAA,MACrB;AAIA,YAAM,WAAW,eACd,EAAE,MAAM,aAAa,OAAO,MAAM,aAAa,KAAK,IACpD,EAAE,MAAM,KAAK;AAChB,YAAM,UAAU,MAAM;AAAA,QACrB;AAAA,QACA;AAAA,QACA;AAAA,QACA,EAAE,cAAc,KAAK;AAAA,MACtB;AACA,2BAAsB,0BAA2B;AACjD,aAAO,QAAQ;AAAA,IAChB,SAAU,OAAQ;AACjB,UAAK,MAAM,SAAS,eAAgB;AACnC,cAAM;AAAA,MACP;AACA,aAAO,MAAM,KAAK;AAAA,IACnB;AAAA,EACD;AAEA,SAAO,EAAE,aAAa,iBAAiB;AACxC;",
|
|
6
|
+
"names": ["coreStore"]
|
|
7
|
+
}
|
package/build/store/actions.js
CHANGED
|
@@ -1,126 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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 actions_exports = {};
|
|
19
|
+
__export(actions_exports, {
|
|
20
|
+
convertSyncedPatternToStatic: () => convertSyncedPatternToStatic,
|
|
21
|
+
createPattern: () => createPattern,
|
|
22
|
+
createPatternFromFile: () => createPatternFromFile,
|
|
23
|
+
setEditingPattern: () => setEditingPattern
|
|
5
24
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns a generator converting one or more static blocks into a pattern, or creating a new empty pattern.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} title Pattern title.
|
|
24
|
-
* @param {'full'|'unsynced'} syncType They way block is synced, 'full' or 'unsynced'.
|
|
25
|
-
* @param {string|undefined} [content] Optional serialized content of blocks to convert to pattern.
|
|
26
|
-
* @param {number[]|undefined} [categories] Ids of any selected categories.
|
|
27
|
-
*/
|
|
28
|
-
const createPattern = (title, syncType, content, categories) => async ({
|
|
29
|
-
registry
|
|
30
|
-
}) => {
|
|
31
|
-
const meta = syncType === _constants.PATTERN_SYNC_TYPES.unsynced ? {
|
|
25
|
+
module.exports = __toCommonJS(actions_exports);
|
|
26
|
+
var import_blocks = require("@wordpress/blocks");
|
|
27
|
+
var import_core_data = require("@wordpress/core-data");
|
|
28
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
29
|
+
var import_constants = require("../constants");
|
|
30
|
+
const createPattern = (title, syncType, content, categories) => async ({ registry }) => {
|
|
31
|
+
const meta = syncType === import_constants.PATTERN_SYNC_TYPES.unsynced ? {
|
|
32
32
|
wp_pattern_sync_status: syncType
|
|
33
|
-
} :
|
|
33
|
+
} : void 0;
|
|
34
34
|
const reusableBlock = {
|
|
35
35
|
title,
|
|
36
36
|
content,
|
|
37
|
-
status:
|
|
37
|
+
status: "publish",
|
|
38
38
|
meta,
|
|
39
39
|
wp_pattern_category: categories
|
|
40
40
|
};
|
|
41
|
-
const updatedRecord = await registry.dispatch(
|
|
41
|
+
const updatedRecord = await registry.dispatch(import_core_data.store).saveEntityRecord("postType", "wp_block", reusableBlock);
|
|
42
42
|
return updatedRecord;
|
|
43
43
|
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create a pattern from a JSON file.
|
|
47
|
-
* @param {File} file The JSON file instance of the pattern.
|
|
48
|
-
* @param {number[]|undefined} [categories] Ids of any selected categories.
|
|
49
|
-
*/
|
|
50
|
-
exports.createPattern = createPattern;
|
|
51
|
-
const createPatternFromFile = (file, categories) => async ({
|
|
52
|
-
dispatch
|
|
53
|
-
}) => {
|
|
44
|
+
const createPatternFromFile = (file, categories) => async ({ dispatch }) => {
|
|
54
45
|
const fileContent = await file.text();
|
|
55
|
-
/** @type {import('./types').PatternJSON} */
|
|
56
46
|
let parsedContent;
|
|
57
47
|
try {
|
|
58
48
|
parsedContent = JSON.parse(fileContent);
|
|
59
49
|
} catch (e) {
|
|
60
|
-
throw new Error(
|
|
50
|
+
throw new Error("Invalid JSON file");
|
|
61
51
|
}
|
|
62
|
-
if (parsedContent.__file !==
|
|
63
|
-
throw new Error(
|
|
52
|
+
if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") {
|
|
53
|
+
throw new Error("Invalid pattern JSON file");
|
|
64
54
|
}
|
|
65
|
-
const pattern = await dispatch.createPattern(
|
|
55
|
+
const pattern = await dispatch.createPattern(
|
|
56
|
+
parsedContent.title,
|
|
57
|
+
parsedContent.syncStatus,
|
|
58
|
+
parsedContent.content,
|
|
59
|
+
categories
|
|
60
|
+
);
|
|
66
61
|
return pattern;
|
|
67
62
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* Returns a generator converting a synced pattern block into a static block.
|
|
71
|
-
*
|
|
72
|
-
* @param {string} clientId The client ID of the block to attach.
|
|
73
|
-
*/
|
|
74
|
-
exports.createPatternFromFile = createPatternFromFile;
|
|
75
|
-
const convertSyncedPatternToStatic = clientId => ({
|
|
76
|
-
registry
|
|
77
|
-
}) => {
|
|
78
|
-
const patternBlock = registry.select(_blockEditor.store).getBlock(clientId);
|
|
63
|
+
const convertSyncedPatternToStatic = (clientId) => ({ registry }) => {
|
|
64
|
+
const patternBlock = registry.select(import_block_editor.store).getBlock(clientId);
|
|
79
65
|
const existingOverrides = patternBlock.attributes?.content;
|
|
80
66
|
function cloneBlocksAndRemoveBindings(blocks) {
|
|
81
|
-
return blocks.map(block => {
|
|
67
|
+
return blocks.map((block) => {
|
|
82
68
|
let metadata = block.attributes.metadata;
|
|
83
69
|
if (metadata) {
|
|
84
|
-
metadata = {
|
|
85
|
-
...metadata
|
|
86
|
-
};
|
|
70
|
+
metadata = { ...metadata };
|
|
87
71
|
delete metadata.id;
|
|
88
72
|
delete metadata.bindings;
|
|
89
|
-
// Use overridden values of the pattern block if they exist.
|
|
90
73
|
if (existingOverrides?.[metadata.name]) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (!(0,
|
|
74
|
+
for (const [attributeName, value] of Object.entries(
|
|
75
|
+
existingOverrides[metadata.name]
|
|
76
|
+
)) {
|
|
77
|
+
if (!(0, import_blocks.getBlockType)(block.name)?.attributes[attributeName]) {
|
|
95
78
|
continue;
|
|
96
79
|
}
|
|
97
|
-
// Update the block attribute with the override value.
|
|
98
80
|
block.attributes[attributeName] = value;
|
|
99
81
|
}
|
|
100
82
|
}
|
|
101
83
|
}
|
|
102
|
-
return (0,
|
|
103
|
-
|
|
104
|
-
|
|
84
|
+
return (0, import_blocks.cloneBlock)(
|
|
85
|
+
block,
|
|
86
|
+
{
|
|
87
|
+
metadata: metadata && Object.keys(metadata).length > 0 ? metadata : void 0
|
|
88
|
+
},
|
|
89
|
+
cloneBlocksAndRemoveBindings(block.innerBlocks)
|
|
90
|
+
);
|
|
105
91
|
});
|
|
106
92
|
}
|
|
107
|
-
const patternInnerBlocks = registry.select(
|
|
108
|
-
registry.dispatch(
|
|
93
|
+
const patternInnerBlocks = registry.select(import_block_editor.store).getBlocks(patternBlock.clientId);
|
|
94
|
+
registry.dispatch(import_block_editor.store).replaceBlocks(
|
|
95
|
+
patternBlock.clientId,
|
|
96
|
+
cloneBlocksAndRemoveBindings(patternInnerBlocks)
|
|
97
|
+
);
|
|
109
98
|
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Returns an action descriptor for SET_EDITING_PATTERN action.
|
|
113
|
-
*
|
|
114
|
-
* @param {string} clientId The clientID of the pattern to target.
|
|
115
|
-
* @param {boolean} isEditing Whether the block should be in editing state.
|
|
116
|
-
* @return {Object} Action descriptor.
|
|
117
|
-
*/
|
|
118
|
-
exports.convertSyncedPatternToStatic = convertSyncedPatternToStatic;
|
|
119
99
|
function setEditingPattern(clientId, isEditing) {
|
|
120
100
|
return {
|
|
121
|
-
type:
|
|
101
|
+
type: "SET_EDITING_PATTERN",
|
|
122
102
|
clientId,
|
|
123
103
|
isEditing
|
|
124
104
|
};
|
|
125
105
|
}
|
|
126
|
-
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
convertSyncedPatternToStatic,
|
|
109
|
+
createPattern,
|
|
110
|
+
createPatternFromFile,
|
|
111
|
+
setEditingPattern
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/store/actions.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\n\nimport { getBlockType, cloneBlock } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_SYNC_TYPES } from '../constants';\n\n/**\n * Returns a generator converting one or more static blocks into a pattern, or creating a new empty pattern.\n *\n * @param {string} title Pattern title.\n * @param {'full'|'unsynced'} syncType They way block is synced, 'full' or 'unsynced'.\n * @param {string|undefined} [content] Optional serialized content of blocks to convert to pattern.\n * @param {number[]|undefined} [categories] Ids of any selected categories.\n */\nexport const createPattern =\n\t( title, syncType, content, categories ) =>\n\tasync ( { registry } ) => {\n\t\tconst meta =\n\t\t\tsyncType === PATTERN_SYNC_TYPES.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,\n\t\t\tcontent,\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t\twp_pattern_category: categories,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\treturn updatedRecord;\n\t};\n\n/**\n * Create a pattern from a JSON file.\n * @param {File} file The JSON file instance of the pattern.\n * @param {number[]|undefined} [categories] Ids of any selected categories.\n */\nexport const createPatternFromFile =\n\t( file, categories ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst fileContent = await file.text();\n\t\t/** @type {import('./types').PatternJSON} */\n\t\tlet parsedContent;\n\t\ttry {\n\t\t\tparsedContent = JSON.parse( fileContent );\n\t\t} catch ( e ) {\n\t\t\tthrow new Error( 'Invalid JSON file' );\n\t\t}\n\t\tif (\n\t\t\tparsedContent.__file !== 'wp_block' ||\n\t\t\t! parsedContent.title ||\n\t\t\t! parsedContent.content ||\n\t\t\ttypeof parsedContent.title !== 'string' ||\n\t\t\ttypeof parsedContent.content !== 'string' ||\n\t\t\t( parsedContent.syncStatus &&\n\t\t\t\ttypeof parsedContent.syncStatus !== 'string' )\n\t\t) {\n\t\t\tthrow new Error( 'Invalid pattern JSON file' );\n\t\t}\n\n\t\tconst pattern = await dispatch.createPattern(\n\t\t\tparsedContent.title,\n\t\t\tparsedContent.syncStatus,\n\t\t\tparsedContent.content,\n\t\t\tcategories\n\t\t);\n\n\t\treturn pattern;\n\t};\n\n/**\n * Returns a generator converting a synced pattern block into a static block.\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const convertSyncedPatternToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tconst patternBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst existingOverrides = patternBlock.attributes?.content;\n\n\t\tfunction cloneBlocksAndRemoveBindings( blocks ) {\n\t\t\treturn blocks.map( ( block ) => {\n\t\t\t\tlet metadata = block.attributes.metadata;\n\t\t\t\tif ( metadata ) {\n\t\t\t\t\tmetadata = { ...metadata };\n\t\t\t\t\tdelete metadata.id;\n\t\t\t\t\tdelete metadata.bindings;\n\t\t\t\t\t// Use overridden values of the pattern block if they exist.\n\t\t\t\t\tif ( existingOverrides?.[ metadata.name ] ) {\n\t\t\t\t\t\t// Iterate over each overridden attribute.\n\t\t\t\t\t\tfor ( const [ attributeName, value ] of Object.entries(\n\t\t\t\t\t\t\texistingOverrides[ metadata.name ]\n\t\t\t\t\t\t) ) {\n\t\t\t\t\t\t\t// Skip if the attribute does not exist in the block type.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! getBlockType( block.name )?.attributes[\n\t\t\t\t\t\t\t\t\tattributeName\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Update the block attribute with the override value.\n\t\t\t\t\t\t\tblock.attributes[ attributeName ] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn cloneBlock(\n\t\t\t\t\tblock,\n\t\t\t\t\t{\n\t\t\t\t\t\tmetadata:\n\t\t\t\t\t\t\tmetadata && Object.keys( metadata ).length > 0\n\t\t\t\t\t\t\t\t? metadata\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t},\n\t\t\t\t\tcloneBlocksAndRemoveBindings( block.innerBlocks )\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\tconst patternInnerBlocks = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlocks( patternBlock.clientId );\n\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks(\n\t\t\t\tpatternBlock.clientId,\n\t\t\t\tcloneBlocksAndRemoveBindings( patternInnerBlocks )\n\t\t\t);\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_PATTERN action.\n *\n * @param {string} clientId The clientID of the pattern to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function setEditingPattern( clientId, isEditing ) {\n\treturn {\n\t\ttype: 'SET_EDITING_PATTERN',\n\t\tclientId,\n\t\tisEditing,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAyC;AACzC,uBAAmC;AACnC,0BAA0C;AAK1C,uBAAmC;AAU5B,MAAM,gBACZ,CAAE,OAAO,UAAU,SAAS,eAC5B,OAAQ,EAAE,SAAS,MAAO;AACzB,QAAM,OACL,aAAa,oCAAmB,WAC7B;AAAA,IACA,wBAAwB;AAAA,EACxB,IACA;AAEJ,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA,qBAAqB;AAAA,EACtB;AAEA,QAAM,gBAAgB,MAAM,SAC1B,SAAU,iBAAAA,KAAU,EACpB,iBAAkB,YAAY,YAAY,aAAc;AAE1D,SAAO;AACR;AAOM,MAAM,wBACZ,CAAE,MAAM,eACR,OAAQ,EAAE,SAAS,MAAO;AACzB,QAAM,cAAc,MAAM,KAAK,KAAK;AAEpC,MAAI;AACJ,MAAI;AACH,oBAAgB,KAAK,MAAO,WAAY;AAAA,EACzC,SAAU,GAAI;AACb,UAAM,IAAI,MAAO,mBAAoB;AAAA,EACtC;AACA,MACC,cAAc,WAAW,cACzB,CAAE,cAAc,SAChB,CAAE,cAAc,WAChB,OAAO,cAAc,UAAU,YAC/B,OAAO,cAAc,YAAY,YAC/B,cAAc,cACf,OAAO,cAAc,eAAe,UACpC;AACD,UAAM,IAAI,MAAO,2BAA4B;AAAA,EAC9C;AAEA,QAAM,UAAU,MAAM,SAAS;AAAA,IAC9B,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,IACd;AAAA,EACD;AAEA,SAAO;AACR;AAOM,MAAM,+BACZ,CAAE,aACF,CAAE,EAAE,SAAS,MAAO;AACnB,QAAM,eAAe,SACnB,OAAQ,oBAAAC,KAAiB,EACzB,SAAU,QAAS;AACrB,QAAM,oBAAoB,aAAa,YAAY;AAEnD,WAAS,6BAA8B,QAAS;AAC/C,WAAO,OAAO,IAAK,CAAE,UAAW;AAC/B,UAAI,WAAW,MAAM,WAAW;AAChC,UAAK,UAAW;AACf,mBAAW,EAAE,GAAG,SAAS;AACzB,eAAO,SAAS;AAChB,eAAO,SAAS;AAEhB,YAAK,oBAAqB,SAAS,IAAK,GAAI;AAE3C,qBAAY,CAAE,eAAe,KAAM,KAAK,OAAO;AAAA,YAC9C,kBAAmB,SAAS,IAAK;AAAA,UAClC,GAAI;AAEH,gBACC,KAAE,4BAAc,MAAM,IAAK,GAAG,WAC7B,aACD,GACC;AACD;AAAA,YACD;AAEA,kBAAM,WAAY,aAAc,IAAI;AAAA,UACrC;AAAA,QACD;AAAA,MACD;AACA,iBAAO;AAAA,QACN;AAAA,QACA;AAAA,UACC,UACC,YAAY,OAAO,KAAM,QAAS,EAAE,SAAS,IAC1C,WACA;AAAA,QACL;AAAA,QACA,6BAA8B,MAAM,WAAY;AAAA,MACjD;AAAA,IACD,CAAE;AAAA,EACH;AAEA,QAAM,qBAAqB,SACzB,OAAQ,oBAAAA,KAAiB,EACzB,UAAW,aAAa,QAAS;AAEnC,WACE,SAAU,oBAAAA,KAAiB,EAC3B;AAAA,IACA,aAAa;AAAA,IACb,6BAA8B,kBAAmB;AAAA,EAClD;AACF;AASM,SAAS,kBAAmB,UAAU,WAAY;AACxD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
|
+
"names": ["coreStore", "blockEditorStore"]
|
|
7
|
+
}
|
package/build/store/constants.js
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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 constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
STORE_NAME: () => STORE_NAME
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
22
|
+
module.exports = __toCommonJS(constants_exports);
|
|
23
|
+
const STORE_NAME = "core/patterns";
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
STORE_NAME
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=constants.js.map
|