@wordpress/block-editor 15.10.1-next.ba3aee3a2.0 → 15.11.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 +2 -0
- package/build/components/block-bindings/attribute-control.cjs +1 -1
- package/build/components/block-bindings/attribute-control.cjs.map +1 -1
- package/build/components/block-bindings/source-fields-list.cjs +1 -1
- package/build/components/block-bindings/source-fields-list.cjs.map +1 -1
- package/build/components/block-edit/context.cjs +5 -0
- package/build/components/block-edit/context.cjs.map +2 -2
- package/build/components/block-edit/index.cjs +3 -0
- package/build/components/block-edit/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +2 -9
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block.cjs +3 -0
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +82 -70
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-visibility/block-visibility-info.cjs +0 -59
- package/build/components/block-visibility/block-visibility-info.cjs.map +3 -3
- package/build/components/block-visibility/constants.cjs +10 -5
- package/build/components/block-visibility/constants.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +13 -5
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +397 -0
- package/build/components/block-visibility/modal.cjs.map +7 -0
- package/build/components/block-visibility/toolbar.cjs +1 -1
- package/build/components/block-visibility/toolbar.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +13 -17
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +81 -0
- package/build/components/block-visibility/utils.cjs.map +7 -0
- package/build/components/block-visibility/viewport-menu-item.cjs +61 -0
- package/build/components/block-visibility/viewport-menu-item.cjs.map +7 -0
- package/build/components/block-visibility/viewport-toolbar.cjs +89 -0
- package/build/components/block-visibility/viewport-toolbar.cjs.map +7 -0
- package/build/components/button-block-appender/index.cjs +23 -19
- package/build/components/button-block-appender/index.cjs.map +2 -2
- package/build/components/font-sizes/font-size-picker.cjs +2 -1
- package/build/components/font-sizes/font-size-picker.cjs.map +2 -2
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +1 -1
- package/build/components/inserter/menu.cjs +6 -2
- package/build/components/inserter/menu.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +4 -25
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +6 -6
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +2 -2
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +39 -22
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +1 -1
- package/build/components/url-input/index.cjs +2 -0
- package/build/components/url-input/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +1 -1
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/hooks/block-fields/index.cjs +92 -217
- package/build/hooks/block-fields/index.cjs.map +3 -3
- package/build/hooks/block-fields/link/index.cjs +13 -32
- package/build/hooks/block-fields/link/index.cjs.map +2 -2
- package/build/hooks/block-fields/media/index.cjs +36 -67
- package/build/hooks/block-fields/media/index.cjs.map +2 -2
- package/build/hooks/block-fields/rich-text/index.cjs +1 -5
- package/build/hooks/block-fields/rich-text/index.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +102 -0
- package/build/hooks/cross-origin-isolation.cjs.map +7 -0
- package/build/hooks/index.cjs +3 -1
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/list-view.cjs +27 -10
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/utils.cjs +3 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/flex.cjs +6 -2
- package/build/layouts/flex.cjs.map +2 -2
- package/build/store/private-selectors.cjs +33 -1
- package/build/store/private-selectors.cjs.map +3 -3
- package/build/store/reducer.cjs +1 -1
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs +14 -9
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +1 -1
- package/build-module/components/block-bindings/attribute-control.mjs.map +1 -1
- package/build-module/components/block-bindings/source-fields-list.mjs +1 -1
- package/build-module/components/block-bindings/source-fields-list.mjs.map +1 -1
- package/build-module/components/block-edit/context.mjs +4 -0
- package/build-module/components/block-edit/context.mjs.map +2 -2
- package/build-module/components/block-edit/index.mjs +4 -0
- package/build-module/components/block-edit/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +2 -9
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +3 -0
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +85 -73
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -59
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +3 -3
- package/build-module/components/block-visibility/constants.mjs +8 -4
- package/build-module/components/block-visibility/constants.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +13 -6
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +384 -0
- package/build-module/components/block-visibility/modal.mjs.map +7 -0
- package/build-module/components/block-visibility/toolbar.mjs +1 -1
- package/build-module/components/block-visibility/toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +13 -13
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +55 -0
- package/build-module/components/block-visibility/utils.mjs.map +7 -0
- package/build-module/components/block-visibility/viewport-menu-item.mjs +40 -0
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +7 -0
- package/build-module/components/block-visibility/viewport-toolbar.mjs +68 -0
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +7 -0
- package/build-module/components/button-block-appender/index.mjs +23 -19
- package/build-module/components/button-block-appender/index.mjs.map +2 -2
- package/build-module/components/font-sizes/font-size-picker.mjs +2 -1
- package/build-module/components/font-sizes/font-size-picker.mjs.map +2 -2
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +1 -1
- package/build-module/components/inserter/menu.mjs +6 -2
- package/build-module/components/inserter/menu.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +6 -22
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +6 -6
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +2 -2
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +39 -22
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -1
- package/build-module/components/rich-text/index.mjs.map +1 -1
- package/build-module/components/url-input/index.mjs +2 -0
- package/build-module/components/url-input/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +1 -1
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +85 -218
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +13 -32
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +36 -67
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/rich-text/index.mjs +1 -5
- package/build-module/hooks/block-fields/rich-text/index.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +100 -0
- package/build-module/hooks/cross-origin-isolation.mjs.map +7 -0
- package/build-module/hooks/index.mjs +3 -1
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +27 -10
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +5 -3
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +6 -2
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +34 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +1 -1
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs +14 -9
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/content-rtl.css +4 -1
- package/build-style/content.css +4 -1
- package/build-style/style-rtl.css +48 -0
- package/build-style/style.css +48 -0
- package/package.json +39 -39
- package/src/components/block-bindings/attribute-control.js +1 -1
- package/src/components/block-bindings/source-fields-list.js +1 -1
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +6 -0
- package/src/components/block-inspector/index.js +2 -6
- package/src/components/block-list/block.js +3 -0
- package/src/components/block-list/block.native.js +5 -0
- package/src/components/block-list/content.scss +4 -1
- package/src/components/block-patterns-list/stories/index.story.jsx +1 -1
- package/src/components/block-tools/index.js +45 -33
- package/src/components/block-visibility/block-visibility-info.js +0 -1
- package/src/components/block-visibility/constants.js +7 -3
- package/src/components/block-visibility/index.js +21 -3
- package/src/components/block-visibility/modal.js +358 -0
- package/src/components/block-visibility/style.scss +58 -0
- package/src/components/block-visibility/test/use-block-visibility.js +12 -56
- package/src/components/block-visibility/test/utils.js +266 -0
- package/src/components/block-visibility/toolbar.js +1 -1
- package/src/components/block-visibility/use-block-visibility.js +18 -21
- package/src/components/block-visibility/utils.js +95 -0
- package/src/components/block-visibility/viewport-menu-item.js +42 -0
- package/src/components/block-visibility/viewport-toolbar.js +88 -0
- package/src/components/button-block-appender/index.js +2 -2
- package/src/components/font-sizes/font-size-picker.js +1 -0
- package/src/components/inner-blocks/use-inner-block-template-sync.js +1 -1
- package/src/components/inserter/menu.js +6 -2
- package/src/components/inspector-controls/fill.js +10 -20
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +11 -8
- package/src/components/list-view/block-select-button.js +2 -2
- package/src/components/list-view/block.js +47 -25
- package/src/components/rich-text/index.js +1 -1
- package/src/components/url-input/index.js +2 -0
- package/src/components/use-block-commands/index.js +4 -3
- package/src/hooks/block-fields/index.js +127 -292
- package/src/hooks/block-fields/link/index.js +13 -51
- package/src/hooks/block-fields/media/index.js +35 -106
- package/src/hooks/block-fields/rich-text/index.js +1 -5
- package/src/hooks/block-fields/styles.scss +2 -0
- package/src/hooks/cross-origin-isolation.js +143 -0
- package/src/hooks/index.js +3 -1
- package/src/hooks/list-view.js +40 -10
- package/src/hooks/utils.js +4 -0
- package/src/layouts/flex.js +8 -3
- package/src/layouts/test/flex.js +53 -0
- package/src/store/private-selectors.js +64 -1
- package/src/store/reducer.js +1 -1
- package/src/store/selectors.js +21 -15
- package/src/store/test/private-selectors.js +80 -0
- package/src/style.scss +1 -0
- package/src/components/block-visibility/styles.scss +0 -10
- /package/src/components/block-icon/stories/{index.story.js → index.story.ts} +0 -0
- /package/src/components/contrast-checker/stories/{index.story.js → index.story.ts} +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/block-editor/src/components/block-visibility/utils.js
|
|
21
|
+
var utils_exports = {};
|
|
22
|
+
__export(utils_exports, {
|
|
23
|
+
getHideEverywhereCheckboxState: () => getHideEverywhereCheckboxState,
|
|
24
|
+
getViewportCheckboxState: () => getViewportCheckboxState
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
27
|
+
var import_constants = require("./constants.cjs");
|
|
28
|
+
function isBlockHiddenForViewport(block, viewport) {
|
|
29
|
+
if (!block) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const blockVisibility = block.attributes?.metadata?.blockVisibility;
|
|
33
|
+
if (blockVisibility === true) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if ("object" !== typeof blockVisibility) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
if (!import_constants.BLOCK_VISIBILITY_VIEWPORT_ENTRIES.some(
|
|
40
|
+
([, { key }]) => key === viewport
|
|
41
|
+
)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return blockVisibility[viewport] === false;
|
|
45
|
+
}
|
|
46
|
+
function getViewportCheckboxState(blocks, viewport) {
|
|
47
|
+
if (!blocks?.length) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const hiddenCount = blocks.filter(
|
|
51
|
+
(block) => isBlockHiddenForViewport(block, viewport)
|
|
52
|
+
).length;
|
|
53
|
+
if (hiddenCount === 0) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (hiddenCount === blocks.length) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function getHideEverywhereCheckboxState(blocks) {
|
|
62
|
+
if (!blocks?.length) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const hiddenEverywhereCount = blocks.filter(
|
|
66
|
+
(block) => block && block.attributes?.metadata?.blockVisibility === false
|
|
67
|
+
).length;
|
|
68
|
+
if (hiddenEverywhereCount === 0) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (hiddenEverywhereCount === blocks.length) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
getHideEverywhereCheckboxState,
|
|
79
|
+
getViewportCheckboxState
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/block-visibility/utils.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { BLOCK_VISIBILITY_VIEWPORT_ENTRIES } from './constants';\n\n/**\n * Checks if a block is hidden for a specific viewport.\n *\n * @param {Object} block The block to check.\n * @param {string} viewport The viewport to check (e.g., 'mobile', 'tablet', 'desktop').\n * @return {boolean} Whether the block is hidden for the viewport.\n */\nfunction isBlockHiddenForViewport( block, viewport ) {\n\tif ( ! block ) {\n\t\treturn false;\n\t}\n\n\tconst blockVisibility = block.attributes?.metadata?.blockVisibility;\n\n\t// If explicitly visible everywhere (true), return false for all viewports.\n\tif ( blockVisibility === true ) {\n\t\treturn false;\n\t}\n\n\t// If null or not an object, block is not hidden for any specific viewport.\n\tif ( 'object' !== typeof blockVisibility ) {\n\t\treturn false;\n\t}\n\n\t// Check if the viewport is valid.\n\tif (\n\t\t! BLOCK_VISIBILITY_VIEWPORT_ENTRIES.some(\n\t\t\t( [ , { key } ] ) => key === viewport\n\t\t)\n\t) {\n\t\treturn false;\n\t}\n\n\t// Check if the specific viewport is hidden.\n\treturn blockVisibility[ viewport ] === false;\n}\n\n/**\n * Gets the checkbox state for a viewport across multiple blocks.\n * Returns `true` if all blocks are hidden, `null` if some are hidden, `false` if none are hidden.\n *\n * @param {Array} blocks Array of blocks to check.\n * @param {string} viewport The viewport to check (e.g., 'mobile', 'tablet', 'desktop').\n * @return {boolean|null} `true` if all hidden, `null` if some hidden, `false` if none hidden.\n */\nexport function getViewportCheckboxState( blocks, viewport ) {\n\tif ( ! blocks?.length ) {\n\t\treturn false;\n\t}\n\n\tconst hiddenCount = blocks.filter( ( block ) =>\n\t\tisBlockHiddenForViewport( block, viewport )\n\t).length;\n\n\tif ( hiddenCount === 0 ) {\n\t\treturn false;\n\t}\n\tif ( hiddenCount === blocks.length ) {\n\t\treturn true;\n\t}\n\n\treturn null; // Indeterminate: some hidden, some visible (normal mixed state)\n}\n\n/**\n * Gets the checkbox state for \"hide everywhere\" across multiple blocks.\n * Returns `true` if all blocks are hidden everywhere, `null` if some are hidden everywhere, `false` if none are.\n *\n * @param {Array} blocks Array of blocks to check.\n * @return {boolean|null} `true` if all hidden everywhere, `null` if some hidden everywhere, `false` if none.\n */\nexport function getHideEverywhereCheckboxState( blocks ) {\n\tif ( ! blocks?.length ) {\n\t\treturn false;\n\t}\n\n\tconst hiddenEverywhereCount = blocks.filter(\n\t\t( block ) =>\n\t\t\tblock && block.attributes?.metadata?.blockVisibility === false\n\t).length;\n\n\tif ( hiddenEverywhereCount === 0 ) {\n\t\treturn false;\n\t}\n\tif ( hiddenEverywhereCount === blocks.length ) {\n\t\treturn true;\n\t}\n\n\treturn null; // Indeterminate: some but not all\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAkD;AASlD,SAAS,yBAA0B,OAAO,UAAW;AACpD,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAEA,QAAM,kBAAkB,MAAM,YAAY,UAAU;AAGpD,MAAK,oBAAoB,MAAO;AAC/B,WAAO;AAAA,EACR;AAGA,MAAK,aAAa,OAAO,iBAAkB;AAC1C,WAAO;AAAA,EACR;AAGA,MACC,CAAE,mDAAkC;AAAA,IACnC,CAAE,CAAE,EAAE,EAAE,IAAI,CAAE,MAAO,QAAQ;AAAA,EAC9B,GACC;AACD,WAAO;AAAA,EACR;AAGA,SAAO,gBAAiB,QAAS,MAAM;AACxC;AAUO,SAAS,yBAA0B,QAAQ,UAAW;AAC5D,MAAK,CAAE,QAAQ,QAAS;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,cAAc,OAAO;AAAA,IAAQ,CAAE,UACpC,yBAA0B,OAAO,QAAS;AAAA,EAC3C,EAAE;AAEF,MAAK,gBAAgB,GAAI;AACxB,WAAO;AAAA,EACR;AACA,MAAK,gBAAgB,OAAO,QAAS;AACpC,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AASO,SAAS,+BAAgC,QAAS;AACxD,MAAK,CAAE,QAAQ,QAAS;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,wBAAwB,OAAO;AAAA,IACpC,CAAE,UACD,SAAS,MAAM,YAAY,UAAU,oBAAoB;AAAA,EAC3D,EAAE;AAEF,MAAK,0BAA0B,GAAI;AAClC,WAAO;AAAA,EACR;AACA,MAAK,0BAA0B,OAAO,QAAS;AAC9C,WAAO;AAAA,EACR;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/block-editor/src/components/block-visibility/viewport-menu-item.js
|
|
21
|
+
var viewport_menu_item_exports = {};
|
|
22
|
+
__export(viewport_menu_item_exports, {
|
|
23
|
+
default: () => BlockVisibilityViewportMenuItem
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(viewport_menu_item_exports);
|
|
26
|
+
var import_i18n = require("@wordpress/i18n");
|
|
27
|
+
var import_components = require("@wordpress/components");
|
|
28
|
+
var import_icons = require("@wordpress/icons");
|
|
29
|
+
var import_element = require("@wordpress/element");
|
|
30
|
+
var import_data = require("@wordpress/data");
|
|
31
|
+
var import__ = require("./index.cjs");
|
|
32
|
+
var import_store = require("../../store/index.cjs");
|
|
33
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
function BlockVisibilityViewportMenuItem({ clientIds }) {
|
|
36
|
+
const [isModalOpen, setIsModalOpen] = (0, import_element.useState)(false);
|
|
37
|
+
const areBlocksHiddenAnywhere = (0, import_data.useSelect)(
|
|
38
|
+
(select) => (0, import_lock_unlock.unlock)(select(import_store.store)).areBlocksHiddenAnywhere(
|
|
39
|
+
clientIds
|
|
40
|
+
),
|
|
41
|
+
[clientIds]
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
+
import_components.MenuItem,
|
|
46
|
+
{
|
|
47
|
+
icon: areBlocksHiddenAnywhere ? import_icons.unseen : import_icons.seen,
|
|
48
|
+
onClick: () => setIsModalOpen(true),
|
|
49
|
+
children: areBlocksHiddenAnywhere ? (0, import_i18n.__)("Show") : (0, import_i18n.__)("Hide")
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
+
import__.BlockVisibilityModal,
|
|
54
|
+
{
|
|
55
|
+
clientIds,
|
|
56
|
+
onClose: () => setIsModalOpen(false)
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=viewport-menu-item.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/block-visibility/viewport-menu-item.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { BlockVisibilityModal } from './';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function BlockVisibilityViewportMenuItem( { clientIds } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst areBlocksHiddenAnywhere = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).areBlocksHiddenAnywhere(\n\t\t\t\tclientIds\n\t\t\t),\n\t\t[ clientIds ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\ticon={ areBlocksHiddenAnywhere ? unseen : seen }\n\t\t\t\tonClick={ () => setIsModalOpen( true ) }\n\t\t\t>\n\t\t\t\t{ areBlocksHiddenAnywhere ? __( 'Show' ) : __( 'Hide' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockVisibilityModal\n\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\tonClose={ () => setIsModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAAyB;AACzB,mBAA6B;AAC7B,qBAAyB;AACzB,kBAA0B;AAK1B,eAAqC;AACrC,mBAA0C;AAC1C,yBAAuB;AAYrB;AAVa,SAAR,gCAAkD,EAAE,UAAU,GAAI;AACxE,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,KAAM;AACxD,QAAM,8BAA0B;AAAA,IAC/B,CAAE,eACD,2BAAQ,OAAQ,aAAAA,KAAiB,CAAE,EAAE;AAAA,MACpC;AAAA,IACD;AAAA,IACD,CAAE,SAAU;AAAA,EACb;AACA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,MAAO,0BAA0B,sBAAS;AAAA,QAC1C,SAAU,MAAM,eAAgB,IAAK;AAAA,QAEnC,wCAA0B,gBAAI,MAAO,QAAI,gBAAI,MAAO;AAAA;AAAA,IACvD;AAAA,IACE,eACD;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,SAAU,MAAM,eAAgB,KAAM;AAAA;AAAA,IACvC;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": ["blockEditorStore"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/block-editor/src/components/block-visibility/viewport-toolbar.js
|
|
21
|
+
var viewport_toolbar_exports = {};
|
|
22
|
+
__export(viewport_toolbar_exports, {
|
|
23
|
+
default: () => BlockVisibilityViewportToolbar
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(viewport_toolbar_exports);
|
|
26
|
+
var import_i18n = require("@wordpress/i18n");
|
|
27
|
+
var import_components = require("@wordpress/components");
|
|
28
|
+
var import_element = require("@wordpress/element");
|
|
29
|
+
var import_icons = require("@wordpress/icons");
|
|
30
|
+
var import_blocks = require("@wordpress/blocks");
|
|
31
|
+
var import_data = require("@wordpress/data");
|
|
32
|
+
var import_store = require("../../store/index.cjs");
|
|
33
|
+
var import__ = require("./index.cjs");
|
|
34
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
function BlockVisibilityViewportToolbar({ clientIds }) {
|
|
37
|
+
const hasBlockVisibilityButtonShownRef = (0, import_element.useRef)(false);
|
|
38
|
+
const [isModalOpen, setIsModalOpen] = (0, import_element.useState)(false);
|
|
39
|
+
const { canToggleBlockVisibility, areBlocksHiddenAnywhere } = (0, import_data.useSelect)(
|
|
40
|
+
(select) => {
|
|
41
|
+
const {
|
|
42
|
+
getBlocksByClientId,
|
|
43
|
+
getBlockName,
|
|
44
|
+
areBlocksHiddenAnywhere: _areBlocksHiddenAnywhere
|
|
45
|
+
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
46
|
+
const _blocks = getBlocksByClientId(clientIds);
|
|
47
|
+
return {
|
|
48
|
+
canToggleBlockVisibility: _blocks.every(
|
|
49
|
+
({ clientId }) => (0, import_blocks.hasBlockSupport)(
|
|
50
|
+
getBlockName(clientId),
|
|
51
|
+
"visibility",
|
|
52
|
+
true
|
|
53
|
+
)
|
|
54
|
+
),
|
|
55
|
+
areBlocksHiddenAnywhere: _areBlocksHiddenAnywhere(clientIds)
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
[clientIds]
|
|
59
|
+
);
|
|
60
|
+
(0, import_element.useEffect)(() => {
|
|
61
|
+
if (areBlocksHiddenAnywhere) {
|
|
62
|
+
hasBlockVisibilityButtonShownRef.current = true;
|
|
63
|
+
}
|
|
64
|
+
}, [areBlocksHiddenAnywhere]);
|
|
65
|
+
if (!areBlocksHiddenAnywhere && !hasBlockVisibilityButtonShownRef.current) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { className: "block-editor-block-visibility-toolbar", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
+
import_components.ToolbarButton,
|
|
71
|
+
{
|
|
72
|
+
disabled: !canToggleBlockVisibility,
|
|
73
|
+
icon: areBlocksHiddenAnywhere ? import_icons.unseen : import_icons.seen,
|
|
74
|
+
label: areBlocksHiddenAnywhere ? (0, import_i18n.__)("Hidden") : (0, import_i18n.__)("Visible"),
|
|
75
|
+
onClick: () => setIsModalOpen(true),
|
|
76
|
+
"aria-expanded": isModalOpen,
|
|
77
|
+
"aria-haspopup": !isModalOpen ? "dialog" : void 0
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
+
import__.BlockVisibilityModal,
|
|
82
|
+
{
|
|
83
|
+
clientIds,
|
|
84
|
+
onClose: () => setIsModalOpen(false)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] });
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=viewport-toolbar.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/block-visibility/viewport-toolbar.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { seen, unseen } from '@wordpress/icons';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { BlockVisibilityModal } from './';\nimport { unlock } from '../../lock-unlock';\n\nexport default function BlockVisibilityViewportToolbar( { clientIds } ) {\n\tconst hasBlockVisibilityButtonShownRef = useRef( false );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { canToggleBlockVisibility, areBlocksHiddenAnywhere } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockName,\n\t\t\t\tareBlocksHiddenAnywhere: _areBlocksHiddenAnywhere,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\treturn {\n\t\t\t\tcanToggleBlockVisibility: _blocks.every( ( { clientId } ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'visibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t\tareBlocksHiddenAnywhere: _areBlocksHiddenAnywhere( clientIds ),\n\t\t\t};\n\t\t},\n\n\t\t[ clientIds ]\n\t);\n\n\t/*\n\t * If the block visibility button has been shown, we don't want to\n\t * remove it from the toolbar until the toolbar is rendered again\n\t * without it. Removing it beforehand can cause focus loss issues.\n\t * It needs to return focus from whence it came, and to do that,\n\t * we need to leave the button in the toolbar.\n\t */\n\tuseEffect( () => {\n\t\tif ( areBlocksHiddenAnywhere ) {\n\t\t\thasBlockVisibilityButtonShownRef.current = true;\n\t\t}\n\t}, [ areBlocksHiddenAnywhere ] );\n\n\tif (\n\t\t! areBlocksHiddenAnywhere &&\n\t\t! hasBlockVisibilityButtonShownRef.current\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-visibility-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled={ ! canToggleBlockVisibility }\n\t\t\t\t\ticon={ areBlocksHiddenAnywhere ? unseen : seen }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tareBlocksHiddenAnywhere\n\t\t\t\t\t\t\t? __( 'Hidden' )\n\t\t\t\t\t\t\t: __( 'Visible' )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => setIsModalOpen( true ) }\n\t\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\t\taria-haspopup={ ! isModalOpen ? 'dialog' : undefined }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockVisibilityModal\n\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\tonClose={ () => setIsModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n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AAE,cAAc,WAAW;AAAA;AAAA,IAC5C,GACD;AAAA,IACE,eACD;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,SAAU,MAAM,eAAgB,KAAM;AAAA;AAAA,IACvC;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": ["blockEditorStore"]
|
|
7
|
+
}
|
|
@@ -73,25 +73,29 @@ function ButtonBlockAppender({ rootClientId, className, onFocus, tabIndex, onSel
|
|
|
73
73
|
"Add block",
|
|
74
74
|
"Generic label for block inserter button"
|
|
75
75
|
);
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
76
|
+
return (
|
|
77
|
+
// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.
|
|
78
|
+
// eslint-disable-next-line @wordpress/components-no-unsafe-button-disabled
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_components.Button,
|
|
81
|
+
{
|
|
82
|
+
__next40pxDefaultSize: true,
|
|
83
|
+
ref,
|
|
84
|
+
onFocus,
|
|
85
|
+
tabIndex,
|
|
86
|
+
className: (0, import_clsx.default)(
|
|
87
|
+
className,
|
|
88
|
+
"block-editor-button-block-appender"
|
|
89
|
+
),
|
|
90
|
+
onClick: onToggle,
|
|
91
|
+
"aria-haspopup": isToggleButton ? "true" : void 0,
|
|
92
|
+
"aria-expanded": isToggleButton ? isOpen : void 0,
|
|
93
|
+
disabled,
|
|
94
|
+
label,
|
|
95
|
+
showTooltip: true,
|
|
96
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.Icon, { icon: import_icons.plus })
|
|
97
|
+
}
|
|
98
|
+
)
|
|
95
99
|
);
|
|
96
100
|
},
|
|
97
101
|
isAppender: true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/button-block-appender/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex, onSelect },\n\tref\n) {\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\tonSelectOrClose={ ( ...args ) => {\n\t\t\t\tif ( onSelect && typeof onSelect === 'function' ) {\n\t\t\t\t\tonSelect( ...args );\n\t\t\t\t}\n\t\t\t} }\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\t\t\t\tconst label = hasSingleBlockType\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Add %s',\n\t\t\t\t\t\t\t\t'directly add the only allowed block'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockTitle\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAAuB;AACvB,qBAA2B;AAC3B,kBAA4B;AAC5B,mBAA2B;AAC3B,wBAAuB;AAKvB,sBAAqB;AAyDf;AAvDN,SAAS,oBACR,EAAE,cAAc,WAAW,SAAS,UAAU,SAAS,GACvD,KACC;AACD,SACC;AAAA,IAAC,gBAAAA;AAAA,IAAA;AAAA,MACA,UAAS;AAAA,MACT;AAAA,MACA,uBAAqB;AAAA,MACrB,iBAAkB,IAAK,SAAU;AAChC,YAAK,YAAY,OAAO,aAAa,YAAa;AACjD,mBAAU,GAAG,IAAK;AAAA,QACnB;AAAA,MACD;AAAA,MACA,cAAe,CAAE;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,MAAO;AACN,cAAM,iBAAiB,CAAE;AACzB,cAAM,QAAQ,yBACX;AAAA;AAAA,cAEA;AAAA,YACC;AAAA,YACA;AAAA,UACD;AAAA,UACA;AAAA,QACA,QACA;AAAA,UACA;AAAA,UACA;AAAA,QACA;AAEH,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex, onSelect },\n\tref\n) {\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\tonSelectOrClose={ ( ...args ) => {\n\t\t\t\tif ( onSelect && typeof onSelect === 'function' ) {\n\t\t\t\t\tonSelect( ...args );\n\t\t\t\t}\n\t\t\t} }\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\t\t\t\tconst label = hasSingleBlockType\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Add %s',\n\t\t\t\t\t\t\t\t'directly add the only allowed block'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockTitle\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.\n\t\t\t\t\t// eslint-disable-next-line @wordpress/components-no-unsafe-button-disabled\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ plus } />\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t\tisAppender\n\t\t/>\n\t);\n}\n\n/**\n * Use `ButtonBlockAppender` instead.\n *\n * @deprecated\n */\nexport const ButtonBlockerAppender = forwardRef( ( props, ref ) => {\n\tdeprecated( `wp.blockEditor.ButtonBlockerAppender`, {\n\t\talternative: 'wp.blockEditor.ButtonBlockAppender',\n\t\tsince: '5.9',\n\t} );\n\n\treturn ButtonBlockAppender( props, ref );\n} );\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md\n */\nexport default forwardRef( ButtonBlockAppender );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAAuB;AACvB,qBAA2B;AAC3B,kBAA4B;AAC5B,mBAA2B;AAC3B,wBAAuB;AAKvB,sBAAqB;AAyDf;AAvDN,SAAS,oBACR,EAAE,cAAc,WAAW,SAAS,UAAU,SAAS,GACvD,KACC;AACD,SACC;AAAA,IAAC,gBAAAA;AAAA,IAAA;AAAA,MACA,UAAS;AAAA,MACT;AAAA,MACA,uBAAqB;AAAA,MACrB,iBAAkB,IAAK,SAAU;AAChC,YAAK,YAAY,OAAO,aAAa,YAAa;AACjD,mBAAU,GAAG,IAAK;AAAA,QACnB;AAAA,MACD;AAAA,MACA,cAAe,CAAE;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,MAAO;AACN,cAAM,iBAAiB,CAAE;AACzB,cAAM,QAAQ,yBACX;AAAA;AAAA,cAEA;AAAA,YACC;AAAA,YACA;AAAA,UACD;AAAA,UACA;AAAA,QACA,QACA;AAAA,UACA;AAAA,UACA;AAAA,QACA;AAEH;AAAA;AAAA;AAAA,UAGC;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB;AAAA,cACA;AAAA,cACA;AAAA,cACA,eAAY,YAAAC;AAAA,gBACX;AAAA,gBACA;AAAA,cACD;AAAA,cACA,SAAU;AAAA,cACV,iBAAgB,iBAAiB,SAAS;AAAA,cAC1C,iBAAgB,iBAAiB,SAAS;AAAA,cAC1C;AAAA,cACA;AAAA,cACA,aAAW;AAAA,cAEX,sDAAC,qBAAK,MAAO,mBAAO;AAAA;AAAA,UACrB;AAAA;AAAA,MAEF;AAAA,MACA,YAAU;AAAA;AAAA,EACX;AAEF;AAOO,IAAM,4BAAwB,2BAAY,CAAE,OAAO,QAAS;AAClE,wBAAAC,SAAY,wCAAwC;AAAA,IACnD,aAAa;AAAA,IACb,OAAO;AAAA,EACR,CAAE;AAEF,SAAO,oBAAqB,OAAO,GAAI;AACxC,CAAE;AAKF,IAAO,oCAAQ,2BAAY,mBAAoB;",
|
|
6
6
|
"names": ["Inserter", "clsx", "deprecated"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/font-sizes/font-size-picker.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { FontSizePicker as BaseFontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nfunction FontSizePicker( props ) {\n\tconst [ fontSizes, customFontSize ] = useSettings(\n\t\t'typography.fontSizes',\n\t\t'typography.customFontSize'\n\t);\n\n\treturn (\n\t\t<BaseFontSizePicker\n\t\t\t{ ...props }\n\t\t\tfontSizes={ fontSizes }\n\t\t\tdisableCustomFontSizes={ ! customFontSize }\n\t\t/>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md\n */\nexport default FontSizePicker;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AAKrD,0BAA4B;AAS1B;AAPF,SAAS,eAAgB,OAAQ;AAChC,QAAM,CAAE,WAAW,cAAe,QAAI;AAAA,IACrC;AAAA,IACA;AAAA,EACD;AAEA,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACL;AAAA,MACA,wBAAyB,CAAE;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { FontSizePicker as BaseFontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\n\nfunction FontSizePicker( props ) {\n\tconst [ fontSizes, customFontSize ] = useSettings(\n\t\t'typography.fontSizes',\n\t\t'typography.customFontSize'\n\t);\n\n\treturn (\n\t\t<BaseFontSizePicker\n\t\t\t{ ...props }\n\t\t\tfontSizes={ fontSizes }\n\t\t\tdisableCustomFontSizes={ ! customFontSize }\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md\n */\nexport default FontSizePicker;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AAKrD,0BAA4B;AAS1B;AAPF,SAAS,eAAgB,OAAQ;AAChC,QAAM,CAAE,WAAW,cAAe,QAAI;AAAA,IACrC;AAAA,IACA;AAAA,EACD;AAEA,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACL;AAAA,MACA,wBAAyB,CAAE;AAAA,MAC3B,uBAAqB;AAAA;AAAA,EACtB;AAEF;AAKA,IAAO,2BAAQ;",
|
|
6
6
|
"names": ["BaseFontSizePicker"]
|
|
7
7
|
}
|
|
@@ -33,7 +33,7 @@ __export(use_inner_block_template_sync_exports, {
|
|
|
33
33
|
default: () => useInnerBlockTemplateSync
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(use_inner_block_template_sync_exports);
|
|
36
|
-
var import_es6 = __toESM(require("fast-deep-equal/es6"));
|
|
36
|
+
var import_es6 = __toESM(require("fast-deep-equal/es6/index.js"));
|
|
37
37
|
var import_element = require("@wordpress/element");
|
|
38
38
|
var import_data = require("@wordpress/data");
|
|
39
39
|
var import_blocks = require("@wordpress/blocks");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inner-blocks/use-inner-block-template-sync.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useLayoutEffect } from '@wordpress/element';\nimport { useRegistry } from '@wordpress/data';\nimport { synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * This hook makes sure that a block's inner blocks stay in sync with the given\n * block \"template\". The template is a block hierarchy to which inner blocks must\n * conform. If the blocks get \"out of sync\" with the template and the template\n * is meant to be locked (e.g. templateLock = \"all\" or templateLock = \"contentOnly\"),\n * then we replace the inner blocks with the correct value after synchronizing it with the template.\n *\n * @param {string} clientId The block client ID.\n * @param {Object} template The template to match.\n * @param {string} templateLock The template lock state for the inner blocks. For\n * example, if the template lock is set to \"all\",\n * then the inner blocks will stay in sync with the\n * template. If not defined or set to false, then\n * the inner blocks will not be synchronized with\n * the given template.\n * @param {boolean} templateInsertUpdatesSelection Whether or not to update the\n * block-editor selection state when inner blocks\n * are replaced after template synchronization.\n */\nexport default function useInnerBlockTemplateSync(\n\tclientId,\n\ttemplate,\n\ttemplateLock,\n\ttemplateInsertUpdatesSelection\n) {\n\t// Instead of adding a useSelect mapping here, please add to the useSelect\n\t// mapping in InnerBlocks! Every subscription impacts performance.\n\tconst registry = useRegistry();\n\n\t// Maintain a reference to the previous value so we can do a deep equality check.\n\tconst existingTemplateRef = useRef( null );\n\n\tuseLayoutEffect( () => {\n\t\tlet isCancelled = false;\n\n\t\tconst {\n\t\t\tgetBlocks,\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisBlockSelected,\n\t\t} = registry.select( blockEditorStore );\n\t\tconst { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t// There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate\n\t\t// The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization),\n\t\t// we need to schedule this one in a microtask as well.\n\t\t// Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter.\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( isCancelled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only synchronize innerBlocks with template if innerBlocks are empty\n\t\t\t// or a locking \"all\" or \"contentOnly\" exists directly on the block.\n\t\t\tconst currentInnerBlocks = getBlocks( clientId );\n\t\t\tconst shouldApplyTemplate =\n\t\t\t\tcurrentInnerBlocks.length === 0 ||\n\t\t\t\ttemplateLock === 'all' ||\n\t\t\t\ttemplateLock === 'contentOnly';\n\n\t\t\tconst hasTemplateChanged = ! fastDeepEqual(\n\t\t\t\ttemplate,\n\t\t\t\texistingTemplateRef.current\n\t\t\t);\n\n\t\t\tif ( ! shouldApplyTemplate || ! hasTemplateChanged ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\texistingTemplateRef.current = template;\n\t\t\tconst nextBlocks = synchronizeBlocksWithTemplate(\n\t\t\t\tcurrentInnerBlocks,\n\t\t\t\ttemplate\n\t\t\t);\n\n\t\t\tif ( ! fastDeepEqual( nextBlocks, currentInnerBlocks ) ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\tclientId,\n\t\t\t\t\tnextBlocks,\n\t\t\t\t\tcurrentInnerBlocks.length === 0 &&\n\t\t\t\t\t\ttemplateInsertUpdatesSelection &&\n\t\t\t\t\t\tnextBlocks.length !== 0 &&\n\t\t\t\t\t\tisBlockSelected( clientId ),\n\t\t\t\t\t// This ensures the \"initialPosition\" doesn't change when applying the template\n\t\t\t\t\t// If we're supposed to focus the block, we'll focus the first inner block\n\t\t\t\t\t// otherwise, we won't apply any auto-focus.\n\t\t\t\t\t// This ensures for instance that the focus stays in the inserter when inserting the \"buttons\" block.\n\t\t\t\t\tgetSelectedBlocksInitialCaretPosition()\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCancelled = true;\n\t\t};\n\t}, [\n\t\ttemplate,\n\t\ttemplateLock,\n\t\tclientId,\n\t\tregistry,\n\t\ttemplateInsertUpdatesSelection,\n\t] );\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useLayoutEffect } from '@wordpress/element';\nimport { useRegistry } from '@wordpress/data';\nimport { synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * This hook makes sure that a block's inner blocks stay in sync with the given\n * block \"template\". The template is a block hierarchy to which inner blocks must\n * conform. If the blocks get \"out of sync\" with the template and the template\n * is meant to be locked (e.g. templateLock = \"all\" or templateLock = \"contentOnly\"),\n * then we replace the inner blocks with the correct value after synchronizing it with the template.\n *\n * @param {string} clientId The block client ID.\n * @param {Object} template The template to match.\n * @param {string} templateLock The template lock state for the inner blocks. For\n * example, if the template lock is set to \"all\",\n * then the inner blocks will stay in sync with the\n * template. If not defined or set to false, then\n * the inner blocks will not be synchronized with\n * the given template.\n * @param {boolean} templateInsertUpdatesSelection Whether or not to update the\n * block-editor selection state when inner blocks\n * are replaced after template synchronization.\n */\nexport default function useInnerBlockTemplateSync(\n\tclientId,\n\ttemplate,\n\ttemplateLock,\n\ttemplateInsertUpdatesSelection\n) {\n\t// Instead of adding a useSelect mapping here, please add to the useSelect\n\t// mapping in InnerBlocks! Every subscription impacts performance.\n\tconst registry = useRegistry();\n\n\t// Maintain a reference to the previous value so we can do a deep equality check.\n\tconst existingTemplateRef = useRef( null );\n\n\tuseLayoutEffect( () => {\n\t\tlet isCancelled = false;\n\n\t\tconst {\n\t\t\tgetBlocks,\n\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\tisBlockSelected,\n\t\t} = registry.select( blockEditorStore );\n\t\tconst { replaceInnerBlocks, __unstableMarkNextChangeAsNotPersistent } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t// There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate\n\t\t// The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization),\n\t\t// we need to schedule this one in a microtask as well.\n\t\t// Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter.\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( isCancelled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only synchronize innerBlocks with template if innerBlocks are empty\n\t\t\t// or a locking \"all\" or \"contentOnly\" exists directly on the block.\n\t\t\tconst currentInnerBlocks = getBlocks( clientId );\n\t\t\tconst shouldApplyTemplate =\n\t\t\t\tcurrentInnerBlocks.length === 0 ||\n\t\t\t\ttemplateLock === 'all' ||\n\t\t\t\ttemplateLock === 'contentOnly';\n\n\t\t\tconst hasTemplateChanged = ! fastDeepEqual(\n\t\t\t\ttemplate,\n\t\t\t\texistingTemplateRef.current\n\t\t\t);\n\n\t\t\tif ( ! shouldApplyTemplate || ! hasTemplateChanged ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\texistingTemplateRef.current = template;\n\t\t\tconst nextBlocks = synchronizeBlocksWithTemplate(\n\t\t\t\tcurrentInnerBlocks,\n\t\t\t\ttemplate\n\t\t\t);\n\n\t\t\tif ( ! fastDeepEqual( nextBlocks, currentInnerBlocks ) ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\tclientId,\n\t\t\t\t\tnextBlocks,\n\t\t\t\t\tcurrentInnerBlocks.length === 0 &&\n\t\t\t\t\t\ttemplateInsertUpdatesSelection &&\n\t\t\t\t\t\tnextBlocks.length !== 0 &&\n\t\t\t\t\t\tisBlockSelected( clientId ),\n\t\t\t\t\t// This ensures the \"initialPosition\" doesn't change when applying the template\n\t\t\t\t\t// If we're supposed to focus the block, we'll focus the first inner block\n\t\t\t\t\t// otherwise, we won't apply any auto-focus.\n\t\t\t\t\t// This ensures for instance that the focus stays in the inserter when inserting the \"buttons\" block.\n\t\t\t\t\tgetSelectedBlocksInitialCaretPosition()\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCancelled = true;\n\t\t};\n\t}, [\n\t\ttemplate,\n\t\ttemplateLock,\n\t\tclientId,\n\t\tregistry,\n\t\ttemplateInsertUpdatesSelection,\n\t] );\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAA0B;AAK1B,qBAAwC;AACxC,kBAA4B;AAC5B,oBAA8C;AAK9C,mBAA0C;AAqB3B,SAAR,0BACN,UACA,UACA,cACA,gCACC;AAGD,QAAM,eAAW,yBAAY;AAG7B,QAAM,0BAAsB,uBAAQ,IAAK;AAEzC,sCAAiB,MAAM;AACtB,QAAI,cAAc;AAElB,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,SAAS,OAAQ,aAAAA,KAAiB;AACtC,UAAM,EAAE,oBAAoB,wCAAwC,IACnE,SAAS,SAAU,aAAAA,KAAiB;AAMrC,WAAO,eAAgB,MAAM;AAC5B,UAAK,aAAc;AAClB;AAAA,MACD;AAIA,YAAM,qBAAqB,UAAW,QAAS;AAC/C,YAAM,sBACL,mBAAmB,WAAW,KAC9B,iBAAiB,SACjB,iBAAiB;AAElB,YAAM,qBAAqB,KAAE,WAAAC;AAAA,QAC5B;AAAA,QACA,oBAAoB;AAAA,MACrB;AAEA,UAAK,CAAE,uBAAuB,CAAE,oBAAqB;AACpD;AAAA,MACD;AAEA,0BAAoB,UAAU;AAC9B,YAAM,iBAAa;AAAA,QAClB;AAAA,QACA;AAAA,MACD;AAEA,UAAK,KAAE,WAAAA,SAAe,YAAY,kBAAmB,GAAI;AACxD,gDAAwC;AACxC;AAAA,UACC;AAAA,UACA;AAAA,UACA,mBAAmB,WAAW,KAC7B,kCACA,WAAW,WAAW,KACtB,gBAAiB,QAAS;AAAA;AAAA;AAAA;AAAA;AAAA,UAK3B,sCAAsC;AAAA,QACvC;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,MAAM;AACZ,oBAAc;AAAA,IACf;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
|
|
6
6
|
"names": ["blockEditorStore", "fastDeepEqual"]
|
|
7
7
|
}
|
|
@@ -87,6 +87,8 @@ function InserterMenu({
|
|
|
87
87
|
const [patternFilter, setPatternFilter] = (0, import_element.useState)("all");
|
|
88
88
|
const [selectedMediaCategory, setSelectedMediaCategory] = (0, import_element.useState)(null);
|
|
89
89
|
const isLargeViewport = (0, import_compose.useViewportMatch)("large");
|
|
90
|
+
const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<");
|
|
91
|
+
const maybeCloseInserter = isMobileViewport ? onClose : NOOP;
|
|
90
92
|
function getInitialTab() {
|
|
91
93
|
if (__experimentalInitialTab) {
|
|
92
94
|
return __experimentalInitialTab;
|
|
@@ -116,6 +118,7 @@ function InserterMenu({
|
|
|
116
118
|
_rootClientId
|
|
117
119
|
);
|
|
118
120
|
onSelect(blocks);
|
|
121
|
+
maybeCloseInserter();
|
|
119
122
|
window.requestAnimationFrame(() => {
|
|
120
123
|
if (!shouldFocusBlock && !blockTypesTabRef.current?.contains(
|
|
121
124
|
ref.current.ownerDocument.activeElement
|
|
@@ -124,15 +127,16 @@ function InserterMenu({
|
|
|
124
127
|
}
|
|
125
128
|
});
|
|
126
129
|
},
|
|
127
|
-
[onInsertBlocks, onSelect, shouldFocusBlock]
|
|
130
|
+
[onInsertBlocks, maybeCloseInserter, onSelect, ref, shouldFocusBlock]
|
|
128
131
|
);
|
|
129
132
|
const onInsertPattern = (0, import_element.useCallback)(
|
|
130
133
|
(blocks, patternName, ...args) => {
|
|
131
134
|
onToggleInsertionPoint(false);
|
|
132
135
|
onInsertBlocks(blocks, { patternName }, ...args);
|
|
133
136
|
onSelect();
|
|
137
|
+
maybeCloseInserter();
|
|
134
138
|
},
|
|
135
|
-
[onInsertBlocks, onSelect]
|
|
139
|
+
[onInsertBlocks, maybeCloseInserter, onSelect, onToggleInsertionPoint]
|
|
136
140
|
);
|
|
137
141
|
const onHover = (0, import_element.useCallback)(
|
|
138
142
|
(item) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inserter/menu.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput, useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviews } from './block-patterns-tab/pattern-category-previews';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport TabbedSidebar from '../tabbed-sidebar';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\nimport { unlock } from '../../lock-unlock';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\tonPatternCategorySelection,\n\t\tonClose,\n\t\t__experimentalInitialTab,\n\t\t__experimentalInitialCategory,\n\t},\n\tref\n) {\n\tconst { isZoomOutMode, hasSectionRootClientId } = useSelect( ( select ) => {\n\t\tconst { isZoomOut, getSectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\treturn {\n\t\t\tisZoomOutMode: isZoomOut(),\n\t\t\thasSectionRootClientId: !! getSectionRootClientId(),\n\t\t};\n\t}, [] );\n\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] = useState(\n\t\t__experimentalInitialCategory\n\t);\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\n\tfunction getInitialTab() {\n\t\tif ( __experimentalInitialTab ) {\n\t\t\treturn __experimentalInitialTab;\n\t\t}\n\n\t\tif ( isZoomOutMode ) {\n\t\t\treturn 'patterns';\n\t\t}\n\n\t\treturn 'blocks';\n\t}\n\tconst [ selectedTab, setSelectedTab ] = useState( getInitialTab() );\n\n\tconst shouldUseZoomOut =\n\t\thasSectionRootClientId &&\n\t\t( selectedTab === 'patterns' || selectedTab === 'media' );\n\n\tuseZoomOut( shouldUseZoomOut && isLargeViewport );\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst blockTypesTabRef = useRef();\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock, _rootClientId ) => {\n\t\t\tonInsertBlocks(\n\t\t\t\tblocks,\n\t\t\t\tmeta,\n\t\t\t\tshouldForceFocusBlock,\n\t\t\t\t_rootClientId\n\t\t\t);\n\t\t\tonSelect( blocks );\n\n\t\t\t// Check for focus loss due to filtering blocks by selected block type\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tif (\n\t\t\t\t\t! shouldFocusBlock &&\n\t\t\t\t\t! blockTypesTabRef.current?.contains(\n\t\t\t\t\t\tref.current.ownerDocument.activeElement\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// There has been a focus loss, so focus the first button in the block types tab\n\t\t\t\t\tblockTypesTabRef.current?.querySelector( 'button' ).focus();\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[ onInsertBlocks, onSelect, shouldFocusBlock ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName, ...args ) => {\n\t\t\tonToggleInsertionPoint( false );\n\t\t\tonInsertBlocks( blocks, { patternName }, ...args );\n\t\t\tonSelect();\n\t\t},\n\t\t[ onInsertBlocks, onSelect ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tonPatternCategorySelection?.();\n\t\t},\n\t\t[ setSelectedPatternCategory, onPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\t!! selectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo( () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\tref={ blockTypesTabRef }\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tonHover,\n\t\tshowMostUsedBlocks,\n\t\tshowInserterHelpPanel,\n\t] );\n\n\tconst patternsTab = useMemo( () => {\n\t\treturn (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviews\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsertPattern,\n\t\tonClickPatternCategory,\n\t\tpatternFilter,\n\t\tselectedPatternCategory,\n\t\tshowPatternPanel,\n\t] );\n\n\tconst mediaTab = useMemo( () => {\n\t\treturn (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tselectedMediaCategory,\n\t\tsetSelectedMediaCategory,\n\t\tshowMediaPanel,\n\t] );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t\t'is-zoom-out': isZoomOutMode,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<TabbedSidebar\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\tselectedTab={ selectedTab }\n\t\t\t\t\tcloseButtonLabel={ __( 'Close Block Inserter' ) }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'blocks',\n\t\t\t\t\t\t\ttitle: __( 'Blocks' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'blocks' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tblocksTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'patterns',\n\t\t\t\t\t\t\ttitle: __( 'Patterns' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'patterns' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tpatternsTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t\t\ttitle: __( 'Media' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ mediaTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const PrivateInserterMenu = forwardRef( InserterMenu );\n\nfunction PublicInserterMenu( props, ref ) {\n\treturn (\n\t\t<PrivateInserterMenu\n\t\t\t{ ...props }\n\t\t\tonPatternCategorySelection={ NOOP }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( PublicInserterMenu );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAOO;AACP,wBAAuD;AACvD,kBAAmB;AACnB,qBAAoD;AACpD,kBAA0B;AAK1B,kBAAiB;AACjB,2BAAiC;AACjC,6BAA0B;AAC1B,gCAA6B;AAC7B,uCAAwC;AACxC,uBAA6C;AAC7C,4BAAkC;AAClC,iCAA8B;AAC9B,mBAA0C;AAC1C,4BAA0B;AAC1B,0BAA2B;AAC3B,yBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDebouncedInput, useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Tips from './tips';\nimport InserterPreviewPanel from './preview-panel';\nimport BlockTypesTab from './block-types-tab';\nimport BlockPatternsTab from './block-patterns-tab';\nimport { PatternCategoryPreviews } from './block-patterns-tab/pattern-category-previews';\nimport { MediaTab, MediaCategoryPanel } from './media-tab';\nimport InserterSearchResults from './search-results';\nimport useInsertionPoint from './hooks/use-insertion-point';\nimport { store as blockEditorStore } from '../../store';\nimport TabbedSidebar from '../tabbed-sidebar';\nimport { useZoomOut } from '../../hooks/use-zoom-out';\nimport { unlock } from '../../lock-unlock';\n\nconst NOOP = () => {};\nfunction InserterMenu(\n\t{\n\t\trootClientId,\n\t\tclientId,\n\t\tisAppender,\n\t\t__experimentalInsertionIndex,\n\t\tonSelect,\n\t\tshowInserterHelpPanel,\n\t\tshowMostUsedBlocks,\n\t\t__experimentalFilterValue = '',\n\t\tshouldFocusBlock = true,\n\t\tonPatternCategorySelection,\n\t\tonClose,\n\t\t__experimentalInitialTab,\n\t\t__experimentalInitialCategory,\n\t},\n\tref\n) {\n\tconst { isZoomOutMode, hasSectionRootClientId } = useSelect( ( select ) => {\n\t\tconst { isZoomOut, getSectionRootClientId } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\treturn {\n\t\t\tisZoomOutMode: isZoomOut(),\n\t\t\thasSectionRootClientId: !! getSectionRootClientId(),\n\t\t};\n\t}, [] );\n\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( __experimentalFilterValue );\n\tconst [ hoveredItem, setHoveredItem ] = useState( null );\n\tconst [ selectedPatternCategory, setSelectedPatternCategory ] = useState(\n\t\t__experimentalInitialCategory\n\t);\n\tconst [ patternFilter, setPatternFilter ] = useState( 'all' );\n\tconst [ selectedMediaCategory, setSelectedMediaCategory ] =\n\t\tuseState( null );\n\tconst isLargeViewport = useViewportMatch( 'large' );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst maybeCloseInserter = isMobileViewport ? onClose : NOOP;\n\n\tfunction getInitialTab() {\n\t\tif ( __experimentalInitialTab ) {\n\t\t\treturn __experimentalInitialTab;\n\t\t}\n\n\t\tif ( isZoomOutMode ) {\n\t\t\treturn 'patterns';\n\t\t}\n\n\t\treturn 'blocks';\n\t}\n\tconst [ selectedTab, setSelectedTab ] = useState( getInitialTab() );\n\n\tconst shouldUseZoomOut =\n\t\thasSectionRootClientId &&\n\t\t( selectedTab === 'patterns' || selectedTab === 'media' );\n\n\tuseZoomOut( shouldUseZoomOut && isLargeViewport );\n\n\tconst [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =\n\t\tuseInsertionPoint( {\n\t\t\trootClientId,\n\t\t\tclientId,\n\t\t\tisAppender,\n\t\t\tinsertionIndex: __experimentalInsertionIndex,\n\t\t\tshouldFocusBlock,\n\t\t} );\n\tconst blockTypesTabRef = useRef();\n\n\tconst onInsert = useCallback(\n\t\t( blocks, meta, shouldForceFocusBlock, _rootClientId ) => {\n\t\t\tonInsertBlocks(\n\t\t\t\tblocks,\n\t\t\t\tmeta,\n\t\t\t\tshouldForceFocusBlock,\n\t\t\t\t_rootClientId\n\t\t\t);\n\t\t\tonSelect( blocks );\n\t\t\tmaybeCloseInserter();\n\n\t\t\t// Check for focus loss due to filtering blocks by selected block type\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tif (\n\t\t\t\t\t! shouldFocusBlock &&\n\t\t\t\t\t! blockTypesTabRef.current?.contains(\n\t\t\t\t\t\tref.current.ownerDocument.activeElement\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\t// There has been a focus loss, so focus the first button in the block types tab\n\t\t\t\t\tblockTypesTabRef.current?.querySelector( 'button' ).focus();\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\t[ onInsertBlocks, maybeCloseInserter, onSelect, ref, shouldFocusBlock ]\n\t);\n\n\tconst onInsertPattern = useCallback(\n\t\t( blocks, patternName, ...args ) => {\n\t\t\tonToggleInsertionPoint( false );\n\t\t\tonInsertBlocks( blocks, { patternName }, ...args );\n\t\t\tonSelect();\n\t\t\tmaybeCloseInserter();\n\t\t},\n\t\t[ onInsertBlocks, maybeCloseInserter, onSelect, onToggleInsertionPoint ]\n\t);\n\n\tconst onHover = useCallback(\n\t\t( item ) => {\n\t\t\tonToggleInsertionPoint( item );\n\t\t\tsetHoveredItem( item );\n\t\t},\n\t\t[ onToggleInsertionPoint, setHoveredItem ]\n\t);\n\n\tconst onClickPatternCategory = useCallback(\n\t\t( patternCategory, filter ) => {\n\t\t\tsetSelectedPatternCategory( patternCategory );\n\t\t\tsetPatternFilter( filter );\n\t\t\tonPatternCategorySelection?.();\n\t\t},\n\t\t[ setSelectedPatternCategory, onPatternCategorySelection ]\n\t);\n\n\tconst showPatternPanel =\n\t\tselectedTab === 'patterns' &&\n\t\t! delayedFilterValue &&\n\t\t!! selectedPatternCategory;\n\n\tconst showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory;\n\n\tconst inserterSearch = useMemo( () => {\n\t\tif ( selectedTab === 'media' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SearchControl\n\t\t\t\t\tclassName=\"block-editor-inserter__search\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tif ( hoveredItem ) {\n\t\t\t\t\t\t\tsetHoveredItem( null );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetFilterValue( value );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t\t/>\n\t\t\t\t{ !! delayedFilterValue && (\n\t\t\t\t\t<InserterSearchResults\n\t\t\t\t\t\tfilterValue={ delayedFilterValue }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisAppender={ isAppender }\n\t\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\t\t__experimentalInsertionIndex\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshowBlockDirectory\n\t\t\t\t\t\tshouldFocusBlock={ shouldFocusBlock }\n\t\t\t\t\t\tprioritizePatterns={ selectedTab === 'patterns' }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tselectedTab,\n\t\thoveredItem,\n\t\tsetHoveredItem,\n\t\tsetFilterValue,\n\t\tfilterValue,\n\t\tdelayedFilterValue,\n\t\tonSelect,\n\t\tonHover,\n\t\tshouldFocusBlock,\n\t\tclientId,\n\t\trootClientId,\n\t\t__experimentalInsertionIndex,\n\t\tisAppender,\n\t] );\n\n\tconst blocksTab = useMemo( () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-inserter__block-list\">\n\t\t\t\t\t<BlockTypesTab\n\t\t\t\t\t\tref={ blockTypesTabRef }\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ showInserterHelpPanel && (\n\t\t\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t\t\t<VisuallyHidden as=\"h2\">\n\t\t\t\t\t\t\t{ __( 'A tip for using the block editor' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t<Tips />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tonHover,\n\t\tshowMostUsedBlocks,\n\t\tshowInserterHelpPanel,\n\t] );\n\n\tconst patternsTab = useMemo( () => {\n\t\treturn (\n\t\t\t<BlockPatternsTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\tonSelectCategory={ onClickPatternCategory }\n\t\t\t\tselectedCategory={ selectedPatternCategory }\n\t\t\t>\n\t\t\t\t{ showPatternPanel && (\n\t\t\t\t\t<PatternCategoryPreviews\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsertPattern }\n\t\t\t\t\t\tcategory={ selectedPatternCategory }\n\t\t\t\t\t\tpatternFilter={ patternFilter }\n\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockPatternsTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsertPattern,\n\t\tonClickPatternCategory,\n\t\tpatternFilter,\n\t\tselectedPatternCategory,\n\t\tshowPatternPanel,\n\t] );\n\n\tconst mediaTab = useMemo( () => {\n\t\treturn (\n\t\t\t<MediaTab\n\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\tselectedCategory={ selectedMediaCategory }\n\t\t\t\tonSelectCategory={ setSelectedMediaCategory }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t>\n\t\t\t\t{ showMediaPanel && (\n\t\t\t\t\t<MediaCategoryPanel\n\t\t\t\t\t\trootClientId={ destinationRootClientId }\n\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\tcategory={ selectedMediaCategory }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</MediaTab>\n\t\t);\n\t}, [\n\t\tdestinationRootClientId,\n\t\tonInsert,\n\t\tselectedMediaCategory,\n\t\tsetSelectedMediaCategory,\n\t\tshowMediaPanel,\n\t] );\n\n\tconst handleSetSelectedTab = ( value ) => {\n\t\t// If no longer on patterns tab remove the category setting.\n\t\tif ( value !== 'patterns' ) {\n\t\t\tsetSelectedPatternCategory( null );\n\t\t}\n\t\tsetSelectedTab( value );\n\t};\n\n\t// Focus first active tab, if any\n\tconst tabsRef = useRef();\n\tuseLayoutEffect( () => {\n\t\tif ( tabsRef.current ) {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\ttabsRef.current\n\t\t\t\t\t.querySelector( '[role=\"tab\"][aria-selected=\"true\"]' )\n\t\t\t\t\t?.focus();\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'block-editor-inserter__menu', {\n\t\t\t\t'show-panel': showPatternPanel || showMediaPanel,\n\t\t\t\t'is-zoom-out': isZoomOutMode,\n\t\t\t} ) }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t<div className=\"block-editor-inserter__main-area\">\n\t\t\t\t<TabbedSidebar\n\t\t\t\t\tref={ tabsRef }\n\t\t\t\t\tonSelect={ handleSetSelectedTab }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\tselectedTab={ selectedTab }\n\t\t\t\t\tcloseButtonLabel={ __( 'Close Block Inserter' ) }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'blocks',\n\t\t\t\t\t\t\ttitle: __( 'Blocks' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'blocks' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tblocksTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'patterns',\n\t\t\t\t\t\t\ttitle: __( 'Patterns' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ selectedTab === 'patterns' &&\n\t\t\t\t\t\t\t\t\t\t! delayedFilterValue &&\n\t\t\t\t\t\t\t\t\t\tpatternsTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t\t\ttitle: __( 'Media' ),\n\t\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ inserterSearch }\n\t\t\t\t\t\t\t\t\t{ mediaTab }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{ showInserterHelpPanel && hoveredItem && (\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-inserter__preview-container__popover\"\n\t\t\t\t\tplacement=\"right-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tanimate={ false }\n\t\t\t\t>\n\t\t\t\t\t<InserterPreviewPanel item={ hoveredItem } />\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const PrivateInserterMenu = forwardRef( InserterMenu );\n\nfunction PublicInserterMenu( props, ref ) {\n\treturn (\n\t\t<PrivateInserterMenu\n\t\t\t{ ...props }\n\t\t\tonPatternCategorySelection={ NOOP }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( PublicInserterMenu );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qB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
|
"names": ["blockEditorStore", "useInsertionPoint", "InserterSearchResults", "BlockTypesTab", "Tips", "BlockPatternsTab", "clsx", "TabbedSidebar", "InserterPreviewPanel"]
|
|
7
7
|
}
|
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// packages/block-editor/src/components/inspector-controls/fill.js
|
|
31
31
|
var fill_exports = {};
|
|
32
32
|
__export(fill_exports, {
|
|
33
|
-
PrivateInspectorControlsFill: () => PrivateInspectorControlsFill,
|
|
34
33
|
default: () => InspectorControlsFill
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(fill_exports);
|
|
@@ -41,12 +40,11 @@ var import_element = require("@wordpress/element");
|
|
|
41
40
|
var import_context = require("../block-edit/context.cjs");
|
|
42
41
|
var import_groups = __toESM(require("./groups.cjs"));
|
|
43
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
function
|
|
43
|
+
function InspectorControlsFill({
|
|
45
44
|
children,
|
|
46
45
|
group = "default",
|
|
47
46
|
__experimentalGroup,
|
|
48
|
-
resetAllFilter
|
|
49
|
-
forceDisplayControls
|
|
47
|
+
resetAllFilter
|
|
50
48
|
}) {
|
|
51
49
|
if (__experimentalGroup) {
|
|
52
50
|
(0, import_deprecated.default)(
|
|
@@ -65,7 +63,8 @@ function PrivateInspectorControlsFill({
|
|
|
65
63
|
(0, import_warning.default)(`Unknown InspectorControls group "${group}" provided.`);
|
|
66
64
|
return null;
|
|
67
65
|
}
|
|
68
|
-
|
|
66
|
+
const shouldDisplayForPatternEditing = context[import_context.mayDisplayPatternEditingControlsKey] && (group === "list" || group === "content");
|
|
67
|
+
if (!context[import_context.mayDisplayControlsKey] && !shouldDisplayForPatternEditing) {
|
|
69
68
|
return null;
|
|
70
69
|
}
|
|
71
70
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalStyleProvider, { document, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fill, { children: (fillProps) => {
|
|
@@ -79,22 +78,6 @@ function PrivateInspectorControlsFill({
|
|
|
79
78
|
);
|
|
80
79
|
} }) });
|
|
81
80
|
}
|
|
82
|
-
function InspectorControlsFill({
|
|
83
|
-
children,
|
|
84
|
-
group = "default",
|
|
85
|
-
__experimentalGroup,
|
|
86
|
-
resetAllFilter
|
|
87
|
-
}) {
|
|
88
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
PrivateInspectorControlsFill,
|
|
90
|
-
{
|
|
91
|
-
group,
|
|
92
|
-
__experimentalGroup,
|
|
93
|
-
resetAllFilter,
|
|
94
|
-
children
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
81
|
function RegisterResetAll({ resetAllFilter, children }) {
|
|
99
82
|
const { registerResetAllFilter, deregisterResetAllFilter } = (0, import_element.useContext)(import_components.__experimentalToolsPanelContext);
|
|
100
83
|
(0, import_element.useEffect)(() => {
|
|
@@ -115,8 +98,4 @@ function ToolsPanelInspectorControl({ children, resetAllFilter, fillProps }) {
|
|
|
115
98
|
innerMarkup
|
|
116
99
|
);
|
|
117
100
|
}
|
|
118
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
-
0 && (module.exports = {
|
|
120
|
-
PrivateInspectorControlsFill
|
|
121
|
-
});
|
|
122
101
|
//# sourceMappingURL=fill.cjs.map
|