@wordpress/block-editor 11.5.0 → 11.7.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 -0
- package/build/components/block-list/block-html.js +1 -3
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +63 -80
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -23
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/editor-styles/index.js +20 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +306 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +583 -0
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +8 -30
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +129 -0
- package/build/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build/components/global-styles/hooks.js +109 -3
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +36 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +66 -45
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +180 -99
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/image-size-control/index.js +8 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/line-height-control/index.js +15 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +5 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/appender.js +105 -0
- package/build/components/list-view/appender.js.map +1 -0
- package/build/components/list-view/block.js +5 -5
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +25 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +37 -13
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-replace-flow/index.js +13 -4
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +28 -3
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +5 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +9 -7
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -1
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/provider/use-block-sync.js +17 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/format-edit.js +2 -30
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -3
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/writing-flow/use-input.js +4 -8
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/hooks/border.js +90 -240
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +92 -229
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +4 -2
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
- package/build/hooks/contrast-checker.js.map +1 -0
- package/build/hooks/custom-class-name.js +4 -4
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +3 -4
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +0 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +3 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +19 -22
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +2 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +23 -26
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +50 -75
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +165 -0
- package/build/layouts/grid.js.map +1 -0
- package/build/layouts/index.js +3 -1
- package/build/layouts/index.js.map +1 -1
- package/build/private-apis.js +7 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +19 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +76 -0
- package/build/utils/object.js.map +1 -0
- package/build/utils/parse-css-unit-to-px.js +15 -9
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-list/block-html.js +1 -3
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +66 -78
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -22
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/editor-styles/index.js +19 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +291 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +554 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +7 -30
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +120 -0
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +104 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +65 -46
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +181 -100
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/image-size-control/index.js +8 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/line-height-control/index.js +15 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +4 -2
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/appender.js +88 -0
- package/build-module/components/list-view/appender.js.map +1 -0
- package/build-module/components/list-view/block.js +5 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +22 -5
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +32 -12
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +12 -4
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +28 -4
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +5 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +9 -7
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +17 -3
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +3 -31
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -3
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +4 -8
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/hooks/border.js +92 -240
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +90 -232
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +4 -2
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
- package/build-module/hooks/contrast-checker.js.map +1 -0
- package/build-module/hooks/custom-class-name.js +4 -4
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +3 -4
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +0 -1
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -2
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +19 -22
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +3 -3
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +23 -26
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +48 -72
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +151 -0
- package/build-module/layouts/grid.js.map +1 -0
- package/build-module/layouts/index.js +2 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +10 -8
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +17 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +69 -0
- package/build-module/utils/object.js.map +1 -0
- package/build-module/utils/parse-css-unit-to-px.js +15 -9
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +32 -12
- package/build-style/style.css +32 -12
- package/package.json +31 -31
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-inspector/style.scss +3 -0
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block-invalid-warning.js +72 -64
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
- package/src/components/block-preview/auto.js +2 -17
- package/src/components/block-preview/test/index.js +0 -2
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
- package/src/components/colors-gradients/style.scss +8 -8
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
- package/src/components/editor-styles/index.js +29 -1
- package/src/components/global-styles/border-panel.js +285 -0
- package/src/components/global-styles/color-panel.js +706 -0
- package/src/components/global-styles/dimensions-panel.js +13 -42
- package/src/components/global-styles/get-block-css-selector.js +129 -0
- package/src/components/global-styles/hooks.js +154 -1
- package/src/components/global-styles/index.js +3 -0
- package/src/components/global-styles/test/use-global-styles-output.js +31 -2
- package/src/components/global-styles/typography-panel.js +67 -45
- package/src/components/global-styles/use-global-styles-output.js +176 -93
- package/src/components/global-styles/utils.js +3 -0
- package/src/components/image-size-control/index.js +4 -3
- package/src/components/image-size-control/test/index.js +2 -2
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/menu.js +0 -1
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +3 -0
- package/src/components/inserter/tabs.js +1 -9
- package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
- package/src/components/line-height-control/index.js +10 -1
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/search-item.js +3 -1
- package/src/components/link-control/style.scss +0 -4
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/appender.js +101 -0
- package/src/components/list-view/block.js +5 -4
- package/src/components/list-view/branch.js +30 -1
- package/src/components/list-view/index.js +43 -10
- package/src/components/list-view/style.scss +19 -0
- package/src/components/list-view/use-block-selection.js +0 -2
- package/src/components/media-replace-flow/index.js +36 -24
- package/src/components/media-replace-flow/style.scss +5 -2
- package/src/components/off-canvas-editor/appender.js +31 -5
- package/src/components/off-canvas-editor/branch.js +3 -1
- package/src/components/off-canvas-editor/index.js +7 -7
- package/src/components/off-canvas-editor/link-ui.js +0 -1
- package/src/components/provider/use-block-sync.js +21 -4
- package/src/components/rich-text/format-edit.js +2 -32
- package/src/components/rich-text/format-toolbar-container.js +1 -7
- package/src/components/url-popover/test/index.js +0 -2
- package/src/components/writing-flow/use-input.js +4 -5
- package/src/hooks/border.js +93 -225
- package/src/hooks/color.js +120 -296
- package/src/hooks/content-lock-ui.js +6 -2
- package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
- package/src/hooks/custom-class-name.js +4 -4
- package/src/hooks/custom-class-name.native.js +3 -4
- package/src/hooks/dimensions.js +0 -1
- package/src/hooks/duotone.js +8 -5
- package/src/hooks/layout.js +19 -16
- package/src/hooks/position.js +3 -3
- package/src/hooks/style.js +29 -28
- package/src/hooks/supports.js +6 -0
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/test/use-typography-props.js +2 -0
- package/src/hooks/test/utils.js +0 -104
- package/src/hooks/typography.js +2 -1
- package/src/hooks/utils.js +63 -70
- package/src/layouts/constrained.js +23 -17
- package/src/layouts/grid.js +172 -0
- package/src/layouts/index.js +2 -1
- package/src/layouts/test/grid.js +21 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +10 -8
- package/src/store/selectors.js +20 -3
- package/src/utils/object.js +69 -0
- package/src/utils/parse-css-unit-to-px.js +14 -9
- package/src/utils/test/object.js +107 -0
- package/src/utils/test/parse-css-unit-to-px.js +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/border-radius.js +0 -100
- package/build/hooks/border-radius.js.map +0 -1
- package/build/hooks/color-panel.js.map +0 -1
- package/build-module/hooks/border-radius.js +0 -84
- package/build-module/hooks/border-radius.js.map +0 -1
- package/build-module/hooks/color-panel.js.map +0 -1
- package/src/hooks/border-radius.js +0 -70
|
@@ -5,9 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
+
exports.useColorsPerOrigin = useColorsPerOrigin;
|
|
8
9
|
exports.useGlobalSetting = useGlobalSetting;
|
|
9
10
|
exports.useGlobalStyle = useGlobalStyle;
|
|
10
11
|
exports.useGlobalStylesReset = void 0;
|
|
12
|
+
exports.useGradientsPerOrigin = useGradientsPerOrigin;
|
|
11
13
|
exports.useSettingsForBlockElement = useSettingsForBlockElement;
|
|
12
14
|
|
|
13
15
|
var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
|
|
@@ -20,6 +22,8 @@ var _data = require("@wordpress/data");
|
|
|
20
22
|
|
|
21
23
|
var _blocks = require("@wordpress/blocks");
|
|
22
24
|
|
|
25
|
+
var _i18n = require("@wordpress/i18n");
|
|
26
|
+
|
|
23
27
|
var _utils = require("./utils");
|
|
24
28
|
|
|
25
29
|
var _context = require("./context");
|
|
@@ -41,7 +45,7 @@ const EMPTY_CONFIG = {
|
|
|
41
45
|
settings: {},
|
|
42
46
|
styles: {}
|
|
43
47
|
};
|
|
44
|
-
const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textDecoration', 'typography.textTransform'];
|
|
48
|
+
const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform'];
|
|
45
49
|
|
|
46
50
|
const useGlobalStylesReset = () => {
|
|
47
51
|
const {
|
|
@@ -130,7 +134,7 @@ function useGlobalStyle(path, blockName) {
|
|
|
130
134
|
|
|
131
135
|
switch (source) {
|
|
132
136
|
case 'all':
|
|
133
|
-
rawResult = // The
|
|
137
|
+
rawResult = // The styles.css path is allowed to be empty, so don't revert to base if undefined.
|
|
134
138
|
finalPath === 'styles.css' ? (0, _lodash.get)(userConfig, finalPath) : (0, _lodash.get)(mergedConfig, finalPath);
|
|
135
139
|
result = shouldDecodeEncode ? (0, _utils.getValueFromVariable)(mergedConfig, blockName, rawResult) : rawResult;
|
|
136
140
|
break;
|
|
@@ -175,6 +179,8 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
|
|
|
175
179
|
};
|
|
176
180
|
}, [blockName, element]);
|
|
177
181
|
return (0, _element.useMemo)(() => {
|
|
182
|
+
var _updatedSettings$colo, _updatedSettings$colo2, _updatedSettings$colo3, _updatedSettings$colo4, _updatedSettings$colo5, _updatedSettings$colo6;
|
|
183
|
+
|
|
178
184
|
const updatedSettings = { ...parentSettings
|
|
179
185
|
};
|
|
180
186
|
|
|
@@ -191,13 +197,36 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
|
|
|
191
197
|
};
|
|
192
198
|
}
|
|
193
199
|
|
|
200
|
+
updatedSettings.color = { ...updatedSettings.color,
|
|
201
|
+
text: ((_updatedSettings$colo = updatedSettings.color) === null || _updatedSettings$colo === void 0 ? void 0 : _updatedSettings$colo.text) && supportedStyles.includes('color'),
|
|
202
|
+
background: ((_updatedSettings$colo2 = updatedSettings.color) === null || _updatedSettings$colo2 === void 0 ? void 0 : _updatedSettings$colo2.background) && (supportedStyles.includes('background') || supportedStyles.includes('backgroundColor')),
|
|
203
|
+
button: ((_updatedSettings$colo3 = updatedSettings.color) === null || _updatedSettings$colo3 === void 0 ? void 0 : _updatedSettings$colo3.button) && supportedStyles.includes('buttonColor'),
|
|
204
|
+
heading: ((_updatedSettings$colo4 = updatedSettings.color) === null || _updatedSettings$colo4 === void 0 ? void 0 : _updatedSettings$colo4.heading) && supportedStyles.includes('headingColor'),
|
|
205
|
+
link: ((_updatedSettings$colo5 = updatedSettings.color) === null || _updatedSettings$colo5 === void 0 ? void 0 : _updatedSettings$colo5.link) && supportedStyles.includes('linkColor'),
|
|
206
|
+
caption: ((_updatedSettings$colo6 = updatedSettings.color) === null || _updatedSettings$colo6 === void 0 ? void 0 : _updatedSettings$colo6.caption) && supportedStyles.includes('captionColor')
|
|
207
|
+
}; // Some blocks can enable background colors but disable gradients.
|
|
208
|
+
|
|
209
|
+
if (!supportedStyles.includes('background')) {
|
|
210
|
+
updatedSettings.color.gradients = [];
|
|
211
|
+
updatedSettings.color.customGradient = false;
|
|
212
|
+
}
|
|
213
|
+
|
|
194
214
|
['lineHeight', 'fontStyle', 'fontWeight', 'letterSpacing', 'textTransform', 'textDecoration'].forEach(key => {
|
|
195
215
|
if (!supportedStyles.includes(key)) {
|
|
196
216
|
updatedSettings.typography = { ...updatedSettings.typography,
|
|
197
217
|
[key]: false
|
|
198
218
|
};
|
|
199
219
|
}
|
|
200
|
-
});
|
|
220
|
+
}); // The column-count style is named text column to reduce confusion with
|
|
221
|
+
// the columns block and manage expectations from the support.
|
|
222
|
+
// See: https://github.com/WordPress/gutenberg/pull/33587
|
|
223
|
+
|
|
224
|
+
if (!supportedStyles.includes('columnCount')) {
|
|
225
|
+
updatedSettings.typography = { ...updatedSettings.typography,
|
|
226
|
+
textColumns: false
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
201
230
|
['contentSize', 'wideSize'].forEach(key => {
|
|
202
231
|
if (!supportedStyles.includes(key)) {
|
|
203
232
|
updatedSettings.layout = { ...updatedSettings.layout,
|
|
@@ -233,7 +262,84 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
|
|
|
233
262
|
};
|
|
234
263
|
}
|
|
235
264
|
|
|
265
|
+
['radius', 'color', 'style', 'width'].forEach(key => {
|
|
266
|
+
if (!supportedStyles.includes('border' + key.charAt(0).toUpperCase() + key.slice(1))) {
|
|
267
|
+
updatedSettings.border = { ...updatedSettings.border,
|
|
268
|
+
[key]: false
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
});
|
|
236
272
|
return updatedSettings;
|
|
237
273
|
}, [parentSettings, supportedStyles, supports]);
|
|
238
274
|
}
|
|
275
|
+
|
|
276
|
+
function useColorsPerOrigin(settings) {
|
|
277
|
+
var _settings$color, _settings$color$palet, _settings$color2, _settings$color2$pale, _settings$color3, _settings$color3$pale, _settings$color4;
|
|
278
|
+
|
|
279
|
+
const customColors = settings === null || settings === void 0 ? void 0 : (_settings$color = settings.color) === null || _settings$color === void 0 ? void 0 : (_settings$color$palet = _settings$color.palette) === null || _settings$color$palet === void 0 ? void 0 : _settings$color$palet.custom;
|
|
280
|
+
const themeColors = settings === null || settings === void 0 ? void 0 : (_settings$color2 = settings.color) === null || _settings$color2 === void 0 ? void 0 : (_settings$color2$pale = _settings$color2.palette) === null || _settings$color2$pale === void 0 ? void 0 : _settings$color2$pale.theme;
|
|
281
|
+
const defaultColors = settings === null || settings === void 0 ? void 0 : (_settings$color3 = settings.color) === null || _settings$color3 === void 0 ? void 0 : (_settings$color3$pale = _settings$color3.palette) === null || _settings$color3$pale === void 0 ? void 0 : _settings$color3$pale.default;
|
|
282
|
+
const shouldDisplayDefaultColors = settings === null || settings === void 0 ? void 0 : (_settings$color4 = settings.color) === null || _settings$color4 === void 0 ? void 0 : _settings$color4.defaultPalette;
|
|
283
|
+
return (0, _element.useMemo)(() => {
|
|
284
|
+
const result = [];
|
|
285
|
+
|
|
286
|
+
if (themeColors && themeColors.length) {
|
|
287
|
+
result.push({
|
|
288
|
+
name: (0, _i18n._x)('Theme', 'Indicates this palette comes from the theme.'),
|
|
289
|
+
colors: themeColors
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
|
|
294
|
+
result.push({
|
|
295
|
+
name: (0, _i18n._x)('Default', 'Indicates this palette comes from WordPress.'),
|
|
296
|
+
colors: defaultColors
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (customColors && customColors.length) {
|
|
301
|
+
result.push({
|
|
302
|
+
name: (0, _i18n._x)('Custom', 'Indicates this palette is created by the user.'),
|
|
303
|
+
colors: customColors
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return result;
|
|
308
|
+
}, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function useGradientsPerOrigin(settings) {
|
|
312
|
+
var _settings$color5, _settings$color5$grad, _settings$color6, _settings$color6$grad, _settings$color7, _settings$color7$grad, _settings$color8;
|
|
313
|
+
|
|
314
|
+
const customGradients = settings === null || settings === void 0 ? void 0 : (_settings$color5 = settings.color) === null || _settings$color5 === void 0 ? void 0 : (_settings$color5$grad = _settings$color5.gradients) === null || _settings$color5$grad === void 0 ? void 0 : _settings$color5$grad.custom;
|
|
315
|
+
const themeGradients = settings === null || settings === void 0 ? void 0 : (_settings$color6 = settings.color) === null || _settings$color6 === void 0 ? void 0 : (_settings$color6$grad = _settings$color6.gradients) === null || _settings$color6$grad === void 0 ? void 0 : _settings$color6$grad.theme;
|
|
316
|
+
const defaultGradients = settings === null || settings === void 0 ? void 0 : (_settings$color7 = settings.color) === null || _settings$color7 === void 0 ? void 0 : (_settings$color7$grad = _settings$color7.gradients) === null || _settings$color7$grad === void 0 ? void 0 : _settings$color7$grad.default;
|
|
317
|
+
const shouldDisplayDefaultGradients = settings === null || settings === void 0 ? void 0 : (_settings$color8 = settings.color) === null || _settings$color8 === void 0 ? void 0 : _settings$color8.defaultGradients;
|
|
318
|
+
return (0, _element.useMemo)(() => {
|
|
319
|
+
const result = [];
|
|
320
|
+
|
|
321
|
+
if (themeGradients && themeGradients.length) {
|
|
322
|
+
result.push({
|
|
323
|
+
name: (0, _i18n._x)('Theme', 'Indicates this palette comes from the theme.'),
|
|
324
|
+
gradients: themeGradients
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
|
|
329
|
+
result.push({
|
|
330
|
+
name: (0, _i18n._x)('Default', 'Indicates this palette comes from WordPress.'),
|
|
331
|
+
gradients: defaultGradients
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (customGradients && customGradients.length) {
|
|
336
|
+
result.push({
|
|
337
|
+
name: (0, _i18n._x)('Custom', 'Indicates this palette is created by the user.'),
|
|
338
|
+
gradients: customGradients
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return result;
|
|
343
|
+
}, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]);
|
|
344
|
+
}
|
|
239
345
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"names":["EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","GlobalStylesContext","canReset","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","configToUse","result","forEach","setting","value","setSetting","newValue","currentConfig","newUserConfig","JSON","parse","stringify","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","rawResult","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","select","blocksStore","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","key","layout","spacing","sides","Array","isArray","length","dimensions","minHeight"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAEC,EAAAA,QAAQ,EAAE,EAAZ;AAAgBC,EAAAA,MAAM,EAAE;AAAxB,CAArB;AAEA,MAAMC,cAAc,GAAG,CACtB,iBADsB,EAEtB,+BAFsB,EAGtB,cAHsB,EAItB,eAJsB,EAKtB,cALsB,EAMtB,cANsB,EAOtB,gBAPsB,EAQtB,uBAR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OAAzB,sDAAe,kBAAqBF,GAArB,CAAf,IACXX,QADW,aACXA,QADW,6CACXA,QAAQ,CAAEa,OADC,uDACX,mBAAqBF,GAArB,CADW,GAEXX,QAFW,aAEXA,QAFW,6CAEXA,QAAQ,CAAEa,OAFC,gFAEX,mBAAqBF,GAArB,CAFW,0DAEX,sBAA4BG,KAF/B;;AAGA,UAAKA,KAAL,aAAKA,KAAL,eAAKA,KAAK,CAAEG,MAAZ,EAAqB;AAAA;;AACpBZ,QAAAA,eAAe,CAACQ,OAAhB,GAA0B,EACzB,GAAGR,eAAe,CAACQ,OADM;AAEzB,WAAEF,GAAF,GAAS,EACR,6BAAGN,eAAe,CAACQ,OAAnB,0DAAG,sBAA2BF,GAA3B,CAAH,CADQ;AAERG,YAAAA;AAFQ;AAFgB,SAA1B;AAOA;AACD,KApBD;;AAsBA,QAAK,CAAEf,eAAe,CAACO,QAAhB,CAA0B,WAA1B,CAAP,EAAiD;AAChDD,MAAAA,eAAe,CAACa,UAAhB,GAA6B,EAC5B,GAAGb,eAAe,CAACa,UADS;AAE5BC,QAAAA,SAAS,EAAE;AAFiB,OAA7B;AAIA;;AAED,WAAOd,eAAP;AACA,GAzEM,EAyEJ,CAAER,cAAF,EAAkBE,eAAlB,EAAmCC,QAAnC,CAzEI,CAAP;AA0EA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'useRootPaddingAwareAlignments',\n\t'border.color',\n\t'border.radius',\n\t'border.style',\n\t'border.width',\n\t'shadow.presets',\n\t'shadow.defaultPresets',\n\t'color.background',\n\t'color.custom',\n\t'color.customDuotone',\n\t'color.customGradient',\n\t'color.defaultDuotone',\n\t'color.defaultGradients',\n\t'color.defaultPalette',\n\t'color.duotone',\n\t'color.gradients',\n\t'color.link',\n\t'color.palette',\n\t'color.text',\n\t'custom',\n\t'dimensions.minHeight',\n\t'layout.contentSize',\n\t'layout.definitions',\n\t'layout.wideSize',\n\t'position.fixed',\n\t'position.sticky',\n\t'spacing.customSpacingSize',\n\t'spacing.spacingSizes',\n\t'spacing.spacingScale',\n\t'spacing.blockGap',\n\t'spacing.margin',\n\t'spacing.padding',\n\t'spacing.units',\n\t'typography.fluid',\n\t'typography.customFontSize',\n\t'typography.dropCap',\n\t'typography.fontFamilies',\n\t'typography.fontSizes',\n\t'typography.fontStyle',\n\t'typography.fontWeight',\n\t'typography.letterSpacing',\n\t'typography.lineHeight',\n\t'typography.textDecoration',\n\t'typography.textTransform',\n];\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useGlobalSetting( propertyPath, blockName, source = 'all' ) {\n\tconst { setUserConfig, ...configs } = useContext( GlobalStylesContext );\n\n\tconst appendedBlockPath = blockName ? '.blocks.' + blockName : '';\n\tconst appendedPropertyPath = propertyPath ? '.' + propertyPath : '';\n\tconst contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;\n\tconst globalPath = `settings${ appendedPropertyPath }`;\n\tconst sourceKey = source === 'all' ? 'merged' : source;\n\n\tconst settingValue = useMemo( () => {\n\t\tconst configToUse = configs[ sourceKey ];\n\t\tif ( ! configToUse ) {\n\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\tif ( propertyPath ) {\n\t\t\treturn (\n\t\t\t\tget( configToUse, contextualPath ) ??\n\t\t\t\tget( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tconst result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tget(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ?? get( configToUse, `settings.${ setting }` );\n\t\t\tif ( value ) {\n\t\t\t\tset( result, setting, value );\n\t\t\t}\n\t\t} );\n\t\treturn result;\n\t}, [\n\t\tconfigs,\n\t\tsourceKey,\n\t\tpropertyPath,\n\t\tcontextualPath,\n\t\tglobalPath,\n\t\tappendedBlockPath,\n\t] );\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset( newUserConfig, contextualPath, newValue );\n\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\treturn [ settingValue, setSetting ];\n}\n\nexport function useGlobalStyle(\n\tpath,\n\tblockName,\n\tsource = 'all',\n\t{ shouldDecodeEncode = true } = {}\n) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst appendedPath = path ? '.' + path : '';\n\tconst finalPath = ! blockName\n\t\t? `styles${ appendedPath }`\n\t\t: `styles.blocks.${ blockName }${ appendedPath }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset(\n\t\t\t\tnewUserConfig,\n\t\t\t\tfinalPath,\n\t\t\t\tshouldDecodeEncode\n\t\t\t\t\t? getPresetVariableFromValue(\n\t\t\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tnewValue\n\t\t\t\t\t )\n\t\t\t\t\t: newValue\n\t\t\t);\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult =\n\t\t\t\t// The stlyes.css path is allowed to be empty, so don't revert to base if undefined.\n\t\t\t\tfinalPath === 'styles.css'\n\t\t\t\t\t? get( userConfig, finalPath )\n\t\t\t\t\t: get( mergedConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = get( userConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = get( baseConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( baseConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\tif ( sides?.length ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tif ( ! supportedStyles.includes( 'minHeight' ) ) {\n\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\tminHeight: false,\n\t\t\t};\n\t\t}\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"names":["EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","GlobalStylesContext","canReset","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","configToUse","result","forEach","setting","value","setSetting","newValue","currentConfig","newUserConfig","JSON","parse","stringify","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","rawResult","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","select","blocksStore","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","color","text","background","button","heading","link","caption","gradients","customGradient","key","textColumns","layout","spacing","sides","Array","isArray","length","dimensions","minHeight","charAt","toUpperCase","slice","border","useColorsPerOrigin","customColors","palette","custom","themeColors","theme","defaultColors","default","shouldDisplayDefaultColors","defaultPalette","push","name","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients"],"mappings":";;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAEC,EAAAA,QAAQ,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CAAa;AACZC,QAAAA,IAAI,EAAE,cACL,SADK,EAEL,8CAFK,CADM;AAKZ3B,QAAAA,SAAS,EAAEgC;AALC,OAAb;AAOA;;AACD,QAAKF,eAAe,IAAIA,eAAe,CAACrB,MAAxC,EAAiD;AAChDtD,MAAAA,MAAM,CAACuE,IAAP,CAAa;AACZC,QAAAA,IAAI,EAAE,cACL,QADK,EAEL,gDAFK,CADM;AAKZ3B,QAAAA,SAAS,EAAE8B;AALC,OAAb;AAOA;;AACD,WAAO3E,MAAP;AACA,GAlCM,EAkCJ,CACF2E,eADE,EAEFC,cAFE,EAGFC,gBAHE,EAIFC,6BAJE,CAlCI,CAAP;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'useRootPaddingAwareAlignments',\n\t'border.color',\n\t'border.radius',\n\t'border.style',\n\t'border.width',\n\t'shadow.presets',\n\t'shadow.defaultPresets',\n\t'color.background',\n\t'color.button',\n\t'color.caption',\n\t'color.custom',\n\t'color.customDuotone',\n\t'color.customGradient',\n\t'color.defaultDuotone',\n\t'color.defaultGradients',\n\t'color.defaultPalette',\n\t'color.duotone',\n\t'color.gradients',\n\t'color.heading',\n\t'color.link',\n\t'color.palette',\n\t'color.text',\n\t'custom',\n\t'dimensions.minHeight',\n\t'layout.contentSize',\n\t'layout.definitions',\n\t'layout.wideSize',\n\t'position.fixed',\n\t'position.sticky',\n\t'spacing.customSpacingSize',\n\t'spacing.spacingSizes',\n\t'spacing.spacingScale',\n\t'spacing.blockGap',\n\t'spacing.margin',\n\t'spacing.padding',\n\t'spacing.units',\n\t'typography.fluid',\n\t'typography.customFontSize',\n\t'typography.dropCap',\n\t'typography.fontFamilies',\n\t'typography.fontSizes',\n\t'typography.fontStyle',\n\t'typography.fontWeight',\n\t'typography.letterSpacing',\n\t'typography.lineHeight',\n\t'typography.textColumns',\n\t'typography.textDecoration',\n\t'typography.textTransform',\n];\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useGlobalSetting( propertyPath, blockName, source = 'all' ) {\n\tconst { setUserConfig, ...configs } = useContext( GlobalStylesContext );\n\n\tconst appendedBlockPath = blockName ? '.blocks.' + blockName : '';\n\tconst appendedPropertyPath = propertyPath ? '.' + propertyPath : '';\n\tconst contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;\n\tconst globalPath = `settings${ appendedPropertyPath }`;\n\tconst sourceKey = source === 'all' ? 'merged' : source;\n\n\tconst settingValue = useMemo( () => {\n\t\tconst configToUse = configs[ sourceKey ];\n\t\tif ( ! configToUse ) {\n\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\tif ( propertyPath ) {\n\t\t\treturn (\n\t\t\t\tget( configToUse, contextualPath ) ??\n\t\t\t\tget( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tconst result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tget(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ?? get( configToUse, `settings.${ setting }` );\n\t\t\tif ( value ) {\n\t\t\t\tset( result, setting, value );\n\t\t\t}\n\t\t} );\n\t\treturn result;\n\t}, [\n\t\tconfigs,\n\t\tsourceKey,\n\t\tpropertyPath,\n\t\tcontextualPath,\n\t\tglobalPath,\n\t\tappendedBlockPath,\n\t] );\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset( newUserConfig, contextualPath, newValue );\n\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\treturn [ settingValue, setSetting ];\n}\n\nexport function useGlobalStyle(\n\tpath,\n\tblockName,\n\tsource = 'all',\n\t{ shouldDecodeEncode = true } = {}\n) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst appendedPath = path ? '.' + path : '';\n\tconst finalPath = ! blockName\n\t\t? `styles${ appendedPath }`\n\t\t: `styles.blocks.${ blockName }${ appendedPath }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset(\n\t\t\t\tnewUserConfig,\n\t\t\t\tfinalPath,\n\t\t\t\tshouldDecodeEncode\n\t\t\t\t\t? getPresetVariableFromValue(\n\t\t\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tnewValue\n\t\t\t\t\t )\n\t\t\t\t\t: newValue\n\t\t\t);\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult =\n\t\t\t\t// The styles.css path is allowed to be empty, so don't revert to base if undefined.\n\t\t\t\tfinalPath === 'styles.css'\n\t\t\t\t\t? get( userConfig, finalPath )\n\t\t\t\t\t: get( mergedConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = get( userConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = get( baseConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( baseConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\tupdatedSettings.color = {\n\t\t\t...updatedSettings.color,\n\t\t\ttext:\n\t\t\t\tupdatedSettings.color?.text &&\n\t\t\t\tsupportedStyles.includes( 'color' ),\n\t\t\tbackground:\n\t\t\t\tupdatedSettings.color?.background &&\n\t\t\t\t( supportedStyles.includes( 'background' ) ||\n\t\t\t\t\tsupportedStyles.includes( 'backgroundColor' ) ),\n\t\t\tbutton:\n\t\t\t\tupdatedSettings.color?.button &&\n\t\t\t\tsupportedStyles.includes( 'buttonColor' ),\n\t\t\theading:\n\t\t\t\tupdatedSettings.color?.heading &&\n\t\t\t\tsupportedStyles.includes( 'headingColor' ),\n\t\t\tlink:\n\t\t\t\tupdatedSettings.color?.link &&\n\t\t\t\tsupportedStyles.includes( 'linkColor' ),\n\t\t\tcaption:\n\t\t\t\tupdatedSettings.color?.caption &&\n\t\t\t\tsupportedStyles.includes( 'captionColor' ),\n\t\t};\n\n\t\t// Some blocks can enable background colors but disable gradients.\n\t\tif ( ! supportedStyles.includes( 'background' ) ) {\n\t\t\tupdatedSettings.color.gradients = [];\n\t\t\tupdatedSettings.color.customGradient = false;\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t// The column-count style is named text column to reduce confusion with\n\t\t// the columns block and manage expectations from the support.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/33587\n\t\tif ( ! supportedStyles.includes( 'columnCount' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextColumns: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\tif ( sides?.length ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tif ( ! supportedStyles.includes( 'minHeight' ) ) {\n\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\tminHeight: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {\n\t\t\tif (\n\t\t\t\t! supportedStyles.includes(\n\t\t\t\t\t'border' + key.charAt( 0 ).toUpperCase() + key.slice( 1 )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tupdatedSettings.border = {\n\t\t\t\t\t...updatedSettings.border,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n\nexport function useColorsPerOrigin( settings ) {\n\tconst customColors = settings?.color?.palette?.custom;\n\tconst themeColors = settings?.color?.palette?.theme;\n\tconst defaultColors = settings?.color?.palette?.default;\n\tconst shouldDisplayDefaultColors = settings?.color?.defaultPalette;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n}\n\nexport function useGradientsPerOrigin( settings ) {\n\tconst customGradients = settings?.color?.gradients?.custom;\n\tconst themeGradients = settings?.color?.gradients?.theme;\n\tconst defaultGradients = settings?.color?.gradients?.default;\n\tconst shouldDisplayDefaultGradients = settings?.color?.defaultGradients;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n}\n"]}
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "BorderPanel", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _borderPanel.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ColorPanel", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _colorPanel.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
6
18
|
Object.defineProperty(exports, "DimensionsPanel", {
|
|
7
19
|
enumerable: true,
|
|
8
20
|
get: function () {
|
|
@@ -21,6 +33,12 @@ Object.defineProperty(exports, "TypographyPanel", {
|
|
|
21
33
|
return _typographyPanel.default;
|
|
22
34
|
}
|
|
23
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "getBlockCSSSelector", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _getBlockCssSelector.getBlockCSSSelector;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
24
42
|
Object.defineProperty(exports, "useGlobalSetting", {
|
|
25
43
|
enumerable: true,
|
|
26
44
|
get: function () {
|
|
@@ -45,6 +63,18 @@ Object.defineProperty(exports, "useGlobalStylesReset", {
|
|
|
45
63
|
return _hooks.useGlobalStylesReset;
|
|
46
64
|
}
|
|
47
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "useHasBorderPanel", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _borderPanel.useHasBorderPanel;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "useHasColorPanel", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _colorPanel.useHasColorPanel;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
48
78
|
Object.defineProperty(exports, "useHasDimensionsPanel", {
|
|
49
79
|
enumerable: true,
|
|
50
80
|
get: function () {
|
|
@@ -66,6 +96,8 @@ Object.defineProperty(exports, "useSettingsForBlockElement", {
|
|
|
66
96
|
|
|
67
97
|
var _hooks = require("./hooks");
|
|
68
98
|
|
|
99
|
+
var _getBlockCssSelector = require("./get-block-css-selector");
|
|
100
|
+
|
|
69
101
|
var _useGlobalStylesOutput = require("./use-global-styles-output");
|
|
70
102
|
|
|
71
103
|
var _context = require("./context");
|
|
@@ -74,6 +106,10 @@ var _typographyPanel = _interopRequireWildcard(require("./typography-panel"));
|
|
|
74
106
|
|
|
75
107
|
var _dimensionsPanel = _interopRequireWildcard(require("./dimensions-panel"));
|
|
76
108
|
|
|
109
|
+
var _borderPanel = _interopRequireWildcard(require("./border-panel"));
|
|
110
|
+
|
|
111
|
+
var _colorPanel = _interopRequireWildcard(require("./color-panel"));
|
|
112
|
+
|
|
77
113
|
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); }
|
|
78
114
|
|
|
79
115
|
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; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AACA;;AACA;;AACA;;AAIA;;AAIA;;AACA","sourcesContent":["export {\n\tuseGlobalStylesReset,\n\tuseGlobalSetting,\n\tuseGlobalStyle,\n\tuseSettingsForBlockElement,\n} from './hooks';\nexport { getBlockCSSSelector } from './get-block-css-selector';\nexport { useGlobalStylesOutput } from './use-global-styles-output';\nexport { GlobalStylesContext } from './context';\nexport {\n\tdefault as TypographyPanel,\n\tuseHasTypographyPanel,\n} from './typography-panel';\nexport {\n\tdefault as DimensionsPanel,\n\tuseHasDimensionsPanel,\n} from './dimensions-panel';\nexport { default as BorderPanel, useHasBorderPanel } from './border-panel';\nexport { default as ColorPanel, useHasColorPanel } from './color-panel';\n"]}
|
|
@@ -28,6 +28,8 @@ var _textDecorationControl = _interopRequireDefault(require("../text-decoration-
|
|
|
28
28
|
|
|
29
29
|
var _utils = require("./utils");
|
|
30
30
|
|
|
31
|
+
var _object = require("../../utils/object");
|
|
32
|
+
|
|
31
33
|
/**
|
|
32
34
|
* WordPress dependencies
|
|
33
35
|
*/
|
|
@@ -35,6 +37,9 @@ var _utils = require("./utils");
|
|
|
35
37
|
/**
|
|
36
38
|
* Internal dependencies
|
|
37
39
|
*/
|
|
40
|
+
const MIN_TEXT_COLUMNS = 1;
|
|
41
|
+
const MAX_TEXT_COLUMNS = 6;
|
|
42
|
+
|
|
38
43
|
function useHasTypographyPanel(settings) {
|
|
39
44
|
const hasFontFamily = useHasFontFamilyControl(settings);
|
|
40
45
|
const hasLineHeight = useHasLineHeightControl(settings);
|
|
@@ -42,8 +47,9 @@ function useHasTypographyPanel(settings) {
|
|
|
42
47
|
const hasLetterSpacing = useHasLetterSpacingControl(settings);
|
|
43
48
|
const hasTextTransform = useHasTextTransformControl(settings);
|
|
44
49
|
const hasTextDecoration = useHasTextDecorationControl(settings);
|
|
50
|
+
const hasTextColumns = useHasTextColumnsControl(settings);
|
|
45
51
|
const hasFontSize = useHasFontSizeControl(settings);
|
|
46
|
-
return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration;
|
|
52
|
+
return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration || hasTextColumns;
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
function useHasFontSizeControl(settings) {
|
|
@@ -112,6 +118,12 @@ function useHasTextDecorationControl(settings) {
|
|
|
112
118
|
return settings === null || settings === void 0 ? void 0 : (_settings$typography11 = settings.typography) === null || _settings$typography11 === void 0 ? void 0 : _settings$typography11.textDecoration;
|
|
113
119
|
}
|
|
114
120
|
|
|
121
|
+
function useHasTextColumnsControl(settings) {
|
|
122
|
+
var _settings$typography12;
|
|
123
|
+
|
|
124
|
+
return settings === null || settings === void 0 ? void 0 : (_settings$typography12 = settings.typography) === null || _settings$typography12 === void 0 ? void 0 : _settings$typography12.textColumns;
|
|
125
|
+
}
|
|
126
|
+
|
|
115
127
|
function TypographyToolsPanel(_ref3) {
|
|
116
128
|
let {
|
|
117
129
|
resetAllFilter,
|
|
@@ -140,11 +152,12 @@ const DEFAULT_CONTROLS = {
|
|
|
140
152
|
lineHeight: true,
|
|
141
153
|
letterSpacing: true,
|
|
142
154
|
textTransform: true,
|
|
143
|
-
textDecoration: true
|
|
155
|
+
textDecoration: true,
|
|
156
|
+
textColumns: true
|
|
144
157
|
};
|
|
145
158
|
|
|
146
159
|
function TypographyPanel(_ref4) {
|
|
147
|
-
var _settings$
|
|
160
|
+
var _settings$typography13, _ref5, _fontFamiliesPerOrigi2, _inheritedValue$typog, _settings$typography14, _settings$typography$2, _settings$typography15, _ref7, _fontSizesPerOrigin$c2, _inheritedValue$typog2, _settings$typography16, _settings$typography17, _inheritedValue$typog3, _inheritedValue$typog4, _inheritedValue$typog5, _inheritedValue$typog6, _inheritedValue$typog7, _inheritedValue$typog8, _inheritedValue$typog9;
|
|
148
161
|
|
|
149
162
|
let {
|
|
150
163
|
as: Wrapper = TypographyToolsPanel,
|
|
@@ -162,7 +175,7 @@ function TypographyPanel(_ref4) {
|
|
|
162
175
|
|
|
163
176
|
|
|
164
177
|
const hasFontFamilyEnabled = useHasFontFamilyControl(settings);
|
|
165
|
-
const fontFamiliesPerOrigin = settings === null || settings === void 0 ? void 0 : (_settings$
|
|
178
|
+
const fontFamiliesPerOrigin = settings === null || settings === void 0 ? void 0 : (_settings$typography13 = settings.typography) === null || _settings$typography13 === void 0 ? void 0 : _settings$typography13.fontFamilies;
|
|
166
179
|
const fontFamilies = (_ref5 = (_fontFamiliesPerOrigi2 = fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) !== null && _fontFamiliesPerOrigi2 !== void 0 ? _fontFamiliesPerOrigi2 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) !== null && _ref5 !== void 0 ? _ref5 : fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default;
|
|
167
180
|
const fontFamily = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog = inheritedValue.typography) === null || _inheritedValue$typog === void 0 ? void 0 : _inheritedValue$typog.fontFamily);
|
|
168
181
|
|
|
@@ -175,11 +188,7 @@ function TypographyPanel(_ref4) {
|
|
|
175
188
|
} = _ref6;
|
|
176
189
|
return f === newValue;
|
|
177
190
|
})) === null || _fontFamilies$find === void 0 ? void 0 : _fontFamilies$find.slug;
|
|
178
|
-
onChange(
|
|
179
|
-
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
180
|
-
fontFamily: slug ? `var:preset|font-family|${slug}` : newValue
|
|
181
|
-
}
|
|
182
|
-
});
|
|
191
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'fontFamily'], slug ? `var:preset|font-family|${slug}` : newValue));
|
|
183
192
|
};
|
|
184
193
|
|
|
185
194
|
const hasFontFamily = () => {
|
|
@@ -192,18 +201,14 @@ function TypographyPanel(_ref4) {
|
|
|
192
201
|
|
|
193
202
|
|
|
194
203
|
const hasFontSizeEnabled = useHasFontSizeControl(settings);
|
|
195
|
-
const disableCustomFontSizes = !(settings !== null && settings !== void 0 && (_settings$
|
|
196
|
-
const fontSizesPerOrigin = (_settings$typography$2 = settings === null || settings === void 0 ? void 0 : (_settings$
|
|
204
|
+
const disableCustomFontSizes = !(settings !== null && settings !== void 0 && (_settings$typography14 = settings.typography) !== null && _settings$typography14 !== void 0 && _settings$typography14.customFontSize);
|
|
205
|
+
const fontSizesPerOrigin = (_settings$typography$2 = settings === null || settings === void 0 ? void 0 : (_settings$typography15 = settings.typography) === null || _settings$typography15 === void 0 ? void 0 : _settings$typography15.fontSizes) !== null && _settings$typography$2 !== void 0 ? _settings$typography$2 : {};
|
|
197
206
|
const fontSizes = (_ref7 = (_fontSizesPerOrigin$c2 = fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) !== null && _fontSizesPerOrigin$c2 !== void 0 ? _fontSizesPerOrigin$c2 : fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) !== null && _ref7 !== void 0 ? _ref7 : fontSizesPerOrigin.default;
|
|
198
207
|
const fontSize = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog2 = inheritedValue.typography) === null || _inheritedValue$typog2 === void 0 ? void 0 : _inheritedValue$typog2.fontSize);
|
|
199
208
|
|
|
200
209
|
const setFontSize = (newValue, metadata) => {
|
|
201
210
|
const actualValue = !!(metadata !== null && metadata !== void 0 && metadata.slug) ? `var:preset|font-size|${metadata === null || metadata === void 0 ? void 0 : metadata.slug}` : newValue;
|
|
202
|
-
onChange(
|
|
203
|
-
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
204
|
-
fontSize: actualValue
|
|
205
|
-
}
|
|
206
|
-
});
|
|
211
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'fontSize'], actualValue));
|
|
207
212
|
};
|
|
208
213
|
|
|
209
214
|
const hasFontSize = () => {
|
|
@@ -217,8 +222,8 @@ function TypographyPanel(_ref4) {
|
|
|
217
222
|
|
|
218
223
|
const hasAppearanceControl = useHasAppearanceControl(settings);
|
|
219
224
|
const appearanceControlLabel = useAppearanceControlLabel(settings);
|
|
220
|
-
const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$
|
|
221
|
-
const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$
|
|
225
|
+
const hasFontStyles = settings === null || settings === void 0 ? void 0 : (_settings$typography16 = settings.typography) === null || _settings$typography16 === void 0 ? void 0 : _settings$typography16.fontStyle;
|
|
226
|
+
const hasFontWeights = settings === null || settings === void 0 ? void 0 : (_settings$typography17 = settings.typography) === null || _settings$typography17 === void 0 ? void 0 : _settings$typography17.fontWeight;
|
|
222
227
|
const fontStyle = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog3 = inheritedValue.typography) === null || _inheritedValue$typog3 === void 0 ? void 0 : _inheritedValue$typog3.fontStyle);
|
|
223
228
|
const fontWeight = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog4 = inheritedValue.typography) === null || _inheritedValue$typog4 === void 0 ? void 0 : _inheritedValue$typog4.fontWeight);
|
|
224
229
|
|
|
@@ -250,11 +255,7 @@ function TypographyPanel(_ref4) {
|
|
|
250
255
|
const lineHeight = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog5 = inheritedValue.typography) === null || _inheritedValue$typog5 === void 0 ? void 0 : _inheritedValue$typog5.lineHeight);
|
|
251
256
|
|
|
252
257
|
const setLineHeight = newValue => {
|
|
253
|
-
onChange(
|
|
254
|
-
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
255
|
-
lineHeight: newValue
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'lineHeight'], newValue));
|
|
258
259
|
};
|
|
259
260
|
|
|
260
261
|
const hasLineHeight = () => {
|
|
@@ -270,11 +271,7 @@ function TypographyPanel(_ref4) {
|
|
|
270
271
|
const letterSpacing = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog6 = inheritedValue.typography) === null || _inheritedValue$typog6 === void 0 ? void 0 : _inheritedValue$typog6.letterSpacing);
|
|
271
272
|
|
|
272
273
|
const setLetterSpacing = newValue => {
|
|
273
|
-
onChange(
|
|
274
|
-
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
275
|
-
letterSpacing: newValue
|
|
276
|
-
}
|
|
277
|
-
});
|
|
274
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'letterSpacing'], newValue));
|
|
278
275
|
};
|
|
279
276
|
|
|
280
277
|
const hasLetterSpacing = () => {
|
|
@@ -283,44 +280,52 @@ function TypographyPanel(_ref4) {
|
|
|
283
280
|
return !!(value !== null && value !== void 0 && (_value$typography6 = value.typography) !== null && _value$typography6 !== void 0 && _value$typography6.letterSpacing);
|
|
284
281
|
};
|
|
285
282
|
|
|
286
|
-
const resetLetterSpacing = () => setLetterSpacing(undefined); // Text
|
|
283
|
+
const resetLetterSpacing = () => setLetterSpacing(undefined); // Text Columns
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
const hasTextColumnsControl = useHasTextColumnsControl(settings);
|
|
287
|
+
const textColumns = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog7 = inheritedValue.typography) === null || _inheritedValue$typog7 === void 0 ? void 0 : _inheritedValue$typog7.textColumns);
|
|
288
|
+
|
|
289
|
+
const setTextColumns = newValue => {
|
|
290
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'textColumns'], newValue));
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const hasTextColumns = () => {
|
|
294
|
+
var _value$typography7;
|
|
295
|
+
|
|
296
|
+
return !!(value !== null && value !== void 0 && (_value$typography7 = value.typography) !== null && _value$typography7 !== void 0 && _value$typography7.textColumns);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const resetTextColumns = () => setTextColumns(undefined); // Text Transform
|
|
287
300
|
|
|
288
301
|
|
|
289
302
|
const hasTextTransformControl = useHasTextTransformControl(settings);
|
|
290
|
-
const textTransform = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$
|
|
303
|
+
const textTransform = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog8 = inheritedValue.typography) === null || _inheritedValue$typog8 === void 0 ? void 0 : _inheritedValue$typog8.textTransform);
|
|
291
304
|
|
|
292
305
|
const setTextTransform = newValue => {
|
|
293
|
-
onChange(
|
|
294
|
-
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
295
|
-
textTransform: newValue
|
|
296
|
-
}
|
|
297
|
-
});
|
|
306
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'textTransform'], newValue));
|
|
298
307
|
};
|
|
299
308
|
|
|
300
309
|
const hasTextTransform = () => {
|
|
301
|
-
var _value$
|
|
310
|
+
var _value$typography8;
|
|
302
311
|
|
|
303
|
-
return !!(value !== null && value !== void 0 && (_value$
|
|
312
|
+
return !!(value !== null && value !== void 0 && (_value$typography8 = value.typography) !== null && _value$typography8 !== void 0 && _value$typography8.textTransform);
|
|
304
313
|
};
|
|
305
314
|
|
|
306
315
|
const resetTextTransform = () => setTextTransform(undefined); // Text Decoration
|
|
307
316
|
|
|
308
317
|
|
|
309
318
|
const hasTextDecorationControl = useHasTextDecorationControl(settings);
|
|
310
|
-
const textDecoration = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$
|
|
319
|
+
const textDecoration = decodeValue(inheritedValue === null || inheritedValue === void 0 ? void 0 : (_inheritedValue$typog9 = inheritedValue.typography) === null || _inheritedValue$typog9 === void 0 ? void 0 : _inheritedValue$typog9.textDecoration);
|
|
311
320
|
|
|
312
321
|
const setTextDecoration = newValue => {
|
|
313
|
-
onChange(
|
|
314
|
-
typography: { ...(value === null || value === void 0 ? void 0 : value.typography),
|
|
315
|
-
textDecoration: newValue
|
|
316
|
-
}
|
|
317
|
-
});
|
|
322
|
+
onChange((0, _object.immutableSet)(value, ['typography', 'textDecoration'], newValue));
|
|
318
323
|
};
|
|
319
324
|
|
|
320
325
|
const hasTextDecoration = () => {
|
|
321
|
-
var _value$
|
|
326
|
+
var _value$typography9;
|
|
322
327
|
|
|
323
|
-
return !!(value !== null && value !== void 0 && (_value$
|
|
328
|
+
return !!(value !== null && value !== void 0 && (_value$typography9 = value.typography) !== null && _value$typography9 !== void 0 && _value$typography9.textDecoration);
|
|
324
329
|
};
|
|
325
330
|
|
|
326
331
|
const resetTextDecoration = () => setTextDecoration(undefined);
|
|
@@ -404,6 +409,22 @@ function TypographyPanel(_ref4) {
|
|
|
404
409
|
onChange: setLetterSpacing,
|
|
405
410
|
size: "__unstable-large",
|
|
406
411
|
__unstableInputWidth: "auto"
|
|
412
|
+
})), hasTextColumnsControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
413
|
+
className: "single-column",
|
|
414
|
+
label: (0, _i18n.__)('Text columns'),
|
|
415
|
+
hasValue: hasTextColumns,
|
|
416
|
+
onDeselect: resetTextColumns,
|
|
417
|
+
isShownByDefault: defaultControls.textColumns,
|
|
418
|
+
panelId: panelId
|
|
419
|
+
}, (0, _element.createElement)(_components.__experimentalNumberControl, {
|
|
420
|
+
label: (0, _i18n.__)('Text columns'),
|
|
421
|
+
max: MAX_TEXT_COLUMNS,
|
|
422
|
+
min: MIN_TEXT_COLUMNS,
|
|
423
|
+
onChange: setTextColumns,
|
|
424
|
+
size: "__unstable-large",
|
|
425
|
+
spinControls: "custom",
|
|
426
|
+
value: textColumns,
|
|
427
|
+
initialPosition: 1
|
|
407
428
|
})), hasTextDecorationControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
408
429
|
className: "single-column",
|
|
409
430
|
label: (0, _i18n.__)('Text decoration'),
|