@wordpress/block-editor 14.1.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +1 -10
- package/build/components/block-alignment-matrix-control/index.js +2 -2
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +8 -2
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-canvas/index.js +8 -1
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-compare/block-view.js +4 -1
- package/build/components/block-compare/block-view.js.map +1 -1
- package/build/components/block-draggable/index.js +4 -4
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-edit/multiple-usage-warning.js +8 -2
- package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build/components/block-inspector/index.js +27 -9
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +6 -3
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/block.js +5 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +5 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +46 -0
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/block-lock/toolbar.js +3 -3
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +4 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +4 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +4 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -4
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +11 -14
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +12 -3
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +2 -15
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +4 -1
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +22 -17
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +1 -4
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +12 -11
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +6 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +8 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +10 -6
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +4 -9
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +3 -4
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +14 -5
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.js +4 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +4 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/button-block-appender/index.js +14 -3
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +4 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/content-lock/index.js +13 -0
- package/build/components/content-lock/index.js.map +1 -0
- package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
- package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
- package/build/components/editor-styles/index.js +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +8 -12
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +8 -5
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +1 -1
- package/build/components/global-styles/color-panel.native.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +34 -37
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +4 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +13 -7
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -6
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/utils.js +4 -6
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +2 -2
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/iframe/index.js +5 -5
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -4
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +4 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/library.js +2 -4
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +3 -3
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -4
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +8 -2
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +4 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +7 -24
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inserter-listbox/index.js +3 -7
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +4 -1
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +4 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +8 -2
- package/build/components/inspector-popover-header/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +7 -4
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +19 -10
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +4 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +28 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +8 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +19 -19
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build/components/rich-text/index.js +38 -30
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +5 -5
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -1
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/tool-selector/index.js +4 -1
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/button.js +12 -3
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +4 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +4 -6
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -1
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-event-redirect.js +66 -0
- package/build/components/writing-flow/use-event-redirect.js.map +1 -0
- package/build/components/writing-flow/use-input.js +31 -1
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +14 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +20 -6
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +4 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-flow/utils.js +27 -0
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/block-bindings.js +32 -29
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -26
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +0 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +4 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +3 -3
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js +1 -5
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +19 -20
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +7 -7
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/layouts/constrained.js +41 -41
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +4 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/utils.js +1 -7
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +2 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +1 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +13 -15
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -8
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +19 -43
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +48 -0
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +16 -11
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/dom.js +101 -0
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +4 -4
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/transform-styles/index.js +120 -16
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +8 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +9 -1
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +4 -1
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-draggable/index.js +4 -4
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +8 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +27 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +6 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +5 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +40 -0
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +3 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +4 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -4
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +11 -14
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +12 -3
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +4 -1
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +22 -17
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -4
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +12 -11
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +6 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +8 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +4 -9
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +3 -4
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +15 -6
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +4 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +15 -4
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +4 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/content-lock/index.js +2 -0
- package/build-module/components/content-lock/index.js.map +1 -0
- package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
- package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
- package/build-module/components/editor-styles/index.js +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +8 -12
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +7 -4
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +2 -2
- package/build-module/components/global-styles/color-panel.native.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +36 -39
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +4 -1
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +13 -7
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -6
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/utils.js +4 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +3 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/iframe/index.js +5 -5
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -4
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -4
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +3 -3
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +1 -4
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +8 -2
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +4 -1
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +7 -24
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +4 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +3 -7
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +4 -1
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +4 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +8 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +7 -4
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +19 -10
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -1
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +28 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +8 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +19 -19
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/index.js +39 -31
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +5 -5
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -1
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +4 -1
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/button.js +12 -3
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +4 -6
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-event-redirect.js +60 -0
- package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +31 -1
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +14 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +16 -2
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +4 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +26 -0
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/block-bindings.js +34 -31
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +10 -30
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +0 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +4 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +3 -3
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +1 -5
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +19 -20
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +7 -7
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/layouts/constrained.js +43 -43
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +4 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/utils.js +1 -7
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +3 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +12 -15
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -46
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +46 -0
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +17 -12
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/dom.js +99 -0
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +4 -4
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +120 -16
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +2 -11
- package/build-style/content.css +2 -11
- package/build-style/style-rtl.css +17 -38
- package/build-style/style.css +17 -38
- package/build-types/utils/dom.d.ts +25 -0
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +34 -32
- package/src/components/block-alignment-matrix-control/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +4 -0
- package/src/components/block-breadcrumb/style.scss +1 -1
- package/src/components/block-canvas/index.js +9 -1
- package/src/components/block-compare/block-view.js +7 -1
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-draggable/index.js +4 -4
- package/src/components/block-draggable/style.scss +1 -1
- package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/src/components/block-edit/multiple-usage-warning.js +4 -0
- package/src/components/block-inspector/index.js +22 -6
- package/src/components/block-list/block-invalid-warning.js +4 -2
- package/src/components/block-list/block.js +6 -2
- package/src/components/block-list/content.scss +2 -3
- package/src/components/block-list/use-block-props/index.js +3 -0
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +44 -0
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-lock/toolbar.js +3 -3
- package/src/components/block-mover/button.js +2 -0
- package/src/components/block-mover/index.js +2 -0
- package/src/components/block-mover/style.scss +1 -1
- package/src/components/block-navigation/dropdown.js +2 -0
- package/src/components/block-pattern-setup/index.js +3 -7
- package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
- package/src/components/block-pattern-setup/style.scss +2 -2
- package/src/components/block-patterns-list/index.js +15 -13
- package/src/components/block-patterns-list/style.scss +2 -2
- package/src/components/block-patterns-paging/index.js +6 -0
- package/src/components/block-popover/index.js +7 -28
- package/src/components/block-popover/style.scss +1 -1
- package/src/components/block-quick-navigation/index.js +2 -0
- package/src/components/block-settings-menu-controls/index.js +7 -1
- package/src/components/block-switcher/index.js +26 -20
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -7
- package/src/components/block-switcher/style.scss +5 -6
- package/src/components/block-toolbar/index.js +17 -8
- package/src/components/block-toolbar/shuffle.js +9 -7
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/block-toolbar-popover.js +10 -6
- package/src/components/block-tools/style.scss +3 -4
- package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +2 -5
- package/src/components/block-tools/zoom-out-popover.js +3 -7
- package/src/components/block-tools/zoom-out-toolbar.js +20 -6
- package/src/components/block-variation-picker/README.md +2 -2
- package/src/components/block-variation-picker/index.js +6 -1
- package/src/components/block-variation-transforms/index.js +2 -0
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/button-block-appender/content.scss +0 -1
- package/src/components/button-block-appender/index.js +14 -3
- package/src/components/color-palette/test/control.js +15 -2
- package/src/components/colors-gradients/dropdown.js +5 -1
- package/src/components/colors-gradients/style.scss +4 -4
- package/src/components/content-lock/index.js +1 -0
- package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
- package/src/components/default-block-appender/content.scss +0 -1
- package/src/components/editor-styles/index.js +4 -3
- package/src/components/global-styles/background-panel.js +6 -14
- package/src/components/global-styles/color-panel.js +8 -4
- package/src/components/global-styles/color-panel.native.js +2 -2
- package/src/components/global-styles/dimensions-panel.js +40 -40
- package/src/components/global-styles/filters-panel.js +5 -1
- package/src/components/global-styles/shadow-panel-components.js +12 -8
- package/src/components/global-styles/style.scss +3 -4
- package/src/components/global-styles/test/typography-utils.js +96 -5
- package/src/components/global-styles/test/utils.js +10 -0
- package/src/components/global-styles/typography-utils.js +22 -6
- package/src/components/global-styles/utils.js +4 -6
- package/src/components/grid/grid-item-movers.js +3 -3
- package/src/components/grid/style.scss +1 -1
- package/src/components/iframe/index.js +5 -5
- package/src/components/inner-blocks/index.js +2 -2
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
- package/src/components/inserter/block-patterns-tab/index.js +2 -0
- package/src/components/inserter/library.js +0 -2
- package/src/components/inserter/media-tab/hooks.js +3 -3
- package/src/components/inserter/media-tab/media-list.js +1 -4
- package/src/components/inserter/media-tab/media-preview.js +12 -2
- package/src/components/inserter/media-tab/media-tab.js +2 -0
- package/src/components/inserter/menu.js +15 -29
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/style.scss +6 -8
- package/src/components/inserter-list-item/index.js +4 -4
- package/src/components/inserter-list-item/style.scss +1 -3
- package/src/components/inserter-listbox/index.js +2 -8
- package/src/components/inserter-listbox/item.js +9 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +2 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
- package/src/components/inspector-popover-header/index.js +4 -0
- package/src/components/letter-spacing-control/README.md +8 -1
- package/src/components/letter-spacing-control/index.js +7 -4
- package/src/components/link-control/index.js +17 -8
- package/src/components/link-control/settings-drawer.js +2 -0
- package/src/components/link-control/style.scss +1 -3
- package/src/components/list-view/block-select-button.js +2 -0
- package/src/components/list-view/style.scss +14 -16
- package/src/components/media-placeholder/index.js +14 -0
- package/src/components/media-replace-flow/index.js +12 -1
- package/src/components/provider/use-block-sync.js +20 -20
- package/src/components/responsive-block-control/README.md +3 -27
- package/src/components/rich-text/content.scss +1 -1
- package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
- package/src/components/rich-text/index.js +54 -41
- package/src/components/rich-text/style.scss +1 -1
- package/src/components/rich-text/use-mark-persistent.js +5 -5
- package/src/components/skip-to-selected-block/index.js +2 -0
- package/src/components/spacing-sizes-control/style.scss +1 -0
- package/src/components/tool-selector/index.js +2 -0
- package/src/components/url-input/button.js +6 -0
- package/src/components/url-input/index.js +2 -0
- package/src/components/url-popover/stories/index.story.js +7 -1
- package/src/components/use-block-drop-zone/index.js +4 -4
- package/src/components/warning/content.scss +3 -10
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +9 -2
- package/src/components/writing-flow/use-event-redirect.js +72 -0
- package/src/components/writing-flow/use-input.js +36 -1
- package/src/components/writing-flow/use-select-all.js +18 -1
- package/src/components/writing-flow/use-selection-observer.js +23 -3
- package/src/components/writing-flow/use-tab-nav.js +4 -4
- package/src/components/writing-flow/utils.js +30 -0
- package/src/hooks/block-bindings.js +42 -43
- package/src/hooks/block-bindings.scss +1 -9
- package/src/hooks/content-lock-ui.js +11 -36
- package/src/hooks/duotone.js +0 -4
- package/src/hooks/layout.js +2 -0
- package/src/hooks/layout.scss +3 -11
- package/src/hooks/spacing-visualizer.js +3 -3
- package/src/hooks/style.js +1 -4
- package/src/hooks/use-bindings-attributes.js +23 -24
- package/src/hooks/use-zoom-out.js +7 -7
- package/src/layouts/constrained.js +50 -47
- package/src/layouts/flex.js +2 -0
- package/src/layouts/test/grid.js +2 -2
- package/src/layouts/test/utils.js +6 -8
- package/src/layouts/utils.js +1 -9
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +4 -6
- package/src/store/private-actions.js +1 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +12 -11
- package/src/store/reducer.js +0 -5
- package/src/store/selectors.js +32 -51
- package/src/store/utils.js +50 -0
- package/src/utils/block-bindings.js +15 -16
- package/src/utils/dom.js +117 -0
- package/src/utils/get-font-styles-and-weights.js +12 -4
- package/src/utils/test/get-font-styles-and-weights.js +148 -0
- package/src/utils/test/transform-styles.js +259 -50
- package/src/utils/transform-styles/index.js +132 -21
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getComputedFluidTypographyValue","getTypographyValueAndUnit","getFontStylesAndWeights","getTypographyFontSizeValue","preset","settings","size","defaultSize","isFluidTypographyEnabled","typography","fluid","fluidTypographySettings","getFluidTypographyOptionsFromSettings","fluidFontSizeValue","minimumFontSize","min","maximumFontSize","max","fontSize","minimumFontSizeLimit","minFontSize","maximumViewportWidth","maxViewportWidth","minimumViewportWidth","minViewportWidth","typographySettings","fluidSettings","Object","keys","length","layoutSettings","layout","defaultMaxViewportWidth","wideSize","getMergedFontFamiliesAndFontFamilyFaces","selectedFontFamily","_fontFamilies$find$fo","fontFamiliesFromSettings","fontFamilies","flatMap","key","_fontFamiliesFromSett","fontFamilyFaces","find","family","fontFamily","fontFace","findNearestFontWeight","availableFontWeights","newFontWeightValue","nearestFontWeight","reduce","nearest","value","fw","currentDiff","Math","abs","parseInt","nearestDiff","findNearestFontStyle","availableFontStyles","newFontStyleValue","validStyles","includes","style","findNearestStyleAndWeight","fontStyle","fontWeight","nearestFontStyle","fontStyles","fontWeights","combinedStyleAndWeightOptions","hasFontStyle","some","fs","hasFontWeight","option"],"sources":["@wordpress/block-editor/src/components/global-styles/typography-utils.js"],"sourcesContent":["/**\n * The fluid utilities must match the backend equivalent.\n * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php\n * ---------------------------------------------------------------\n */\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetComputedFluidTypographyValue,\n\tgetTypographyValueAndUnit,\n} from '../font-sizes/fluid-utils';\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * @typedef {Object} FluidPreset\n * @property {string|undefined} max A maximum font size value.\n * @property {?string|undefined} min A minimum font size value.\n */\n\n/**\n * @typedef {Object} Preset\n * @property {?string|?number} size A default font size.\n * @property {string} name A font size name, displayed in the UI.\n * @property {string} slug A font size slug\n * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.\n */\n\n/**\n * @typedef {Object} TypographySettings\n * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.\n * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.\n * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.\n * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.\n * @property {?string} minFontSize The smallest a calculated font size may be. Optional.\n */\n\n/**\n * Returns a font-size value based on a given font-size preset.\n * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.\n *\n * @param {Preset} preset\n * @param {Object} settings\n * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.\n * @param {Object?} settings.typography.layout Layout options.\n *\n * @return {string|*} A font-size value or the value of preset.size.\n */\nexport function getTypographyFontSizeValue( preset, settings ) {\n\tconst { size: defaultSize } = preset;\n\n\tif ( ! isFluidTypographyEnabled( settings?.typography ) ) {\n\t\treturn defaultSize;\n\t}\n\t/*\n\t * Checks whether a font size has explicitly bypassed fluid calculations.\n\t * Also catches falsy values and 0/'0'.\n\t * Fluid calculations cannot be performed on `0`.\n\t */\n\tif ( ! defaultSize || '0' === defaultSize || false === preset?.fluid ) {\n\t\treturn defaultSize;\n\t}\n\n\tlet fluidTypographySettings =\n\t\tgetFluidTypographyOptionsFromSettings( settings );\n\tfluidTypographySettings =\n\t\ttypeof fluidTypographySettings?.fluid === 'object'\n\t\t\t? fluidTypographySettings?.fluid\n\t\t\t: {};\n\n\tconst fluidFontSizeValue = getComputedFluidTypographyValue( {\n\t\tminimumFontSize: preset?.fluid?.min,\n\t\tmaximumFontSize: preset?.fluid?.max,\n\t\tfontSize: defaultSize,\n\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\tmaximumViewportWidth: fluidTypographySettings?.maxViewportWidth,\n\t\tminimumViewportWidth: fluidTypographySettings?.minViewportWidth,\n\t} );\n\n\tif ( !! fluidFontSizeValue ) {\n\t\treturn fluidFontSizeValue;\n\t}\n\n\treturn defaultSize;\n}\n\nfunction isFluidTypographyEnabled( typographySettings ) {\n\tconst fluidSettings = typographySettings?.fluid;\n\treturn (\n\t\ttrue === fluidSettings ||\n\t\t( fluidSettings &&\n\t\t\ttypeof fluidSettings === 'object' &&\n\t\t\tObject.keys( fluidSettings ).length > 0 )\n\t);\n}\n\n/**\n * Returns fluid typography settings from theme.json setting object.\n *\n * @param {Object} settings Theme.json settings\n * @param {Object} settings.typography Theme.json typography settings\n * @param {Object} settings.layout Theme.json layout settings\n * @return {TypographySettings} Fluid typography settings\n */\nexport function getFluidTypographyOptionsFromSettings( settings ) {\n\tconst typographySettings = settings?.typography;\n\tconst layoutSettings = settings?.layout;\n\tconst defaultMaxViewportWidth = getTypographyValueAndUnit(\n\t\tlayoutSettings?.wideSize\n\t)\n\t\t? layoutSettings?.wideSize\n\t\t: null;\n\treturn isFluidTypographyEnabled( typographySettings ) &&\n\t\tdefaultMaxViewportWidth\n\t\t? {\n\t\t\t\tfluid: {\n\t\t\t\t\tmaxViewportWidth: defaultMaxViewportWidth,\n\t\t\t\t\t...typographySettings.fluid,\n\t\t\t\t},\n\t\t }\n\t\t: {\n\t\t\t\tfluid: typographySettings?.fluid,\n\t\t };\n}\n\n/**\n * Returns an object of merged font families and the font faces from the selected font family\n * based on the theme.json settings object and the currently selected font family.\n *\n * @param {Object} settings Theme.json settings.\n * @param {string} selectedFontFamily Decoded font family string.\n * @return {Object} Merged font families and font faces from the selected font family.\n */\nexport function getMergedFontFamiliesAndFontFamilyFaces(\n\tsettings,\n\tselectedFontFamily\n) {\n\tconst fontFamiliesFromSettings = settings?.typography?.fontFamilies;\n\n\tconst fontFamilies = [ 'default', 'theme', 'custom' ].flatMap(\n\t\t( key ) => fontFamiliesFromSettings?.[ key ] ?? []\n\t);\n\n\tconst fontFamilyFaces =\n\t\tfontFamilies.find(\n\t\t\t( family ) => family.fontFamily === selectedFontFamily\n\t\t)?.fontFace ?? [];\n\n\treturn { fontFamilies, fontFamilyFaces };\n}\n\n/**\n * Returns the nearest font weight value from the available font weight list based on the new font weight.\n * The nearest font weight is the one with the smallest difference from the new font weight.\n *\n * @param {Array} availableFontWeights Array of available font weights.\n * @param {string} newFontWeightValue New font weight value.\n * @return {string} Nearest font weight.\n */\nexport function findNearestFontWeight(\n\tavailableFontWeights,\n\tnewFontWeightValue\n) {\n\tif ( ! newFontWeightValue || typeof newFontWeightValue !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tif ( ! availableFontWeights || availableFontWeights.length === 0 ) {\n\t\treturn newFontWeightValue;\n\t}\n\n\tconst nearestFontWeight = availableFontWeights?.reduce(\n\t\t( nearest, { value: fw } ) => {\n\t\t\tconst currentDiff = Math.abs(\n\t\t\t\tparseInt( fw ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\tconst nearestDiff = Math.abs(\n\t\t\t\tparseInt( nearest ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\treturn currentDiff < nearestDiff ? fw : nearest;\n\t\t},\n\t\tavailableFontWeights[ 0 ]?.value\n\t);\n\n\treturn nearestFontWeight;\n}\n\n/**\n * Returns the nearest font style based on the new font style.\n * Defaults to an empty string if the new font style is not valid or available.\n *\n * @param {Array} availableFontStyles Array of available font weights.\n * @param {string} newFontStyleValue New font style value.\n * @return {string} Nearest font style or an empty string.\n */\nexport function findNearestFontStyle( availableFontStyles, newFontStyleValue ) {\n\tif ( typeof newFontStyleValue !== 'string' || ! newFontStyleValue ) {\n\t\treturn '';\n\t}\n\n\tconst validStyles = [ 'normal', 'italic', 'oblique' ];\n\tif ( ! validStyles.includes( newFontStyleValue ) ) {\n\t\treturn '';\n\t}\n\n\tif (\n\t\t! availableFontStyles ||\n\t\tavailableFontStyles.length === 0 ||\n\t\tavailableFontStyles.find(\n\t\t\t( style ) => style.value === newFontStyleValue\n\t\t)\n\t) {\n\t\treturn newFontStyleValue;\n\t}\n\n\tif (\n\t\tnewFontStyleValue === 'oblique' &&\n\t\t! availableFontStyles.find( ( style ) => style.value === 'oblique' )\n\t) {\n\t\treturn 'italic';\n\t}\n\n\treturn '';\n}\n\n/**\n * Returns the nearest font style and weight based on the available font family faces and the new font style and weight.\n *\n * @param {Array} fontFamilyFaces Array of available font family faces.\n * @param {string} fontStyle New font style. Defaults to previous value.\n * @param {string} fontWeight New font weight. Defaults to previous value.\n * @return {Object} Nearest font style and font weight.\n */\nexport function findNearestStyleAndWeight(\n\tfontFamilyFaces,\n\tfontStyle,\n\tfontWeight\n) {\n\tlet nearestFontStyle = fontStyle;\n\tlet nearestFontWeight = fontWeight;\n\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Check if the new font style and weight are available in the font family faces.\n\tconst hasFontStyle = fontStyles?.some(\n\t\t( { value: fs } ) => fs === fontStyle\n\t);\n\tconst hasFontWeight = fontWeights?.some(\n\t\t( { value: fw } ) => fw === fontWeight\n\t);\n\n\tif ( ! hasFontStyle ) {\n\t\t/*\n\t\t * Default to italic if oblique is not available.\n\t\t * Or find the nearest font style based on the nearest font weight.\n\t\t */\n\t\tnearestFontStyle = fontStyle\n\t\t\t? findNearestFontStyle( fontStyles, fontStyle )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontWeight ===\n\t\t\t\t\t\tfindNearestFontWeight( fontWeights, fontWeight )\n\t\t\t )?.style?.fontStyle;\n\t}\n\n\tif ( ! hasFontWeight ) {\n\t\t/*\n\t\t * Find the nearest font weight based on available weights.\n\t\t * Or find the nearest font weight based on the nearest font style.\n\t\t */\n\t\tnearestFontWeight = fontWeight\n\t\t\t? findNearestFontWeight( fontWeights, fontWeight )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontStyle ===\n\t\t\t\t\t\t( nearestFontStyle || fontStyle )\n\t\t\t )?.style?.fontWeight;\n\t}\n\n\treturn { nearestFontStyle, nearestFontWeight };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SACCA,+BAA+B,EAC/BC,yBAAyB,QACnB,2BAA2B;AAClC,SAASC,uBAAuB,QAAQ,yCAAyC;;AAEjF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC9D,MAAM;IAAEC,IAAI,EAAEC;EAAY,CAAC,GAAGH,MAAM;EAEpC,IAAK,CAAEI,wBAAwB,CAAEH,QAAQ,EAAEI,UAAW,CAAC,EAAG;IACzD,OAAOF,WAAW;EACnB;EACA;AACD;AACA;AACA;AACA;EACC,IAAK,CAAEA,WAAW,IAAI,GAAG,KAAKA,WAAW,IAAI,KAAK,KAAKH,MAAM,EAAEM,KAAK,EAAG;IACtE,OAAOH,WAAW;EACnB;EAEA,IAAII,uBAAuB,GAC1BC,qCAAqC,CAAEP,QAAS,CAAC;EAClDM,uBAAuB,GACtB,OAAOA,uBAAuB,EAAED,KAAK,KAAK,QAAQ,GAC/CC,uBAAuB,EAAED,KAAK,GAC9B,CAAC,CAAC;EAEN,MAAMG,kBAAkB,GAAGb,+BAA+B,CAAE;IAC3Dc,eAAe,EAAEV,MAAM,EAAEM,KAAK,EAAEK,GAAG;IACnCC,eAAe,EAAEZ,MAAM,EAAEM,KAAK,EAAEO,GAAG;IACnCC,QAAQ,EAAEX,WAAW;IACrBY,oBAAoB,EAAER,uBAAuB,EAAES,WAAW;IAC1DC,oB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EAAG;IACrB;AACF;AACA;AACA;IACEJ,gBAAgB,GAAGF,SAAS,GACzBP,oBAAoB,CAAEU,UAAU,EAAEH,SAAU,CAAC,GAC7CK,6BAA6B,EAAE7B,IAAI,CACjCkC,MAAM,IACPA,MAAM,CAACZ,KAAK,CAACG,UAAU,KACvBrB,qBAAqB,CAAEwB,WAAW,EAAEH,UAAW,CAChD,CAAC,EAAEH,KAAK,EAAEE,SAAS;EACvB;EAEA,IAAK,CAAES,aAAa,EAAG;IACtB;AACF;AACA;AACA;IACE1B,iBAAiB,GAAGkB,UAAU,GAC3BrB,qBAAqB,CAAEwB,WAAW,EAAEH,UAAW,CAAC,GAChDI,6BAA6B,EAAE7B,IAAI,CACjCkC,MAAM,IACPA,MAAM,CAACZ,KAAK,CAACE,SAAS,MACpBE,gBAAgB,IAAIF,SAAS,CAChC,CAAC,EAAEF,KAAK,EAAEG,UAAU;EACxB;EAEA,OAAO;IAAEC,gBAAgB;IAAEnB;EAAkB,CAAC;AAC/C","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["getComputedFluidTypographyValue","getTypographyValueAndUnit","getFontStylesAndWeights","getTypographyFontSizeValue","preset","settings","size","defaultSize","fluid","isFluidTypographyEnabled","typography","fluidTypographySettings","getFluidTypographyOptionsFromSettings","fluidFontSizeValue","minimumFontSize","min","maximumFontSize","max","fontSize","minimumFontSizeLimit","minFontSize","maximumViewportWidth","maxViewportWidth","minimumViewportWidth","minViewportWidth","typographySettings","fluidSettings","Object","keys","length","layoutSettings","layout","defaultMaxViewportWidth","wideSize","getMergedFontFamiliesAndFontFamilyFaces","selectedFontFamily","_fontFamilies$find$fo","fontFamiliesFromSettings","fontFamilies","flatMap","key","_fontFamiliesFromSett","fontFamilyFaces","find","family","fontFamily","fontFace","findNearestFontWeight","availableFontWeights","newFontWeightValue","toString","nearestFontWeight","reduce","nearest","value","fw","currentDiff","Math","abs","parseInt","nearestDiff","findNearestFontStyle","availableFontStyles","newFontStyleValue","validStyles","includes","style","findNearestStyleAndWeight","fontStyle","fontWeight","nearestFontStyle","fontStyles","fontWeights","combinedStyleAndWeightOptions","hasFontStyle","some","fs","hasFontWeight","option"],"sources":["@wordpress/block-editor/src/components/global-styles/typography-utils.js"],"sourcesContent":["/**\n * The fluid utilities must match the backend equivalent.\n * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php\n * ---------------------------------------------------------------\n */\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetComputedFluidTypographyValue,\n\tgetTypographyValueAndUnit,\n} from '../font-sizes/fluid-utils';\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * @typedef {Object} FluidPreset\n * @property {string|undefined} max A maximum font size value.\n * @property {?string|undefined} min A minimum font size value.\n */\n\n/**\n * @typedef {Object} Preset\n * @property {?string|?number} size A default font size.\n * @property {string} name A font size name, displayed in the UI.\n * @property {string} slug A font size slug\n * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.\n */\n\n/**\n * @typedef {Object} TypographySettings\n * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.\n * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.\n * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.\n * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.\n * @property {?string} minFontSize The smallest a calculated font size may be. Optional.\n */\n\n/**\n * Returns a font-size value based on a given font-size preset.\n * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.\n *\n * The Core PHP equivalent is wp_get_typography_font_size_value().\n *\n * @param {Preset} preset\n * @param {Object} settings\n * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.\n * @param {Object?} settings.typography.layout Layout options.\n *\n * @return {string|*} A font-size value or the value of preset.size.\n */\nexport function getTypographyFontSizeValue( preset, settings ) {\n\tconst { size: defaultSize } = preset;\n\n\t/*\n\t * Catch falsy values and 0/'0'. Fluid calculations cannot be performed on `0`.\n\t * Also return early when a preset font size explicitly disables fluid typography with `false`.\n\t */\n\tif ( ! defaultSize || '0' === defaultSize || false === preset?.fluid ) {\n\t\treturn defaultSize;\n\t}\n\n\t/*\n\t * Return early when fluid typography is disabled in the settings, and there\n\t * are no local settings to enable it for the individual preset.\n\t *\n\t * If this condition isn't met, either the settings or individual preset settings\n\t * have enabled fluid typography.\n\t */\n\tif (\n\t\t! isFluidTypographyEnabled( settings?.typography ) &&\n\t\t! isFluidTypographyEnabled( preset )\n\t) {\n\t\treturn defaultSize;\n\t}\n\n\tlet fluidTypographySettings =\n\t\tgetFluidTypographyOptionsFromSettings( settings );\n\tfluidTypographySettings =\n\t\ttypeof fluidTypographySettings?.fluid === 'object'\n\t\t\t? fluidTypographySettings?.fluid\n\t\t\t: {};\n\n\tconst fluidFontSizeValue = getComputedFluidTypographyValue( {\n\t\tminimumFontSize: preset?.fluid?.min,\n\t\tmaximumFontSize: preset?.fluid?.max,\n\t\tfontSize: defaultSize,\n\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\tmaximumViewportWidth: fluidTypographySettings?.maxViewportWidth,\n\t\tminimumViewportWidth: fluidTypographySettings?.minViewportWidth,\n\t} );\n\n\tif ( !! fluidFontSizeValue ) {\n\t\treturn fluidFontSizeValue;\n\t}\n\n\treturn defaultSize;\n}\n\nfunction isFluidTypographyEnabled( typographySettings ) {\n\tconst fluidSettings = typographySettings?.fluid;\n\treturn (\n\t\ttrue === fluidSettings ||\n\t\t( fluidSettings &&\n\t\t\ttypeof fluidSettings === 'object' &&\n\t\t\tObject.keys( fluidSettings ).length > 0 )\n\t);\n}\n\n/**\n * Returns fluid typography settings from theme.json setting object.\n *\n * @param {Object} settings Theme.json settings\n * @param {Object} settings.typography Theme.json typography settings\n * @param {Object} settings.layout Theme.json layout settings\n * @return {TypographySettings} Fluid typography settings\n */\nexport function getFluidTypographyOptionsFromSettings( settings ) {\n\tconst typographySettings = settings?.typography;\n\tconst layoutSettings = settings?.layout;\n\tconst defaultMaxViewportWidth = getTypographyValueAndUnit(\n\t\tlayoutSettings?.wideSize\n\t)\n\t\t? layoutSettings?.wideSize\n\t\t: null;\n\treturn isFluidTypographyEnabled( typographySettings ) &&\n\t\tdefaultMaxViewportWidth\n\t\t? {\n\t\t\t\tfluid: {\n\t\t\t\t\tmaxViewportWidth: defaultMaxViewportWidth,\n\t\t\t\t\t...typographySettings.fluid,\n\t\t\t\t},\n\t\t }\n\t\t: {\n\t\t\t\tfluid: typographySettings?.fluid,\n\t\t };\n}\n\n/**\n * Returns an object of merged font families and the font faces from the selected font family\n * based on the theme.json settings object and the currently selected font family.\n *\n * @param {Object} settings Theme.json settings.\n * @param {string} selectedFontFamily Decoded font family string.\n * @return {Object} Merged font families and font faces from the selected font family.\n */\nexport function getMergedFontFamiliesAndFontFamilyFaces(\n\tsettings,\n\tselectedFontFamily\n) {\n\tconst fontFamiliesFromSettings = settings?.typography?.fontFamilies;\n\n\tconst fontFamilies = [ 'default', 'theme', 'custom' ].flatMap(\n\t\t( key ) => fontFamiliesFromSettings?.[ key ] ?? []\n\t);\n\n\tconst fontFamilyFaces =\n\t\tfontFamilies.find(\n\t\t\t( family ) => family.fontFamily === selectedFontFamily\n\t\t)?.fontFace ?? [];\n\n\treturn { fontFamilies, fontFamilyFaces };\n}\n\n/**\n * Returns the nearest font weight value from the available font weight list based on the new font weight.\n * The nearest font weight is the one with the smallest difference from the new font weight.\n *\n * @param {Array} availableFontWeights Array of available font weights.\n * @param {string} newFontWeightValue New font weight value.\n * @return {string} Nearest font weight.\n */\nexport function findNearestFontWeight(\n\tavailableFontWeights,\n\tnewFontWeightValue\n) {\n\tnewFontWeightValue =\n\t\t'number' === typeof newFontWeightValue\n\t\t\t? newFontWeightValue.toString()\n\t\t\t: newFontWeightValue;\n\tif ( ! newFontWeightValue || typeof newFontWeightValue !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tif ( ! availableFontWeights || availableFontWeights.length === 0 ) {\n\t\treturn newFontWeightValue;\n\t}\n\n\tconst nearestFontWeight = availableFontWeights?.reduce(\n\t\t( nearest, { value: fw } ) => {\n\t\t\tconst currentDiff = Math.abs(\n\t\t\t\tparseInt( fw ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\tconst nearestDiff = Math.abs(\n\t\t\t\tparseInt( nearest ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\treturn currentDiff < nearestDiff ? fw : nearest;\n\t\t},\n\t\tavailableFontWeights[ 0 ]?.value\n\t);\n\n\treturn nearestFontWeight;\n}\n\n/**\n * Returns the nearest font style based on the new font style.\n * Defaults to an empty string if the new font style is not valid or available.\n *\n * @param {Array} availableFontStyles Array of available font weights.\n * @param {string} newFontStyleValue New font style value.\n * @return {string} Nearest font style or an empty string.\n */\nexport function findNearestFontStyle( availableFontStyles, newFontStyleValue ) {\n\tif ( typeof newFontStyleValue !== 'string' || ! newFontStyleValue ) {\n\t\treturn '';\n\t}\n\n\tconst validStyles = [ 'normal', 'italic', 'oblique' ];\n\tif ( ! validStyles.includes( newFontStyleValue ) ) {\n\t\treturn '';\n\t}\n\n\tif (\n\t\t! availableFontStyles ||\n\t\tavailableFontStyles.length === 0 ||\n\t\tavailableFontStyles.find(\n\t\t\t( style ) => style.value === newFontStyleValue\n\t\t)\n\t) {\n\t\treturn newFontStyleValue;\n\t}\n\n\tif (\n\t\tnewFontStyleValue === 'oblique' &&\n\t\t! availableFontStyles.find( ( style ) => style.value === 'oblique' )\n\t) {\n\t\treturn 'italic';\n\t}\n\n\treturn '';\n}\n\n/**\n * Returns the nearest font style and weight based on the available font family faces and the new font style and weight.\n *\n * @param {Array} fontFamilyFaces Array of available font family faces.\n * @param {string} fontStyle New font style. Defaults to previous value.\n * @param {string} fontWeight New font weight. Defaults to previous value.\n * @return {Object} Nearest font style and font weight.\n */\nexport function findNearestStyleAndWeight(\n\tfontFamilyFaces,\n\tfontStyle,\n\tfontWeight\n) {\n\tlet nearestFontStyle = fontStyle;\n\tlet nearestFontWeight = fontWeight;\n\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Check if the new font style and weight are available in the font family faces.\n\tconst hasFontStyle = fontStyles?.some(\n\t\t( { value: fs } ) => fs === fontStyle\n\t);\n\tconst hasFontWeight = fontWeights?.some(\n\t\t( { value: fw } ) => fw?.toString() === fontWeight?.toString()\n\t);\n\n\tif ( ! hasFontStyle ) {\n\t\t/*\n\t\t * Default to italic if oblique is not available.\n\t\t * Or find the nearest font style based on the nearest font weight.\n\t\t */\n\t\tnearestFontStyle = fontStyle\n\t\t\t? findNearestFontStyle( fontStyles, fontStyle )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontWeight ===\n\t\t\t\t\t\tfindNearestFontWeight( fontWeights, fontWeight )\n\t\t\t )?.style?.fontStyle;\n\t}\n\n\tif ( ! hasFontWeight ) {\n\t\t/*\n\t\t * Find the nearest font weight based on available weights.\n\t\t * Or find the nearest font weight based on the nearest font style.\n\t\t */\n\t\tnearestFontWeight = fontWeight\n\t\t\t? findNearestFontWeight( fontWeights, fontWeight )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontStyle ===\n\t\t\t\t\t\t( nearestFontStyle || fontStyle )\n\t\t\t )?.style?.fontWeight;\n\t}\n\n\treturn { nearestFontStyle, nearestFontWeight };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SACCA,+BAA+B,EAC/BC,yBAAyB,QACnB,2BAA2B;AAClC,SAASC,uBAAuB,QAAQ,yCAAyC;;AAEjF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;A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qB,CAAEyB,WAAW,EAAEH,UAAW,CAChD,CAAC,EAAEH,KAAK,EAAEE,SAAS;EACvB;EAEA,IAAK,CAAES,aAAa,EAAG;IACtB;AACF;AACA;AACA;IACE1B,iBAAiB,GAAGkB,UAAU,GAC3BtB,qBAAqB,CAAEyB,WAAW,EAAEH,UAAW,CAAC,GAChDI,6BAA6B,EAAE9B,IAAI,CACjCmC,MAAM,IACPA,MAAM,CAACZ,KAAK,CAACE,SAAS,MACpBE,gBAAgB,IAAIF,SAAS,CAChC,CAAC,EAAEF,KAAK,EAAEG,UAAU;EACxB;EAEA,OAAO;IAAEC,gBAAgB;IAAEnB;EAAkB,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -230,9 +230,8 @@ function getValueFromCustomVariable(features, blockName, variable, path) {
|
|
|
230
230
|
*/
|
|
231
231
|
export function getValueFromVariable(features, blockName, variable) {
|
|
232
232
|
if (!variable || typeof variable !== 'string') {
|
|
233
|
-
if (
|
|
234
|
-
|
|
235
|
-
variable = getValueFromObjectPath(features, refPath);
|
|
233
|
+
if (typeof variable?.ref === 'string') {
|
|
234
|
+
variable = getValueFromObjectPath(features, variable.ref);
|
|
236
235
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
237
236
|
// Pointing to another dynamic value is not supported.
|
|
238
237
|
if (!variable || !!variable?.ref) {
|
|
@@ -447,8 +446,7 @@ export function getResolvedRefValue(ruleValue, tree) {
|
|
|
447
446
|
* For example: { "ref": "style.color.background" } => "#fff".
|
|
448
447
|
*/
|
|
449
448
|
if (typeof ruleValue !== 'string' && ruleValue?.ref) {
|
|
450
|
-
const
|
|
451
|
-
const resolvedRuleValue = getCSSValueFromRawStyle(getValueFromObjectPath(tree, refPath));
|
|
449
|
+
const resolvedRuleValue = getCSSValueFromRawStyle(getValueFromObjectPath(tree, ruleValue.ref));
|
|
452
450
|
|
|
453
451
|
/*
|
|
454
452
|
* Presence of another ref indicates a reference to another dynamic value.
|
|
@@ -457,7 +455,7 @@ export function getResolvedRefValue(ruleValue, tree) {
|
|
|
457
455
|
if (resolvedRuleValue?.ref) {
|
|
458
456
|
return undefined;
|
|
459
457
|
}
|
|
460
|
-
if (
|
|
458
|
+
if (resolvedRuleValue === undefined) {
|
|
461
459
|
return ruleValue;
|
|
462
460
|
}
|
|
463
461
|
return resolvedRuleValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fastDeepEqual","useViewportMatch","getCSSValueFromRawStyle","getTypographyFontSizeValue","getValueFromObjectPath","ROOT_BLOCK_SELECTOR","ROOT_CSS_PROPERTIES_SELECTOR","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","settings","size","STYLE_PATH_TO_CSS_VAR_INFIX","shadow","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","_getValueFromObjectPa","ref","refPath","split","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","scopeFeatureSelectors","featureSelectors","Object","entries","feature","subfeature","subfeatureSelector","appendToSelector","toAppend","includes","newSelectors","map","sel","areGlobalStyleConfigsEqual","original","variation","styles","getBlockStyleVariationSelector","blockSelector","variationClass","ancestorRegex","addVariationClass","_match","group1","group2","part","replace","getResolvedThemeFilePath","file","themeFileURIs","Array","isArray","uri","themeFileUri","name","href","getResolvedRefValue","ruleValue","tree","resolvedRuleValue","getResolvedValue","resolvedValue","url","_links"],"sources":["@wordpress/block-editor/src/components/global-styles/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getCSSValueFromRawStyle } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { getValueFromObjectPath } from '../../utils/object';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_CSS_PROPERTIES_SELECTOR = ':root';\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tvalueKey: 'colors',\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'shadow', 'presets' ],\n\t\tvalueKey: 'shadow',\n\t\tcssVarInfix: 'shadow',\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, settings ) =>\n\t\t\tgetTypographyFontSizeValue( preset, settings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'filter.duotone': 'duotone',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.caption.color.text': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tshadow: 'shadow',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tgetValueFromObjectPath( features, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t...presetPath,\n\t\t] ),\n\t\tgetValueFromObjectPath( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tgetValueFromObjectPath( features.settings, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t'custom',\n\t\t\t...path,\n\t\t] ) ??\n\t\tgetValueFromObjectPath( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( variable?.ref && typeof variable?.ref === 'string' ) {\n\t\t\tconst refPath = variable.ref.split( '.' );\n\t\t\tvariable = getValueFromObjectPath( features, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tif ( ! scope || ! selector ) {\n\t\treturn selector;\n\t}\n\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Scopes a collection of selectors for features and subfeatures.\n *\n * @example\n * ```js\n * const scope = '.custom-scope';\n * const selectors = {\n * color: '.wp-my-block p',\n * typography: { fontSize: '.wp-my-block caption' },\n * };\n * const result = scopeFeatureSelector( scope, selectors );\n * // result is {\n * // color: '.custom-scope .wp-my-block p',\n * // typography: { fonSize: '.custom-scope .wp-my-block caption' },\n * // }\n * ```\n *\n * @param {string} scope Selector to scope collection of selectors with.\n * @param {Object} selectors Collection of feature selectors e.g.\n *\n * @return {Object|undefined} Scoped collection of feature selectors.\n */\nexport function scopeFeatureSelectors( scope, selectors ) {\n\tif ( ! scope || ! selectors ) {\n\t\treturn;\n\t}\n\n\tconst featureSelectors = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\tif ( typeof selector === 'string' ) {\n\t\t\tfeatureSelectors[ feature ] = scopeSelector( scope, selector );\n\t\t}\n\n\t\tif ( typeof selector === 'object' ) {\n\t\t\tfeatureSelectors[ feature ] = {};\n\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\tfeatureSelectors[ feature ][ subfeature ] = scopeSelector(\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tsubfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn featureSelectors;\n}\n\n/**\n * Appends a sub-selector to an existing one.\n *\n * Given the compounded `selector` \"h1, h2, h3\"\n * and the `toAppend` selector \".some-class\" the result will be\n * \"h1.some-class, h2.some-class, h3.some-class\".\n *\n * @param {string} selector Original selector.\n * @param {string} toAppend Selector to append.\n *\n * @return {string} The new selector.\n */\nexport function appendToSelector( selector, toAppend ) {\n\tif ( ! selector.includes( ',' ) ) {\n\t\treturn selector + toAppend;\n\t}\n\tconst selectors = selector.split( ',' );\n\tconst newSelectors = selectors.map( ( sel ) => sel + toAppend );\n\treturn newSelectors.join( ',' );\n}\n\n/**\n * Compares global style variations according to their styles and settings properties.\n *\n * @example\n * ```js\n * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };\n * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };\n * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );\n * // false\n * ```\n *\n * @param {Object} original A global styles object.\n * @param {Object} variation A global styles object.\n *\n * @return {boolean} Whether `original` and `variation` match.\n */\nexport function areGlobalStyleConfigsEqual( original, variation ) {\n\tif ( typeof original !== 'object' || typeof variation !== 'object' ) {\n\t\treturn original === variation;\n\t}\n\treturn (\n\t\tfastDeepEqual( original?.styles, variation?.styles ) &&\n\t\tfastDeepEqual( original?.settings, variation?.settings )\n\t);\n}\n\n/**\n * Generates the selector for a block style variation by creating the\n * appropriate CSS class and adding it to the ancestor portion of the block's\n * selector.\n *\n * For example, take the Button block which has a compound selector:\n * `.wp-block-button .wp-block-button__link`. With a variation named 'custom',\n * the class `.is-style-custom` should be added to the `.wp-block-button`\n * ancestor only.\n *\n * This function will take into account comma separated and complex selectors.\n *\n * @param {string} variation Name for the variation.\n * @param {string} blockSelector CSS selector for the block.\n *\n * @return {string} CSS selector for the block style variation.\n */\nexport function getBlockStyleVariationSelector( variation, blockSelector ) {\n\tconst variationClass = `.is-style-${ variation }`;\n\n\tif ( ! blockSelector ) {\n\t\treturn variationClass;\n\t}\n\n\tconst ancestorRegex = /((?::\\([^)]+\\))?\\s*)([^\\s:]+)/;\n\tconst addVariationClass = ( _match, group1, group2 ) => {\n\t\treturn group1 + group2 + variationClass;\n\t};\n\n\tconst result = blockSelector\n\t\t.split( ',' )\n\t\t.map( ( part ) => part.replace( ancestorRegex, addVariationClass ) );\n\n\treturn result.join( ',' );\n}\n\n/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs ) {\n\tif ( ! file || ! themeFileURIs || ! Array.isArray( themeFileURIs ) ) {\n\t\treturn file;\n\t}\n\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri?.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n\n/**\n * Resolves ref values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedRefValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t/*\n\t * Where the rule value is an object with a 'ref' property pointing\n\t * to a path, this converts that path into the value at that path.\n\t * For example: { \"ref\": \"style.color.background\" } => \"#fff\".\n\t */\n\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\tconst resolvedRuleValue = getCSSValueFromRawStyle(\n\t\t\tgetValueFromObjectPath( tree, refPath )\n\t\t);\n\n\t\t/*\n\t\t * Presence of another ref indicates a reference to another dynamic value.\n\t\t * Pointing to another dynamic value is not supported.\n\t\t */\n\t\tif ( resolvedRuleValue?.ref ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! resolvedRuleValue ) {\n\t\t\treturn ruleValue;\n\t\t}\n\n\t\treturn resolvedRuleValue;\n\t}\n\treturn ruleValue;\n}\n\n/**\n * Resolves ref and relative path values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t// Resolve ref values.\n\tconst resolvedValue = getResolvedRefValue( ruleValue, tree );\n\n\t// Resolve relative paths.\n\tif ( resolvedValue?.url ) {\n\t\tresolvedValue.url = getResolvedThemeFilePath(\n\t\t\tresolvedValue.url,\n\t\t\ttree?._links?.[ 'wp:theme-file' ]\n\t\t);\n\t}\n\n\treturn resolvedValue;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,yBAAyB;;AAEjE;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,sBAAsB,QAAQ,oBAAoB;;AAE3D;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;AACzC,OAAO,MAAMC,4BAA4B,GAAG,OAAO;AAEnD,OAAO,MAAMC,eAAe,GAAG,CAC9B;EACCC,IAAI,EAAE,CAAE,OAAO,EAAE,SAAS,CAAE;EAC5BC,QAAQ,EAAE,OAAO;EACjBC,WAAW,EAAE,OAAO;EACpBC,OAAO,EAAE,CACR;IAAEC,WAAW,EAAE,OAAO;IAAEC,YAAY,EAAE;EAAQ,CAAC,EAC/C;IACCD,WAAW,EAAE,kBAAkB;IAC/BC,YAAY,EAAE;EACf,CAAC,EACD;IACCD,WAAW,EAAE,cAAc;IAC3BC,YAAY,EAAE;EACf,CAAC;AAEH,CAAC,EACD;EACCL,IAAI,EAAE,CAAE,OAAO,EAAE,WAAW,CAAE;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,WAAW,EAAE,UAAU;EACvBC,OAAO,EAAE,CACR;IACCC,WAAW,EAAE,qBAAqB;IAClCC,YAAY,EAAE;EACf,CAAC;AAEH,CAAC,EACD;EACCL,IAAI,EAAE,CAAE,OAAO,EAAE,SAAS,CAAE;EAC5BC,QAAQ,EAAE,QAAQ;EACl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AAiB,EAAG;MAC1B,OAAOF,SAAS;IACjB;IAEA,OAAOE,iBAAiB;EACzB;EACA,OAAOF,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,gBAAgBA,CAAEH,SAAS,EAAEC,IAAI,EAAG;EACnD,IAAK,CAAED,SAAS,IAAI,CAAEC,IAAI,EAAG;IAC5B,OAAOD,SAAS;EACjB;;EAEA;EACA,MAAMI,aAAa,GAAGL,mBAAmB,CAAEC,SAAS,EAAEC,IAAK,CAAC;;EAE5D;EACA,IAAKG,aAAa,EAAEC,GAAG,EAAG;IACzBD,aAAa,CAACC,GAAG,GAAGf,wBAAwB,CAC3Cc,aAAa,CAACC,GAAG,EACjBJ,IAAI,EAAEK,MAAM,GAAI,eAAe,CAChC,CAAC;EACF;EAEA,OAAOF,aAAa;AACrB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["fastDeepEqual","useViewportMatch","getCSSValueFromRawStyle","getTypographyFontSizeValue","getValueFromObjectPath","ROOT_BLOCK_SELECTOR","ROOT_CSS_PROPERTIES_SELECTOR","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","settings","size","STYLE_PATH_TO_CSS_VAR_INFIX","shadow","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","_getValueFromObjectPa","ref","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","split","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","scopeFeatureSelectors","featureSelectors","Object","entries","feature","subfeature","subfeatureSelector","appendToSelector","toAppend","includes","newSelectors","map","sel","areGlobalStyleConfigsEqual","original","variation","styles","getBlockStyleVariationSelector","blockSelector","variationClass","ancestorRegex","addVariationClass","_match","group1","group2","part","replace","getResolvedThemeFilePath","file","themeFileURIs","Array","isArray","uri","themeFileUri","name","href","getResolvedRefValue","ruleValue","tree","resolvedRuleValue","getResolvedValue","resolvedValue","url","_links"],"sources":["@wordpress/block-editor/src/components/global-styles/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getCSSValueFromRawStyle } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { getValueFromObjectPath } from '../../utils/object';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_CSS_PROPERTIES_SELECTOR = ':root';\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tvalueKey: 'colors',\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'shadow', 'presets' ],\n\t\tvalueKey: 'shadow',\n\t\tcssVarInfix: 'shadow',\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, settings ) =>\n\t\t\tgetTypographyFontSizeValue( preset, settings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'filter.duotone': 'duotone',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.caption.color.text': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tshadow: 'shadow',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tgetValueFromObjectPath( features, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t...presetPath,\n\t\t] ),\n\t\tgetValueFromObjectPath( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tgetValueFromObjectPath( features.settings, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t'custom',\n\t\t\t...path,\n\t\t] ) ??\n\t\tgetValueFromObjectPath( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( typeof variable?.ref === 'string' ) {\n\t\t\tvariable = getValueFromObjectPath( features, variable.ref );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tif ( ! scope || ! selector ) {\n\t\treturn selector;\n\t}\n\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Scopes a collection of selectors for features and subfeatures.\n *\n * @example\n * ```js\n * const scope = '.custom-scope';\n * const selectors = {\n * color: '.wp-my-block p',\n * typography: { fontSize: '.wp-my-block caption' },\n * };\n * const result = scopeFeatureSelector( scope, selectors );\n * // result is {\n * // color: '.custom-scope .wp-my-block p',\n * // typography: { fonSize: '.custom-scope .wp-my-block caption' },\n * // }\n * ```\n *\n * @param {string} scope Selector to scope collection of selectors with.\n * @param {Object} selectors Collection of feature selectors e.g.\n *\n * @return {Object|undefined} Scoped collection of feature selectors.\n */\nexport function scopeFeatureSelectors( scope, selectors ) {\n\tif ( ! scope || ! selectors ) {\n\t\treturn;\n\t}\n\n\tconst featureSelectors = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\tif ( typeof selector === 'string' ) {\n\t\t\tfeatureSelectors[ feature ] = scopeSelector( scope, selector );\n\t\t}\n\n\t\tif ( typeof selector === 'object' ) {\n\t\t\tfeatureSelectors[ feature ] = {};\n\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\tfeatureSelectors[ feature ][ subfeature ] = scopeSelector(\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tsubfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn featureSelectors;\n}\n\n/**\n * Appends a sub-selector to an existing one.\n *\n * Given the compounded `selector` \"h1, h2, h3\"\n * and the `toAppend` selector \".some-class\" the result will be\n * \"h1.some-class, h2.some-class, h3.some-class\".\n *\n * @param {string} selector Original selector.\n * @param {string} toAppend Selector to append.\n *\n * @return {string} The new selector.\n */\nexport function appendToSelector( selector, toAppend ) {\n\tif ( ! selector.includes( ',' ) ) {\n\t\treturn selector + toAppend;\n\t}\n\tconst selectors = selector.split( ',' );\n\tconst newSelectors = selectors.map( ( sel ) => sel + toAppend );\n\treturn newSelectors.join( ',' );\n}\n\n/**\n * Compares global style variations according to their styles and settings properties.\n *\n * @example\n * ```js\n * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };\n * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };\n * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );\n * // false\n * ```\n *\n * @param {Object} original A global styles object.\n * @param {Object} variation A global styles object.\n *\n * @return {boolean} Whether `original` and `variation` match.\n */\nexport function areGlobalStyleConfigsEqual( original, variation ) {\n\tif ( typeof original !== 'object' || typeof variation !== 'object' ) {\n\t\treturn original === variation;\n\t}\n\treturn (\n\t\tfastDeepEqual( original?.styles, variation?.styles ) &&\n\t\tfastDeepEqual( original?.settings, variation?.settings )\n\t);\n}\n\n/**\n * Generates the selector for a block style variation by creating the\n * appropriate CSS class and adding it to the ancestor portion of the block's\n * selector.\n *\n * For example, take the Button block which has a compound selector:\n * `.wp-block-button .wp-block-button__link`. With a variation named 'custom',\n * the class `.is-style-custom` should be added to the `.wp-block-button`\n * ancestor only.\n *\n * This function will take into account comma separated and complex selectors.\n *\n * @param {string} variation Name for the variation.\n * @param {string} blockSelector CSS selector for the block.\n *\n * @return {string} CSS selector for the block style variation.\n */\nexport function getBlockStyleVariationSelector( variation, blockSelector ) {\n\tconst variationClass = `.is-style-${ variation }`;\n\n\tif ( ! blockSelector ) {\n\t\treturn variationClass;\n\t}\n\n\tconst ancestorRegex = /((?::\\([^)]+\\))?\\s*)([^\\s:]+)/;\n\tconst addVariationClass = ( _match, group1, group2 ) => {\n\t\treturn group1 + group2 + variationClass;\n\t};\n\n\tconst result = blockSelector\n\t\t.split( ',' )\n\t\t.map( ( part ) => part.replace( ancestorRegex, addVariationClass ) );\n\n\treturn result.join( ',' );\n}\n\n/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs ) {\n\tif ( ! file || ! themeFileURIs || ! Array.isArray( themeFileURIs ) ) {\n\t\treturn file;\n\t}\n\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri?.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n\n/**\n * Resolves ref values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedRefValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t/*\n\t * Where the rule value is an object with a 'ref' property pointing\n\t * to a path, this converts that path into the value at that path.\n\t * For example: { \"ref\": \"style.color.background\" } => \"#fff\".\n\t */\n\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\tconst resolvedRuleValue = getCSSValueFromRawStyle(\n\t\t\tgetValueFromObjectPath( tree, ruleValue.ref )\n\t\t);\n\n\t\t/*\n\t\t * Presence of another ref indicates a reference to another dynamic value.\n\t\t * Pointing to another dynamic value is not supported.\n\t\t */\n\t\tif ( resolvedRuleValue?.ref ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( resolvedRuleValue === undefined ) {\n\t\t\treturn ruleValue;\n\t\t}\n\n\t\treturn resolvedRuleValue;\n\t}\n\treturn ruleValue;\n}\n\n/**\n * Resolves ref and relative path values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t// Resolve ref values.\n\tconst resolvedValue = getResolvedRefValue( ruleValue, tree );\n\n\t// Resolve relative paths.\n\tif ( resolvedValue?.url ) {\n\t\tresolvedValue.url = getResolvedThemeFilePath(\n\t\t\tresolvedValue.url,\n\t\t\ttree?._links?.[ 'wp:theme-file' ]\n\t\t);\n\t}\n\n\treturn resolvedValue;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,yBAAyB;;AAEjE;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,sBAAsB,QAAQ,oBAAoB;;AAE3D;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;AACzC,OAAO,MAAMC,4BAA4B,GAAG,OAAO;AAEnD,OAAO,MAAMC,eAAe,GAAG,CAC9B;EACCC,IAAI,EAAE,CAAE,OAAO,EAAE,SAAS,CAAE;EAC5BC,QAAQ,EAAE,OAAO;EACjBC,WAAW,EAAE,OAAO;EACpBC,OAAO,EAAE,CACR;IAAEC,WAAW,EAAE,OAAO;IAAEC,YAAY,EAAE;EAAQ,CAAC,EAC/C;IACCD,WAAW,EAAE,kBAAkB;IAC/BC,YAAY,EAAE;EACf,CAAC,EACD;IACCD,WAAW,EAAE,cAAc;IAC3BC,YAAY,EAAE;EACf,CAAC;AAEH,CAAC,EACD;EACCL,IAAI,EAAE,CAAE,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AACA;IACE,IAAK8D,iBAAiB,EAAE9D,GAAG,EAAG;MAC7B,OAAOb,SAAS;IACjB;IAEA,IAAK2E,iBAAiB,KAAK3E,SAAS,EAAG;MACtC,OAAOyE,SAAS;IACjB;IAEA,OAAOE,iBAAiB;EACzB;EACA,OAAOF,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,gBAAgBA,CAAEH,SAAS,EAAEC,IAAI,EAAG;EACnD,IAAK,CAAED,SAAS,IAAI,CAAEC,IAAI,EAAG;IAC5B,OAAOD,SAAS;EACjB;;EAEA;EACA,MAAMI,aAAa,GAAGL,mBAAmB,CAAEC,SAAS,EAAEC,IAAK,CAAC;;EAE5D;EACA,IAAKG,aAAa,EAAEC,GAAG,EAAG;IACzBD,aAAa,CAACC,GAAG,GAAGf,wBAAwB,CAC3Cc,aAAa,CAACC,GAAG,EACjBJ,IAAI,EAAEK,MAAM,GAAI,eAAe,CAChC,CAAC;EACF;EAEA,OAAOF,aAAa;AACrB","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
10
10
|
import { VisuallyHidden, ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
11
11
|
import { chevronLeft, chevronUp, chevronDown, chevronRight } from '@wordpress/icons';
|
|
12
12
|
import { useDispatch } from '@wordpress/data';
|
|
@@ -49,7 +49,7 @@ export function GridItemMovers({
|
|
|
49
49
|
children: [/*#__PURE__*/_jsx("div", {
|
|
50
50
|
className: "block-editor-grid-item-mover__move-horizontal-button-container is-left",
|
|
51
51
|
children: /*#__PURE__*/_jsx(GridItemMover, {
|
|
52
|
-
icon: chevronLeft,
|
|
52
|
+
icon: isRTL() ? chevronRight : chevronLeft,
|
|
53
53
|
label: __('Move left'),
|
|
54
54
|
description: __('Move left'),
|
|
55
55
|
isDisabled: columnStart <= 1,
|
|
@@ -93,7 +93,7 @@ export function GridItemMovers({
|
|
|
93
93
|
}), /*#__PURE__*/_jsx("div", {
|
|
94
94
|
className: "block-editor-grid-item-mover__move-horizontal-button-container is-right",
|
|
95
95
|
children: /*#__PURE__*/_jsx(GridItemMover, {
|
|
96
|
-
icon: chevronRight,
|
|
96
|
+
icon: isRTL() ? chevronLeft : chevronRight,
|
|
97
97
|
label: __('Move right'),
|
|
98
98
|
description: __('Move right'),
|
|
99
99
|
isDisabled: columnCount && columnEnd >= columnCount,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","VisuallyHidden","ToolbarButton","ToolbarGroup","chevronLeft","chevronUp","chevronDown","chevronRight","useDispatch","useInstanceId","BlockControls","useGetNumberOfBlocksBeforeCell","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","GridItemMovers","layout","parentLayout","onChange","gridClientId","blockClientId","_layout$columnStart","_layout$rowStart","_layout$columnSpan","_layout$rowSpan","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","columnStart","rowStart","columnSpan","rowSpan","columnEnd","rowEnd","columnCount","rowCount","getNumberOfBlocksBeforeCell","group","children","className","GridItemMover","icon","label","description","isDisabled","onClick","instanceId","descriptionId","disabled","accessibleWhenDisabled","id"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-movers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport {\n\tchevronLeft,\n\tchevronUp,\n\tchevronDown,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\n\nexport function GridItemMovers( {\n\tlayout,\n\tparentLayout,\n\tonChange,\n\tgridClientId,\n\tblockClientId,\n} ) {\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst columnStart = layout?.columnStart ?? 1;\n\tconst rowStart = layout?.rowStart ?? 1;\n\tconst columnSpan = layout?.columnSpan ?? 1;\n\tconst rowSpan = layout?.rowSpan ?? 1;\n\tconst columnEnd = columnStart + columnSpan - 1;\n\tconst rowEnd = rowStart + rowSpan - 1;\n\tconst columnCount = parentLayout?.columnCount;\n\tconst rowCount = parentLayout?.rowCount;\n\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\tgridClientId,\n\t\tcolumnCount\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarGroup className=\"block-editor-grid-item-mover__move-button-container\">\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-left\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Move left' ) }\n\t\t\t\t\t\tdescription={ __( 'Move left' ) }\n\t\t\t\t\t\tisDisabled={ columnStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart - 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-vertical-button-container\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-up-button\"\n\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\tlabel={ __( 'Move up' ) }\n\t\t\t\t\t\tdescription={ __( 'Move up' ) }\n\t\t\t\t\t\tisDisabled={ rowStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart - 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-down-button\"\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tlabel={ __( 'Move down' ) }\n\t\t\t\t\t\tdescription={ __( 'Move down' ) }\n\t\t\t\t\t\tisDisabled={ rowCount && rowEnd >= rowCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-right\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ chevronRight }\n\t\t\t\t\t\tlabel={ __( 'Move right' ) }\n\t\t\t\t\t\tdescription={ __( 'Move right' ) }\n\t\t\t\t\t\tisDisabled={ columnCount && columnEnd >= columnCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart + 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\nfunction GridItemMover( {\n\tclassName,\n\ticon,\n\tlabel,\n\tisDisabled,\n\tonClick,\n\tdescription,\n} ) {\n\tconst instanceId = useInstanceId( GridItemMover );\n\tconst descriptionId = `block-editor-grid-item-mover-button__description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-grid-item-mover-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\tdisabled={ isDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ description }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,cAAc,EACdC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SACCC,WAAW,EACXC,SAAS,EACTC,WAAW,EACXC,YAAY,QACN,kBAAkB;AACzB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,8BAA8B,QAAQ,wCAAwC;AACvF,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,OAAO,SAASC,cAAcA,CAAE;EAC/BC,MAAM;EACNC,YAAY;EACZC,QAAQ;EACRC,YAAY;EACZC;AACD,CAAC,EAAG;EAAA,IAAAC,mBAAA,EAAAC,gBAAA,EAAAC,kBAAA,EAAAC,eAAA;EACH,MAAM;IAAEC,oBAAoB;IAAEC;EAAwC,CAAC,GACtEvB,WAAW,CAAEK,gBAAiB,CAAC;EAEhC,MAAMmB,WAAW,IAAAN,mBAAA,GAAGL,MAAM,EAAEW,WAAW,cAAAN,mBAAA,cAAAA,mBAAA,GAAI,CAAC;EAC5C,MAAMO,QAA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YAAc;UACrBuC,KAAK,EAAG9C,EAAE,CAAE,YAAa,CAAG;UAC5B+C,WAAW,EAAG/C,EAAE,CAAE,YAAa,CAAG;UAClCgD,UAAU,EAAGV,WAAW,IAAIF,SAAS,IAAIE,WAAa;UACtDW,OAAO,EAAGA,CAAA,KAAM;YACf1B,QAAQ,CAAE;cACTS,WAAW,EAAEA,WAAW,GAAG;YAC5B,CAAE,CAAC;YACHD,uCAAuC,CAAC,CAAC;YACzCD,oBAAoB,CACnB,CAAEL,aAAa,CAAE,EACjBD,YAAY,EACZA,YAAY,EACZgB,2BAA2B,CAC1BR,WAAW,GAAG,CAAC,EACfC,QACD,CACD,CAAC;UACF;QAAG,CACH;MAAC,CACE,CAAC;IAAA,CACO;EAAC,CACD,CAAC;AAElB;AAEA,SAASW,aAAaA,CAAE;EACvBD,SAAS;EACTE,IAAI;EACJC,KAAK;EACLE,UAAU;EACVC,OAAO;EACPF;AACD,CAAC,EAAG;EACH,MAAMG,UAAU,GAAGzC,aAAa,CAAEmC,aAAc,CAAC;EACjD,MAAMO,aAAa,GAAI,oDAAoDD,UAAY,EAAC;EACxF,oBACCjC,KAAA,CAAAE,SAAA;IAAAuB,QAAA,gBACC3B,IAAA,CAACb,aAAa;MACbyC,SAAS,EAAG5C,IAAI,CACf,qCAAqC,EACrC4C,SACD,CAAG;MACHE,IAAI,EAAGA,IAAM;MACbC,KAAK,EAAGA,KAAO;MACf,oBAAmBK,aAAe;MAClCF,OAAO,EAAGD,UAAU,GAAG,IAAI,GAAGC,OAAS;MACvCG,QAAQ,EAAGJ,UAAY;MACvBK,sBAAsB;IAAA,CACtB,CAAC,eACFtC,IAAA,CAACd,cAAc;MAACqD,EAAE,EAAGH,aAAe;MAAAT,QAAA,EACjCK;IAAW,CACE,CAAC;EAAA,CAChB,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","isRTL","VisuallyHidden","ToolbarButton","ToolbarGroup","chevronLeft","chevronUp","chevronDown","chevronRight","useDispatch","useInstanceId","BlockControls","useGetNumberOfBlocksBeforeCell","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","GridItemMovers","layout","parentLayout","onChange","gridClientId","blockClientId","_layout$columnStart","_layout$rowStart","_layout$columnSpan","_layout$rowSpan","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","columnStart","rowStart","columnSpan","rowSpan","columnEnd","rowEnd","columnCount","rowCount","getNumberOfBlocksBeforeCell","group","children","className","GridItemMover","icon","label","description","isDisabled","onClick","instanceId","descriptionId","disabled","accessibleWhenDisabled","id"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-movers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport {\n\tchevronLeft,\n\tchevronUp,\n\tchevronDown,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\n\nexport function GridItemMovers( {\n\tlayout,\n\tparentLayout,\n\tonChange,\n\tgridClientId,\n\tblockClientId,\n} ) {\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst columnStart = layout?.columnStart ?? 1;\n\tconst rowStart = layout?.rowStart ?? 1;\n\tconst columnSpan = layout?.columnSpan ?? 1;\n\tconst rowSpan = layout?.rowSpan ?? 1;\n\tconst columnEnd = columnStart + columnSpan - 1;\n\tconst rowEnd = rowStart + rowSpan - 1;\n\tconst columnCount = parentLayout?.columnCount;\n\tconst rowCount = parentLayout?.rowCount;\n\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\tgridClientId,\n\t\tcolumnCount\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarGroup className=\"block-editor-grid-item-mover__move-button-container\">\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-left\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Move left' ) }\n\t\t\t\t\t\tdescription={ __( 'Move left' ) }\n\t\t\t\t\t\tisDisabled={ columnStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart - 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-vertical-button-container\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-up-button\"\n\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\tlabel={ __( 'Move up' ) }\n\t\t\t\t\t\tdescription={ __( 'Move up' ) }\n\t\t\t\t\t\tisDisabled={ rowStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart - 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-down-button\"\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tlabel={ __( 'Move down' ) }\n\t\t\t\t\t\tdescription={ __( 'Move down' ) }\n\t\t\t\t\t\tisDisabled={ rowCount && rowEnd >= rowCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-right\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\tlabel={ __( 'Move right' ) }\n\t\t\t\t\t\tdescription={ __( 'Move right' ) }\n\t\t\t\t\t\tisDisabled={ columnCount && columnEnd >= columnCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart + 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\nfunction GridItemMover( {\n\tclassName,\n\ticon,\n\tlabel,\n\tisDisabled,\n\tonClick,\n\tdescription,\n} ) {\n\tconst instanceId = useInstanceId( GridItemMover );\n\tconst descriptionId = `block-editor-grid-item-mover-button__description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-grid-item-mover-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\tdisabled={ isDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ description }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AA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,2BAA2B,CAC1BR,WAAW,GAAG,CAAC,EACfC,QACD,CACD,CAAC;UACF;QAAG,CACH;MAAC,CACE,CAAC;IAAA,CACO;EAAC,CACD,CAAC;AAElB;AAEA,SAASW,aAAaA,CAAE;EACvBD,SAAS;EACTE,IAAI;EACJC,KAAK;EACLE,UAAU;EACVC,OAAO;EACPF;AACD,CAAC,EAAG;EACH,MAAMG,UAAU,GAAGzC,aAAa,CAAEmC,aAAc,CAAC;EACjD,MAAMO,aAAa,GAAI,oDAAoDD,UAAY,EAAC;EACxF,oBACCjC,KAAA,CAAAE,SAAA;IAAAuB,QAAA,gBACC3B,IAAA,CAACb,aAAa;MACbyC,SAAS,EAAG7C,IAAI,CACf,qCAAqC,EACrC6C,SACD,CAAG;MACHE,IAAI,EAAGA,IAAM;MACbC,KAAK,EAAGA,KAAO;MACf,oBAAmBK,aAAe;MAClCF,OAAO,EAAGD,UAAU,GAAG,IAAI,GAAGC,OAAS;MACvCG,QAAQ,EAAGJ,UAAY;MACvBK,sBAAsB;IAAA,CACtB,CAAC,eACFtC,IAAA,CAACd,cAAc;MAACqD,EAAE,EAAGH,aAAe;MAAAT,QAAA,EACjCK;IAAW,CACE,CAAC;EAAA,CAChB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -119,7 +119,7 @@ function Iframe({
|
|
|
119
119
|
scripts = ''
|
|
120
120
|
} = resolvedAssets;
|
|
121
121
|
const [iframeDocument, setIframeDocument] = useState();
|
|
122
|
-
const
|
|
122
|
+
const prevContainerWidthRef = useRef();
|
|
123
123
|
const [bodyClasses, setBodyClasses] = useState([]);
|
|
124
124
|
const clearerRef = useBlockSelectionClearer();
|
|
125
125
|
const [before, writingFlowRef, after] = useWritingFlow();
|
|
@@ -203,7 +203,7 @@ function Iframe({
|
|
|
203
203
|
const isZoomedOut = scale !== 1;
|
|
204
204
|
useEffect(() => {
|
|
205
205
|
if (!isZoomedOut) {
|
|
206
|
-
|
|
206
|
+
prevContainerWidthRef.current = containerWidth;
|
|
207
207
|
}
|
|
208
208
|
}, [containerWidth, isZoomedOut]);
|
|
209
209
|
const disabledRef = useDisabled({
|
|
@@ -256,12 +256,12 @@ function Iframe({
|
|
|
256
256
|
}
|
|
257
257
|
iframeDocument.documentElement.classList.add('is-zoomed-out');
|
|
258
258
|
const maxWidth = 750;
|
|
259
|
-
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) /
|
|
259
|
+
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidthRef.current : scale);
|
|
260
260
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize);
|
|
261
261
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`);
|
|
262
262
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-inner-height', `${iframeWindowInnerHeight}px`);
|
|
263
263
|
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-container-width', `${containerWidth}px`);
|
|
264
|
-
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-prev-container-width', `${
|
|
264
|
+
iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-prev-container-width', `${prevContainerWidthRef.current}px`);
|
|
265
265
|
return () => {
|
|
266
266
|
iframeDocument.documentElement.classList.remove('is-zoomed-out');
|
|
267
267
|
iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scale');
|
|
@@ -338,7 +338,7 @@ function Iframe({
|
|
|
338
338
|
className: clsx('block-editor-iframe__scale-container', isZoomedOut && 'is-zoomed-out'),
|
|
339
339
|
style: {
|
|
340
340
|
'--wp-block-editor-iframe-zoom-out-container-width': isZoomedOut && `${containerWidth}px`,
|
|
341
|
-
'--wp-block-editor-iframe-zoom-out-prev-container-width': isZoomedOut && `${
|
|
341
|
+
'--wp-block-editor-iframe-zoom-out-prev-container-width': isZoomedOut && `${prevContainerWidthRef.current}px`
|
|
342
342
|
},
|
|
343
343
|
children: iframe
|
|
344
344
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useState","createPortal","forwardRef","useMemo","useEffect","useRef","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","select","getSettings","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","prevContainerWidth","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","current","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","maxWidth","style","setProperty","Math","min","remove","removeProperty","shouldRenderFocusCaptureElements","iframe","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst prevContainerWidth = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tprevContainerWidth.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\tconst maxWidth = 750;\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? Math.min( containerWidth, maxWidth ) /\n\t\t\t\t\t\tprevContainerWidth.current\n\t\t\t\t: scale\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width',\n\t\t\t`${ prevContainerWidth.current }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ containerWidth }px`,\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ prevContainerWidth.current }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,MAAM,QACA,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,SAASC,WAAWA,CAAEC,KAAK,EAAEC,WAAW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UAAAiB,QAAA,EACvCA;QAAQ,CACI,CAAC;MAAA,CACX,CAAC,EACPjB,cAAc,CAACG,eAChB;IAAC,CACK,CAAC,EACPkG,gCAAgC,IAAI3D,KAAK;EAAA,CAC1C,CACF;EAED,oBACCnE,KAAA;IAAKsI,SAAS,EAAC,gCAAgC;IAACtF,GAAG,EAAGyD,eAAiB;IAAA/D,QAAA,GACpE6B,uBAAuB,eACzBzE,IAAA;MACCwI,SAAS,EAAG7J,IAAI,CACf,sCAAsC,EACtCkI,WAAW,IAAI,eAChB,CAAG;MACHa,KAAK,EAAG;QACP,mDAAmD,EAClDb,WAAW,IAAK,GAAGlC,cAAgB,IAAG;QACvC,wDAAwD,EACvDkC,WAAW,IAAK,GAAG9C,kBAAkB,CAAC+C,OAAS;MACjD,CAAG;MAAAlE,QAAA,EAEDqF;IAAM,CACJ,CAAC;EAAA,CACF,CAAC;AAER;AAEA,SAASS,aAAaA,CAAEtF,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAMyF,aAAa,GAAGlJ,SAAS,CAC5B8D,MAAM,IACPA,MAAM,CAAEzD,gBAAiB,CAAC,CAAC0D,WAAW,CAAC,CAAC,CAACoF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAO3I,IAAA,CAAC0C,MAAM;IAAA,GAAMU,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAepE,UAAU,CAAE4J,aAAc,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useState","createPortal","forwardRef","useMemo","useEffect","useRef","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","getCompatibilityStyles","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","bubbleEvent","event","Constructor","frame","init","key","contentDocument","defaultView","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","defaultPrevented","preventDefault","cancelled","dispatchEvent","useBubbleEvents","iframeDocument","frameElement","html","documentElement","eventTypes","handlers","name","prototype","Object","getPrototypeOf","constructorName","constructor","window","addEventListener","removeEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","readonly","forwardedRef","ref","title","props","resolvedAssets","isPreviewMode","select","getSettings","settings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","setIframeDocument","prevContainerWidthRef","bodyClasses","setBodyClasses","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","containerResizeListener","width","containerWidth","setRef","node","_load","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","classList","add","Array","from","body","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","iframeWindowInnerHeight","setIframeWindowInnerHeight","iframeResizeRef","nodeWindow","innerHeight","onResize","windowInnerWidth","setWindowInnerWidth","windowResizeRef","innerWidth","isZoomedOut","current","disabledRef","isDisabled","bodyRef","src","cleanup","_src","URL","createObjectURL","Blob","revokeObjectURL","maxWidth","style","setProperty","Math","min","remove","removeProperty","shouldRenderFocusCaptureElements","iframe","onKeyDown","currentTarget","target","stopPropagation","nativeEvent","KeyboardEvent","className","document","IframeIfReady","isInitialised","__internalIsInitialized"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst settings = getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst prevContainerWidthRef = useRef();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst [ iframeWindowInnerHeight, setIframeWindowInnerHeight ] = useState();\n\n\tconst iframeResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\tconst onResize = () => {\n\t\t\tsetIframeWindowInnerHeight( nodeWindow.innerHeight );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst [ windowInnerWidth, setWindowInnerWidth ] = useState();\n\n\tconst windowResizeRef = useRefEffect( ( node ) => {\n\t\tconst nodeWindow = node.ownerDocument.defaultView;\n\n\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\tconst onResize = () => {\n\t\t\tsetWindowInnerWidth( nodeWindow.innerWidth );\n\t\t};\n\t\tnodeWindow.addEventListener( 'resize', onResize );\n\t\treturn () => {\n\t\t\tnodeWindow.removeEventListener( 'resize', onResize );\n\t\t};\n\t}, [] );\n\n\tconst isZoomedOut = scale !== 1;\n\n\tuseEffect( () => {\n\t\tif ( ! isZoomedOut ) {\n\t\t\tprevContainerWidthRef.current = containerWidth;\n\t\t}\n\t}, [ containerWidth, isZoomedOut ] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width, or when\n\t\t// expanding preview iframes.\n\t\tisZoomedOut ? iframeResizeRef : null,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\tuseEffect( () => {\n\t\tif ( ! iframeDocument || ! isZoomedOut ) {\n\t\t\treturn;\n\t\t}\n\n\t\tiframeDocument.documentElement.classList.add( 'is-zoomed-out' );\n\n\t\tconst maxWidth = 750;\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-scale',\n\t\t\tscale === 'default'\n\t\t\t\t? Math.min( containerWidth, maxWidth ) /\n\t\t\t\t\t\tprevContainerWidthRef.current\n\t\t\t\t: scale\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size',\n\t\t\ttypeof frameSize === 'number' ? `${ frameSize }px` : frameSize\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-content-height',\n\t\t\t`${ contentHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height',\n\t\t\t`${ iframeWindowInnerHeight }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-container-width',\n\t\t\t`${ containerWidth }px`\n\t\t);\n\t\tiframeDocument.documentElement.style.setProperty(\n\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width',\n\t\t\t`${ prevContainerWidthRef.current }px`\n\t\t);\n\n\t\treturn () => {\n\t\t\tiframeDocument.documentElement.classList.remove( 'is-zoomed-out' );\n\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-frame-size'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-content-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-inner-height'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width'\n\t\t\t);\n\t\t\tiframeDocument.documentElement.style.removeProperty(\n\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width'\n\t\t\t);\n\t\t};\n\t}, [\n\t\tscale,\n\t\tframeSize,\n\t\tiframeDocument,\n\t\tiframeWindowInnerHeight,\n\t\tcontentHeight,\n\t\tcontainerWidth,\n\t\twindowInnerWidth,\n\t\tisZoomedOut,\n\t] );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: props.style?.height,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t// We want to prevent React events from bubbling throught the iframe\n\t\t\t\t\t\t// we bubble these manually.\n\t\t\t\t\t\t/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ windowResizeRef }>\n\t\t\t{ containerResizeListener }\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ containerWidth }px`,\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-prev-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ prevContainerWidthRef.current }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,MAAM,QACA,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,sBAAsB,QAAQ,4BAA4B;AACnE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,SAASC,WAAWA,CAAEC,KAAK,EAAEC,WAAW,EAAEC,KAAK,EAAG;EACjD,MAAMC,IAAI,GAAG,CAAC,CAAC;EAEf,KAAM,MAAMC,GAAG,IAAIJ,KAAK,EAAG;IAC1BG,IAAI,CAAEC,GAAG,CAAE,GAAGJ,KAAK,CAAEI,GAAG,CAAE;EAC3B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAKJ,KAAK,YAAYE,KAAK,CAACG,eAAe,CAACC,WAAW,CAACC,UAAU,EAAG;IACpE,MAAMC,IAAI,GAAGN,KAAK,CAACO,qBAAqB,CAAC,CAAC;IAC1CN,IAAI,CAACO,OAAO,IAAIF,IAAI,CAACG,IAAI;IACzBR,IAAI,C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;QACvC,wDAAwD,EACvDkC,WAAW,IAAK,GAAG9C,qBAAqB,CAAC+C,OAAS;MACpD,CAAG;MAAAlE,QAAA,EAEDqF;IAAM,CACJ,CAAC;EAAA,CACF,CAAC;AAER;AAEA,SAASS,aAAaA,CAAEtF,KAAK,EAAEF,GAAG,EAAG;EACpC,MAAMyF,aAAa,GAAGlJ,SAAS,CAC5B8D,MAAM,IACPA,MAAM,CAAEzD,gBAAiB,CAAC,CAAC0D,WAAW,CAAC,CAAC,CAACoF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,oBAAO3I,IAAA,CAAC0C,MAAM;IAAA,GAAMU,KAAK;IAAGH,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAEA,eAAepE,UAAU,CAAE4J,aAAc,CAAC","ignoreList":[]}
|
|
@@ -171,7 +171,7 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
171
171
|
getBlockEditingMode,
|
|
172
172
|
getBlockSettings,
|
|
173
173
|
isDragging,
|
|
174
|
-
|
|
174
|
+
getSectionRootClientId
|
|
175
175
|
} = unlock(select(blockEditorStore));
|
|
176
176
|
let _isDropZoneDisabled;
|
|
177
177
|
if (!clientId) {
|
|
@@ -193,9 +193,7 @@ export function useInnerBlocksProps(props = {}, options = {}) {
|
|
|
193
193
|
// In zoom out mode, we want to disable the drop zone for the sections.
|
|
194
194
|
// The inner blocks belonging to the section drop zone is
|
|
195
195
|
// already disabled by the blocks themselves being disabled.
|
|
196
|
-
const
|
|
197
|
-
sectionRootClientId
|
|
198
|
-
} = unlock(getSettings());
|
|
196
|
+
const sectionRootClientId = getSectionRootClientId();
|
|
199
197
|
_isDropZoneDisabled = clientId !== sectionRootClientId;
|
|
200
198
|
}
|
|
201
199
|
return {
|