@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.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 +33 -3
- package/build/components/block-canvas/index.js +107 -0
- package/build/components/block-canvas/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +19 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +66 -0
- package/build/components/block-patterns-paging/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -7
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -0
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +1 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -4
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/default-block-appender/index.native.js +20 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/duotone/utils.js +68 -0
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/editor-styles/index.js +28 -9
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -101
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +61 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -0
- package/build/components/global-styles/index.js +11 -17
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +67 -33
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -5
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +9 -9
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +8 -12
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-source-filter.js +54 -0
- package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-sync-filter.js +46 -0
- package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +91 -45
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +21 -10
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/menu.js +13 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -12
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +12 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.js +24 -13
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -3
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +13 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/index.js +12 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +29 -24
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +11 -11
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/constants.js +30 -0
- package/build/components/media-upload/constants.js.map +1 -0
- package/build/components/media-upload/index.native.js +63 -53
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +1 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +34 -35
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +14 -32
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +95 -0
- package/build/components/rich-text/multiline.js.map +1 -0
- package/build/components/rich-text/split-value.js +10 -16
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-enter.js +31 -40
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +18 -33
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-commands/index.js +30 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +5 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/background.js +258 -0
- package/build/hooks/background.js.map +1 -0
- package/build/hooks/block-hooks.js +188 -0
- package/build/hooks/block-hooks.js.map +1 -0
- package/build/hooks/block-rename-ui.js +160 -0
- package/build/hooks/block-rename-ui.js.map +1 -0
- package/build/hooks/duotone.js +29 -42
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +31 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +10 -3
- package/build/hooks/style.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +33 -10
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +42 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +23 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +43 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +84 -23
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +0 -4
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +97 -0
- package/build-module/components/block-canvas/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +4 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +20 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +59 -0
- package/build-module/components/block-patterns-paging/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -0
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +1 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -4
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js +20 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/duotone/utils.js +65 -0
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/editor-styles/index.js +28 -9
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -100
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +53 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
- package/build-module/components/global-styles/index.js +2 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +66 -33
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -5
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +9 -9
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
- package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +87 -46
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -12
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +25 -14
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -3
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +15 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/index.js +12 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +13 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +30 -25
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -7
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/constants.js +14 -0
- package/build-module/components/media-upload/constants.js.map +1 -0
- package/build-module/components/media-upload/index.native.js +53 -34
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +1 -1
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +35 -37
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +15 -33
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +87 -0
- package/build-module/components/rich-text/multiline.js.map +1 -0
- package/build-module/components/rich-text/split-value.js +10 -16
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +33 -42
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +19 -34
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +28 -16
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/hooks/background.js +244 -0
- package/build-module/hooks/background.js.map +1 -0
- package/build-module/hooks/block-hooks.js +181 -0
- package/build-module/hooks/block-hooks.js.map +1 -0
- package/build-module/hooks/block-rename-ui.js +153 -0
- package/build-module/hooks/block-rename-ui.js.map +1 -0
- package/build-module/hooks/duotone.js +26 -39
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -2
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +33 -16
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +4 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +10 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +33 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +39 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +21 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +41 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +78 -22
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +0 -4
- package/build-module/store/utils.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +170 -127
- package/build-style/style.css +170 -127
- package/package.json +32 -32
- package/src/components/block-canvas/index.js +108 -0
- package/src/components/block-inspector/index.js +5 -1
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-patterns-list/index.js +32 -7
- package/src/components/block-patterns-list/style.scss +26 -9
- package/src/components/block-patterns-paging/index.js +92 -0
- package/src/components/block-patterns-paging/style.scss +42 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
- package/src/components/block-settings-menu-controls/index.js +4 -9
- package/src/components/block-styles/index.js +1 -0
- package/src/components/block-styles/style.scss +3 -3
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
- package/src/components/block-tools/block-contextual-toolbar.js +16 -5
- package/src/components/block-tools/block-selection-button.js +9 -1
- package/src/components/block-tools/style.scss +0 -98
- package/src/components/border-radius-control/input-controls.js +1 -1
- package/src/components/border-radius-control/linked-button.js +8 -11
- package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
- package/src/components/colors/with-colors.js +3 -2
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
- package/src/components/default-block-appender/index.native.js +26 -3
- package/src/components/duotone/utils.js +65 -0
- package/src/components/editor-styles/index.js +32 -23
- package/src/components/global-styles/hooks.js +4 -112
- package/src/components/global-styles/image-settings-panel.js +71 -0
- package/src/components/global-styles/index.js +4 -3
- package/src/components/global-styles/use-global-styles-output.js +25 -16
- package/src/components/global-styles/utils.js +1 -2
- package/src/components/iframe/index.js +72 -33
- package/src/components/image-editor/use-save-image.js +2 -9
- package/src/components/image-editor/use-transform-image.js +9 -9
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
- package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
- package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
- package/src/components/inserter/block-patterns-source-filter.js +40 -0
- package/src/components/inserter/block-patterns-sync-filter.js +35 -0
- package/src/components/inserter/block-patterns-tab.js +168 -57
- package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
- package/src/components/inserter/hooks/use-patterns-state.js +27 -16
- package/src/components/inserter/menu.js +15 -17
- package/src/components/inserter/search-results.js +6 -4
- package/src/components/inserter/style.scss +23 -2
- package/src/components/inserter/tabs.js +2 -12
- package/src/components/inserter/test/index.native.js +8 -12
- package/src/components/inspector-controls/block-support-slot-container.js +19 -3
- package/src/components/inspector-controls/fill.js +28 -14
- package/src/components/inspector-controls/groups.js +6 -2
- package/src/components/inspector-controls/slot.js +28 -3
- package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
- package/src/components/link-control/index.js +13 -0
- package/src/components/link-control/style.scss +23 -2
- package/src/components/link-control/test/index.js +88 -6
- package/src/components/list-view/block-select-button.js +1 -3
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/style.scss +1 -2
- package/src/components/list-view/use-block-selection.js +38 -32
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +2 -2
- package/src/components/media-placeholder/index.native.js +11 -12
- package/src/components/media-replace-flow/index.js +2 -2
- package/src/components/media-replace-flow/test/index.js +5 -23
- package/src/components/media-upload/README.md +3 -2
- package/src/components/media-upload/constants.js +15 -0
- package/src/components/media-upload/index.native.js +66 -40
- package/src/components/media-upload/style.native.scss +4 -0
- package/src/components/media-upload/test/index.native.js +2 -2
- package/src/components/preview-options/README.md +7 -0
- package/src/components/preview-options/index.js +1 -1
- package/src/components/rich-text/index.js +48 -44
- package/src/components/rich-text/index.native.js +14 -42
- package/src/components/rich-text/multiline.js +121 -0
- package/src/components/rich-text/split-value.js +10 -35
- package/src/components/rich-text/use-enter.js +32 -42
- package/src/components/rich-text/use-paste-handler.js +16 -40
- package/src/components/spacing-sizes-control/style.scss +5 -7
- package/src/components/spacing-sizes-control/utils.js +1 -2
- package/src/components/use-block-commands/index.js +28 -20
- package/src/components/use-block-display-information/index.js +3 -0
- package/src/hooks/background.js +288 -0
- package/src/hooks/background.scss +57 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +230 -0
- package/src/hooks/block-rename-ui.scss +3 -0
- package/src/hooks/duotone.js +42 -43
- package/src/hooks/index.js +2 -2
- package/src/hooks/layout.js +31 -33
- package/src/hooks/position.js +4 -3
- package/src/hooks/style.js +11 -2
- package/src/hooks/test/align.native.js +4 -3
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +52 -10
- package/src/store/private-actions.js +37 -6
- package/src/store/private-selectors.js +21 -0
- package/src/store/reducer.js +38 -0
- package/src/store/selectors.js +107 -26
- package/src/store/test/actions.js +19 -8
- package/src/store/test/private-actions.js +17 -0
- package/src/store/test/reducer.js +25 -0
- package/src/store/test/selectors.js +130 -123
- package/src/store/utils.js +3 -10
- package/src/style.scss +4 -0
- package/build/components/duotone/components.js +0 -135
- package/build/components/duotone/components.js.map +0 -1
- package/build/components/duotone/index.js +0 -38
- package/build/components/duotone/index.js.map +0 -1
- package/build/components/global-styles/behaviors-panel.js +0 -64
- package/build/components/global-styles/behaviors-panel.js.map +0 -1
- package/build/components/inserter/reusable-blocks-tab.js +0 -85
- package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build/hooks/auto-inserting-blocks.js +0 -174
- package/build/hooks/auto-inserting-blocks.js.map +0 -1
- package/build/hooks/behaviors.js +0 -173
- package/build/hooks/behaviors.js.map +0 -1
- package/build-module/components/duotone/components.js +0 -126
- package/build-module/components/duotone/components.js.map +0 -1
- package/build-module/components/duotone/index.js +0 -3
- package/build-module/components/duotone/index.js.map +0 -1
- package/build-module/components/global-styles/behaviors-panel.js +0 -57
- package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
- package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build-module/hooks/auto-inserting-blocks.js +0 -167
- package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
- package/build-module/hooks/behaviors.js +0 -166
- package/build-module/hooks/behaviors.js.map +0 -1
- package/src/components/duotone/components.js +0 -133
- package/src/components/duotone/index.js +0 -7
- package/src/components/global-styles/behaviors-panel.js +0 -71
- package/src/components/inserter/reusable-blocks-tab.js +0 -84
- package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
- package/src/hooks/auto-inserting-blocks.js +0 -232
- package/src/hooks/behaviors.js +0 -206
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["colord","extend","namesPlugin","a11yPlugin","SVG","useCallback","useMemo","transformStyles","
|
|
1
|
+
{"version":3,"names":["colord","extend","namesPlugin","a11yPlugin","SVG","useCallback","useMemo","useSelect","transformStyles","store","blockEditorStore","unlock","useDarkThemeBodyClassName","styles","scope","node","ownerDocument","defaultView","body","canvas","querySelector","backgroundColor","tempCanvas","createElement","classList","add","appendChild","getComputedStyle","getPropertyValue","removeChild","colordBackgroundColor","luminance","alpha","remove","EditorStyles","overrides","select","getStyleOverrides","transformedStyles","transformedSvgs","_styles","Object","values","id","override","index","findIndex","_id","overrideWithId","push","filter","style","css","__unstableType","map","assets","join","Fragment","ref","key","xmlns","viewBox","width","height","role","visibility","position","left","overflow","dangerouslySetInnerHTML","__html"],"sources":["@wordpress/block-editor/src/components/editor-styles/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { SVG } from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport transformStyles from '../../utils/transform-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction useDarkThemeBodyClassName( styles, scope ) {\n\treturn useCallback(\n\t\t( node ) => {\n\t\t\tif ( ! node ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView, body } = ownerDocument;\n\t\t\tconst canvas = scope ? ownerDocument.querySelector( scope ) : body;\n\n\t\t\tlet backgroundColor;\n\n\t\t\tif ( ! canvas ) {\n\t\t\t\t// The real .editor-styles-wrapper element might not exist in the\n\t\t\t\t// DOM, so calculate the background color by creating a fake\n\t\t\t\t// wrapper.\n\t\t\t\tconst tempCanvas = ownerDocument.createElement( 'div' );\n\t\t\t\ttempCanvas.classList.add( 'editor-styles-wrapper' );\n\t\t\t\tbody.appendChild( tempCanvas );\n\n\t\t\t\tbackgroundColor = defaultView\n\t\t\t\t\t?.getComputedStyle( tempCanvas, null )\n\t\t\t\t\t.getPropertyValue( 'background-color' );\n\n\t\t\t\tbody.removeChild( tempCanvas );\n\t\t\t} else {\n\t\t\t\tbackgroundColor = defaultView\n\t\t\t\t\t?.getComputedStyle( canvas, null )\n\t\t\t\t\t.getPropertyValue( 'background-color' );\n\t\t\t}\n\t\t\tconst colordBackgroundColor = colord( backgroundColor );\n\t\t\t// If background is transparent, it should be treated as light color.\n\t\t\tif (\n\t\t\t\tcolordBackgroundColor.luminance() > 0.5 ||\n\t\t\t\tcolordBackgroundColor.alpha() === 0\n\t\t\t) {\n\t\t\t\tbody.classList.remove( 'is-dark-theme' );\n\t\t\t} else {\n\t\t\t\tbody.classList.add( 'is-dark-theme' );\n\t\t\t}\n\t\t},\n\t\t[ styles, scope ]\n\t);\n}\n\nexport default function EditorStyles( { styles, scope } ) {\n\tconst overrides = useSelect(\n\t\t( select ) => unlock( select( blockEditorStore ) ).getStyleOverrides(),\n\t\t[]\n\t);\n\tconst [ transformedStyles, transformedSvgs ] = useMemo( () => {\n\t\tconst _styles = Object.values( styles ?? [] );\n\n\t\tfor ( const [ id, override ] of overrides ) {\n\t\t\tconst index = _styles.findIndex( ( { id: _id } ) => id === _id );\n\t\t\tconst overrideWithId = { ...override, id };\n\t\t\tif ( index === -1 ) {\n\t\t\t\t_styles.push( overrideWithId );\n\t\t\t} else {\n\t\t\t\t_styles[ index ] = overrideWithId;\n\t\t\t}\n\t\t}\n\n\t\treturn [\n\t\t\ttransformStyles(\n\t\t\t\t_styles.filter( ( style ) => style?.css ),\n\t\t\t\tscope\n\t\t\t),\n\t\t\t_styles\n\t\t\t\t.filter( ( style ) => style.__unstableType === 'svgs' )\n\t\t\t\t.map( ( style ) => style.assets )\n\t\t\t\t.join( '' ),\n\t\t];\n\t}, [ styles, overrides, scope ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ /* Use an empty style element to have a document reference,\n\t\t\t but this could be any element. */ }\n\t\t\t<style\n\t\t\t\tref={ useDarkThemeBodyClassName( transformedStyles, scope ) }\n\t\t\t/>\n\t\t\t{ transformedStyles.map( ( css, index ) => (\n\t\t\t\t<style key={ index }>{ css }</style>\n\t\t\t) ) }\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\tviewBox=\"0 0 0 0\"\n\t\t\t\twidth=\"0\"\n\t\t\t\theight=\"0\"\n\t\t\t\trole=\"none\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\tleft: '-9999px',\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t} }\n\t\t\t\tdangerouslySetInnerHTML={ { __html: transformedSvgs } }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,UAAU,MAAM,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,GAAG,QAAQ,uBAAuB;AAC3C,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASC,SAAS,Q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H,KAAK,IAAMA,KAAK,CAACI,MAAO,CAAC,CAChCC,IAAI,CAAE,EAAG,CAAC,CACZ;EACF,CAAC,EAAE,CAAE3C,MAAM,EAAEsB,SAAS,EAAErB,KAAK,CAAG,CAAC;EAEjC,OACCS,aAAA,CAAAkC,QAAA,QAGClC,aAAA;IACCmC,GAAG,EAAG9C,yBAAyB,CAAE0B,iBAAiB,EAAExB,KAAM;EAAG,CAC7D,CAAC,EACAwB,iBAAiB,CAACgB,GAAG,CAAE,CAAEF,GAAG,EAAEP,KAAK,KACpCtB,aAAA;IAAOoC,GAAG,EAAGd;EAAO,GAAGO,GAAY,CAClC,CAAC,EACH7B,aAAA,CAACnB,GAAG;IACHwD,KAAK,EAAC,4BAA4B;IAClCC,OAAO,EAAC,SAAS;IACjBC,KAAK,EAAC,GAAG;IACTC,MAAM,EAAC,GAAG;IACVC,IAAI,EAAC,MAAM;IACXb,KAAK,EAAG;MACPc,UAAU,EAAE,QAAQ;MACpBC,QAAQ,EAAE,UAAU;MACpBC,IAAI,EAAE,SAAS;MACfC,QAAQ,EAAE;IACX,CAAG;IACHC,uBAAuB,EAAG;MAAEC,MAAM,EAAE/B;IAAgB;EAAG,CACvD,CACA,CAAC;AAEL"}
|
|
@@ -8,7 +8,7 @@ import fastDeepEqual from 'fast-deep-equal/es6';
|
|
|
8
8
|
*/
|
|
9
9
|
import { useContext, useCallback, useMemo } from '@wordpress/element';
|
|
10
10
|
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import { store as blocksStore
|
|
11
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
12
12
|
import { _x } from '@wordpress/i18n';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -20,10 +20,9 @@ import { GlobalStylesContext } from './context';
|
|
|
20
20
|
import { unlock } from '../../lock-unlock';
|
|
21
21
|
const EMPTY_CONFIG = {
|
|
22
22
|
settings: {},
|
|
23
|
-
styles: {}
|
|
24
|
-
behaviors: {}
|
|
23
|
+
styles: {}
|
|
25
24
|
};
|
|
26
|
-
const VALID_SETTINGS = ['appearanceTools', '
|
|
25
|
+
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', 'lightbox.enabled', 'lightbox.allowEditing', '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', 'typography.writingMode'];
|
|
27
26
|
export const useGlobalStylesReset = () => {
|
|
28
27
|
const {
|
|
29
28
|
user: config,
|
|
@@ -276,100 +275,4 @@ export function useGradientsPerOrigin(settings) {
|
|
|
276
275
|
return result;
|
|
277
276
|
}, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]);
|
|
278
277
|
}
|
|
279
|
-
export function __experimentalUseGlobalBehaviors(blockName, source = 'all') {
|
|
280
|
-
const {
|
|
281
|
-
merged: mergedConfig,
|
|
282
|
-
base: baseConfig,
|
|
283
|
-
user: userConfig,
|
|
284
|
-
setUserConfig
|
|
285
|
-
} = useContext(GlobalStylesContext);
|
|
286
|
-
const finalPath = !blockName ? `behaviors` : `behaviors.blocks.${blockName}`;
|
|
287
|
-
let rawResult, result;
|
|
288
|
-
switch (source) {
|
|
289
|
-
case 'all':
|
|
290
|
-
rawResult = getValueFromObjectPath(mergedConfig, finalPath);
|
|
291
|
-
result = getValueFromVariable(mergedConfig, blockName, rawResult);
|
|
292
|
-
break;
|
|
293
|
-
case 'user':
|
|
294
|
-
rawResult = getValueFromObjectPath(userConfig, finalPath);
|
|
295
|
-
result = getValueFromVariable(mergedConfig, blockName, rawResult);
|
|
296
|
-
break;
|
|
297
|
-
case 'base':
|
|
298
|
-
rawResult = getValueFromObjectPath(baseConfig, finalPath);
|
|
299
|
-
result = getValueFromVariable(baseConfig, blockName, rawResult);
|
|
300
|
-
break;
|
|
301
|
-
default:
|
|
302
|
-
throw 'Unsupported source';
|
|
303
|
-
}
|
|
304
|
-
const animation = result?.lightbox?.animation || 'zoom';
|
|
305
|
-
const setBehavior = newValue => {
|
|
306
|
-
let newBehavior;
|
|
307
|
-
// The user saves with Apply Globally option.
|
|
308
|
-
if (typeof newValue === 'object') {
|
|
309
|
-
newBehavior = newValue;
|
|
310
|
-
} else {
|
|
311
|
-
switch (newValue) {
|
|
312
|
-
case 'lightbox':
|
|
313
|
-
newBehavior = {
|
|
314
|
-
lightbox: {
|
|
315
|
-
enabled: true,
|
|
316
|
-
animation
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
break;
|
|
320
|
-
case 'fade':
|
|
321
|
-
newBehavior = {
|
|
322
|
-
lightbox: {
|
|
323
|
-
enabled: true,
|
|
324
|
-
animation: 'fade'
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
break;
|
|
328
|
-
case 'zoom':
|
|
329
|
-
newBehavior = {
|
|
330
|
-
lightbox: {
|
|
331
|
-
enabled: true,
|
|
332
|
-
animation: 'zoom'
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
break;
|
|
336
|
-
case '':
|
|
337
|
-
newBehavior = {
|
|
338
|
-
lightbox: {
|
|
339
|
-
enabled: false,
|
|
340
|
-
animation
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
break;
|
|
344
|
-
default:
|
|
345
|
-
break;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
setUserConfig(currentConfig => setImmutably(currentConfig, finalPath.split('.'), newBehavior));
|
|
349
|
-
};
|
|
350
|
-
let behavior = '';
|
|
351
|
-
if (result === undefined) behavior = 'default';
|
|
352
|
-
if (result?.lightbox.enabled) behavior = 'lightbox';
|
|
353
|
-
return {
|
|
354
|
-
behavior,
|
|
355
|
-
inheritedBehaviors: result,
|
|
356
|
-
setBehavior
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
export function __experimentalUseHasBehaviorsPanel(settings, name, {
|
|
360
|
-
blockSupportOnly = false
|
|
361
|
-
} = {}) {
|
|
362
|
-
if (!settings?.behaviors) {
|
|
363
|
-
return false;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// If every behavior is disabled on block supports, do not show the behaviors inspector control.
|
|
367
|
-
const hasSomeBlockSupport = Object.keys(settings?.behaviors).some(key => hasBlockSupport(name, `behaviors.${key}`));
|
|
368
|
-
if (blockSupportOnly) {
|
|
369
|
-
return hasSomeBlockSupport;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// If every behavior is disabled, do not show the behaviors inspector control.
|
|
373
|
-
return Object.values(settings?.behaviors).some(value => value === true && hasSomeBlockSupport);
|
|
374
|
-
}
|
|
375
278
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fastDeepEqual","useContext","useCallback","useMemo","useSelect","store","blocksStore","hasBlockSupport","_x","getValueFromVariable","getPresetVariableFromValue","getValueFromObjectPath","setImmutably","GlobalStylesContext","unlock","EMPTY_CONFIG","settings","styles","behaviors","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","canReset","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","configToUse","_getValueFromObjectPa","result","forEach","setting","_getValueFromObjectPa2","value","split","setSetting","newValue","currentConfig","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","rawResult","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","select","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","color","text","background","button","heading","link","caption","gradients","customGradient","defaultDuotone","customDuotone","key","textColumns","layout","spacing","sides","Array","isArray","length","dimensions","minHeight","charAt","toUpperCase","slice","border","shadow","useColorsPerOrigin","customColors","palette","custom","themeColors","theme","defaultColors","default","shouldDisplayDefaultColors","defaultPalette","push","name","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","__experimentalUseGlobalBehaviors","animation","lightbox","setBehavior","newBehavior","enabled","behavior","undefined","inheritedBehaviors","__experimentalUseHasBehaviorsPanel","blockSupportOnly","hasSomeBlockSupport","Object","keys","some","values"],"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore, hasBlockSupport } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {}, behaviors: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'behaviors',\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\t'typography.writingMode',\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\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\tgetValueFromObjectPath( configToUse, contextualPath ) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tlet result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, `settings.${ setting }` );\n\t\t\tif ( value ) {\n\t\t\t\tresult = setImmutably( result, setting.split( '.' ), 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\tsetImmutably( currentConfig, contextualPath.split( '.' ), newValue )\n\t\t);\n\t};\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\tsetImmutably(\n\t\t\t\tcurrentConfig,\n\t\t\t\tfinalPath.split( '.' ),\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);\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult = getValueFromObjectPath( 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 = getValueFromObjectPath( 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 = getValueFromObjectPath( 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// If filters are not supported by the block/element, disable duotone.\n\t\tif ( ! supportedStyles.includes( 'filter' ) ) {\n\t\t\tupdatedSettings.color.defaultDuotone = false;\n\t\t\tupdatedSettings.color.customDuotone = 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\t'writingMode',\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\t// Check if spacing type is supported before adding sides.\n\t\t\tif ( sides?.length && updatedSettings.spacing?.[ key ] ) {\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\tupdatedSettings.shadow = supportedStyles.includes( 'shadow' )\n\t\t\t? updatedSettings.shadow\n\t\t\t: false;\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\nexport function __experimentalUseGlobalBehaviors( blockName, source = 'all' ) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst finalPath = ! blockName\n\t\t? `behaviors`\n\t\t: `behaviors.blocks.${ blockName }`;\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult = getValueFromObjectPath( mergedConfig, finalPath );\n\t\t\tresult = getValueFromVariable( mergedConfig, blockName, rawResult );\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = getValueFromObjectPath( userConfig, finalPath );\n\t\t\tresult = getValueFromVariable( mergedConfig, blockName, rawResult );\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = getValueFromObjectPath( baseConfig, finalPath );\n\t\t\tresult = getValueFromVariable( baseConfig, blockName, rawResult );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\tconst animation = result?.lightbox?.animation || 'zoom';\n\n\tconst setBehavior = ( newValue ) => {\n\t\tlet newBehavior;\n\t\t// The user saves with Apply Globally option.\n\t\tif ( typeof newValue === 'object' ) {\n\t\t\tnewBehavior = newValue;\n\t\t} else {\n\t\t\tswitch ( newValue ) {\n\t\t\t\tcase 'lightbox':\n\t\t\t\t\tnewBehavior = {\n\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\tanimation,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'fade':\n\t\t\t\t\tnewBehavior = {\n\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\tanimation: 'fade',\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'zoom':\n\t\t\t\t\tnewBehavior = {\n\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\t\tanimation: 'zoom',\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\tcase '':\n\t\t\t\t\tnewBehavior = {\n\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\tenabled: false,\n\t\t\t\t\t\t\tanimation,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tsetUserConfig( ( currentConfig ) =>\n\t\t\tsetImmutably( currentConfig, finalPath.split( '.' ), newBehavior )\n\t\t);\n\t};\n\tlet behavior = '';\n\tif ( result === undefined ) behavior = 'default';\n\tif ( result?.lightbox.enabled ) behavior = 'lightbox';\n\n\treturn { behavior, inheritedBehaviors: result, setBehavior };\n}\n\nexport function __experimentalUseHasBehaviorsPanel(\n\tsettings,\n\tname,\n\t{ blockSupportOnly = false } = {}\n) {\n\tif ( ! settings?.behaviors ) {\n\t\treturn false;\n\t}\n\n\t// If every behavior is disabled on block supports, do not show the behaviors inspector control.\n\tconst hasSomeBlockSupport = Object.keys( settings?.behaviors ).some(\n\t\t( key ) => hasBlockSupport( name, `behaviors.${ key }` )\n\t);\n\n\tif ( blockSupportOnly ) {\n\t\treturn hasSomeBlockSupport;\n\t}\n\n\t// If every behavior is disabled, do not show the behaviors inspector control.\n\treturn Object.values( settings?.behaviors ).some(\n\t\t( value ) => value === true && hasSomeBlockSupport\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACrE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,EAAEC,eAAe,QAAQ,mBAAmB;AACzE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,oBAAoB,EAAEC,0BAA0B,QAAQ,SAAS;AAC1E,SAASC,sBAAsB,EAAEC,YAAY,QAAQ,oBAAoB;AACzE,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAMC,YAAY,GAAG;EAAEC,QAAQ,EAAE,CAAC,CAAC;EAAEC,MAAM,EAAE,CAAC,CAAC;EAAEC,SAAS,EAAE,CAAC;AAAE,CAAC;AAEhE,MAAMC,cAAc,GAAG,CACtB,iBAAiB,EACjB,WAAW,EACX,+BAA+B,EAC/B,cAAc,EACd,eAAe,EACf,cAAc,EACd,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I,CAAC,EAAE8E,WAAY,CAClE,CAAC;EACF,CAAC;EACD,IAAIE,QAAQ,GAAG,EAAE;EACjB,IAAKrF,MAAM,KAAKsF,SAAS,EAAGD,QAAQ,GAAG,SAAS;EAChD,IAAKrF,MAAM,EAAEiF,QAAQ,CAACG,OAAO,EAAGC,QAAQ,GAAG,UAAU;EAErD,OAAO;IAAEA,QAAQ;IAAEE,kBAAkB,EAAEvF,MAAM;IAAEkF;EAAY,CAAC;AAC7D;AAEA,OAAO,SAASM,kCAAkCA,CACjD9G,QAAQ,EACR8F,IAAI,EACJ;EAAEiB,gBAAgB,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,EAChC;EACD,IAAK,CAAE/G,QAAQ,EAAEE,SAAS,EAAG;IAC5B,OAAO,KAAK;EACb;;EAEA;EACA,MAAM8G,mBAAmB,GAAGC,MAAM,CAACC,IAAI,CAAElH,QAAQ,EAAEE,SAAU,CAAC,CAACiH,IAAI,CAChE/C,GAAG,IAAM7E,eAAe,CAAEuG,IAAI,EAAG,aAAa1B,GAAK,EAAE,CACxD,CAAC;EAED,IAAK2C,gBAAgB,EAAG;IACvB,OAAOC,mBAAmB;EAC3B;;EAEA;EACA,OAAOC,MAAM,CAACG,MAAM,CAAEpH,QAAQ,EAAEE,SAAU,CAAC,CAACiH,IAAI,CAC7CzF,KAAK,IAAMA,KAAK,KAAK,IAAI,IAAIsF,mBAChC,CAAC;AACF"}
|
|
1
|
+
{"version":3,"names":["fastDeepEqual","useContext","useCallback","useMemo","useSelect","store","blocksStore","_x","getValueFromVariable","getPresetVariableFromValue","getValueFromObjectPath","setImmutably","GlobalStylesContext","unlock","EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","canReset","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","configToUse","_getValueFromObjectPa","result","forEach","setting","_getValueFromObjectPa2","value","split","setSetting","newValue","currentConfig","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","rawResult","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","select","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","color","text","background","button","heading","link","caption","gradients","customGradient","defaultDuotone","customDuotone","key","textColumns","layout","spacing","sides","Array","isArray","length","dimensions","minHeight","charAt","toUpperCase","slice","border","shadow","useColorsPerOrigin","customColors","palette","custom","themeColors","theme","defaultColors","default","shouldDisplayDefaultColors","defaultPalette","push","name","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients"],"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\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 { getValueFromObjectPath, setImmutably } from '../../utils/object';\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'lightbox.enabled',\n\t'lightbox.allowEditing',\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\t'typography.writingMode',\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\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\tgetValueFromObjectPath( configToUse, contextualPath ) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tlet result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, `settings.${ setting }` );\n\t\t\tif ( value ) {\n\t\t\t\tresult = setImmutably( result, setting.split( '.' ), 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\tsetImmutably( currentConfig, contextualPath.split( '.' ), newValue )\n\t\t);\n\t};\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\tsetImmutably(\n\t\t\t\tcurrentConfig,\n\t\t\t\tfinalPath.split( '.' ),\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);\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult = getValueFromObjectPath( 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 = getValueFromObjectPath( 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 = getValueFromObjectPath( 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// If filters are not supported by the block/element, disable duotone.\n\t\tif ( ! supportedStyles.includes( 'filter' ) ) {\n\t\t\tupdatedSettings.color.defaultDuotone = false;\n\t\t\tupdatedSettings.color.customDuotone = 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\t'writingMode',\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\t// Check if spacing type is supported before adding sides.\n\t\t\tif ( sides?.length && updatedSettings.spacing?.[ key ] ) {\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\tupdatedSettings.shadow = supportedStyles.includes( 'shadow' )\n\t\t\t? updatedSettings.shadow\n\t\t\t: false;\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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,UAAU,EAAEC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACrE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,oBAAoB,EAAEC,0BAA0B,QAAQ,SAAS;AAC1E,SAASC,sBAAsB,EAAEC,YAAY,QAAQ,oBAAoB;AACzE,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAMC,YAAY,GAAG;EAAEC,QAAQ,EAAE,CAAC,CAAC;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B,KAAK;EACxD,MAAMW,gBAAgB,GAAGlG,QAAQ,EAAEwD,KAAK,EAAEO,SAAS,EAAE0B,OAAO;EAC5D,MAAMU,6BAA6B,GAAGnG,QAAQ,EAAEwD,KAAK,EAAE0C,gBAAgB;EAEvE,OAAO9G,OAAO,CAAE,MAAM;IACrB,MAAMiC,MAAM,GAAG,EAAE;IACjB,IAAK4E,cAAc,IAAIA,cAAc,CAACvB,MAAM,EAAG;MAC9CrD,MAAM,CAACuE,IAAI,CAAE;QACZC,IAAI,EAAErG,EAAE,CACP,OAAO,EACP,8CACD,CAAC;QACDuE,SAAS,EAAEkC;MACZ,CAAE,CAAC;IACJ;IACA,IACCE,6BAA6B,IAC7BD,gBAAgB,IAChBA,gBAAgB,CAACxB,MAAM,EACtB;MACDrD,MAAM,CAACuE,IAAI,CAAE;QACZC,IAAI,EAAErG,EAAE,CACP,SAAS,EACT,8CACD,CAAC;QACDuE,SAAS,EAAEmC;MACZ,CAAE,CAAC;IACJ;IACA,IAAKF,eAAe,IAAIA,eAAe,CAACtB,MAAM,EAAG;MAChDrD,MAAM,CAACuE,IAAI,CAAE;QACZC,IAAI,EAAErG,EAAE,CACP,QAAQ,EACR,gDACD,CAAC;QACDuE,SAAS,EAAEiC;MACZ,CAAE,CAAC;IACJ;IACA,OAAO3E,MAAM;EACd,CAAC,EAAE,CACF2E,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,6BAA6B,CAC5B,CAAC;AACJ"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, ToggleControl } from '@wordpress/components';
|
|
6
|
+
import { __, _x } from '@wordpress/i18n';
|
|
7
|
+
export function useHasImageSettingsPanel(name, value, inheritedValue) {
|
|
8
|
+
// Note: If lightbox `value` exists, that means it was
|
|
9
|
+
// defined via the the Global Styles UI and will NOT
|
|
10
|
+
// be a boolean value or contain the `allowEditing` property,
|
|
11
|
+
// so we should show the settings panel in those cases.
|
|
12
|
+
return name === 'core/image' && inheritedValue?.lightbox?.allowEditing || !!value?.lightbox;
|
|
13
|
+
}
|
|
14
|
+
export default function ImageSettingsPanel({
|
|
15
|
+
onChange,
|
|
16
|
+
value,
|
|
17
|
+
inheritedValue,
|
|
18
|
+
panelId
|
|
19
|
+
}) {
|
|
20
|
+
const resetLightbox = () => {
|
|
21
|
+
onChange(undefined);
|
|
22
|
+
};
|
|
23
|
+
const onChangeLightbox = newSetting => {
|
|
24
|
+
onChange({
|
|
25
|
+
enabled: newSetting
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
let lightboxChecked = false;
|
|
29
|
+
if (inheritedValue?.lightbox?.enabled) {
|
|
30
|
+
lightboxChecked = inheritedValue.lightbox.enabled;
|
|
31
|
+
}
|
|
32
|
+
return createElement(Fragment, null, createElement(ToolsPanel, {
|
|
33
|
+
label: _x('Settings', 'Image settings'),
|
|
34
|
+
resetAll: resetLightbox,
|
|
35
|
+
panelId: panelId
|
|
36
|
+
}, createElement(ToolsPanelItem
|
|
37
|
+
// We use the `userSettings` prop instead of `settings`, because `settings`
|
|
38
|
+
// contains the core/theme values for the lightbox and we want to show the
|
|
39
|
+
// "RESET" button ONLY when the user has explicitly set a value in the
|
|
40
|
+
// Global Styles.
|
|
41
|
+
, {
|
|
42
|
+
hasValue: () => !!value?.lightbox,
|
|
43
|
+
label: __('Expand on Click'),
|
|
44
|
+
onDeselect: resetLightbox,
|
|
45
|
+
isShownByDefault: true,
|
|
46
|
+
panelId: panelId
|
|
47
|
+
}, createElement(ToggleControl, {
|
|
48
|
+
label: __('Expand on Click'),
|
|
49
|
+
checked: lightboxChecked,
|
|
50
|
+
onChange: onChangeLightbox
|
|
51
|
+
}))));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=image-settings-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","ToggleControl","__","_x","useHasImageSettingsPanel","name","value","inheritedValue","lightbox","allowEditing","ImageSettingsPanel","onChange","panelId","resetLightbox","undefined","onChangeLightbox","newSetting","enabled","lightboxChecked","createElement","Fragment","label","resetAll","hasValue","onDeselect","isShownByDefault","checked"],"sources":["@wordpress/block-editor/src/components/global-styles/image-settings-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\nexport function useHasImageSettingsPanel( name, value, inheritedValue ) {\n\t// Note: If lightbox `value` exists, that means it was\n\t// defined via the the Global Styles UI and will NOT\n\t// be a boolean value or contain the `allowEditing` property,\n\t// so we should show the settings panel in those cases.\n\treturn (\n\t\t( name === 'core/image' && inheritedValue?.lightbox?.allowEditing ) ||\n\t\t!! value?.lightbox\n\t);\n}\n\nexport default function ImageSettingsPanel( {\n\tonChange,\n\tvalue,\n\tinheritedValue,\n\tpanelId,\n} ) {\n\tconst resetLightbox = () => {\n\t\tonChange( undefined );\n\t};\n\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\tonChange( {\n\t\t\tenabled: newSetting,\n\t\t} );\n\t};\n\n\tlet lightboxChecked = false;\n\n\tif ( inheritedValue?.lightbox?.enabled ) {\n\t\tlightboxChecked = inheritedValue.lightbox.enabled;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ _x( 'Settings', 'Image settings' ) }\n\t\t\t\tresetAll={ resetLightbox }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t// We use the `userSettings` prop instead of `settings`, because `settings`\n\t\t\t\t\t// contains the core/theme values for the lightbox and we want to show the\n\t\t\t\t\t// \"RESET\" button ONLY when the user has explicitly set a value in the\n\t\t\t\t\t// Global Styles.\n\t\t\t\t\thasValue={ () => !! value?.lightbox }\n\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\tonDeselect={ resetLightbox }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Expand on Click' ) }\n\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,aAAa,QACP,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AAExC,OAAO,SAASC,wBAAwBA,CAAEC,IAAI,EAAEC,KAAK,EAAEC,cAAc,EAAG;EACvE;EACA;EACA;EACA;EACA,OACGF,IAAI,KAAK,YAAY,IAAIE,cAAc,EAAEC,QAAQ,EAAEC,YAAY,IACjE,CAAC,CAAEH,KAAK,EAAEE,QAAQ;AAEpB;AAEA,eAAe,SAASE,kBAAkBA,CAAE;EAC3CC,QAAQ;EACRL,KAAK;EACLC,cAAc;EACdK;AACD,CAAC,EAAG;EACH,MAAMC,aAAa,GAAGA,CAAA,KAAM;IAC3BF,QAAQ,CAAEG,SAAU,CAAC;EACtB,CAAC;EAED,MAAMC,gBAAgB,GAAKC,UAAU,IAAM;IAC1CL,QAAQ,CAAE;MACTM,OAAO,EAAED;IACV,CAAE,CAAC;EACJ,CAAC;EAED,IAAIE,eAAe,GAAG,KAAK;EAE3B,IAAKX,cAAc,EAAEC,QAAQ,EAAES,OAAO,EAAG;IACxCC,eAAe,GAAGX,cAAc,CAACC,QAAQ,CAACS,OAAO;EAClD;EAEA,OACCE,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACrB,UAAU;IACVuB,KAAK,EAAGlB,EAAE,CAAE,UAAU,EAAE,gBAAiB,CAAG;IAC5CmB,QAAQ,EAAGT,aAAe;IAC1BD,OAAO,EAAGA;EAAS,GAEnBO,aAAA,CAACnB;EACA;EACA;EACA;EACA;EAAA;IACAuB,QAAQ,EAAGA,CAAA,KAAM,CAAC,CAAEjB,KAAK,EAAEE,QAAU;IACrCa,KAAK,EAAGnB,EAAE,CAAE,iBAAkB,CAAG;IACjCsB,UAAU,EAAGX,aAAe;IAC5BY,gBAAgB,EAAG,IAAM;IACzBb,OAAO,EAAGA;EAAS,GAEnBO,aAAA,CAAClB,aAAa;IACboB,KAAK,EAAGnB,EAAE,CAAE,iBAAkB,CAAG;IACjCwB,OAAO,EAAGR,eAAiB;IAC3BP,QAAQ,EAAGI;EAAkB,CAC7B,CACc,CACL,CACX,CAAC;AAEL"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { useGlobalStylesReset, useGlobalSetting, useGlobalStyle, useSettingsForBlockElement } from './hooks';
|
|
2
2
|
export { getBlockCSSSelector } from './get-block-css-selector';
|
|
3
3
|
export { getLayoutStyles, useGlobalStylesOutput, useGlobalStylesOutputWithConfig } from './use-global-styles-output';
|
|
4
4
|
export { GlobalStylesContext } from './context';
|
|
@@ -8,7 +8,7 @@ export { default as BorderPanel, useHasBorderPanel } from './border-panel';
|
|
|
8
8
|
export { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
9
9
|
export { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';
|
|
10
10
|
export { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';
|
|
11
|
-
export { default as
|
|
11
|
+
export { default as ImageSettingsPanel, useHasImageSettingsPanel } from './image-settings-panel';
|
|
12
12
|
export { default as AdvancedPanel } from './advanced-panel';
|
|
13
13
|
export { areGlobalStyleConfigsEqual } from './utils';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useGlobalStylesReset","useGlobalSetting","useGlobalStyle","useSettingsForBlockElement","getBlockCSSSelector","getLayoutStyles","useGlobalStylesOutput","useGlobalStylesOutputWithConfig","GlobalStylesContext","default","TypographyPanel","useHasTypographyPanel","DimensionsPanel","useHasDimensionsPanel","BorderPanel","useHasBorderPanel","ColorPanel","useHasColorPanel","EffectsPanel","useHasEffectsPanel","FiltersPanel","useHasFiltersPanel","ImageSettingsPanel","useHasImageSettingsPanel","AdvancedPanel","areGlobalStyleConfigsEqual"],"sources":["@wordpress/block-editor/src/components/global-styles/index.js"],"sourcesContent":["export {\n\tuseGlobalStylesReset,\n\tuseGlobalSetting,\n\tuseGlobalStyle,\n\tuseSettingsForBlockElement,\n} from './hooks';\nexport { getBlockCSSSelector } from './get-block-css-selector';\nexport {\n\tgetLayoutStyles,\n\tuseGlobalStylesOutput,\n\tuseGlobalStylesOutputWithConfig,\n} 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';\nexport { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';\nexport { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';\nexport {\n\tdefault as ImageSettingsPanel,\n\tuseHasImageSettingsPanel,\n} from './image-settings-panel';\nexport { default as AdvancedPanel } from './advanced-panel';\nexport { areGlobalStyleConfigsEqual } from './utils';\n"],"mappings":"AAAA,SACCA,oBAAoB,EACpBC,gBAAgB,EAChBC,cAAc,EACdC,0BAA0B,QACpB,SAAS;AAChB,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SACCC,eAAe,EACfC,qBAAqB,EACrBC,+BAA+B,QACzB,4BAA4B;AACnC,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SACCC,OAAO,IAAIC,eAAe,EAC1BC,qBAAqB,QACf,oBAAoB;AAC3B,SACCF,OAAO,IAAIG,eAAe,EAC1BC,qBAAqB,QACf,oBAAoB;AAC3B,SAASJ,OAAO,IAAIK,WAAW,EAAEC,iBAAiB,QAAQ,gBAAgB;AAC1E,SAASN,OAAO,IAAIO,UAAU,EAAEC,gBAAgB,QAAQ,eAAe;AACvE,SAASR,OAAO,IAAIS,YAAY,EAAEC,kBAAkB,QAAQ,iBAAiB;AAC7E,SAASV,OAAO,IAAIW,YAAY,EAAEC,kBAAkB,QAAQ,iBAAiB;AAC7E,SACCZ,OAAO,IAAIa,kBAAkB,EAC7BC,wBAAwB,QAClB,wBAAwB;AAC/B,SAASd,OAAO,IAAIe,aAAa,QAAQ,kBAAkB;AAC3D,SAASC,0BAA0B,QAAQ,SAAS"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
5
4
|
import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, __EXPERIMENTAL_ELEMENTS as ELEMENTS, getBlockSupport, getBlockTypes, store as blocksStore } from '@wordpress/blocks';
|
|
6
5
|
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import {
|
|
6
|
+
import { useContext, useMemo } from '@wordpress/element';
|
|
8
7
|
import { getCSSRules } from '@wordpress/style-engine';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -15,11 +14,12 @@ import { getBlockCSSSelector } from './get-block-css-selector';
|
|
|
15
14
|
import { getTypographyFontSizeValue, getFluidTypographyOptionsFromSettings } from './typography-utils';
|
|
16
15
|
import { GlobalStylesContext } from './context';
|
|
17
16
|
import { useGlobalSetting } from './hooks';
|
|
18
|
-
import {
|
|
17
|
+
import { getDuotoneFilter } from '../duotone/utils';
|
|
19
18
|
import { getGapCSSValue } from '../../hooks/gap';
|
|
20
19
|
import { store as blockEditorStore } from '../../store';
|
|
21
20
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
22
21
|
import { getValueFromObjectPath, kebabCase, setImmutably } from '../../utils/object';
|
|
22
|
+
import BlockContext from '../block-context';
|
|
23
23
|
|
|
24
24
|
// List of block support features that can have their related styles
|
|
25
25
|
// generated under their own feature level selector rather than the block's.
|
|
@@ -114,10 +114,7 @@ function getPresetsSvgFilters(blockPresets = {}) {
|
|
|
114
114
|
// Duotone are the only type of filters for now.
|
|
115
115
|
metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
|
|
116
116
|
const presetByOrigin = getValueFromObjectPath(blockPresets, metadata.path, {});
|
|
117
|
-
return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset =>
|
|
118
|
-
preset: preset,
|
|
119
|
-
key: preset.slug
|
|
120
|
-
})))).join('');
|
|
117
|
+
return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => getDuotoneFilter(`wp-duotone-${preset.slug}`, preset.colors))).join('');
|
|
121
118
|
});
|
|
122
119
|
}
|
|
123
120
|
function flattenTree(input = {}, prefix, token) {
|
|
@@ -233,9 +230,10 @@ const getFeatureDeclarations = (selectors, styles) => {
|
|
|
233
230
|
*
|
|
234
231
|
* @param {Object} tree A theme.json tree containing layout definitions.
|
|
235
232
|
*
|
|
233
|
+
* @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.
|
|
236
234
|
* @return {Array} An array of style declarations.
|
|
237
235
|
*/
|
|
238
|
-
export function getStylesDeclarations(blockStyles = {}, selector = '', useRootPaddingAlign, tree = {}) {
|
|
236
|
+
export function getStylesDeclarations(blockStyles = {}, selector = '', useRootPaddingAlign, tree = {}, isTemplate = true) {
|
|
239
237
|
const isRoot = ROOT_BLOCK_SELECTOR === selector;
|
|
240
238
|
const output = Object.entries(STYLE_PROPERTY).reduce((declarations, [key, {
|
|
241
239
|
value,
|
|
@@ -279,8 +277,8 @@ export function getStylesDeclarations(blockStyles = {}, selector = '', useRootPa
|
|
|
279
277
|
// This is temporary as we absorb more and more styles into the engine.
|
|
280
278
|
const extraRules = getCSSRules(blockStyles);
|
|
281
279
|
extraRules.forEach(rule => {
|
|
282
|
-
// Don't output padding properties if padding variables are set.
|
|
283
|
-
if (isRoot && useRootPaddingAlign && rule.key.startsWith('padding')) {
|
|
280
|
+
// Don't output padding properties if padding variables are set or if we're not editing a full template.
|
|
281
|
+
if (isRoot && (useRootPaddingAlign || !isTemplate) && rule.key.startsWith('padding')) {
|
|
284
282
|
return;
|
|
285
283
|
}
|
|
286
284
|
const cssProperty = rule.key.startsWith('--') ? rule.key : kebabCase(rule.key);
|
|
@@ -546,7 +544,7 @@ export const toCustomProperties = (tree, blockSelectors) => {
|
|
|
546
544
|
});
|
|
547
545
|
return ruleset;
|
|
548
546
|
};
|
|
549
|
-
export const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false) => {
|
|
547
|
+
export const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, isTemplate = true) => {
|
|
550
548
|
const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
|
|
551
549
|
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
|
|
552
550
|
const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
|
|
@@ -570,16 +568,18 @@ export const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGa
|
|
|
570
568
|
if (wideSize) {
|
|
571
569
|
ruleset += ` --wp--style--global--wide-size: ${wideSize};`;
|
|
572
570
|
}
|
|
573
|
-
|
|
571
|
+
|
|
572
|
+
// Root padding styles should only be output for full templates, not patterns or template parts.
|
|
573
|
+
if (useRootPaddingAlign && isTemplate) {
|
|
574
574
|
/*
|
|
575
575
|
* These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508
|
|
576
576
|
* almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.
|
|
577
577
|
*/
|
|
578
578
|
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
579
579
|
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
580
|
-
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
|
|
580
|
+
.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }
|
|
581
581
|
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
582
|
-
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
582
|
+
.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
583
583
|
.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
584
584
|
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
|
|
585
585
|
}
|
|
@@ -654,7 +654,7 @@ export const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGa
|
|
|
654
654
|
}
|
|
655
655
|
|
|
656
656
|
// Process the remaining block styles (they use either normal block class or __experimentalSelector).
|
|
657
|
-
const declarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree);
|
|
657
|
+
const declarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree, isTemplate);
|
|
658
658
|
if (declarations?.length) {
|
|
659
659
|
ruleset += `${selector}{${declarations.join(';')};}`;
|
|
660
660
|
}
|
|
@@ -831,6 +831,8 @@ export function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
|
|
|
831
831
|
} = select(blockEditorStore);
|
|
832
832
|
return !!getSettings().disableLayoutStyles;
|
|
833
833
|
});
|
|
834
|
+
const blockContext = useContext(BlockContext);
|
|
835
|
+
const isTemplate = blockContext?.templateSlug !== undefined;
|
|
834
836
|
const getBlockStyles = useSelect(select => {
|
|
835
837
|
return select(blocksStore).getBlockStyles;
|
|
836
838
|
}, []);
|
|
@@ -842,7 +844,7 @@ export function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
|
|
|
842
844
|
mergedConfig = updateConfigWithSeparator(mergedConfig);
|
|
843
845
|
const blockSelectors = getBlockSelectors(getBlockTypes(), getBlockStyles);
|
|
844
846
|
const customProperties = toCustomProperties(mergedConfig, blockSelectors);
|
|
845
|
-
const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles);
|
|
847
|
+
const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
|
|
846
848
|
const svgs = toSvgFilters(mergedConfig, blockSelectors);
|
|
847
849
|
const styles = [{
|
|
848
850
|
css: customProperties,
|