@wordpress/block-editor 15.21.0 → 15.22.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 +23 -1
- package/README.md +2 -2
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-compare/index.cjs +2 -2
- package/build/components/block-compare/index.cjs.map +2 -2
- package/build/components/block-editing-mode/index.cjs +13 -7
- package/build/components/block-editing-mode/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +35 -20
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs +0 -1
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-switcher/block-transformations-menu.cjs +16 -15
- package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +4 -4
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +25 -14
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +4 -1
- package/build/components/colors-gradients/dropdown.cjs.map +3 -3
- package/build/components/contrast-checker/index.cjs +22 -4
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +23 -15
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +154 -26
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +2 -0
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
- package/build/components/global-styles/color-panel.cjs +98 -375
- package/build/components/global-styles/color-panel.cjs.map +3 -3
- package/build/components/global-styles/dimensions-panel.cjs +2 -5
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +34 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +82 -10
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +3 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +179 -220
- package/build/components/inserter/index.cjs.map +3 -3
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inserter/search-results.cjs +1 -1
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +2 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +9 -20
- package/build/components/list-view/block-select-button.cjs.map +3 -3
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +14 -3
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +5 -5
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +4 -4
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +7 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -23
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/url-popover/image-url-input-ui.cjs +0 -2
- package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +5 -5
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -3
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +12 -17
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs +124 -75
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/border.cjs +0 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +0 -165
- package/build/hooks/color.cjs.map +3 -3
- package/build/hooks/contrast-checker.cjs +31 -28
- package/build/hooks/contrast-checker.cjs.map +3 -3
- package/build/hooks/custom-class-name.cjs +0 -1
- package/build/hooks/custom-class-name.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -5
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/elements.cjs +142 -0
- package/build/hooks/elements.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +11 -0
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +21 -11
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +65 -10
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +6 -3
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/position.cjs +19 -22
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/states.cjs +2 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/style.cjs +50 -6
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/supports.cjs +0 -7
- package/build/hooks/supports.cjs.map +2 -2
- package/build/hooks/typography.cjs +62 -10
- package/build/hooks/typography.cjs.map +3 -3
- package/build/layouts/flex.cjs +99 -6
- package/build/layouts/flex.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +7 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +1 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +42 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +14 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +60 -41
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/block-bindings.cjs +9 -9
- package/build/utils/block-bindings.cjs.map +3 -3
- package/build/utils/color-values.cjs +10 -1
- package/build/utils/color-values.cjs.map +3 -3
- package/build/utils/dom.cjs +2 -5
- package/build/utils/dom.cjs.map +3 -3
- package/build/utils/fit-text-frontend.cjs +6 -2
- package/build/utils/fit-text-frontend.cjs.map +3 -3
- package/build/utils/fit-text-utils.cjs +1 -1
- package/build/utils/fit-text-utils.cjs.map +3 -3
- package/build/utils/format-font-style.cjs +1 -1
- package/build/utils/format-font-style.cjs.map +3 -3
- package/build/utils/format-font-weight.cjs +1 -1
- package/build/utils/format-font-weight.cjs.map +3 -3
- package/build/utils/get-editor-region.cjs +4 -2
- package/build/utils/get-editor-region.cjs.map +3 -3
- package/build/utils/get-font-styles-and-weights.cjs +8 -12
- package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
- package/build/utils/get-px-from-css-unit.cjs +1 -1
- package/build/utils/get-px-from-css-unit.cjs.map +1 -1
- package/build/utils/index.cjs +1 -1
- package/build/utils/index.cjs.map +1 -1
- package/build/utils/math.cjs +1 -1
- package/build/utils/math.cjs.map +3 -3
- package/build/utils/object.cjs +8 -8
- package/build/utils/object.cjs.map +3 -3
- package/build/utils/order-inserter-block-items.cjs +1 -1
- package/build/utils/order-inserter-block-items.cjs.map +3 -3
- package/build/utils/pasting.cjs +4 -2
- package/build/utils/pasting.cjs.map +3 -3
- package/build/utils/selection.cjs +3 -2
- package/build/utils/selection.cjs.map +3 -3
- package/build/utils/sorting.cjs +9 -3
- package/build/utils/sorting.cjs.map +3 -3
- package/build/utils/transform-styles/index.cjs +3 -2
- package/build/utils/transform-styles/index.cjs.map +3 -3
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
- package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
- package/build/{components/rich-text/native/index.cjs → utils/transform-styles/types.cjs} +4 -13
- package/build/utils/transform-styles/types.cjs.map +7 -0
- package/build/utils/types.cjs +19 -0
- package/build/utils/types.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-compare/index.mjs +1 -1
- package/build-module/components/block-compare/index.mjs.map +2 -2
- package/build-module/components/block-editing-mode/index.mjs +14 -8
- package/build-module/components/block-editing-mode/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +35 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs +0 -1
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-switcher/block-transformations-menu.mjs +16 -15
- package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +4 -4
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +27 -15
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +4 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs +18 -4
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +23 -15
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +157 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -0
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
- package/build-module/components/global-styles/color-panel.mjs +106 -387
- package/build-module/components/global-styles/color-panel.mjs.map +3 -3
- package/build-module/components/global-styles/dimensions-panel.mjs +3 -7
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +33 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +84 -10
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +3 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +185 -222
- package/build-module/components/inserter/index.mjs.map +3 -3
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +2 -3
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +10 -27
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +14 -3
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +5 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -23
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
- package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +5 -5
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -3
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +12 -17
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs +123 -75
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/border.mjs +1 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -178
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs +32 -19
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/custom-class-name.mjs +0 -1
- package/build-module/hooks/custom-class-name.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +13 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +115 -0
- package/build-module/hooks/elements.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +11 -0
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +21 -11
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +68 -10
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -3
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/position.mjs +20 -23
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/states.mjs +2 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +53 -8
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/supports.mjs +0 -7
- package/build-module/hooks/supports.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +62 -10
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +105 -7
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +7 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +1 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +39 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +14 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +62 -42
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/block-bindings.mjs +9 -9
- package/build-module/utils/block-bindings.mjs.map +3 -3
- package/build-module/utils/color-values.mjs +9 -1
- package/build-module/utils/color-values.mjs.map +3 -3
- package/build-module/utils/dom.mjs +2 -5
- package/build-module/utils/dom.mjs.map +3 -3
- package/build-module/utils/fit-text-frontend.mjs +6 -2
- package/build-module/utils/fit-text-frontend.mjs.map +3 -3
- package/build-module/utils/fit-text-utils.mjs +1 -1
- package/build-module/utils/fit-text-utils.mjs.map +3 -3
- package/build-module/utils/format-font-style.mjs +1 -1
- package/build-module/utils/format-font-style.mjs.map +3 -3
- package/build-module/utils/format-font-weight.mjs +1 -1
- package/build-module/utils/format-font-weight.mjs.map +3 -3
- package/build-module/utils/get-editor-region.mjs +4 -2
- package/build-module/utils/get-editor-region.mjs.map +3 -3
- package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
- package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
- package/build-module/utils/get-px-from-css-unit.mjs +1 -1
- package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
- package/build-module/utils/index.mjs +1 -1
- package/build-module/utils/index.mjs.map +1 -1
- package/build-module/utils/math.mjs +1 -1
- package/build-module/utils/math.mjs.map +3 -3
- package/build-module/utils/object.mjs +8 -8
- package/build-module/utils/object.mjs.map +3 -3
- package/build-module/utils/order-inserter-block-items.mjs +1 -1
- package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
- package/build-module/utils/pasting.mjs +4 -2
- package/build-module/utils/pasting.mjs.map +3 -3
- package/build-module/utils/selection.mjs +3 -2
- package/build-module/utils/selection.mjs.map +3 -3
- package/build-module/utils/sorting.mjs +9 -3
- package/build-module/utils/sorting.mjs.map +3 -3
- package/build-module/utils/transform-styles/index.mjs +3 -2
- package/build-module/utils/transform-styles/index.mjs.map +3 -3
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
- package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
- package/build-module/utils/transform-styles/types.mjs +1 -0
- package/build-module/utils/transform-styles/types.mjs.map +7 -0
- package/build-module/utils/types.mjs +1 -0
- package/build-module/utils/types.mjs.map +7 -0
- package/build-style/content-rtl.css +14 -0
- package/build-style/content.css +14 -0
- package/build-style/style-rtl.css +60 -49
- package/build-style/style.css +60 -49
- package/build-types/utils/block-bindings.d.ts +27 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -0
- package/build-types/utils/color-values.d.ts +40 -0
- package/build-types/utils/color-values.d.ts.map +1 -0
- package/build-types/utils/dom.d.ts +19 -19
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/fit-text-frontend.d.ts +7 -0
- package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
- package/build-types/utils/fit-text-utils.d.ts +15 -0
- package/build-types/utils/fit-text-utils.d.ts.map +1 -0
- package/build-types/utils/format-font-style.d.ts +12 -0
- package/build-types/utils/format-font-style.d.ts.map +1 -0
- package/build-types/utils/format-font-weight.d.ts +12 -0
- package/build-types/utils/format-font-weight.d.ts.map +1 -0
- package/build-types/utils/get-editor-region.d.ts +9 -0
- package/build-types/utils/get-editor-region.d.ts.map +1 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
- package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
- package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +3 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/math.d.ts +61 -0
- package/build-types/utils/math.d.ts.map +1 -0
- package/build-types/utils/object.d.ts +39 -0
- package/build-types/utils/object.d.ts.map +1 -0
- package/build-types/utils/order-inserter-block-items.d.ts +13 -0
- package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
- package/build-types/utils/pasting.d.ts +28 -0
- package/build-types/utils/pasting.d.ts.map +1 -0
- package/build-types/utils/selection.d.ts +21 -0
- package/build-types/utils/selection.d.ts.map +1 -0
- package/build-types/utils/sorting.d.ts +17 -0
- package/build-types/utils/sorting.d.ts.map +1 -0
- package/build-types/utils/transform-styles/index.d.ts +15 -0
- package/build-types/utils/transform-styles/index.d.ts.map +1 -0
- package/build-types/utils/transform-styles/types.d.ts +13 -0
- package/build-types/utils/transform-styles/types.d.ts.map +1 -0
- package/build-types/utils/types.d.ts +28 -0
- package/build-types/utils/types.d.ts.map +1 -0
- package/package.json +55 -46
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
- package/src/components/block-breadcrumb/README.md +2 -2
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-compare/README.md +6 -6
- package/src/components/block-compare/index.js +1 -3
- package/src/components/block-editing-mode/index.js +17 -9
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
- package/src/components/block-inspector/index.js +22 -20
- package/src/components/block-patterns-list/index.js +1 -2
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-rename/modal.js +0 -1
- package/src/components/block-switcher/block-transformations-menu.js +16 -18
- package/src/components/block-switcher/index.js +4 -4
- package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
- package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-types-list/README.md +0 -19
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/colors-gradients/control.js +29 -12
- package/src/components/colors-gradients/dropdown.js +4 -1
- package/src/components/colors-gradients/style.scss +39 -2
- package/src/components/contrast-checker/README.md +9 -0
- package/src/components/contrast-checker/index.js +42 -3
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +3 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/advanced-panel.js +5 -1
- package/src/components/global-styles/background-panel.js +203 -36
- package/src/components/global-styles/border-panel.js +2 -0
- package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
- package/src/components/global-styles/color-panel.js +125 -487
- package/src/components/global-styles/dimensions-panel.js +13 -18
- package/src/components/global-styles/hooks.js +45 -0
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/global-styles/test/background-panel.js +56 -0
- package/src/components/global-styles/test/color-panel.js +172 -118
- package/src/components/global-styles/test/typography-panel.js +167 -0
- package/src/components/global-styles/typography-panel.js +100 -11
- package/src/components/iframe/index.js +8 -3
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/index.js +257 -288
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inserter/search-results.js +1 -3
- package/src/components/inspector-controls/README.md +0 -2
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/test/index.js +2 -3
- package/src/components/list-view/block-select-button.js +9 -29
- package/src/components/list-view/block.js +1 -0
- package/src/components/media-placeholder/README.md +1 -29
- package/src/components/media-upload/README.md +0 -19
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/test/use-block-sync.js +40 -0
- package/src/components/provider/use-block-sync.js +15 -3
- package/src/components/rich-text/content.scss +2 -0
- package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
- package/src/components/rich-text/event-listeners/delete.js +9 -4
- package/src/components/rich-text/event-listeners/enter.js +9 -2
- package/src/components/rich-text/event-listeners/input-events.js +13 -4
- package/src/components/rich-text/event-listeners/input-rules.js +20 -4
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
- package/src/components/rich-text/index.js +1 -33
- package/src/components/unit-control/README.md +1 -1
- package/src/components/url-popover/README.md +1 -1
- package/src/components/url-popover/image-url-input-ui.js +0 -2
- package/src/components/use-block-commands/index.js +5 -5
- package/src/components/use-block-display-information/index.js +15 -2
- package/src/components/use-block-display-information/test/index.js +140 -0
- package/src/hooks/anchor.js +9 -18
- package/src/hooks/background.js +210 -133
- package/src/hooks/background.scss +0 -35
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/border.js +1 -5
- package/src/hooks/color.js +2 -210
- package/src/hooks/color.scss +3 -9
- package/src/hooks/contrast-checker.js +60 -17
- package/src/hooks/custom-class-name.js +0 -1
- package/src/hooks/dimensions.js +15 -8
- package/src/hooks/elements.js +140 -0
- package/src/hooks/elements.scss +8 -0
- package/src/hooks/fit-text.js +16 -0
- package/src/hooks/grid-visualizer.js +59 -45
- package/src/hooks/layout-child.js +92 -14
- package/src/hooks/layout.js +6 -3
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/position.js +23 -27
- package/src/hooks/states.js +2 -2
- package/src/hooks/style.js +91 -9
- package/src/hooks/supports.js +0 -9
- package/src/hooks/test/background.js +59 -0
- package/src/hooks/test/block-style-state.js +14 -14
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/layout.js +6 -6
- package/src/hooks/test/style.js +133 -11
- package/src/hooks/typography.js +70 -6
- package/src/layouts/flex.js +118 -15
- package/src/private-apis.js +8 -0
- package/src/store/actions.js +13 -3
- package/src/store/private-actions.js +1 -4
- package/src/store/private-selectors.js +89 -0
- package/src/store/reducer.js +19 -7
- package/src/store/selectors.js +91 -53
- package/src/store/test/actions.js +21 -0
- package/src/store/test/private-selectors.js +166 -7
- package/src/store/test/reducer.js +107 -10
- package/src/store/test/selectors.js +77 -0
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +51 -0
- package/src/utils/color-values.ts +63 -0
- package/src/utils/{dom.js → dom.ts} +27 -27
- package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
- package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
- package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
- package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
- package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
- package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
- package/src/utils/{math.js → math.ts} +37 -30
- package/src/utils/object.ts +89 -0
- package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
- package/src/utils/{pasting.js → pasting.ts} +18 -11
- package/src/utils/{selection.js → selection.ts} +11 -4
- package/src/utils/sorting.ts +81 -0
- package/src/utils/test/color-values.js +44 -1
- package/src/utils/transform-styles/{index.js → index.ts} +25 -25
- package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
- package/src/utils/transform-styles/types.ts +13 -0
- package/src/utils/types.ts +29 -0
- package/build/components/media-upload-progress/constants.cjs +0 -46
- package/build/components/media-upload-progress/constants.cjs.map +0 -7
- package/build/components/rich-text/native/format-edit.cjs +0 -60
- package/build/components/rich-text/native/format-edit.cjs.map +0 -7
- package/build/components/rich-text/native/index.cjs.map +0 -7
- package/build/components/rich-text/native/use-format-types.cjs +0 -139
- package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
- package/build-module/components/media-upload-progress/constants.mjs +0 -16
- package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
- package/build-module/components/rich-text/native/format-edit.mjs +0 -39
- package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
- package/build-module/components/rich-text/native/index.mjs +0 -7
- package/build-module/components/rich-text/native/index.mjs.map +0 -7
- package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
- package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
- package/src/components/audio-player/audio-url-parser.native.js +0 -20
- package/src/components/audio-player/index.native.js +0 -225
- package/src/components/audio-player/styles.native.scss +0 -114
- package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
- package/src/components/block-alignment-control/test/index.native.js +0 -37
- package/src/components/block-alignment-control/ui.native.js +0 -86
- package/src/components/block-caption/README.md +0 -104
- package/src/components/block-caption/index.native.js +0 -89
- package/src/components/block-caption/styles.native.scss +0 -7
- package/src/components/block-controls/slot.native.js +0 -33
- package/src/components/block-draggable/draggable-chip.native.js +0 -49
- package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
- package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
- package/src/components/block-draggable/index.native.js +0 -467
- package/src/components/block-draggable/style.native.scss +0 -19
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
- package/src/components/block-draggable/test/helpers.native.js +0 -182
- package/src/components/block-draggable/test/index.native.js +0 -419
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
- package/src/components/block-edit/edit.native.js +0 -49
- package/src/components/block-edit/test/edit.native.js +0 -65
- package/src/components/block-heading-level-dropdown/index.native.js +0 -68
- package/src/components/block-icon/index.native.js +0 -47
- package/src/components/block-icon/style.native.scss +0 -7
- package/src/components/block-list/block-crash-boundary.native.js +0 -43
- package/src/components/block-list/block-crash-warning.native.js +0 -21
- package/src/components/block-list/block-invalid-warning.native.js +0 -70
- package/src/components/block-list/block-list-context.native.js +0 -172
- package/src/components/block-list/block-list-item-cell.native.js +0 -62
- package/src/components/block-list/block-list-item.native.js +0 -209
- package/src/components/block-list/block-list-item.native.scss +0 -16
- package/src/components/block-list/block-outline.native.js +0 -77
- package/src/components/block-list/block-selection-button.native.js +0 -100
- package/src/components/block-list/block-selection-button.native.scss +0 -34
- package/src/components/block-list/block.native.js +0 -716
- package/src/components/block-list/block.native.scss +0 -62
- package/src/components/block-list/grid-item.native.js +0 -58
- package/src/components/block-list/index.native.js +0 -437
- package/src/components/block-list/insertion-point.native.js +0 -36
- package/src/components/block-list/style.native.scss +0 -117
- package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
- package/src/components/block-list/test/block-list-context.native.js +0 -243
- package/src/components/block-list/test/block-outline.native.js +0 -255
- package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
- package/src/components/block-list/test/index.native.js +0 -205
- package/src/components/block-list/use-block-props/index.native.js +0 -10
- package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
- package/src/components/block-list-appender/index.native.js +0 -70
- package/src/components/block-list-appender/style.native.scss +0 -8
- package/src/components/block-media-update-progress/README.md +0 -100
- package/src/components/block-media-update-progress/index.native.js +0 -299
- package/src/components/block-media-update-progress/styles.native.scss +0 -9
- package/src/components/block-media-update-progress/test/index.native.js +0 -543
- package/src/components/block-mover/index.native.js +0 -193
- package/src/components/block-mover/mover-description.native.js +0 -155
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
- package/src/components/block-mover/test/index.native.js +0 -186
- package/src/components/block-settings/button.native.js +0 -41
- package/src/components/block-settings/container.native.js +0 -91
- package/src/components/block-settings/container.native.scss +0 -4
- package/src/components/block-settings/index.native.js +0 -5
- package/src/components/block-styles/index.native.js +0 -94
- package/src/components/block-styles/preview.native.js +0 -109
- package/src/components/block-styles/style.native.scss +0 -64
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
- package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
- package/src/components/block-toolbar/index.native.js +0 -126
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
- package/src/components/block-toolbar/test/index.native.js +0 -36
- package/src/components/block-types-list/index.native.js +0 -175
- package/src/components/block-types-list/style.native.scss +0 -25
- package/src/components/block-variation-picker/index.native.js +0 -107
- package/src/components/block-variation-picker/style.native.scss +0 -32
- package/src/components/button-block-appender/index.native.js +0 -92
- package/src/components/button-block-appender/styles.native.scss +0 -43
- package/src/components/caption/README.md +0 -44
- package/src/components/caption/index.native.js +0 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
- package/src/components/contrast-checker/index.native.js +0 -113
- package/src/components/contrast-checker/style.native.scss +0 -26
- package/src/components/convert-to-group-buttons/index.native.js +0 -79
- package/src/components/default-block-appender/index.native.js +0 -113
- package/src/components/default-block-appender/style.native.scss +0 -18
- package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
- package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
- package/src/components/floating-toolbar/index.native.js +0 -141
- package/src/components/floating-toolbar/styles.native.scss +0 -43
- package/src/components/font-sizes/index.native.js +0 -7
- package/src/components/global-styles/color-panel.native.js +0 -207
- package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
- package/src/components/global-styles/use-global-styles-context.native.js +0 -592
- package/src/components/gradients/index.native.js +0 -2
- package/src/components/image-link-destinations/index.native.js +0 -152
- package/src/components/image-link-destinations/style.native.scss +0 -16
- package/src/components/index.native.js +0 -108
- package/src/components/inner-blocks/constants.native.js +0 -5
- package/src/components/inner-blocks/index.native.js +0 -221
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
- package/src/components/inserter/block-types-tab.native.js +0 -76
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
- package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
- package/src/components/inserter/index.native.js +0 -424
- package/src/components/inserter/menu.native.js +0 -237
- package/src/components/inserter/no-results.native.js +0 -49
- package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
- package/src/components/inserter/search-results.native.js +0 -67
- package/src/components/inserter/style.native.scss +0 -83
- package/src/components/inserter/tabs.native.js +0 -152
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
- package/src/components/inserter/test/fixtures/index.native.js +0 -12
- package/src/components/inserter/test/index.native.js +0 -273
- package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
- package/src/components/inserter/test/utils.native.js +0 -37
- package/src/components/inserter/utils.native.js +0 -46
- package/src/components/inserter-button/index.native.js +0 -108
- package/src/components/inserter-button/style.native.scss +0 -72
- package/src/components/inspector-controls/fill.native.js +0 -62
- package/src/components/inspector-controls/slot.native.js +0 -35
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
- package/src/components/line-height-control/index.native.js +0 -28
- package/src/components/media-placeholder/index.native.js +0 -258
- package/src/components/media-placeholder/styles.native.scss +0 -108
- package/src/components/media-replace-flow/index.native.js +0 -12
- package/src/components/media-upload/constants.native.js +0 -14
- package/src/components/media-upload/index.native.js +0 -356
- package/src/components/media-upload/style.native.scss +0 -4
- package/src/components/media-upload/test/index.native.js +0 -172
- package/src/components/media-upload-progress/README.md +0 -100
- package/src/components/media-upload-progress/constants.js +0 -6
- package/src/components/media-upload-progress/index.native.js +0 -233
- package/src/components/media-upload-progress/styles.native.scss +0 -15
- package/src/components/media-upload-progress/test/index.native.js +0 -220
- package/src/components/plain-text/index.native.js +0 -164
- package/src/components/plain-text/style.native.scss +0 -10
- package/src/components/provider/index.native.js +0 -32
- package/src/components/rich-text/embed-handler-picker.native.js +0 -65
- package/src/components/rich-text/file-paste-handler.native.js +0 -3
- package/src/components/rich-text/format-toolbar/index.native.js +0 -21
- package/src/components/rich-text/format-toolbar-container.native.js +0 -16
- package/src/components/rich-text/index.native.js +0 -701
- package/src/components/rich-text/input-event.native.js +0 -10
- package/src/components/rich-text/native/format-edit.js +0 -44
- package/src/components/rich-text/native/get-format-colors.native.js +0 -47
- package/src/components/rich-text/native/index.js +0 -1
- package/src/components/rich-text/native/index.native.js +0 -1389
- package/src/components/rich-text/native/style.native.scss +0 -28
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
- package/src/components/rich-text/native/test/index.native.js +0 -345
- package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
- package/src/components/rich-text/native/use-format-types.js +0 -146
- package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
- package/src/components/rich-text/shortcut.native.js +0 -10
- package/src/components/ungroup-button/README.md +0 -23
- package/src/components/ungroup-button/index.native.js +0 -77
- package/src/components/unsupported-block-details/index.native.js +0 -187
- package/src/components/unsupported-block-details/style.native.scss +0 -56
- package/src/components/url-input/index.native.js +0 -33
- package/src/components/use-block-drop-zone/index.native.js +0 -207
- package/src/components/use-on-block-drop/index.native.js +0 -115
- package/src/components/use-unsupported-block-editor/index.native.js +0 -59
- package/src/components/video-player/gridicon-play.native.js +0 -13
- package/src/components/video-player/index.native.js +0 -133
- package/src/components/video-player/styles.native.scss +0 -29
- package/src/components/warning/index.native.js +0 -64
- package/src/components/warning/style.native.scss +0 -47
- package/src/hooks/align.native.js +0 -49
- package/src/hooks/custom-class-name.native.js +0 -70
- package/src/hooks/index.native.js +0 -36
- package/src/hooks/layout.native.js +0 -23
- package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
- package/src/hooks/test/align.native.js +0 -134
- package/src/hooks/test/anchor.native.js +0 -32
- package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
- package/src/hooks/typography.native.js +0 -60
- package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
- package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
- package/src/index.native.js +0 -6
- package/src/private-apis.native.js +0 -21
- package/src/store/defaults.native.js +0 -23
- package/src/utils/block-bindings.js +0 -46
- package/src/utils/color-values.js +0 -28
- package/src/utils/object.js +0 -67
- package/src/utils/sorting.js +0 -54
- /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
- /package/src/utils/{index.js → index.ts} +0 -0
|
@@ -4031,6 +4031,82 @@ describe( 'selectors', () => {
|
|
|
4031
4031
|
} )
|
|
4032
4032
|
);
|
|
4033
4033
|
} );
|
|
4034
|
+
|
|
4035
|
+
it( 'should use variation metadata for transformation items', () => {
|
|
4036
|
+
registerBlockType( 'core/variation-transform-source', {
|
|
4037
|
+
apiVersion: 3,
|
|
4038
|
+
category: 'text',
|
|
4039
|
+
title: 'Variation Transform Source',
|
|
4040
|
+
edit: () => {},
|
|
4041
|
+
save: () => {},
|
|
4042
|
+
transforms: {
|
|
4043
|
+
to: [
|
|
4044
|
+
{
|
|
4045
|
+
type: 'block',
|
|
4046
|
+
blocks: [ 'core/variation-transform-target' ],
|
|
4047
|
+
variationName: 'grid',
|
|
4048
|
+
transform: () => {},
|
|
4049
|
+
},
|
|
4050
|
+
],
|
|
4051
|
+
},
|
|
4052
|
+
} );
|
|
4053
|
+
registerBlockType( 'core/variation-transform-target', {
|
|
4054
|
+
apiVersion: 3,
|
|
4055
|
+
category: 'design',
|
|
4056
|
+
title: 'Group',
|
|
4057
|
+
icon: 'group',
|
|
4058
|
+
edit: () => {},
|
|
4059
|
+
save: () => {},
|
|
4060
|
+
variations: [
|
|
4061
|
+
{
|
|
4062
|
+
name: 'grid',
|
|
4063
|
+
title: 'Grid',
|
|
4064
|
+
icon: 'grid',
|
|
4065
|
+
attributes: { layout: { type: 'grid' } },
|
|
4066
|
+
scope: [ 'transform' ],
|
|
4067
|
+
},
|
|
4068
|
+
],
|
|
4069
|
+
} );
|
|
4070
|
+
|
|
4071
|
+
const state = {
|
|
4072
|
+
blocks: {
|
|
4073
|
+
byClientId: new Map(),
|
|
4074
|
+
attributes: new Map(),
|
|
4075
|
+
order: new Map(),
|
|
4076
|
+
parents: new Map(),
|
|
4077
|
+
cache: {},
|
|
4078
|
+
blockEditingModes: new Map(),
|
|
4079
|
+
},
|
|
4080
|
+
preferences: {
|
|
4081
|
+
insertUsage: {
|
|
4082
|
+
'core/variation-transform-target/grid': {
|
|
4083
|
+
count: 10,
|
|
4084
|
+
time: 1000,
|
|
4085
|
+
},
|
|
4086
|
+
},
|
|
4087
|
+
},
|
|
4088
|
+
blockListSettings: new Map(),
|
|
4089
|
+
settings: {},
|
|
4090
|
+
};
|
|
4091
|
+
const blocks = [ { name: 'core/variation-transform-source' } ];
|
|
4092
|
+
|
|
4093
|
+
try {
|
|
4094
|
+
const items = getBlockTransformItems( state, blocks );
|
|
4095
|
+
|
|
4096
|
+
expect( items ).toHaveLength( 1 );
|
|
4097
|
+
expect( items[ 0 ] ).toMatchObject( {
|
|
4098
|
+
id: 'core/variation-transform-target/grid',
|
|
4099
|
+
name: 'core/variation-transform-target',
|
|
4100
|
+
variationName: 'grid',
|
|
4101
|
+
title: 'Grid',
|
|
4102
|
+
icon: 'grid',
|
|
4103
|
+
frecency: 2.5,
|
|
4104
|
+
} );
|
|
4105
|
+
} finally {
|
|
4106
|
+
unregisterBlockType( 'core/variation-transform-source' );
|
|
4107
|
+
unregisterBlockType( 'core/variation-transform-target' );
|
|
4108
|
+
}
|
|
4109
|
+
} );
|
|
4034
4110
|
} );
|
|
4035
4111
|
|
|
4036
4112
|
describe( 'isValidTemplate', () => {
|
|
@@ -5005,6 +5081,7 @@ describe( '__unstableGetClientIdsTree', () => {
|
|
|
5005
5081
|
},
|
|
5006
5082
|
{ clientId: 'baz', innerBlocks: [] },
|
|
5007
5083
|
] );
|
|
5084
|
+
expect( console ).toHaveWarned();
|
|
5008
5085
|
} );
|
|
5009
5086
|
|
|
5010
5087
|
it( "should return the full content tree starting from the root, consisting of stripped down block object containing only its client ID and its inner blocks' client IDs", () => {
|
package/src/style.scss
CHANGED
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
@use "./hooks/block-bindings.scss" as *;
|
|
62
62
|
@use "./hooks/border.scss" as *;
|
|
63
63
|
@use "./hooks/color.scss" as *;
|
|
64
|
+
@use "./hooks/elements.scss" as *;
|
|
64
65
|
@use "./hooks/dimensions.scss" as *;
|
|
65
66
|
@use "./hooks/layout.scss" as *;
|
|
66
67
|
@use "./hooks/spacing.scss" as *;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
type Binding = { source?: string };
|
|
2
|
+
type Bindings = Record< string, Binding >;
|
|
3
|
+
|
|
4
|
+
const DEFAULT_ATTRIBUTE = '__default';
|
|
5
|
+
const PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the block has the `__default` binding for pattern overrides.
|
|
9
|
+
*
|
|
10
|
+
* @param bindings A block's bindings from the metadata attribute.
|
|
11
|
+
*
|
|
12
|
+
* @return Whether the block has the `__default` binding for pattern overrides.
|
|
13
|
+
*/
|
|
14
|
+
export function hasPatternOverridesDefaultBinding(
|
|
15
|
+
bindings: Bindings | undefined | null
|
|
16
|
+
): bindings is Bindings {
|
|
17
|
+
return bindings?.[ DEFAULT_ATTRIBUTE ]?.source === PATTERN_OVERRIDES_SOURCE;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns the bindings with the `__default` binding for pattern overrides
|
|
22
|
+
* replaced with the full-set of supported attributes. e.g.:
|
|
23
|
+
*
|
|
24
|
+
* - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`
|
|
25
|
+
* - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`
|
|
26
|
+
*
|
|
27
|
+
* @param bindings A block's bindings from the metadata attribute.
|
|
28
|
+
* @param supportedAttributes The block's attributes which are supported by block bindings.
|
|
29
|
+
*
|
|
30
|
+
* @return The bindings with default replaced for pattern overrides.
|
|
31
|
+
*/
|
|
32
|
+
export function replacePatternOverridesDefaultBinding(
|
|
33
|
+
bindings: Bindings | undefined | null,
|
|
34
|
+
supportedAttributes: string[]
|
|
35
|
+
) {
|
|
36
|
+
// The `__default` binding currently only works for pattern overrides.
|
|
37
|
+
if ( ! hasPatternOverridesDefaultBinding( bindings ) ) {
|
|
38
|
+
return bindings;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const bindingsWithDefaults: Bindings = {};
|
|
42
|
+
for ( const attributeName of supportedAttributes ) {
|
|
43
|
+
// If the block has mixed binding sources, retain any non pattern override bindings.
|
|
44
|
+
const bindingSource = bindings[ attributeName ]
|
|
45
|
+
? bindings[ attributeName ]
|
|
46
|
+
: { source: PATTERN_OVERRIDES_SOURCE };
|
|
47
|
+
bindingsWithDefaults[ attributeName ] = bindingSource;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return bindingsWithDefaults;
|
|
51
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the palette slug from a style value for any preset type, supporting
|
|
3
|
+
* both the user preset format and the theme CSS-variable format:
|
|
4
|
+
*
|
|
5
|
+
* - User format: `var:preset|<type>|slug`
|
|
6
|
+
* - Theme format: `var(--wp--preset--<type>--slug)`
|
|
7
|
+
*
|
|
8
|
+
* Returns `undefined` for plain values, non-strings, or any other
|
|
9
|
+
* unrecognised format.
|
|
10
|
+
*
|
|
11
|
+
* @param rawValue Raw style value stored in the style object.
|
|
12
|
+
* @param type Preset type, e.g. `'color'` or `'gradient'`.
|
|
13
|
+
* @return The palette slug, or undefined.
|
|
14
|
+
*/
|
|
15
|
+
export function extractPresetSlug(
|
|
16
|
+
rawValue: unknown,
|
|
17
|
+
type: 'color' | 'gradient'
|
|
18
|
+
) {
|
|
19
|
+
if ( typeof rawValue !== 'string' ) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const userPrefix = `var:preset|${ type }|`;
|
|
23
|
+
if ( rawValue.startsWith( userPrefix ) ) {
|
|
24
|
+
return rawValue.slice( userPrefix.length );
|
|
25
|
+
}
|
|
26
|
+
const cssVarPrefix = `--wp--preset--${ type }--`;
|
|
27
|
+
const themeFormatMatch = rawValue.match(
|
|
28
|
+
new RegExp( `^var\\(${ cssVarPrefix }([^)]+)\\)$` )
|
|
29
|
+
);
|
|
30
|
+
return themeFormatMatch?.[ 1 ];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Encodes a color value for storage in the style object.
|
|
35
|
+
*
|
|
36
|
+
* When a `slug` is provided it is used directly (the slug-based selection
|
|
37
|
+
* path). This is important because two palette entries can share the same
|
|
38
|
+
* hex value (e.g. two custom colors both set to `#e10000`); relying on a
|
|
39
|
+
* hex lookup alone would collapse them onto whichever entry appears first
|
|
40
|
+
* in the palette and silently discard the user's actual choice. Only when
|
|
41
|
+
* no slug is supplied does the function fall back to matching the hex value
|
|
42
|
+
* against the palette; if a match is found the slug is encoded, otherwise
|
|
43
|
+
* the raw value is stored as-is.
|
|
44
|
+
*
|
|
45
|
+
* Callers pass the flattened palette (`allColors`), typically computed once
|
|
46
|
+
* per render from the per-origin `colors` array.
|
|
47
|
+
*
|
|
48
|
+
* @param allColors Flat array of `{ color, slug }` objects.
|
|
49
|
+
* @param colorValue Hex or CSS color string.
|
|
50
|
+
* @param slug Optional palette slug from slug-aware selection.
|
|
51
|
+
* @return Encoded value suitable for the style object.
|
|
52
|
+
*/
|
|
53
|
+
export function encodeColorValueWithPalette(
|
|
54
|
+
allColors: { color: string; slug: string }[],
|
|
55
|
+
colorValue?: string,
|
|
56
|
+
slug?: string
|
|
57
|
+
) {
|
|
58
|
+
if ( slug ) {
|
|
59
|
+
return 'var:preset|color|' + slug;
|
|
60
|
+
}
|
|
61
|
+
const colorObject = allColors.find( ( { color } ) => color === colorValue );
|
|
62
|
+
return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue;
|
|
63
|
+
}
|
|
@@ -5,12 +5,12 @@ const BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns true if two elements are contained within the same block.
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
8
|
+
* @param a First element.
|
|
9
|
+
* @param b Second element.
|
|
10
10
|
*
|
|
11
|
-
* @return
|
|
11
|
+
* @return Whether elements are in the same block.
|
|
12
12
|
*/
|
|
13
|
-
export function isInSameBlock( a, b ) {
|
|
13
|
+
export function isInSameBlock( a: Element, b: Element ) {
|
|
14
14
|
return a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -18,13 +18,13 @@ export function isInSameBlock( a, b ) {
|
|
|
18
18
|
* Returns true if an element is considered part of the block and not its inner
|
|
19
19
|
* blocks or appender.
|
|
20
20
|
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
21
|
+
* @param blockElement Block container element.
|
|
22
|
+
* @param element Element.
|
|
23
23
|
*
|
|
24
|
-
* @return
|
|
25
|
-
*
|
|
24
|
+
* @return Whether an element is considered part of the block and not
|
|
25
|
+
* its inner blocks or appender.
|
|
26
26
|
*/
|
|
27
|
-
export function isInsideRootBlock( blockElement, element ) {
|
|
27
|
+
export function isInsideRootBlock( blockElement: Element, element: Element ) {
|
|
28
28
|
const parentBlock = element.closest(
|
|
29
29
|
[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )
|
|
30
30
|
);
|
|
@@ -34,12 +34,12 @@ export function isInsideRootBlock( blockElement, element ) {
|
|
|
34
34
|
/**
|
|
35
35
|
* Finds the block client ID given any DOM node inside the block.
|
|
36
36
|
*
|
|
37
|
-
* @param
|
|
37
|
+
* @param node DOM node.
|
|
38
38
|
*
|
|
39
|
-
* @return
|
|
40
|
-
*
|
|
39
|
+
* @return Client ID or undefined if the node is not part of
|
|
40
|
+
* a block.
|
|
41
41
|
*/
|
|
42
|
-
export function getBlockClientId( node ) {
|
|
42
|
+
export function getBlockClientId( node: Node | null ) {
|
|
43
43
|
while ( node && node.nodeType !== node.ELEMENT_NODE ) {
|
|
44
44
|
node = node.parentNode;
|
|
45
45
|
}
|
|
@@ -48,7 +48,7 @@ export function getBlockClientId( node ) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
const elementNode =
|
|
51
|
+
const elementNode = node as Element;
|
|
52
52
|
const blockNode = elementNode.closest( BLOCK_SELECTOR );
|
|
53
53
|
|
|
54
54
|
if ( ! blockNode ) {
|
|
@@ -61,11 +61,11 @@ export function getBlockClientId( node ) {
|
|
|
61
61
|
/**
|
|
62
62
|
* Calculates the union of two rectangles.
|
|
63
63
|
*
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @return
|
|
64
|
+
* @param rect1 First rectangle.
|
|
65
|
+
* @param rect2 Second rectangle.
|
|
66
|
+
* @return Union of the two rectangles.
|
|
67
67
|
*/
|
|
68
|
-
export function rectUnion( rect1, rect2 ) {
|
|
68
|
+
export function rectUnion( rect1: DOMRect, rect2: DOMRect ) {
|
|
69
69
|
const left = Math.min( rect1.left, rect2.left );
|
|
70
70
|
const right = Math.max( rect1.right, rect2.right );
|
|
71
71
|
const bottom = Math.max( rect1.bottom, rect2.bottom );
|
|
@@ -77,10 +77,10 @@ export function rectUnion( rect1, rect2 ) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Returns whether an element is visible.
|
|
79
79
|
*
|
|
80
|
-
* @param
|
|
81
|
-
* @return
|
|
80
|
+
* @param element Element.
|
|
81
|
+
* @return Whether the element is visible.
|
|
82
82
|
*/
|
|
83
|
-
export function isElementVisible( element ) {
|
|
83
|
+
export function isElementVisible( element: Element ) {
|
|
84
84
|
const viewport = element.ownerDocument.defaultView;
|
|
85
85
|
if ( ! viewport ) {
|
|
86
86
|
return false;
|
|
@@ -121,10 +121,10 @@ export function isElementVisible( element ) {
|
|
|
121
121
|
/**
|
|
122
122
|
* Checks if the element is scrollable.
|
|
123
123
|
*
|
|
124
|
-
* @param
|
|
125
|
-
* @return
|
|
124
|
+
* @param element Element.
|
|
125
|
+
* @return True if the element is scrollable.
|
|
126
126
|
*/
|
|
127
|
-
function isScrollable( element ) {
|
|
127
|
+
function isScrollable( element: Element ) {
|
|
128
128
|
const style = window.getComputedStyle( element );
|
|
129
129
|
return (
|
|
130
130
|
style.overflowX === 'auto' ||
|
|
@@ -145,10 +145,10 @@ export const WITH_OVERFLOW_ELEMENT_BLOCKS = [ 'core/navigation' ];
|
|
|
145
145
|
* The returned rect represents the full extent of the element and its visible
|
|
146
146
|
* children, which may extend beyond the viewport.
|
|
147
147
|
*
|
|
148
|
-
* @param
|
|
149
|
-
* @return
|
|
148
|
+
* @param element Element.
|
|
149
|
+
* @return Bounding client rect of the element and its visible children.
|
|
150
150
|
*/
|
|
151
|
-
export function getElementBounds( element ) {
|
|
151
|
+
export function getElementBounds( element: Element ) {
|
|
152
152
|
const viewport = element.ownerDocument.defaultView;
|
|
153
153
|
|
|
154
154
|
if ( ! viewport ) {
|
|
@@ -14,14 +14,21 @@ import { store, getElement, getContext } from '@wordpress/interactivity';
|
|
|
14
14
|
*/
|
|
15
15
|
import { optimizeFitText } from './fit-text-utils';
|
|
16
16
|
|
|
17
|
+
interface FitTextContext {
|
|
18
|
+
fontSize?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
// Initialize via Interactivity API for client-side navigation
|
|
18
22
|
store( 'core/fit-text', {
|
|
19
23
|
callbacks: {
|
|
20
24
|
init() {
|
|
21
|
-
const context = getContext();
|
|
22
|
-
const { ref } = getElement();
|
|
25
|
+
const context = getContext< FitTextContext >();
|
|
26
|
+
const { ref } = getElement() as { ref: HTMLElement | null };
|
|
23
27
|
|
|
24
|
-
const applyFontSize = ( fontSize ) => {
|
|
28
|
+
const applyFontSize = ( fontSize: number ) => {
|
|
29
|
+
if ( ! ref ) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
25
32
|
if ( fontSize === 0 ) {
|
|
26
33
|
ref.style.fontSize = '';
|
|
27
34
|
} else {
|
|
@@ -33,7 +40,7 @@ store( 'core/fit-text', {
|
|
|
33
40
|
context.fontSize = optimizeFitText( ref, applyFontSize );
|
|
34
41
|
|
|
35
42
|
// Starts ResizeObserver to handle dynamic resizing.
|
|
36
|
-
if ( window.ResizeObserver && ref
|
|
43
|
+
if ( window.ResizeObserver && ref?.parentElement ) {
|
|
37
44
|
const resizeObserver = new window.ResizeObserver( () => {
|
|
38
45
|
context.fontSize = optimizeFitText( ref, applyFontSize );
|
|
39
46
|
} );
|
|
@@ -47,6 +54,7 @@ store( 'core/fit-text', {
|
|
|
47
54
|
}
|
|
48
55
|
};
|
|
49
56
|
}
|
|
57
|
+
return undefined;
|
|
50
58
|
},
|
|
51
59
|
},
|
|
52
60
|
} );
|
|
@@ -3,14 +3,19 @@
|
|
|
3
3
|
* Uses callback-based approach for maximum code reuse between editor and frontend.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
type ApplyFontSize = ( size: number ) => void;
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Find optimal font size using simple binary search between 0-2400px.
|
|
8
10
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @return
|
|
11
|
+
* @param textElement The text element
|
|
12
|
+
* @param applyFontSize Function that receives font size in pixels
|
|
13
|
+
* @return Optimal font size
|
|
12
14
|
*/
|
|
13
|
-
function findOptimalFontSize(
|
|
15
|
+
function findOptimalFontSize(
|
|
16
|
+
textElement: HTMLElement,
|
|
17
|
+
applyFontSize: ApplyFontSize
|
|
18
|
+
) {
|
|
14
19
|
const alreadyHasScrollableHeight =
|
|
15
20
|
textElement.scrollHeight > textElement.clientHeight;
|
|
16
21
|
let minSize = 0;
|
|
@@ -85,10 +90,13 @@ function findOptimalFontSize( textElement, applyFontSize ) {
|
|
|
85
90
|
* Complete fit text optimization for a single text element.
|
|
86
91
|
* Handles the full flow using callbacks for font size application.
|
|
87
92
|
*
|
|
88
|
-
* @param
|
|
89
|
-
* @param
|
|
93
|
+
* @param textElement The text element (paragraph, heading, etc.)
|
|
94
|
+
* @param applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)
|
|
90
95
|
*/
|
|
91
|
-
export function optimizeFitText(
|
|
96
|
+
export function optimizeFitText(
|
|
97
|
+
textElement: HTMLElement | null,
|
|
98
|
+
applyFontSize: ApplyFontSize
|
|
99
|
+
) {
|
|
92
100
|
if ( ! textElement ) {
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { _x } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { FormattedFont } from './types';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Formats font styles to human readable names.
|
|
8
13
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @return
|
|
14
|
+
* @param fontStyle font style string
|
|
15
|
+
* @return new object with formatted font style
|
|
11
16
|
*/
|
|
12
|
-
export function formatFontStyle(
|
|
17
|
+
export function formatFontStyle(
|
|
18
|
+
fontStyle: FormattedFont | string | undefined
|
|
19
|
+
): FormattedFont {
|
|
13
20
|
if ( ! fontStyle ) {
|
|
14
21
|
return {};
|
|
15
22
|
}
|
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { _x } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { FormattedFont } from './types';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Formats font weights to human readable names.
|
|
8
13
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @return
|
|
14
|
+
* @param fontWeight font weight string
|
|
15
|
+
* @return new object with formatted font weight
|
|
11
16
|
*/
|
|
12
|
-
export function formatFontWeight(
|
|
17
|
+
export function formatFontWeight(
|
|
18
|
+
fontWeight: FormattedFont | string | undefined
|
|
19
|
+
): FormattedFont {
|
|
13
20
|
if ( ! fontWeight ) {
|
|
14
21
|
return {};
|
|
15
22
|
}
|
|
@@ -2,23 +2,27 @@
|
|
|
2
2
|
* Gets the editor region for a given editor canvas element or
|
|
3
3
|
* returns the passed element if no region is found
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @return
|
|
5
|
+
* @param editor The editor canvas element.
|
|
6
|
+
* @return The editor region or given editor element
|
|
7
7
|
*/
|
|
8
|
-
export default function getEditorRegion( editor ) {
|
|
8
|
+
export default function getEditorRegion( editor: Element | null | undefined ) {
|
|
9
9
|
if ( ! editor ) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// If there are multiple editors, we need to find the iframe that contains our contentRef to make sure
|
|
14
14
|
// we're focusing the region that contains this editor.
|
|
15
|
-
const editorCanvas =
|
|
15
|
+
const editorCanvas: Element =
|
|
16
16
|
Array.from(
|
|
17
|
-
document
|
|
17
|
+
document
|
|
18
|
+
.querySelectorAll< HTMLIFrameElement >(
|
|
19
|
+
'iframe[name="editor-canvas"]'
|
|
20
|
+
)
|
|
21
|
+
.values()
|
|
18
22
|
).find( ( iframe ) => {
|
|
19
23
|
// Find the iframe that contains our contentRef
|
|
20
24
|
const iframeDocument =
|
|
21
|
-
iframe.contentDocument || iframe.contentWindow
|
|
25
|
+
iframe.contentDocument || iframe.contentWindow!.document;
|
|
22
26
|
|
|
23
27
|
return iframeDocument === editor.ownerDocument;
|
|
24
28
|
} ) ?? editor;
|
|
@@ -8,6 +8,11 @@ import { _x, sprintf } from '@wordpress/i18n';
|
|
|
8
8
|
*/
|
|
9
9
|
import { formatFontStyle } from './format-font-style';
|
|
10
10
|
import { formatFontWeight } from './format-font-weight';
|
|
11
|
+
import type {
|
|
12
|
+
FontFamilyFace,
|
|
13
|
+
FormattedFont,
|
|
14
|
+
CombinedStyleAndWeightOption,
|
|
15
|
+
} from './types';
|
|
11
16
|
|
|
12
17
|
const FONT_STYLES = [
|
|
13
18
|
{
|
|
@@ -67,13 +72,15 @@ const FONT_WEIGHTS = [
|
|
|
67
72
|
* Builds a list of font style and weight options based on font family faces.
|
|
68
73
|
* Defaults to the standard font styles and weights if no font family faces are provided.
|
|
69
74
|
*
|
|
70
|
-
* @param
|
|
71
|
-
* @return
|
|
75
|
+
* @param fontFamilyFaces font family faces array
|
|
76
|
+
* @return new object with combined and separated font style and weight properties
|
|
72
77
|
*/
|
|
73
|
-
export function getFontStylesAndWeights(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
export function getFontStylesAndWeights(
|
|
79
|
+
fontFamilyFaces: FontFamilyFace[] | undefined
|
|
80
|
+
) {
|
|
81
|
+
let fontStyles: FormattedFont[] = [];
|
|
82
|
+
let fontWeights: FormattedFont[] = [];
|
|
83
|
+
const combinedStyleAndWeightOptions: CombinedStyleAndWeightOption[] = [];
|
|
77
84
|
const isSystemFont = ! fontFamilyFaces || fontFamilyFaces?.length === 0;
|
|
78
85
|
let isVariableFont = false;
|
|
79
86
|
|
|
@@ -86,13 +93,10 @@ export function getFontStylesAndWeights( fontFamilyFaces ) {
|
|
|
86
93
|
isVariableFont = true;
|
|
87
94
|
|
|
88
95
|
// Find font weight start and end values.
|
|
89
|
-
|
|
90
|
-
startValue = parseInt(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
} else {
|
|
94
|
-
endValue = parseInt( endValue.slice( 0, 1 ) );
|
|
95
|
-
}
|
|
96
|
+
const [ startStr, endStr ] = face.fontWeight.split( ' ' );
|
|
97
|
+
const startValue = parseInt( startStr.slice( 0, 1 ) );
|
|
98
|
+
const endValue =
|
|
99
|
+
endStr === '1000' ? 10 : parseInt( endStr.slice( 0, 1 ) );
|
|
96
100
|
|
|
97
101
|
// Create font weight options for available variable weights.
|
|
98
102
|
for ( let i = startValue; i <= endValue; i++ ) {
|
|
@@ -140,7 +144,7 @@ export function getFontStylesAndWeights( fontFamilyFaces ) {
|
|
|
140
144
|
} );
|
|
141
145
|
|
|
142
146
|
// If there is no font weight of 600 or above, then include faux bold as an option.
|
|
143
|
-
if ( ! fontWeights.some( ( weight ) => weight.value >= '600' ) ) {
|
|
147
|
+
if ( ! fontWeights.some( ( weight ) => ( weight.value ?? '' ) >= '600' ) ) {
|
|
144
148
|
fontWeights.push( {
|
|
145
149
|
name: _x( 'Bold', 'font weight' ),
|
|
146
150
|
value: '700',
|
|
@@ -174,13 +178,13 @@ export function getFontStylesAndWeights( fontFamilyFaces ) {
|
|
|
174
178
|
: sprintf(
|
|
175
179
|
/* translators: 1: Font weight name. 2: Font style name. */
|
|
176
180
|
_x( '%1$s %2$s', 'font' ),
|
|
177
|
-
weightName,
|
|
178
|
-
styleName
|
|
181
|
+
weightName ?? '',
|
|
182
|
+
styleName ?? ''
|
|
179
183
|
);
|
|
180
184
|
|
|
181
185
|
combinedStyleAndWeightOptions.push( {
|
|
182
186
|
key: `${ styleValue }-${ weightValue }`,
|
|
183
|
-
name: optionName,
|
|
187
|
+
name: optionName ?? '',
|
|
184
188
|
style: {
|
|
185
189
|
fontStyle: styleValue,
|
|
186
190
|
fontWeight: weightValue,
|