@wordpress/interface 9.17.0 → 9.17.1-next.47f435fc9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/action-item/index.js +68 -66
- package/build/components/action-item/index.js.map +7 -1
- package/build/components/complementary-area/index.js +215 -194
- package/build/components/complementary-area/index.js.map +7 -1
- package/build/components/complementary-area-header/index.js +53 -33
- package/build/components/complementary-area-header/index.js.map +7 -1
- package/build/components/complementary-area-more-menu-item/index.js +60 -39
- package/build/components/complementary-area-more-menu-item/index.js.map +7 -1
- package/build/components/complementary-area-toggle/index.js +61 -50
- package/build/components/complementary-area-toggle/index.js.map +7 -1
- package/build/components/fullscreen-mode/index.js +33 -27
- package/build/components/fullscreen-mode/index.js.map +7 -1
- package/build/components/index.js +52 -55
- package/build/components/index.js.map +7 -1
- package/build/components/interface-skeleton/index.js +156 -132
- package/build/components/interface-skeleton/index.js.map +7 -1
- package/build/components/pinned-items/index.js +48 -39
- package/build/components/pinned-items/index.js.map +7 -1
- package/build/index.js +27 -24
- package/build/index.js.map +7 -1
- package/build/store/actions.js +94 -165
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -12
- package/build/store/constants.js.map +7 -1
- package/build/store/deprecated.js +55 -29
- package/build/store/deprecated.js.map +7 -1
- package/build/store/index.js +44 -32
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +49 -51
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +96 -93
- package/build/store/selectors.js.map +7 -1
- package/build-module/components/action-item/index.js +49 -59
- package/build-module/components/action-item/index.js.map +7 -1
- package/build-module/components/complementary-area/index.js +185 -174
- package/build-module/components/complementary-area/index.js.map +7 -1
- package/build-module/components/complementary-area-header/index.js +25 -26
- package/build-module/components/complementary-area-header/index.js.map +7 -1
- package/build-module/components/complementary-area-more-menu-item/index.js +33 -33
- package/build-module/components/complementary-area-more-menu-item/index.js.map +7 -1
- package/build-module/components/complementary-area-toggle/index.js +41 -44
- package/build-module/components/complementary-area-toggle/index.js.map +7 -1
- package/build-module/components/fullscreen-mode/index.js +13 -19
- package/build-module/components/fullscreen-mode/index.js.map +7 -1
- package/build-module/components/index.js +15 -8
- package/build-module/components/index.js.map +7 -1
- package/build-module/components/interface-skeleton/index.js +132 -122
- package/build-module/components/interface-skeleton/index.js.map +7 -1
- package/build-module/components/pinned-items/index.js +20 -32
- package/build-module/components/pinned-items/index.js.map +7 -1
- package/build-module/index.js +6 -3
- package/build-module/index.js.map +7 -1
- package/build-module/store/actions.js +47 -138
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -7
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/deprecated.js +21 -20
- package/build-module/store/deprecated.js.map +7 -1
- package/build-module/store/index.js +10 -22
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +28 -45
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +64 -87
- package/build-module/store/selectors.js.map +7 -1
- package/build-style/style-rtl.css +87 -85
- package/build-style/style.css +87 -85
- package/package.json +21 -15
- package/src/components/complementary-area/style.scss +5 -0
- package/src/components/complementary-area-header/style.scss +3 -0
- package/src/components/fullscreen-mode/style.scss +3 -0
- package/src/components/index.js +0 -1
- package/src/components/interface-skeleton/index.js +1 -5
- package/src/components/interface-skeleton/style.scss +6 -0
- package/src/components/pinned-items/style.scss +3 -0
- package/src/style.scss +6 -5
- package/build/components/index.native.js +0 -21
- package/build/components/index.native.js.map +0 -1
- package/build/components/navigable-region/index.js +0 -38
- package/build/components/navigable-region/index.js.map +0 -1
- package/build-module/components/index.native.js +0 -3
- package/build-module/components/index.native.js.map +0 -1
- package/build-module/components/navigable-region/index.js +0 -30
- package/build-module/components/navigable-region/index.js.map +0 -1
- package/src/components/navigable-region/README.md +0 -36
- package/src/components/navigable-region/index.js +0 -29
package/build/store/reducer.js
CHANGED
|
@@ -1,68 +1,66 @@
|
|
|
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 reducer_exports = {};
|
|
19
|
+
__export(reducer_exports, {
|
|
20
|
+
activeModal: () => activeModal,
|
|
21
|
+
complementaryAreas: () => complementaryAreas,
|
|
22
|
+
default: () => reducer_default
|
|
5
23
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
24
|
+
module.exports = __toCommonJS(reducer_exports);
|
|
25
|
+
var import_data = require("@wordpress/data");
|
|
14
26
|
function complementaryAreas(state = {}, action) {
|
|
15
27
|
switch (action.type) {
|
|
16
|
-
case
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
area
|
|
21
|
-
} = action;
|
|
22
|
-
|
|
23
|
-
// If there's already an area, don't overwrite it.
|
|
24
|
-
if (state[scope]) {
|
|
25
|
-
return state;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
...state,
|
|
29
|
-
[scope]: area
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
case 'ENABLE_COMPLEMENTARY_AREA':
|
|
33
|
-
{
|
|
34
|
-
const {
|
|
35
|
-
scope,
|
|
36
|
-
area
|
|
37
|
-
} = action;
|
|
38
|
-
return {
|
|
39
|
-
...state,
|
|
40
|
-
[scope]: area
|
|
41
|
-
};
|
|
28
|
+
case "SET_DEFAULT_COMPLEMENTARY_AREA": {
|
|
29
|
+
const { scope, area } = action;
|
|
30
|
+
if (state[scope]) {
|
|
31
|
+
return state;
|
|
42
32
|
}
|
|
33
|
+
return {
|
|
34
|
+
...state,
|
|
35
|
+
[scope]: area
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
case "ENABLE_COMPLEMENTARY_AREA": {
|
|
39
|
+
const { scope, area } = action;
|
|
40
|
+
return {
|
|
41
|
+
...state,
|
|
42
|
+
[scope]: area
|
|
43
|
+
};
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
46
|
return state;
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Reducer for storing the name of the open modal, or null if no modal is open.
|
|
49
|
-
*
|
|
50
|
-
* @param {Object} state Previous state.
|
|
51
|
-
* @param {Object} action Action object containing the `name` of the modal
|
|
52
|
-
*
|
|
53
|
-
* @return {Object} Updated state
|
|
54
|
-
*/
|
|
55
48
|
function activeModal(state = null, action) {
|
|
56
49
|
switch (action.type) {
|
|
57
|
-
case
|
|
50
|
+
case "OPEN_MODAL":
|
|
58
51
|
return action.name;
|
|
59
|
-
case
|
|
52
|
+
case "CLOSE_MODAL":
|
|
60
53
|
return null;
|
|
61
54
|
}
|
|
62
55
|
return state;
|
|
63
56
|
}
|
|
64
|
-
var
|
|
57
|
+
var reducer_default = (0, import_data.combineReducers)({
|
|
65
58
|
complementaryAreas,
|
|
66
59
|
activeModal
|
|
67
60
|
});
|
|
68
|
-
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
activeModal,
|
|
64
|
+
complementaryAreas
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/store/reducer.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function complementaryAreas( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEFAULT_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\n\t\t\t// If there's already an area, don't overwrite it.\n\t\t\tif ( state[ scope ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t\tcase 'ENABLE_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n\tactiveModal,\n} );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAgC;AAEzB,SAAS,mBAAoB,QAAQ,CAAC,GAAG,QAAS;AACxD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK,kCAAkC;AACtC,YAAM,EAAE,OAAO,KAAK,IAAI;AAGxB,UAAK,MAAO,KAAM,GAAI;AACrB,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,KAAM,GAAG;AAAA,MACZ;AAAA,IACD;AAAA,IACA,KAAK,6BAA6B;AACjC,YAAM,EAAE,OAAO,KAAK,IAAI;AACxB,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,KAAM,GAAG;AAAA,MACZ;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAUO,SAAS,YAAa,QAAQ,MAAM,QAAS;AACnD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,OAAO;AAAA,IACf,KAAK;AACJ,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAEA,IAAO,sBAAQ,6BAAiB;AAAA,EAC/B;AAAA,EACA;AACD,CAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/store/selectors.js
CHANGED
|
@@ -1,99 +1,102 @@
|
|
|
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 selectors_exports = {};
|
|
29
|
+
__export(selectors_exports, {
|
|
30
|
+
getActiveComplementaryArea: () => getActiveComplementaryArea,
|
|
31
|
+
isComplementaryAreaLoading: () => isComplementaryAreaLoading,
|
|
32
|
+
isFeatureActive: () => isFeatureActive,
|
|
33
|
+
isItemPinned: () => isItemPinned,
|
|
34
|
+
isModalActive: () => isModalActive
|
|
6
35
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* @return {string | null | undefined} The complementary area that is active in the given scope.
|
|
28
|
-
*/
|
|
29
|
-
const getActiveComplementaryArea = exports.getActiveComplementaryArea = (0, _data.createRegistrySelector)(select => (state, scope) => {
|
|
30
|
-
scope = (0, _deprecated2.normalizeComplementaryAreaScope)(scope);
|
|
31
|
-
const isComplementaryAreaVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
|
|
32
|
-
|
|
33
|
-
// Return `undefined` to indicate that the user has never toggled
|
|
34
|
-
// visibility, this is the vanilla default. Other code relies on this
|
|
35
|
-
// nuance in the return value.
|
|
36
|
-
if (isComplementaryAreaVisible === undefined) {
|
|
37
|
-
return undefined;
|
|
36
|
+
module.exports = __toCommonJS(selectors_exports);
|
|
37
|
+
var import_data = require("@wordpress/data");
|
|
38
|
+
var import_deprecated = __toESM(require("@wordpress/deprecated"));
|
|
39
|
+
var import_preferences = require("@wordpress/preferences");
|
|
40
|
+
var import_deprecated2 = require("./deprecated");
|
|
41
|
+
const getActiveComplementaryArea = (0, import_data.createRegistrySelector)(
|
|
42
|
+
(select) => (state, scope) => {
|
|
43
|
+
scope = (0, import_deprecated2.normalizeComplementaryAreaScope)(scope);
|
|
44
|
+
const isComplementaryAreaVisible = select(import_preferences.store).get(
|
|
45
|
+
scope,
|
|
46
|
+
"isComplementaryAreaVisible"
|
|
47
|
+
);
|
|
48
|
+
if (isComplementaryAreaVisible === void 0) {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
if (isComplementaryAreaVisible === false) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return state?.complementaryAreas?.[scope];
|
|
38
55
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
);
|
|
57
|
+
const isComplementaryAreaLoading = (0, import_data.createRegistrySelector)(
|
|
58
|
+
(select) => (state, scope) => {
|
|
59
|
+
scope = (0, import_deprecated2.normalizeComplementaryAreaScope)(scope);
|
|
60
|
+
const isVisible = select(import_preferences.store).get(
|
|
61
|
+
scope,
|
|
62
|
+
"isComplementaryAreaVisible"
|
|
63
|
+
);
|
|
64
|
+
const identifier = state?.complementaryAreas?.[scope];
|
|
65
|
+
return isVisible && identifier === void 0;
|
|
43
66
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Returns a boolean indicating whether a feature is active for a particular
|
|
72
|
-
* scope.
|
|
73
|
-
*
|
|
74
|
-
* @param {Object} state The store state.
|
|
75
|
-
* @param {string} scope The scope of the feature (e.g. core/edit-post).
|
|
76
|
-
* @param {string} featureName The name of the feature.
|
|
77
|
-
*
|
|
78
|
-
* @return {boolean} Is the feature enabled?
|
|
79
|
-
*/
|
|
80
|
-
const isFeatureActive = exports.isFeatureActive = (0, _data.createRegistrySelector)(select => (state, scope, featureName) => {
|
|
81
|
-
(0, _deprecated.default)(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
|
|
82
|
-
since: '6.0',
|
|
83
|
-
alternative: `select( 'core/preferences' ).get( scope, featureName )`
|
|
84
|
-
});
|
|
85
|
-
return !!select(_preferences.store).get(scope, featureName);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Returns true if a modal is active, or false otherwise.
|
|
90
|
-
*
|
|
91
|
-
* @param {Object} state Global application state.
|
|
92
|
-
* @param {string} modalName A string that uniquely identifies the modal.
|
|
93
|
-
*
|
|
94
|
-
* @return {boolean} Whether the modal is active.
|
|
95
|
-
*/
|
|
67
|
+
);
|
|
68
|
+
const isItemPinned = (0, import_data.createRegistrySelector)(
|
|
69
|
+
(select) => (state, scope, item) => {
|
|
70
|
+
scope = (0, import_deprecated2.normalizeComplementaryAreaScope)(scope);
|
|
71
|
+
item = (0, import_deprecated2.normalizeComplementaryAreaName)(scope, item);
|
|
72
|
+
const pinnedItems = select(import_preferences.store).get(
|
|
73
|
+
scope,
|
|
74
|
+
"pinnedItems"
|
|
75
|
+
);
|
|
76
|
+
return pinnedItems?.[item] ?? true;
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const isFeatureActive = (0, import_data.createRegistrySelector)(
|
|
80
|
+
(select) => (state, scope, featureName) => {
|
|
81
|
+
(0, import_deprecated.default)(
|
|
82
|
+
`select( 'core/interface' ).isFeatureActive( scope, featureName )`,
|
|
83
|
+
{
|
|
84
|
+
since: "6.0",
|
|
85
|
+
alternative: `select( 'core/preferences' ).get( scope, featureName )`
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
return !!select(import_preferences.store).get(scope, featureName);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
96
91
|
function isModalActive(state, modalName) {
|
|
97
92
|
return state.activeModal === modalName;
|
|
98
93
|
}
|
|
99
|
-
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
getActiveComplementaryArea,
|
|
97
|
+
isComplementaryAreaLoading,
|
|
98
|
+
isFeatureActive,
|
|
99
|
+
isItemPinned,
|
|
100
|
+
isModalActive
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/store/selectors.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tnormalizeComplementaryAreaScope,\n\tnormalizeComplementaryAreaName,\n} from './deprecated';\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string | null | undefined} The complementary area that is active in the given scope.\n */\nexport const getActiveComplementaryArea = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tscope = normalizeComplementaryAreaScope( scope );\n\t\tconst isComplementaryAreaVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\n\t\t// Return `undefined` to indicate that the user has never toggled\n\t\t// visibility, this is the vanilla default. Other code relies on this\n\t\t// nuance in the return value.\n\t\tif ( isComplementaryAreaVisible === undefined ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Return `null` to indicate the user hid the complementary area.\n\t\tif ( isComplementaryAreaVisible === false ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn state?.complementaryAreas?.[ scope ];\n\t}\n);\n\nexport const isComplementaryAreaLoading = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tscope = normalizeComplementaryAreaScope( scope );\n\t\tconst isVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\t\tconst identifier = state?.complementaryAreas?.[ scope ];\n\n\t\treturn isVisible && identifier === undefined;\n\t}\n);\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport const isItemPinned = createRegistrySelector(\n\t( select ) => ( state, scope, item ) => {\n\t\tscope = normalizeComplementaryAreaScope( scope );\n\t\titem = normalizeComplementaryAreaName( scope, item );\n\t\tconst pinnedItems = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'pinnedItems'\n\t\t);\n\t\treturn pinnedItems?.[ item ] ?? true;\n\t}\n);\n\n/**\n * Returns a boolean indicating whether a feature is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, scope, featureName ) => {\n\t\tdeprecated(\n\t\t\t`select( 'core/interface' ).isFeatureActive( scope, featureName )`,\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative: `select( 'core/preferences' ).get( scope, featureName )`,\n\t\t\t}\n\t\t);\n\n\t\treturn !! select( preferencesStore ).get( scope, featureName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,wBAAuB;AACvB,yBAA0C;AAK1C,IAAAA,qBAGO;AAUA,MAAM,iCAA6B;AAAA,EACzC,CAAE,WAAY,CAAE,OAAO,UAAW;AACjC,gBAAQ,oDAAiC,KAAM;AAC/C,UAAM,6BAA6B,OAAQ,mBAAAC,KAAiB,EAAE;AAAA,MAC7D;AAAA,MACA;AAAA,IACD;AAKA,QAAK,+BAA+B,QAAY;AAC/C,aAAO;AAAA,IACR;AAGA,QAAK,+BAA+B,OAAQ;AAC3C,aAAO;AAAA,IACR;AAEA,WAAO,OAAO,qBAAsB,KAAM;AAAA,EAC3C;AACD;AAEO,MAAM,iCAA6B;AAAA,EACzC,CAAE,WAAY,CAAE,OAAO,UAAW;AACjC,gBAAQ,oDAAiC,KAAM;AAC/C,UAAM,YAAY,OAAQ,mBAAAA,KAAiB,EAAE;AAAA,MAC5C;AAAA,MACA;AAAA,IACD;AACA,UAAM,aAAa,OAAO,qBAAsB,KAAM;AAEtD,WAAO,aAAa,eAAe;AAAA,EACpC;AACD;AAWO,MAAM,mBAAe;AAAA,EAC3B,CAAE,WAAY,CAAE,OAAO,OAAO,SAAU;AACvC,gBAAQ,oDAAiC,KAAM;AAC/C,eAAO,mDAAgC,OAAO,IAAK;AACnD,UAAM,cAAc,OAAQ,mBAAAA,KAAiB,EAAE;AAAA,MAC9C;AAAA,MACA;AAAA,IACD;AACA,WAAO,cAAe,IAAK,KAAK;AAAA,EACjC;AACD;AAYO,MAAM,sBAAkB;AAAA,EAC9B,CAAE,WAAY,CAAE,OAAO,OAAO,gBAAiB;AAC9C,0BAAAC;AAAA,MACC;AAAA,MACA;AAAA,QACC,OAAO;AAAA,QACP,aAAa;AAAA,MACd;AAAA,IACD;AAEA,WAAO,CAAC,CAAE,OAAQ,mBAAAD,KAAiB,EAAE,IAAK,OAAO,WAAY;AAAA,EAC9D;AACD;AAUO,SAAS,cAAe,OAAO,WAAY;AACjD,SAAO,MAAM,gBAAgB;AAC9B;",
|
|
6
|
+
"names": ["import_deprecated", "preferencesStore", "deprecated"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const noop = () => {};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MenuGroup, Button, Slot, Fill } from "@wordpress/components";
|
|
3
|
+
import { Children } from "@wordpress/element";
|
|
4
|
+
const noop = () => {
|
|
5
|
+
};
|
|
8
6
|
function ActionItemSlot({
|
|
9
7
|
name,
|
|
10
8
|
as: Component = MenuGroup,
|
|
@@ -12,65 +10,57 @@ function ActionItemSlot({
|
|
|
12
10
|
bubblesVirtually,
|
|
13
11
|
...props
|
|
14
12
|
}) {
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// Special handling exists for backward compatibility.
|
|
25
|
-
// It ensures that menu items created by plugin authors aren't
|
|
26
|
-
// duplicated with automatically injected menu items coming
|
|
27
|
-
// from pinnable plugin sidebars.
|
|
28
|
-
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
29
|
-
const initializedByPlugins = [];
|
|
30
|
-
Children.forEach(fills, ({
|
|
31
|
-
props: {
|
|
32
|
-
__unstableExplicitMenuItem,
|
|
33
|
-
__unstableTarget
|
|
34
|
-
}
|
|
35
|
-
}) => {
|
|
36
|
-
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
37
|
-
initializedByPlugins.push(__unstableTarget);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const children = Children.map(fills, child => {
|
|
41
|
-
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Slot,
|
|
15
|
+
{
|
|
16
|
+
name,
|
|
17
|
+
bubblesVirtually,
|
|
18
|
+
fillProps,
|
|
19
|
+
children: (fills) => {
|
|
20
|
+
if (!Children.toArray(fills).length) {
|
|
42
21
|
return null;
|
|
43
22
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
const initializedByPlugins = [];
|
|
24
|
+
Children.forEach(
|
|
25
|
+
fills,
|
|
26
|
+
({
|
|
27
|
+
props: { __unstableExplicitMenuItem, __unstableTarget }
|
|
28
|
+
}) => {
|
|
29
|
+
if (__unstableTarget && __unstableExplicitMenuItem) {
|
|
30
|
+
initializedByPlugins.push(__unstableTarget);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
const children = Children.map(fills, (child) => {
|
|
35
|
+
if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(
|
|
36
|
+
child.props.__unstableTarget
|
|
37
|
+
)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return child;
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ jsx(Component, { ...props, children });
|
|
43
|
+
}
|
|
50
44
|
}
|
|
51
|
-
|
|
45
|
+
);
|
|
52
46
|
}
|
|
53
|
-
function ActionItem({
|
|
54
|
-
name,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}) {
|
|
59
|
-
return /*#__PURE__*/_jsx(Fill, {
|
|
60
|
-
name: name,
|
|
61
|
-
children: ({
|
|
62
|
-
onClick: fpOnClick
|
|
63
|
-
}) => {
|
|
64
|
-
return /*#__PURE__*/_jsx(Component, {
|
|
47
|
+
function ActionItem({ name, as: Component = Button, onClick, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(Fill, { name, children: ({ onClick: fpOnClick }) => {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Component,
|
|
51
|
+
{
|
|
65
52
|
onClick: onClick || fpOnClick ? (...args) => {
|
|
66
53
|
(onClick || noop)(...args);
|
|
67
54
|
(fpOnClick || noop)(...args);
|
|
68
|
-
} :
|
|
55
|
+
} : void 0,
|
|
69
56
|
...props
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
});
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
} });
|
|
73
60
|
}
|
|
74
61
|
ActionItem.Slot = ActionItemSlot;
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
var action_item_default = ActionItem;
|
|
63
|
+
export {
|
|
64
|
+
action_item_default as default
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/action-item/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\n\nconst noop = () => {};\n\nfunction ActionItemSlot( {\n\tname,\n\tas: Component = MenuGroup,\n\tfillProps = {},\n\tbubblesVirtually,\n\t...props\n} ) {\n\treturn (\n\t\t<Slot\n\t\t\tname={ name }\n\t\t\tbubblesVirtually={ bubblesVirtually }\n\t\t\tfillProps={ fillProps }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! Children.toArray( fills ).length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Special handling exists for backward compatibility.\n\t\t\t\t// It ensures that menu items created by plugin authors aren't\n\t\t\t\t// duplicated with automatically injected menu items coming\n\t\t\t\t// from pinnable plugin sidebars.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t\tconst initializedByPlugins = [];\n\t\t\t\tChildren.forEach(\n\t\t\t\t\tfills,\n\t\t\t\t\t( {\n\t\t\t\t\t\tprops: { __unstableExplicitMenuItem, __unstableTarget },\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tif ( __unstableTarget && __unstableExplicitMenuItem ) {\n\t\t\t\t\t\t\tinitializedByPlugins.push( __unstableTarget );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst children = Children.map( fills, ( child ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! child.props.__unstableExplicitMenuItem &&\n\t\t\t\t\t\tinitializedByPlugins.includes(\n\t\t\t\t\t\t\tchild.props.__unstableTarget\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t} );\n\n\t\t\t\treturn <Component { ...props }>{ children }</Component>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nfunction ActionItem( { name, as: Component = Button, onClick, ...props } ) {\n\treturn (\n\t\t<Fill name={ name }>\n\t\t\t{ ( { onClick: fpOnClick } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tonClick || fpOnClick\n\t\t\t\t\t\t\t\t? ( ...args ) => {\n\t\t\t\t\t\t\t\t\t\t( onClick || noop )( ...args );\n\t\t\t\t\t\t\t\t\t\t( fpOnClick || noop )( ...args );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Fill>\n\t);\n}\n\nActionItem.Slot = ActionItemSlot;\n\nexport default ActionItem;\n"],
|
|
5
|
+
"mappings": "AAsDW;AAnDX,SAAS,WAAW,QAAQ,MAAM,YAAY;AAC9C,SAAS,gBAAgB;AAEzB,MAAM,OAAO,MAAM;AAAC;AAEpB,SAAS,eAAgB;AAAA,EACxB;AAAA,EACA,IAAI,YAAY;AAAA,EAChB,YAAY,CAAC;AAAA,EACb;AAAA,EACA,GAAG;AACJ,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEE,WAAE,UAAW;AACd,YAAK,CAAE,SAAS,QAAS,KAAM,EAAE,QAAS;AACzC,iBAAO;AAAA,QACR;AAOA,cAAM,uBAAuB,CAAC;AAC9B,iBAAS;AAAA,UACR;AAAA,UACA,CAAE;AAAA,YACD,OAAO,EAAE,4BAA4B,iBAAiB;AAAA,UACvD,MAAO;AACN,gBAAK,oBAAoB,4BAA6B;AACrD,mCAAqB,KAAM,gBAAiB;AAAA,YAC7C;AAAA,UACD;AAAA,QACD;AACA,cAAM,WAAW,SAAS,IAAK,OAAO,CAAE,UAAW;AAClD,cACC,CAAE,MAAM,MAAM,8BACd,qBAAqB;AAAA,YACpB,MAAM,MAAM;AAAA,UACb,GACC;AACD,mBAAO;AAAA,UACR;AACA,iBAAO;AAAA,QACR,CAAE;AAEF,eAAO,oBAAC,aAAY,GAAG,OAAU,UAAU;AAAA,MAC5C;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,WAAY,EAAE,MAAM,IAAI,YAAY,QAAQ,SAAS,GAAG,MAAM,GAAI;AAC1E,SACC,oBAAC,QAAK,MACH,WAAE,EAAE,SAAS,UAAU,MAAO;AAC/B,WACC;AAAA,MAAC;AAAA;AAAA,QACA,SACC,WAAW,YACR,IAAK,SAAU;AACf,WAAE,WAAW,MAAQ,GAAG,IAAK;AAC7B,WAAE,aAAa,MAAQ,GAAG,IAAK;AAAA,QAC/B,IACA;AAAA,QAEF,GAAG;AAAA;AAAA,IACN;AAAA,EAEF,GACD;AAEF;AAEA,WAAW,OAAO;AAElB,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|