@wordpress/block-editor 11.3.2 → 11.4.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 +6 -0
- package/README.md +4 -4
- package/build/components/block-actions/index.js +2 -7
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +5 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -33
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +2 -2
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -0
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +6 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/font-appearance-control/index.js +0 -3
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +106 -45
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +421 -0
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +6 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/index.js +17 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -11
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +9 -15
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +4 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +4 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/link-control/index.js +15 -15
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +72 -30
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +52 -0
- package/build/components/link-control/settings.js.map +1 -0
- package/build/components/list-view/index.js +6 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +5 -4
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +116 -0
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
- package/build/components/off-canvas-editor/link-ui.js +1 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/provider/index.js +2 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +0 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-input/index.js +2 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/index.js +6 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/dimensions.js +8 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +2 -76
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +3 -51
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +2 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/line-height.js +0 -42
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/metadata.js +6 -0
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/position.js +6 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/typography.js +112 -127
- package/build/hooks/typography.js.map +1 -1
- package/build/index.js +6 -6
- package/build/index.js.map +1 -1
- package/build/layouts/flow.js +23 -2
- package/build/layouts/flow.js.map +1 -1
- package/build/lock-unlock.js +19 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/{experiments.js → private-apis.js} +12 -19
- package/build/private-apis.js.map +1 -0
- package/build/{experiments.native.js → private-apis.native.js} +9 -19
- package/build/private-apis.native.js.map +1 -0
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/store/selectors.js +18 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -7
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +5 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -33
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -1
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -0
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +6 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -1
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +100 -46
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +400 -0
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +6 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/index.js +17 -11
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-size-control/index.js +7 -12
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +9 -15
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +3 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +3 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/link-control/index.js +16 -16
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +68 -30
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +43 -0
- package/build-module/components/link-control/settings.js.map +1 -0
- package/build-module/components/list-view/index.js +6 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +4 -3
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +99 -0
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -0
- package/build-module/components/off-canvas-editor/link-ui.js +1 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/index.js +6 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/dimensions.js +7 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -69
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +6 -47
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +3 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -38
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/metadata.js +6 -0
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/position.js +5 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/typography.js +110 -123
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flow.js +23 -2
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/private-apis.js +19 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/private-apis.native.js +15 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/selectors.js +18 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +35 -22
- package/build-style/style.css +35 -22
- package/package.json +31 -31
- package/src/components/block-actions/index.js +0 -9
- package/src/components/block-alignment-control/use-available-alignments.js +17 -12
- package/src/components/block-popover/inbetween.js +21 -53
- package/src/components/block-tools/selected-block-popover.js +1 -1
- package/src/components/block-types-list/index.native.js +2 -0
- package/src/components/colors-gradients/control.js +3 -0
- package/src/components/font-appearance-control/index.js +1 -1
- package/src/components/global-styles/hooks.js +186 -66
- package/src/components/global-styles/index.js +5 -0
- package/src/components/global-styles/typography-panel.js +403 -0
- package/src/components/global-styles/use-global-styles-output.js +6 -2
- package/src/components/iframe/index.js +20 -18
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
- package/src/components/image-size-control/index.js +10 -12
- package/src/components/image-size-control/style.scss +3 -21
- package/src/components/inserter/block-patterns-tab.js +9 -23
- package/src/components/inserter/block-types-tab.native.js +2 -0
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
- package/src/components/inserter/search-results.native.js +2 -0
- package/src/components/link-control/index.js +22 -22
- package/src/components/link-control/settings-drawer.js +85 -30
- package/src/components/link-control/settings.js +41 -0
- package/src/components/link-control/style.scss +39 -7
- package/src/components/link-control/test/index.js +213 -4
- package/src/components/list-view/index.js +5 -0
- package/src/components/off-canvas-editor/block-contents.js +3 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +115 -0
- package/src/components/off-canvas-editor/link-ui.js +1 -0
- package/src/components/provider/index.js +1 -1
- package/src/components/rich-text/index.js +0 -2
- package/src/components/url-input/index.js +3 -2
- package/src/components/url-popover/index.js +8 -2
- package/src/hooks/dimensions.js +13 -1
- package/src/hooks/font-family.js +0 -58
- package/src/hooks/font-size.js +1 -36
- package/src/hooks/gap.js +9 -2
- package/src/hooks/index.js +1 -0
- package/src/hooks/line-height.js +0 -33
- package/src/hooks/metadata.js +4 -0
- package/src/hooks/position.js +7 -1
- package/src/hooks/typography.js +133 -212
- package/src/index.js +1 -1
- package/src/layouts/flow.js +16 -1
- package/src/lock-unlock.js +10 -0
- package/src/private-apis.js +19 -0
- package/src/private-apis.native.js +15 -0
- package/src/store/index.js +1 -1
- package/src/store/selectors.js +16 -1
- package/tsconfig.json +20 -1
- package/build/experiments.js.map +0 -1
- package/build/experiments.native.js.map +0 -1
- package/build/hooks/font-appearance.js +0 -188
- package/build/hooks/font-appearance.js.map +0 -1
- package/build/hooks/letter-spacing.js +0 -129
- package/build/hooks/letter-spacing.js.map +0 -1
- package/build/hooks/text-decoration.js +0 -130
- package/build/hooks/text-decoration.js.map +0 -1
- package/build/hooks/text-transform.js +0 -130
- package/build/hooks/text-transform.js.map +0 -1
- package/build-module/experiments.js +0 -25
- package/build-module/experiments.js.map +0 -1
- package/build-module/experiments.native.js +0 -23
- package/build-module/experiments.native.js.map +0 -1
- package/build-module/hooks/font-appearance.js +0 -161
- package/build-module/hooks/font-appearance.js.map +0 -1
- package/build-module/hooks/letter-spacing.js +0 -107
- package/build-module/hooks/letter-spacing.js.map +0 -1
- package/build-module/hooks/text-decoration.js +0 -108
- package/build-module/hooks/text-decoration.js.map +0 -1
- package/build-module/hooks/text-transform.js +0 -108
- package/build-module/hooks/text-transform.js.map +0 -1
- package/src/experiments.js +0 -27
- package/src/experiments.native.js +0 -25
- package/src/hooks/font-appearance.js +0 -146
- package/src/hooks/letter-spacing.js +0 -101
- package/src/hooks/text-decoration.js +0 -102
- package/src/hooks/text-transform.js +0 -101
|
@@ -13,27 +13,25 @@ var _element = require("@wordpress/element");
|
|
|
13
13
|
|
|
14
14
|
var _blocks = require("@wordpress/blocks");
|
|
15
15
|
|
|
16
|
-
var _components = require("@wordpress/components");
|
|
17
|
-
|
|
18
|
-
var _i18n = require("@wordpress/i18n");
|
|
19
|
-
|
|
20
16
|
var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _typographyPanel = _interopRequireWildcard(require("../components/global-styles/typography-panel"));
|
|
23
19
|
|
|
24
20
|
var _lineHeight = require("./line-height");
|
|
25
21
|
|
|
26
|
-
var _fontAppearance = require("./font-appearance");
|
|
27
|
-
|
|
28
22
|
var _fontFamily = require("./font-family");
|
|
29
23
|
|
|
30
24
|
var _fontSize = require("./font-size");
|
|
31
25
|
|
|
32
|
-
var
|
|
26
|
+
var _components = require("../components");
|
|
33
27
|
|
|
34
|
-
var
|
|
28
|
+
var _utils = require("./utils");
|
|
35
29
|
|
|
36
|
-
var
|
|
30
|
+
var _hooks = require("../components/global-styles/hooks");
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* WordPress dependencies
|
|
@@ -42,125 +40,118 @@ var _letterSpacing = require("./letter-spacing");
|
|
|
42
40
|
/**
|
|
43
41
|
* Internal dependencies
|
|
44
42
|
*/
|
|
43
|
+
function omit(object, keys) {
|
|
44
|
+
return Object.fromEntries(Object.entries(object).filter(_ref => {
|
|
45
|
+
let [key] = _ref;
|
|
46
|
+
return !keys.includes(key);
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
51
|
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
52
|
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
53
|
+
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
54
|
+
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
45
55
|
const TYPOGRAPHY_SUPPORT_KEY = 'typography';
|
|
46
56
|
exports.TYPOGRAPHY_SUPPORT_KEY = TYPOGRAPHY_SUPPORT_KEY;
|
|
47
|
-
const TYPOGRAPHY_SUPPORT_KEYS = [_lineHeight.LINE_HEIGHT_SUPPORT_KEY, _fontSize.FONT_SIZE_SUPPORT_KEY,
|
|
57
|
+
const TYPOGRAPHY_SUPPORT_KEYS = [_lineHeight.LINE_HEIGHT_SUPPORT_KEY, _fontSize.FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, _fontFamily.FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
|
|
48
58
|
exports.TYPOGRAPHY_SUPPORT_KEYS = TYPOGRAPHY_SUPPORT_KEYS;
|
|
49
59
|
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
60
|
+
function TypographyInspectorControl(_ref2) {
|
|
61
|
+
let {
|
|
62
|
+
children
|
|
63
|
+
} = _ref2;
|
|
64
|
+
return (0, _element.createElement)(_inspectorControls.default, {
|
|
65
|
+
group: "typography"
|
|
66
|
+
}, children);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function useBlockSettings(name) {
|
|
70
|
+
const fontFamilies = (0, _components.useSetting)('typography.fontFamilies');
|
|
71
|
+
const fontSizes = (0, _components.useSetting)('typography.fontSizes');
|
|
72
|
+
const customFontSize = (0, _components.useSetting)('typography.customFontSize');
|
|
73
|
+
const fontStyle = (0, _components.useSetting)('typography.fontStyle');
|
|
74
|
+
const fontWeight = (0, _components.useSetting)('typography.fontWeight');
|
|
75
|
+
const lineHeight = (0, _components.useSetting)('typography.lineHeight');
|
|
76
|
+
const textDecoration = (0, _components.useSetting)('typography.textDecoration');
|
|
77
|
+
const textTransform = (0, _components.useSetting)('typography.textTransform');
|
|
78
|
+
const letterSpacing = (0, _components.useSetting)('typography.letterSpacing');
|
|
79
|
+
const supports = (0, _hooks.useSupportedStyles)(name, null);
|
|
80
|
+
return (0, _element.useMemo)(() => {
|
|
81
|
+
const rawSettings = {
|
|
82
|
+
typography: {
|
|
83
|
+
fontFamilies: {
|
|
84
|
+
custom: fontFamilies
|
|
85
|
+
},
|
|
86
|
+
fontSizes: {
|
|
87
|
+
custom: fontSizes
|
|
88
|
+
},
|
|
89
|
+
customFontSize,
|
|
90
|
+
fontStyle,
|
|
91
|
+
fontWeight,
|
|
92
|
+
lineHeight,
|
|
93
|
+
textDecoration,
|
|
94
|
+
textTransform,
|
|
95
|
+
letterSpacing
|
|
76
96
|
}
|
|
77
97
|
};
|
|
98
|
+
return (0, _hooks.overrideSettingsWithSupports)(rawSettings, supports);
|
|
99
|
+
}, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textDecoration, textTransform, letterSpacing, supports]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function TypographyPanel(_ref3) {
|
|
103
|
+
let {
|
|
104
|
+
clientId,
|
|
105
|
+
name,
|
|
106
|
+
attributes,
|
|
107
|
+
setAttributes
|
|
108
|
+
} = _ref3;
|
|
109
|
+
const settings = useBlockSettings(name);
|
|
110
|
+
const isEnabled = (0, _typographyPanel.useHasTypographyPanel)(settings);
|
|
111
|
+
const value = (0, _element.useMemo)(() => {
|
|
112
|
+
var _attributes$style, _attributes$style2, _attributes$style2$ty;
|
|
113
|
+
|
|
114
|
+
return { ...attributes.style,
|
|
115
|
+
typography: { ...((_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography),
|
|
116
|
+
fontFamily: attributes.fontFamily ? 'var:preset|font-family|' + attributes.fontFamily : undefined,
|
|
117
|
+
fontSize: attributes.fontSize ? 'var:preset|font-size|' + attributes.fontSize : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}, [attributes.style, attributes.fontSize, attributes.fontFamily]);
|
|
121
|
+
|
|
122
|
+
const onChange = newStyle => {
|
|
123
|
+
var _newStyle$typography, _newStyle$typography2;
|
|
124
|
+
|
|
125
|
+
const updatedStyle = { ...omit(newStyle, ['fontFamily'])
|
|
126
|
+
};
|
|
127
|
+
const fontSizeValue = newStyle === null || newStyle === void 0 ? void 0 : (_newStyle$typography = newStyle.typography) === null || _newStyle$typography === void 0 ? void 0 : _newStyle$typography.fontSize;
|
|
128
|
+
const fontFamilyValue = newStyle === null || newStyle === void 0 ? void 0 : (_newStyle$typography2 = newStyle.typography) === null || _newStyle$typography2 === void 0 ? void 0 : _newStyle$typography2.fontFamily;
|
|
129
|
+
const fontSizeSlug = fontSizeValue !== null && fontSizeValue !== void 0 && fontSizeValue.startsWith('var:preset|font-size|') ? fontSizeValue.substring('var:preset|font-size|'.length) : undefined;
|
|
130
|
+
const fontFamilySlug = fontFamilyValue !== null && fontFamilyValue !== void 0 && fontFamilyValue.startsWith('var:preset|font-family|') ? fontFamilyValue.substring('var:preset|font-family|'.length) : undefined;
|
|
131
|
+
updatedStyle.typography = { ...omit(updatedStyle.typography, ['fontFamily']),
|
|
132
|
+
fontSize: fontSizeSlug ? undefined : fontSizeValue
|
|
133
|
+
};
|
|
134
|
+
setAttributes({
|
|
135
|
+
style: (0, _utils.cleanEmptyObject)(updatedStyle),
|
|
136
|
+
fontFamily: fontFamilySlug,
|
|
137
|
+
fontSize: fontSizeSlug
|
|
138
|
+
});
|
|
78
139
|
};
|
|
79
140
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
,
|
|
95
|
-
label: (0, _i18n.__)('Font size'),
|
|
96
|
-
onDeselect: () => (0, _fontSize.resetFontSize)(props),
|
|
97
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontSize,
|
|
98
|
-
resetAllFilter: newAttributes => {
|
|
99
|
-
var _newAttributes$style2;
|
|
100
|
-
|
|
101
|
-
return { ...newAttributes,
|
|
102
|
-
fontSize: undefined,
|
|
103
|
-
style: { ...newAttributes.style,
|
|
104
|
-
typography: { ...((_newAttributes$style2 = newAttributes.style) === null || _newAttributes$style2 === void 0 ? void 0 : _newAttributes$style2.typography),
|
|
105
|
-
fontSize: undefined
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
panelId: clientId
|
|
111
|
-
}, (0, _element.createElement)(_fontSize.FontSizeEdit, props)), !isFontAppearanceDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
112
|
-
className: "single-column",
|
|
113
|
-
hasValue: () => (0, _fontAppearance.hasFontAppearanceValue)(props),
|
|
114
|
-
label: (0, _fontAppearanceControl.getFontAppearanceLabel)(hasFontStyles, hasFontWeights),
|
|
115
|
-
onDeselect: () => (0, _fontAppearance.resetFontAppearance)(props),
|
|
116
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.fontAppearance,
|
|
117
|
-
resetAllFilter: newAttributes => {
|
|
118
|
-
var _newAttributes$style3;
|
|
119
|
-
|
|
120
|
-
return { ...newAttributes,
|
|
121
|
-
style: { ...newAttributes.style,
|
|
122
|
-
typography: { ...((_newAttributes$style3 = newAttributes.style) === null || _newAttributes$style3 === void 0 ? void 0 : _newAttributes$style3.typography),
|
|
123
|
-
fontStyle: undefined,
|
|
124
|
-
fontWeight: undefined
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
},
|
|
129
|
-
panelId: clientId
|
|
130
|
-
}, (0, _element.createElement)(_fontAppearance.FontAppearanceEdit, props)), !isLineHeightDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
131
|
-
className: "single-column",
|
|
132
|
-
hasValue: () => (0, _lineHeight.hasLineHeightValue)(props),
|
|
133
|
-
label: (0, _i18n.__)('Line height'),
|
|
134
|
-
onDeselect: () => (0, _lineHeight.resetLineHeight)(props),
|
|
135
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.lineHeight,
|
|
136
|
-
resetAllFilter: createResetAllFilter('lineHeight'),
|
|
137
|
-
panelId: clientId
|
|
138
|
-
}, (0, _element.createElement)(_lineHeight.LineHeightEdit, props)), !isLetterSpacingDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
139
|
-
className: "single-column",
|
|
140
|
-
hasValue: () => (0, _letterSpacing.hasLetterSpacingValue)(props),
|
|
141
|
-
label: (0, _i18n.__)('Letter spacing'),
|
|
142
|
-
onDeselect: () => (0, _letterSpacing.resetLetterSpacing)(props),
|
|
143
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.letterSpacing,
|
|
144
|
-
resetAllFilter: createResetAllFilter('letterSpacing'),
|
|
145
|
-
panelId: clientId
|
|
146
|
-
}, (0, _element.createElement)(_letterSpacing.LetterSpacingEdit, props)), !isTextDecorationDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
147
|
-
className: "single-column",
|
|
148
|
-
hasValue: () => (0, _textDecoration.hasTextDecorationValue)(props),
|
|
149
|
-
label: (0, _i18n.__)('Decoration'),
|
|
150
|
-
onDeselect: () => (0, _textDecoration.resetTextDecoration)(props),
|
|
151
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textDecoration,
|
|
152
|
-
resetAllFilter: createResetAllFilter('textDecoration'),
|
|
153
|
-
panelId: clientId
|
|
154
|
-
}, (0, _element.createElement)(_textDecoration.TextDecorationEdit, props)), !isTextTransformDisabled && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
155
|
-
hasValue: () => (0, _textTransform.hasTextTransformValue)(props)
|
|
156
|
-
/* translators: Ensure translation is distinct from "Font size" */
|
|
157
|
-
,
|
|
158
|
-
label: (0, _i18n.__)('Letter case'),
|
|
159
|
-
onDeselect: () => (0, _textTransform.resetTextTransform)(props),
|
|
160
|
-
isShownByDefault: defaultControls === null || defaultControls === void 0 ? void 0 : defaultControls.textTransform,
|
|
161
|
-
resetAllFilter: createResetAllFilter('textTransform'),
|
|
162
|
-
panelId: clientId
|
|
163
|
-
}, (0, _element.createElement)(_textTransform.TextTransformEdit, props)));
|
|
141
|
+
if (!isEnabled) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const defaultControls = (0, _blocks.getBlockSupport)(name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
|
|
146
|
+
return (0, _element.createElement)(_typographyPanel.default, {
|
|
147
|
+
as: TypographyInspectorControl,
|
|
148
|
+
panelId: clientId,
|
|
149
|
+
name: name,
|
|
150
|
+
settings: settings,
|
|
151
|
+
value: value,
|
|
152
|
+
onChange: onChange,
|
|
153
|
+
defaultControls: defaultControls
|
|
154
|
+
});
|
|
164
155
|
}
|
|
165
156
|
|
|
166
157
|
const hasTypographySupport = blockName => {
|
|
@@ -168,10 +159,4 @@ const hasTypographySupport = blockName => {
|
|
|
168
159
|
};
|
|
169
160
|
|
|
170
161
|
exports.hasTypographySupport = hasTypographySupport;
|
|
171
|
-
|
|
172
|
-
function useIsTypographyDisabled() {
|
|
173
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
174
|
-
const configs = [(0, _fontAppearance.useIsFontAppearanceDisabled)(props), (0, _fontSize.useIsFontSizeDisabled)(props), (0, _lineHeight.useIsLineHeightDisabled)(props), (0, _fontFamily.useIsFontFamilyDisabled)(props), (0, _textDecoration.useIsTextDecorationDisabled)(props), (0, _textTransform.useIsTextTransformDisabled)(props), (0, _letterSpacing.useIsLetterSpacingDisabled)(props)];
|
|
175
|
-
return configs.filter(Boolean).length === configs.length;
|
|
176
|
-
}
|
|
177
162
|
//# sourceMappingURL=typography.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","LINE_HEIGHT_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","LETTER_SPACING_SUPPORT_KEY","TypographyPanel","props","clientId","isFontFamilyDisabled","isFontSizeDisabled","isFontAppearanceDisabled","isLineHeightDisabled","isTextDecorationDisabled","isTextTransformDisabled","isLetterSpacingDisabled","hasFontStyles","hasFontWeights","isDisabled","useIsTypographyDisabled","isSupported","hasTypographySupport","name","defaultControls","createResetAllFilter","attribute","newAttributes","style","typography","undefined","fontFamily","fontSize","fontAppearance","fontStyle","fontWeight","lineHeight","letterSpacing","textDecoration","textTransform","blockName","some","key","configs","filter","Boolean","length"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAEA;;AAOA;;AAUA;;AAOA;;AAOA;;AAOA;;AAOA;;AA1DA;AACA;AACA;;AAKA;AACA;AACA;AAyDO,MAAMA,sBAAsB,GAAG,YAA/B;;AACA,MAAMC,uBAAuB,GAAG,CACtCC,mCADsC,EAEtCC,+BAFsC,EAGtCC,sCAHsC,EAItCC,uCAJsC,EAKtCC,mCALsC,EAMtCC,2CANsC,EAOtCC,yCAPsC,EAQtCC,yCARsC,CAAhC;;;AAWA,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAeD,KAArB;AACA,QAAME,oBAAoB,GAAG,yCAAyBF,KAAzB,CAA7B;AACA,QAAMG,kBAAkB,GAAG,qCAAuBH,KAAvB,CAA3B;AACA,QAA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7B,CALe,EAMf,+CAA4BA,KAA5B,CANe,EAOf,+CAA4BA,KAA5B,CAPe,CAAhB;AAUA,SAAOmC,OAAO,CAACC,MAAR,CAAgBC,OAAhB,EAA0BC,MAA1B,KAAqCH,OAAO,CAACG,MAApD;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport { getFontAppearanceLabel } from '../components/font-appearance-control';\n\nimport {\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tLineHeightEdit,\n\thasLineHeightValue,\n\tresetLineHeight,\n\tuseIsLineHeightDisabled,\n} from './line-height';\nimport {\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFontAppearanceEdit,\n\thasFontAppearanceValue,\n\tresetFontAppearance,\n\tuseIsFontAppearanceDisabled,\n\tuseIsFontStyleDisabled,\n\tuseIsFontWeightDisabled,\n} from './font-appearance';\nimport {\n\tFONT_FAMILY_SUPPORT_KEY,\n\tFontFamilyEdit,\n\thasFontFamilyValue,\n\tresetFontFamily,\n\tuseIsFontFamilyDisabled,\n} from './font-family';\nimport {\n\tFONT_SIZE_SUPPORT_KEY,\n\tFontSizeEdit,\n\thasFontSizeValue,\n\tresetFontSize,\n\tuseIsFontSizeDisabled,\n} from './font-size';\nimport {\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTextDecorationEdit,\n\thasTextDecorationValue,\n\tresetTextDecoration,\n\tuseIsTextDecorationDisabled,\n} from './text-decoration';\nimport {\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tTextTransformEdit,\n\thasTextTransformValue,\n\tresetTextTransform,\n\tuseIsTextTransformDisabled,\n} from './text-transform';\nimport {\n\tLETTER_SPACING_SUPPORT_KEY,\n\tLetterSpacingEdit,\n\thasLetterSpacingValue,\n\tresetLetterSpacing,\n\tuseIsLetterSpacingDisabled,\n} from './letter-spacing';\n\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nexport function TypographyPanel( props ) {\n\tconst { clientId } = props;\n\tconst isFontFamilyDisabled = useIsFontFamilyDisabled( props );\n\tconst isFontSizeDisabled = useIsFontSizeDisabled( props );\n\tconst isFontAppearanceDisabled = useIsFontAppearanceDisabled( props );\n\tconst isLineHeightDisabled = useIsLineHeightDisabled( props );\n\tconst isTextDecorationDisabled = useIsTextDecorationDisabled( props );\n\tconst isTextTransformDisabled = useIsTextTransformDisabled( props );\n\tconst isLetterSpacingDisabled = useIsLetterSpacingDisabled( props );\n\n\tconst hasFontStyles = ! useIsFontStyleDisabled( props );\n\tconst hasFontWeights = ! useIsFontWeightDisabled( props );\n\n\tconst isDisabled = useIsTypographyDisabled( props );\n\tconst isSupported = hasTypographySupport( props.name );\n\n\tif ( isDisabled || ! isSupported ) return null;\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\ttypography: {\n\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\treturn (\n\t\t<InspectorControls group=\"typography\">\n\t\t\t{ ! isFontFamilyDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontFamilyValue( props ) }\n\t\t\t\t\tlabel={ __( 'Font family' ) }\n\t\t\t\t\tonDeselect={ () => resetFontFamily( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontFamily }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontFamily: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontFamilyEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontSizeDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasFontSizeValue( props ) }\n\t\t\t\t\t/* translators: Ensure translation is distinct from \"Letter case\" */\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\tonDeselect={ () => resetFontSize( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontSize }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tfontSize: undefined,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontSize: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontSizeEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isFontAppearanceDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasFontAppearanceValue( props ) }\n\t\t\t\t\tlabel={ getFontAppearanceLabel(\n\t\t\t\t\t\thasFontStyles,\n\t\t\t\t\t\thasFontWeights\n\t\t\t\t\t) }\n\t\t\t\t\tonDeselect={ () => resetFontAppearance( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.fontAppearance }\n\t\t\t\t\tresetAllFilter={ ( newAttributes ) => ( {\n\t\t\t\t\t\t...newAttributes,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...newAttributes.style,\n\t\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\t\t...newAttributes.style?.typography,\n\t\t\t\t\t\t\t\tfontStyle: undefined,\n\t\t\t\t\t\t\t\tfontWeight: undefined,\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\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<FontAppearanceEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLineHeightDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLineHeightValue( props ) }\n\t\t\t\t\tlabel={ __( 'Line height' ) }\n\t\t\t\t\tonDeselect={ () => resetLineHeight( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.lineHeight }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'lineHeight' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LineHeightEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isLetterSpacingDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasLetterSpacingValue( props ) }\n\t\t\t\t\tlabel={ __( 'Letter spacing' ) }\n\t\t\t\t\tonDeselect={ () => resetLetterSpacing( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.letterSpacing }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'letterSpacing' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<LetterSpacingEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextDecorationDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => hasTextDecorationValue( props ) }\n\t\t\t\t\tlabel={ __( 'Decoration' ) }\n\t\t\t\t\tonDeselect={ () => resetTextDecoration( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textDecoration }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textDecoration' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextDecorationEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ ! isTextTransformDisabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => hasTextTransformValue( props ) }\n\t\t\t\t\t/* translators: Ensure translation is distinct from \"Font size\" */\n\t\t\t\t\tlabel={ __( 'Letter case' ) }\n\t\t\t\t\tonDeselect={ () => resetTextTransform( props ) }\n\t\t\t\t\tisShownByDefault={ defaultControls?.textTransform }\n\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'textTransform' ) }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<TextTransformEdit { ...props } />\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n\nfunction useIsTypographyDisabled( props = {} ) {\n\tconst configs = [\n\t\tuseIsFontAppearanceDisabled( props ),\n\t\tuseIsFontSizeDisabled( props ),\n\t\tuseIsLineHeightDisabled( props ),\n\t\tuseIsFontFamilyDisabled( props ),\n\t\tuseIsTextDecorationDisabled( props ),\n\t\tuseIsTextTransformDisabled( props ),\n\t\tuseIsLetterSpacingDisabled( props ),\n\t];\n\n\treturn configs.filter( Boolean ).length === configs.length;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","LINE_HEIGHT_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","TypographyInspectorControl","children","useBlockSettings","name","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textDecoration","textTransform","letterSpacing","supports","rawSettings","typography","custom","TypographyPanel","clientId","attributes","setAttributes","settings","isEnabled","value","style","fontFamily","undefined","fontSize","onChange","newStyle","updatedStyle","fontSizeValue","fontFamilyValue","fontSizeSlug","startsWith","substring","length","fontFamilySlug","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;;;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AApBA;AACA;AACA;;AAIA;AACA;AACA;AAiBA,SAASA,IAAT,CAAeC,MAAf,EAAuBC,IAAvB,EAA8B;AAC7B,SAAOC,MAAM,CAACC,WAAP,CACND,MAAM,CAACE,OAAP,CAAgBJ,MAAhB,EAAyBK,MAAzB,CAAiC;AAAA,QAAE,CAAEC,GAAF,CAAF;AAAA,WAAe,CAAEL,IAAI,CAACM,QAAL,CAAeD,GAAf,CAAjB;AAAA,GAAjC,CADM,CAAP;AAGA;;AAED,MAAME,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,0BAA0B,GAAG,wCAA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AAK,EAAGE,KALT;AAMC,IAAA,QAAQ,EAAGK,QANZ;AAOC,IAAA,eAAe,EAAGU;AAPnB,IADD;AAWA;;AAEM,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAO5C,uBAAuB,CAAC6C,IAAxB,CAAgCrD,GAAF,IACpC,6BAAiBoD,SAAjB,EAA4BpD,GAA5B,CADM,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { useSetting } from '../components';\nimport { cleanEmptyObject } from './utils';\nimport {\n\toverrideSettingsWithSupports,\n\tuseSupportedStyles,\n} from '../components/global-styles/hooks';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction TypographyInspectorControl( { children } ) {\n\treturn (\n\t\t<InspectorControls group=\"typography\">{ children }</InspectorControls>\n\t);\n}\n\nfunction useBlockSettings( name ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst supports = useSupportedStyles( name, null );\n\n\treturn useMemo( () => {\n\t\tconst rawSettings = {\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t};\n\t\treturn overrideSettingsWithSupports( rawSettings, supports );\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tsupports,\n\t] );\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst settings = useBlockSettings( name );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn {\n\t\t\t...attributes.style,\n\t\t\ttypography: {\n\t\t\t\t...attributes.style?.typography,\n\t\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t\t: undefined,\n\t\t\t\tfontSize: attributes.fontSize\n\t\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t\t},\n\t\t};\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tconst updatedStyle = { ...omit( newStyle, [ 'fontFamily' ] ) };\n\t\tconst fontSizeValue = newStyle?.typography?.fontSize;\n\t\tconst fontFamilyValue = newStyle?.typography?.fontFamily;\n\t\tconst fontSizeSlug = fontSizeValue?.startsWith(\n\t\t\t'var:preset|font-size|'\n\t\t)\n\t\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t\t: undefined;\n\t\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t\t'var:preset|font-family|'\n\t\t)\n\t\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t\t: undefined;\n\t\tupdatedStyle.typography = {\n\t\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t\t};\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\t\tfontFamily: fontFamilySlug,\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tname={ name }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
|
package/build/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _exportNames = {
|
|
|
18
18
|
storeConfig: true,
|
|
19
19
|
store: true,
|
|
20
20
|
SETTINGS_DEFAULTS: true,
|
|
21
|
-
|
|
21
|
+
privateApis: true
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "SETTINGS_DEFAULTS", {
|
|
24
24
|
enumerable: true,
|
|
@@ -80,16 +80,16 @@ Object.defineProperty(exports, "__experimentaluseLayoutStyles", {
|
|
|
80
80
|
return _hooks.useLayoutStyles;
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
Object.defineProperty(exports, "
|
|
83
|
+
Object.defineProperty(exports, "getTypographyClassesAndStyles", {
|
|
84
84
|
enumerable: true,
|
|
85
85
|
get: function () {
|
|
86
|
-
return
|
|
86
|
+
return _hooks.getTypographyClassesAndStyles;
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
|
-
Object.defineProperty(exports, "
|
|
89
|
+
Object.defineProperty(exports, "privateApis", {
|
|
90
90
|
enumerable: true,
|
|
91
91
|
get: function () {
|
|
92
|
-
return
|
|
92
|
+
return _privateApis.privateApis;
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "store", {
|
|
@@ -159,5 +159,5 @@ var _store = require("./store");
|
|
|
159
159
|
|
|
160
160
|
var _defaults = require("./store/defaults");
|
|
161
161
|
|
|
162
|
-
var
|
|
162
|
+
var _privateApis = require("./private-apis");
|
|
163
163
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAcA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tgetTypographyClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tgetGapCSSValue as __experimentalGetGapCSSValue,\n\tuseCachedTruthy,\n\tuseLayoutClasses as __experimentaluseLayoutClasses,\n\tuseLayoutStyles as __experimentaluseLayoutStyles,\n} from './hooks';\nexport * from './components';\nexport * from './elements';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\nexport {
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAcA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tgetTypographyClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tgetGapCSSValue as __experimentalGetGapCSSValue,\n\tuseCachedTruthy,\n\tuseLayoutClasses as __experimentaluseLayoutClasses,\n\tuseLayoutStyles as __experimentaluseLayoutStyles,\n} from './hooks';\nexport * from './components';\nexport * from './elements';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\nexport { privateApis } from './private-apis';\n"]}
|
package/build/layouts/flow.js
CHANGED
|
@@ -66,7 +66,7 @@ var _default = {
|
|
|
66
66
|
return 'vertical';
|
|
67
67
|
},
|
|
68
68
|
|
|
69
|
-
getAlignments(layout) {
|
|
69
|
+
getAlignments(layout, isBlockBasedTheme) {
|
|
70
70
|
const alignmentInfo = (0, _utils.getAlignmentsInfo)(layout);
|
|
71
71
|
|
|
72
72
|
if (layout.alignments !== undefined) {
|
|
@@ -86,7 +86,28 @@ var _default = {
|
|
|
86
86
|
name: 'center'
|
|
87
87
|
}, {
|
|
88
88
|
name: 'right'
|
|
89
|
-
}];
|
|
89
|
+
}]; // This is for backwards compatibility with hybrid themes.
|
|
90
|
+
|
|
91
|
+
if (!isBlockBasedTheme) {
|
|
92
|
+
const {
|
|
93
|
+
contentSize,
|
|
94
|
+
wideSize
|
|
95
|
+
} = layout;
|
|
96
|
+
|
|
97
|
+
if (contentSize) {
|
|
98
|
+
alignments.unshift({
|
|
99
|
+
name: 'full'
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (wideSize) {
|
|
104
|
+
alignments.unshift({
|
|
105
|
+
name: 'wide',
|
|
106
|
+
info: alignmentInfo.wide
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
90
111
|
alignments.unshift({
|
|
91
112
|
name: 'none',
|
|
92
113
|
info: alignmentInfo.none
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["name","label","inspectorControls","DefaultLayoutInspectorControls","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","getOrientation","getAlignments","layout","alignmentInfo","alignments","undefined","includes","unshift","map","alignment","info","none"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;eAKe;AACdA,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAE,cAAI,MAAJ,CAFO;AAGdC,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,GAA0C;AAC5D,WAAO,IAAP;AACA,GALa;AAMdC,EAAAA,eAAe,EAAE,SAASC,4BAAT,GAAwC;AACxD,WAAO,IAAP;AACA,GARa;AASdC,EAAAA,cAAc,EAAE,SAASA,cAAT,OAMZ;AAAA;;AAAA,QANqC;AACxCC,MAAAA,QADwC;AAExCC,MAAAA,KAFwC;AAGxCC,MAAAA,SAHwC;AAIxCC,MAAAA,kBAJwC;AAKxCC,MAAAA;AALwC,KAMrC;AACH,UAAMC,kBAAkB,GAAG,yBAAgBJ,KAAhB,aAAgBA,KAAhB,yCAAgBA,KAAK,CAAEK,OAAvB,mDAAgB,eAAgBC,QAAhC,CAA3B,CADG,CAGH;AACA;;AACA,QAAIC,aAAa,GAAG,EAApB;;AACA,QAAK,CAAE,qCAAyBN,SAAzB,EAAoC,SAApC,EAA+C,UAA/C,CAAP,EAAqE;AACpE;AACA,UAAKG,kBAAL,aAAKA,kBAAL,eAAKA,kBAAkB,CAAEI,GAAzB,EAA+B;AAC9BD,QAAAA,aAAa,GAAG,yBAAgBH,kBAAhB,aAAgBA,kBAAhB,uBAAgBA,kBAAkB,CAAEI,GAApC,CAAhB;AACA,OAFD,MAEO,IAAK,OAAOJ,kBAAP,KAA8B,QAAnC,EAA8C;AACpDG,QAAAA,aAAa,GAAG,yBAAgBH,kBAAhB,CAAhB;AACA;AACD;;AAED,QAAIK,MAAM,GAAG,EAAb,CAfG,CAiBH;;AACA,QAAKP,kBAAkB,IAAIK,aAA3B,EAA2C;AAC1CE,MAAAA,MAAM,IAAI,2BACTV,QADS,EAETI,iBAFS,EAGT,SAHS,EAITI,aAJS,CAAV;AAMA;;AACD,WAAOE,MAAP;AACA,GA1Ca;;AA2CdC,EAAAA,cAAc,GAAG;AAChB,WAAO,UAAP;AACA,GA7Ca;;AA8CdC,EAAAA,aAAa,CAAEC,MAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["name","label","inspectorControls","DefaultLayoutInspectorControls","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","getOrientation","getAlignments","layout","isBlockBasedTheme","alignmentInfo","alignments","undefined","includes","unshift","map","alignment","info","contentSize","wideSize","wide","none"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;eAKe;AACdA,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAE,cAAI,MAAJ,CAFO;AAGdC,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,GAA0C;AAC5D,WAAO,IAAP;AACA,GALa;AAMdC,E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AK,CAAEJ,MAAM,CAACG,UAAP,CAAkBE,QAAlB,CAA4B,MAA5B,CAAP,EAA8C;AAC7CL,QAAAA,MAAM,CAACG,UAAP,CAAkBG,OAAlB,CAA2B,MAA3B;AACA;;AACD,aAAON,MAAM,CAACG,UAAP,CAAkBI,GAAlB,CAAyBC,SAAF,KAAmB;AAChD5B,QAAAA,IAAI,EAAE4B,SAD0C;AAEhDC,QAAAA,IAAI,EAAEP,aAAa,CAAEM,SAAF;AAF6B,OAAnB,CAAvB,CAAP;AAIA;;AAED,UAAML,UAAU,GAAG,CAClB;AAAEvB,MAAAA,IAAI,EAAE;AAAR,KADkB,EAElB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAFkB,EAGlB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAHkB,CAAnB,CAZ0C,CAkB1C;;AACA,QAAK,CAAEqB,iBAAP,EAA2B;AAC1B,YAAM;AAAES,QAAAA,WAAF;AAAeC,QAAAA;AAAf,UAA4BX,MAAlC;;AACA,UAAKU,WAAL,EAAmB;AAClBP,QAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE1B,UAAAA,IAAI,EAAE;AAAR,SAApB;AACA;;AAED,UAAK+B,QAAL,EAAgB;AACfR,QAAAA,UAAU,CAACG,OAAX,CAAoB;AACnB1B,UAAAA,IAAI,EAAE,MADa;AAEnB6B,UAAAA,IAAI,EAAEP,aAAa,CAACU;AAFD,SAApB;AAIA;AACD;;AAEDT,IAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE1B,MAAAA,IAAI,EAAE,MAAR;AAAgB6B,MAAAA,IAAI,EAAEP,aAAa,CAACW;AAApC,KAApB;AAEA,WAAOV,UAAP;AACA;;AAlFa,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls() {\n\t\treturn null;\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tlet output = '';\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'default',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout, isBlockBasedTheme ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\t// This is for backwards compatibility with hybrid themes.\n\t\tif ( ! isBlockBasedTheme ) {\n\t\t\tconst { contentSize, wideSize } = layout;\n\t\t\tif ( contentSize ) {\n\t\t\t\talignments.unshift( { name: 'full' } );\n\t\t\t}\n\n\t\t\tif ( wideSize ) {\n\t\t\t\talignments.unshift( {\n\t\t\t\t\tname: 'wide',\n\t\t\t\t\tinfo: alignmentInfo.wide,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.unlock = exports.lock = void 0;
|
|
7
|
+
|
|
8
|
+
var _privateApis = require("@wordpress/private-apis");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
const {
|
|
14
|
+
lock,
|
|
15
|
+
unlock
|
|
16
|
+
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/block-editor');
|
|
17
|
+
exports.unlock = unlock;
|
|
18
|
+
exports.lock = lock;
|
|
19
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/lock-unlock.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,yBAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/block-editor'\n\t);\n"]}
|
|
@@ -5,41 +5,34 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var _experiments = require("@wordpress/experiments");
|
|
8
|
+
exports.privateApis = void 0;
|
|
11
9
|
|
|
12
10
|
var globalStyles = _interopRequireWildcard(require("./components/global-styles"));
|
|
13
11
|
|
|
14
12
|
var _provider = require("./components/provider");
|
|
15
13
|
|
|
14
|
+
var _lockUnlock = require("./lock-unlock");
|
|
15
|
+
|
|
16
16
|
var _offCanvasEditor = _interopRequireDefault(require("./components/off-canvas-editor"));
|
|
17
17
|
|
|
18
|
+
var _leafMoreMenu = _interopRequireDefault(require("./components/off-canvas-editor/leaf-more-menu"));
|
|
19
|
+
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
23
|
|
|
22
|
-
/**
|
|
23
|
-
* WordPress dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
24
|
/**
|
|
27
25
|
* Internal dependencies
|
|
28
26
|
*/
|
|
29
|
-
|
|
30
|
-
lock,
|
|
31
|
-
unlock
|
|
32
|
-
} = (0, _experiments.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/block-editor');
|
|
27
|
+
|
|
33
28
|
/**
|
|
34
|
-
*
|
|
29
|
+
* Private @wordpress/block-editor APIs.
|
|
35
30
|
*/
|
|
36
|
-
|
|
37
|
-
exports.
|
|
38
|
-
|
|
39
|
-
const experiments = {};
|
|
40
|
-
exports.experiments = experiments;
|
|
41
|
-
lock(experiments, { ...globalStyles,
|
|
31
|
+
const privateApis = {};
|
|
32
|
+
exports.privateApis = privateApis;
|
|
33
|
+
(0, _lockUnlock.lock)(privateApis, { ...globalStyles,
|
|
42
34
|
ExperimentalBlockEditorProvider: _provider.ExperimentalBlockEditorProvider,
|
|
35
|
+
LeafMoreMenu: _leafMoreMenu.default,
|
|
43
36
|
OffCanvasEditor: _offCanvasEditor.default
|
|
44
37
|
});
|
|
45
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=private-apis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider","LeafMoreMenu","OffCanvasEditor"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;;;;;AAPA;AACA;AACA;;AAOA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA,yCAFkB;AAGlBC,EAAAA,YAAY,EAAZA,qBAHkB;AAIlBC,EAAAA,eAAe,EAAfA;AAJkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport OffCanvasEditor from './components/off-canvas-editor';\nimport LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tLeafMoreMenu,\n\tOffCanvasEditor,\n} );\n"]}
|
|
@@ -3,38 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
var _experiments = require("@wordpress/experiments");
|
|
6
|
+
exports.privateApis = void 0;
|
|
9
7
|
|
|
10
8
|
var globalStyles = _interopRequireWildcard(require("./components/global-styles"));
|
|
11
9
|
|
|
12
10
|
var _provider = require("./components/provider");
|
|
13
11
|
|
|
12
|
+
var _lockUnlock = require("./lock-unlock");
|
|
13
|
+
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
18
|
/**
|
|
23
19
|
* Internal dependencies
|
|
24
20
|
*/
|
|
25
|
-
|
|
26
|
-
lock,
|
|
27
|
-
unlock
|
|
28
|
-
} = (0, _experiments.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/block-editor');
|
|
21
|
+
|
|
29
22
|
/**
|
|
30
|
-
*
|
|
23
|
+
* Private @wordpress/block-editor APIs.
|
|
31
24
|
*/
|
|
32
|
-
|
|
33
|
-
exports.
|
|
34
|
-
|
|
35
|
-
const experiments = {};
|
|
36
|
-
exports.experiments = experiments;
|
|
37
|
-
lock(experiments, { ...globalStyles,
|
|
25
|
+
const privateApis = {};
|
|
26
|
+
exports.privateApis = privateApis;
|
|
27
|
+
(0, _lockUnlock.lock)(privateApis, { ...globalStyles,
|
|
38
28
|
ExperimentalBlockEditorProvider: _provider.ExperimentalBlockEditorProvider
|
|
39
29
|
});
|
|
40
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=private-apis.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/private-apis.native.js"],"names":["privateApis","globalStyles","ExperimentalBlockEditorProvider"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;;;;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,EAApB;;AACP,sBAAMA,WAAN,EAAmB,EAClB,GAAGC,YADe;AAElBC,EAAAA,+BAA+B,EAA/BA;AAFkB,CAAnB","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n} );\n"]}
|
package/build/store/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var actions = _interopRequireWildcard(require("./actions"));
|
|
|
21
21
|
|
|
22
22
|
var _constants = require("./constants");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _lockUnlock = require("../lock-unlock");
|
|
25
25
|
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
|
|
@@ -61,6 +61,6 @@ exports.store = store;
|
|
|
61
61
|
const registeredStore = (0, _data.registerStore)(_constants.STORE_NAME, { ...storeConfig,
|
|
62
62
|
persist: ['preferences']
|
|
63
63
|
});
|
|
64
|
-
(0,
|
|
65
|
-
(0,
|
|
64
|
+
(0, _lockUnlock.unlock)(registeredStore).registerPrivateActions(privateActions);
|
|
65
|
+
(0, _lockUnlock.unlock)(registeredStore).registerPrivateSelectors(privateSelectors);
|
|
66
66
|
//# sourceMappingURL=index.js.map
|
package/build/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/store/index.js"],"names":["storeConfig","reducer","selectors","actions","store","STORE_NAME","persist","registeredStore","registerPrivateActions","privateActions","registerPrivateSelectors","privateSelectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAG;AAC1BC,EAAAA,OAAO,EAAPA,gBAD0B;AAE1BC,EAAAA,SAF0B;AAG1BC,EAAAA;AAH0B,CAApB;AAMP;AACA;AACA;AACA;AACA;;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B,EAClD,GAAGL,WAD+C;AAElDM,EAAAA,OAAO,EAAE,CAAE,aAAF;AAFyC,CAA9B,CAAd,C,CAKP;AACA;;;AACA,MAAMC,eAAe,GAAG,yBAAeF,qBAAf,EAA2B,EAClD,GAAGL,WAD+C;AAElDM,EAAAA,OAAO,EAAE,CAAE,aAAF;AAFyC,CAA3B,CAAxB;AAIA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/store/index.js"],"names":["storeConfig","reducer","selectors","actions","store","STORE_NAME","persist","registeredStore","registerPrivateActions","privateActions","registerPrivateSelectors","privateSelectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAG;AAC1BC,EAAAA,OAAO,EAAPA,gBAD0B;AAE1BC,EAAAA,SAF0B;AAG1BC,EAAAA;AAH0B,CAApB;AAMP;AACA;AACA;AACA;AACA;;;AACO,MAAMC,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B,EAClD,GAAGL,WAD+C;AAElDM,EAAAA,OAAO,EAAE,CAAE,aAAF;AAFyC,CAA9B,CAAd,C,CAKP;AACA;;;AACA,MAAMC,eAAe,GAAG,yBAAeF,qBAAf,EAA2B,EAClD,GAAGL,WAD+C;AAElDM,EAAAA,OAAO,EAAE,CAAE,aAAF;AAFyC,CAA3B,CAAxB;AAIA,wBAAQC,eAAR,EAA0BC,sBAA1B,CAAkDC,cAAlD;AACA,wBAAQF,eAAR,EAA0BG,wBAA1B,CAAoDC,gBAApD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as privateActions from './private-actions';\nimport * as privateSelectors from './private-selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore\n */\nexport const storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the block editor namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( STORE_NAME, {\n\t...storeConfig,\n\tpersist: [ 'preferences' ],\n} );\n\n// We will be able to use the `register` function once we switch\n// the \"preferences\" persistence to use the new preferences package.\nconst registeredStore = registerStore( STORE_NAME, {\n\t...storeConfig,\n\tpersist: [ 'preferences' ],\n} );\nunlock( registeredStore ).registerPrivateActions( privateActions );\nunlock( registeredStore ).registerPrivateSelectors( privateSelectors );\n"]}
|