@wordpress/block-editor 13.1.0 → 13.3.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 +21 -17
- package/README.md +1 -2
- package/build/components/block-breadcrumb/index.js +12 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-lock/modal.js +67 -67
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +0 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +12 -6
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +5 -7
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +20 -17
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +4 -12
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +4 -1
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -58
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build/components/block-tools/index.js +14 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -2
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +57 -0
- package/build/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build/components/block-tools/zoom-out-toolbar.js +138 -0
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build/components/button-block-appender/index.js +3 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +193 -127
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +10 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/index.js +6 -4
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +26 -61
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +178 -116
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +8 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +50 -12
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +50 -0
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +25 -9
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +17 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +94 -0
- package/build/components/grid/grid-item-movers.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/grid-item-resizer.js +18 -56
- package/build/components/grid/grid-item-resizer.js.map +1 -0
- package/build/components/grid/grid-visualizer.js +305 -0
- package/build/components/grid/grid-visualizer.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/index.js +14 -0
- package/build/components/grid/index.js.map +1 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js +40 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build/components/grid/use-grid-layout-sync.js +169 -0
- package/build/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build/components/grid/utils.js +145 -0
- package/build/components/grid/utils.js.map +1 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/media-placeholder/index.js +19 -23
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/input-rules.js +1 -0
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/index.native.js +10 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +14 -0
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +66 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -0
- package/build/components/url-popover/index.js +3 -0
- package/build/components/url-popover/index.js.map +1 -1
- package/build/hooks/background.js +26 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +11 -17
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +195 -11
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +16 -11
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/grid-visualizer.js +65 -0
- package/build/hooks/grid-visualizer.js.map +1 -0
- package/build/hooks/index.js +15 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +65 -40
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +2 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +16 -6
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +5 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +44 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +92 -76
- package/build/layouts/grid.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +17 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +0 -3
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/utils/format-font-style.js +45 -0
- package/build/utils/format-font-style.js.map +1 -0
- package/build/utils/format-font-weight.js +68 -0
- package/build/utils/format-font-weight.js.map +1 -0
- package/build/utils/get-editor-region.js +34 -0
- package/build/utils/get-editor-region.js.map +1 -0
- package/build/utils/get-font-styles-and-weights.js +167 -0
- package/build/utils/get-font-styles-and-weights.js.map +1 -0
- package/build/utils/pasting.js +5 -13
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +12 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-lock/modal.js +67 -67
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +0 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +12 -6
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +5 -7
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +20 -17
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +5 -13
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +4 -1
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +10 -61
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +9 -2
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -2
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +48 -0
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js +131 -0
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -0
- package/build-module/components/button-block-appender/index.js +3 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +194 -128
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +11 -3
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +6 -4
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -63
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +181 -119
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +3 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +8 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +3 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +52 -14
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +48 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -9
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +15 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +87 -0
- package/build-module/components/grid/grid-item-movers.js.map +1 -0
- package/build-module/components/{grid-visualizer → grid}/grid-item-resizer.js +13 -51
- package/build-module/components/grid/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid/grid-visualizer.js +297 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -0
- package/build-module/components/grid/index.js +5 -0
- package/build-module/components/grid/index.js.map +1 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js +33 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build-module/components/grid/use-grid-layout-sync.js +162 -0
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build-module/components/grid/utils.js +131 -0
- package/build-module/components/grid/utils.js.map +1 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -19
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +19 -23
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -5
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +14 -0
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +60 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -0
- package/build-module/components/url-popover/index.js +3 -0
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/hooks/background.js +26 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +11 -17
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +193 -11
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -11
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +64 -0
- package/build-module/hooks/grid-visualizer.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +63 -38
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +2 -9
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +16 -6
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +5 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +92 -76
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +8 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +17 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +0 -3
- package/build-module/store/defaults.native.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/utils/format-font-style.js +39 -0
- package/build-module/utils/format-font-style.js.map +1 -0
- package/build-module/utils/format-font-weight.js +62 -0
- package/build-module/utils/format-font-weight.js.map +1 -0
- package/build-module/utils/get-editor-region.js +28 -0
- package/build-module/utils/get-editor-region.js.map +1 -0
- package/build-module/utils/get-font-styles-and-weights.js +160 -0
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -0
- package/build-module/utils/pasting.js +5 -13
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/style-rtl.css +238 -106
- package/build-style/style.css +238 -106
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +16 -1
- package/src/components/block-lock/modal.js +95 -82
- package/src/components/block-lock/style.scss +11 -1
- package/src/components/block-lock/toolbar.js +0 -1
- package/src/components/block-mover/button.js +1 -1
- package/src/components/block-mover/index.js +37 -24
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -2
- package/src/components/block-patterns-paging/index.js +8 -11
- package/src/components/block-patterns-paging/style.scss +18 -0
- package/src/components/block-quick-navigation/index.js +21 -28
- package/src/components/block-rename/modal.js +2 -8
- package/src/components/block-switcher/test/index.js +6 -6
- package/src/components/block-toolbar/shuffle.js +4 -1
- package/src/components/block-toolbar/style.scss +1 -11
- package/src/components/block-tools/block-selection-button.js +11 -83
- package/src/components/block-tools/block-toolbar-breadcrumb.js +9 -4
- package/src/components/block-tools/index.js +21 -1
- package/src/components/block-tools/style.scss +15 -0
- package/src/components/block-tools/use-show-block-tools.js +14 -6
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -4
- package/src/components/block-tools/zoom-out-popover.js +49 -0
- package/src/components/block-tools/zoom-out-toolbar.js +140 -0
- package/src/components/button-block-appender/index.js +2 -1
- package/src/components/child-layout-control/index.js +243 -160
- package/src/components/date-format-picker/index.js +10 -1
- package/src/components/date-format-picker/style.scss +0 -9
- package/src/components/dimensions-tool/index.js +97 -89
- package/src/components/font-appearance-control/index.js +29 -83
- package/src/components/font-appearance-control/style.scss +3 -5
- package/src/components/global-styles/background-panel.js +249 -170
- package/src/components/global-styles/border-panel.js +3 -2
- package/src/components/global-styles/color-panel.js +3 -2
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/filters-panel.js +3 -2
- package/src/components/global-styles/hooks.js +9 -0
- package/src/components/global-styles/image-settings-panel.js +3 -2
- package/src/components/global-styles/style.scss +105 -20
- package/src/components/global-styles/test/typography-utils.js +269 -0
- package/src/components/global-styles/test/use-global-styles-output.js +38 -3
- package/src/components/global-styles/typography-panel.js +49 -12
- package/src/components/global-styles/typography-utils.js +63 -0
- package/src/components/global-styles/use-global-styles-output.js +25 -9
- package/src/components/global-styles/utils.js +17 -6
- package/src/components/grid/grid-item-movers.js +112 -0
- package/src/components/{grid-visualizer → grid}/grid-item-resizer.js +15 -52
- package/src/components/grid/grid-visualizer.js +384 -0
- package/src/components/grid/index.js +4 -0
- package/src/components/grid/style.scss +98 -0
- package/src/components/grid/use-get-number-of-blocks-before-cell.js +30 -0
- package/src/components/grid/use-grid-layout-sync.js +170 -0
- package/src/components/grid/utils.js +178 -0
- package/src/components/iframe/content.scss +1 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +0 -1
- package/src/components/inner-blocks/index.js +4 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +1 -16
- package/src/components/inserter/menu.js +47 -13
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +1 -49
- package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/media-placeholder/index.js +22 -32
- package/src/components/navigable-toolbar/index.js +3 -1
- package/src/components/rich-text/event-listeners/input-rules.js +1 -1
- package/src/components/rich-text/index.native.js +10 -8
- package/src/components/rich-text/native/index.native.js +17 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +6 -1
- package/src/components/tabbed-sidebar/README.md +76 -0
- package/src/components/tabbed-sidebar/index.js +70 -0
- package/src/components/tabbed-sidebar/style.scss +53 -0
- package/src/components/url-popover/index.js +3 -0
- package/src/hooks/background.js +25 -10
- package/src/hooks/block-hooks.js +9 -16
- package/src/hooks/block-style-variation.js +226 -9
- package/src/hooks/duotone.js +16 -12
- package/src/hooks/grid-visualizer.js +64 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +75 -39
- package/src/hooks/position.js +3 -10
- package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
- package/src/hooks/use-bindings-attributes.js +18 -4
- package/src/hooks/utils.js +5 -1
- package/src/layouts/constrained.js +43 -2
- package/src/layouts/grid.js +175 -88
- package/src/lock-unlock.js +1 -1
- package/src/private-apis.js +12 -1
- package/src/store/actions.js +21 -1
- package/src/store/defaults.js +0 -2
- package/src/store/defaults.native.js +0 -3
- package/src/store/private-keys.js +1 -0
- package/src/style.scss +2 -2
- package/src/utils/format-font-style.js +40 -0
- package/src/utils/format-font-weight.js +63 -0
- package/src/utils/get-editor-region.js +31 -0
- package/src/utils/get-font-styles-and-weights.js +191 -0
- package/src/utils/pasting.js +5 -12
- package/src/utils/test/format-font-style.js +34 -0
- package/src/utils/test/format-font-weight.js +66 -0
- package/src/utils/test/get-font-styles-and-weights.js +513 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build/components/grid-visualizer/grid-visualizer.js +0 -92
- package/build/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build/components/grid-visualizer/index.js.map +0 -1
- package/build/components/grid-visualizer/utils.js +0 -10
- package/build/components/grid-visualizer/utils.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-visualizer.js +0 -84
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build-module/components/grid-visualizer/index.js +0 -3
- package/build-module/components/grid-visualizer/index.js.map +0 -1
- package/build-module/components/grid-visualizer/utils.js +0 -4
- package/build-module/components/grid-visualizer/utils.js.map +0 -1
- package/src/components/grid-visualizer/grid-visualizer.js +0 -101
- package/src/components/grid-visualizer/index.js +0 -2
- package/src/components/grid-visualizer/style.scss +0 -34
- package/src/components/grid-visualizer/utils.js +0 -5
- package/src/hooks/position.scss +0 -18
- /package/src/components/font-sizes/{README.MD → README.md} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the editor region for a given editor canvas element or
|
|
3
|
+
* returns the passed element if no region is found
|
|
4
|
+
*
|
|
5
|
+
* @param { Object } editor The editor canvas element.
|
|
6
|
+
* @return { Object } The editor region or given editor element
|
|
7
|
+
*/
|
|
8
|
+
export default function getEditorRegion( editor ) {
|
|
9
|
+
if ( ! editor ) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// If there are multiple editors, we need to find the iframe that contains our contentRef to make sure
|
|
14
|
+
// we're focusing the region that contains this editor.
|
|
15
|
+
const editorCanvas =
|
|
16
|
+
Array.from(
|
|
17
|
+
document.querySelectorAll( 'iframe[name="editor-canvas"]' ).values()
|
|
18
|
+
).find( ( iframe ) => {
|
|
19
|
+
// Find the iframe that contains our contentRef
|
|
20
|
+
const iframeDocument =
|
|
21
|
+
iframe.contentDocument || iframe.contentWindow.document;
|
|
22
|
+
|
|
23
|
+
return iframeDocument === editor.ownerDocument;
|
|
24
|
+
} ) ?? editor;
|
|
25
|
+
|
|
26
|
+
// The region is provivided by the editor, not the block-editor.
|
|
27
|
+
// We should send focus to the region if one is available to reuse the
|
|
28
|
+
// same interface for navigating landmarks. If no region is available,
|
|
29
|
+
// use the canvas instead.
|
|
30
|
+
return editorCanvas?.closest( '[role="region"]' ) ?? editorCanvas;
|
|
31
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { _x, __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { formatFontStyle } from './format-font-style';
|
|
10
|
+
import { formatFontWeight } from './format-font-weight';
|
|
11
|
+
|
|
12
|
+
const FONT_STYLES = [
|
|
13
|
+
{
|
|
14
|
+
name: _x( 'Regular', 'font style' ),
|
|
15
|
+
value: 'normal',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: _x( 'Italic', 'font style' ),
|
|
19
|
+
value: 'italic',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const FONT_WEIGHTS = [
|
|
24
|
+
{
|
|
25
|
+
name: _x( 'Thin', 'font weight' ),
|
|
26
|
+
value: '100',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: _x( 'Extra Light', 'font weight' ),
|
|
30
|
+
value: '200',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: _x( 'Light', 'font weight' ),
|
|
34
|
+
value: '300',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: _x( 'Regular', 'font weight' ),
|
|
38
|
+
value: '400',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: _x( 'Medium', 'font weight' ),
|
|
42
|
+
value: '500',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: _x( 'Semi Bold', 'font weight' ),
|
|
46
|
+
value: '600',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: _x( 'Bold', 'font weight' ),
|
|
50
|
+
value: '700',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: _x( 'Extra Bold', 'font weight' ),
|
|
54
|
+
value: '800',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: _x( 'Black', 'font weight' ),
|
|
58
|
+
value: '900',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: _x( 'Extra Black', 'font weight' ),
|
|
62
|
+
value: '1000',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Builds a list of font style and weight options based on font family faces.
|
|
68
|
+
* Defaults to the standard font styles and weights if no font family faces are provided.
|
|
69
|
+
*
|
|
70
|
+
* @param {Array} fontFamilyFaces font family faces array
|
|
71
|
+
* @return {Object} new object with combined and separated font style and weight properties
|
|
72
|
+
*/
|
|
73
|
+
export function getFontStylesAndWeights( fontFamilyFaces ) {
|
|
74
|
+
let fontStyles = [];
|
|
75
|
+
let fontWeights = [];
|
|
76
|
+
const combinedStyleAndWeightOptions = [];
|
|
77
|
+
const isSystemFont = ! fontFamilyFaces || fontFamilyFaces?.length === 0;
|
|
78
|
+
let isVariableFont = false;
|
|
79
|
+
|
|
80
|
+
fontFamilyFaces?.forEach( ( face ) => {
|
|
81
|
+
// Check for variable font by looking for a space in the font weight value. e.g. "100 900"
|
|
82
|
+
if ( /\s/.test( face.fontWeight.trim() ) ) {
|
|
83
|
+
isVariableFont = true;
|
|
84
|
+
|
|
85
|
+
// Find font weight start and end values.
|
|
86
|
+
let [ startValue, endValue ] = face.fontWeight.split( ' ' );
|
|
87
|
+
startValue = parseInt( startValue.slice( 0, 1 ) );
|
|
88
|
+
if ( endValue === '1000' ) {
|
|
89
|
+
endValue = 10;
|
|
90
|
+
} else {
|
|
91
|
+
endValue = parseInt( endValue.slice( 0, 1 ) );
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Create font weight options for available variable weights.
|
|
95
|
+
for ( let i = startValue; i <= endValue; i++ ) {
|
|
96
|
+
const fontWeightValue = `${ i.toString() }00`;
|
|
97
|
+
if (
|
|
98
|
+
! fontWeights.some(
|
|
99
|
+
( weight ) => weight.value === fontWeightValue
|
|
100
|
+
)
|
|
101
|
+
) {
|
|
102
|
+
fontWeights.push( formatFontWeight( fontWeightValue ) );
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Format font style and weight values.
|
|
108
|
+
const fontWeight = formatFontWeight( face.fontWeight );
|
|
109
|
+
const fontStyle = formatFontStyle( face.fontStyle );
|
|
110
|
+
|
|
111
|
+
// Create font style and font weight lists without duplicates.
|
|
112
|
+
if ( fontStyle ) {
|
|
113
|
+
if (
|
|
114
|
+
! fontStyles.some(
|
|
115
|
+
( style ) => style.value === fontStyle.value
|
|
116
|
+
)
|
|
117
|
+
) {
|
|
118
|
+
fontStyles.push( fontStyle );
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if ( fontWeight ) {
|
|
122
|
+
if (
|
|
123
|
+
! fontWeights.some(
|
|
124
|
+
( weight ) => weight.value === fontWeight.value
|
|
125
|
+
)
|
|
126
|
+
) {
|
|
127
|
+
if ( ! isVariableFont ) {
|
|
128
|
+
fontWeights.push( fontWeight );
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
// If there is no font weight of 600 or above, then include faux bold as an option.
|
|
135
|
+
if ( ! fontWeights.some( ( weight ) => weight.value >= '600' ) ) {
|
|
136
|
+
fontWeights.push( {
|
|
137
|
+
name: _x( 'Bold', 'font weight' ),
|
|
138
|
+
value: '700',
|
|
139
|
+
} );
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// If there is no italic font style, then include faux italic as an option.
|
|
143
|
+
if ( ! fontStyles.some( ( style ) => style.value === 'italic' ) ) {
|
|
144
|
+
fontStyles.push( {
|
|
145
|
+
name: _x( 'Italic', 'font style' ),
|
|
146
|
+
value: 'italic',
|
|
147
|
+
} );
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Use default font styles and weights for system fonts.
|
|
151
|
+
if ( isSystemFont ) {
|
|
152
|
+
fontStyles = FONT_STYLES;
|
|
153
|
+
fontWeights = FONT_WEIGHTS;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Use default styles and weights if there are no available styles or weights from the provided font faces.
|
|
157
|
+
fontStyles = fontStyles.length === 0 ? FONT_STYLES : fontStyles;
|
|
158
|
+
fontWeights = fontWeights.length === 0 ? FONT_WEIGHTS : fontWeights;
|
|
159
|
+
|
|
160
|
+
// Generate combined font style and weight options for available fonts.
|
|
161
|
+
fontStyles.forEach( ( { name: styleName, value: styleValue } ) => {
|
|
162
|
+
fontWeights.forEach( ( { name: weightName, value: weightValue } ) => {
|
|
163
|
+
const optionName =
|
|
164
|
+
styleValue === 'normal'
|
|
165
|
+
? weightName
|
|
166
|
+
: sprintf(
|
|
167
|
+
/* translators: 1: Font weight name. 2: Font style name. */
|
|
168
|
+
__( '%1$s %2$s' ),
|
|
169
|
+
weightName,
|
|
170
|
+
styleName
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
combinedStyleAndWeightOptions.push( {
|
|
174
|
+
key: `${ styleValue }-${ weightValue }`,
|
|
175
|
+
name: optionName,
|
|
176
|
+
style: {
|
|
177
|
+
fontStyle: styleValue,
|
|
178
|
+
fontWeight: weightValue,
|
|
179
|
+
},
|
|
180
|
+
} );
|
|
181
|
+
} );
|
|
182
|
+
} );
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
fontStyles,
|
|
186
|
+
fontWeights,
|
|
187
|
+
combinedStyleAndWeightOptions,
|
|
188
|
+
isSystemFont,
|
|
189
|
+
isVariableFont,
|
|
190
|
+
};
|
|
191
|
+
}
|
package/src/utils/pasting.js
CHANGED
|
@@ -52,21 +52,14 @@ export function getPasteEventData( { clipboardData } ) {
|
|
|
52
52
|
let plainText = '';
|
|
53
53
|
let html = '';
|
|
54
54
|
|
|
55
|
-
// IE11 only supports `Text` as an argument for `getData` and will
|
|
56
|
-
// otherwise throw an invalid argument error, so we try the standard
|
|
57
|
-
// arguments first, then fallback to `Text` if they fail.
|
|
58
55
|
try {
|
|
59
56
|
plainText = clipboardData.getData( 'text/plain' );
|
|
60
57
|
html = clipboardData.getData( 'text/html' );
|
|
61
|
-
} catch (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// don't support clipboardData at all, so allow default
|
|
67
|
-
// behaviour.
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
58
|
+
} catch ( error ) {
|
|
59
|
+
// Some browsers like UC Browser paste plain text by default and
|
|
60
|
+
// don't support clipboardData at all, so allow default
|
|
61
|
+
// behaviour.
|
|
62
|
+
return;
|
|
70
63
|
}
|
|
71
64
|
|
|
72
65
|
// Remove Windows-specific metadata appended within copied HTML text.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { formatFontStyle } from '../format-font-style';
|
|
5
|
+
|
|
6
|
+
describe( 'formatFontStyle', () => {
|
|
7
|
+
it( 'should return empty object if style is not available', () => {
|
|
8
|
+
expect( formatFontStyle() ).toEqual( {} );
|
|
9
|
+
} );
|
|
10
|
+
|
|
11
|
+
it( 'should return the same object if style is already an object', () => {
|
|
12
|
+
const fontStyle = { name: 'Italic', value: 'italic' };
|
|
13
|
+
expect( formatFontStyle( fontStyle ) ).toEqual( fontStyle );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'should return the formatted font style', () => {
|
|
17
|
+
expect( formatFontStyle( 'normal' ) ).toEqual( {
|
|
18
|
+
name: 'Regular',
|
|
19
|
+
value: 'normal',
|
|
20
|
+
} );
|
|
21
|
+
expect( formatFontStyle( 'italic' ) ).toEqual( {
|
|
22
|
+
name: 'Italic',
|
|
23
|
+
value: 'italic',
|
|
24
|
+
} );
|
|
25
|
+
expect( formatFontStyle( 'oblique' ) ).toEqual( {
|
|
26
|
+
name: 'Oblique',
|
|
27
|
+
value: 'oblique',
|
|
28
|
+
} );
|
|
29
|
+
expect( formatFontStyle( 'oblique 40deg' ) ).toEqual( {
|
|
30
|
+
name: 'oblique 40deg',
|
|
31
|
+
value: 'oblique 40deg',
|
|
32
|
+
} );
|
|
33
|
+
} );
|
|
34
|
+
} );
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { formatFontWeight } from '../format-font-weight';
|
|
5
|
+
|
|
6
|
+
describe( 'formatFontWeight', () => {
|
|
7
|
+
it( 'should return empty object if weight is not available', () => {
|
|
8
|
+
expect( formatFontWeight() ).toEqual( {} );
|
|
9
|
+
} );
|
|
10
|
+
|
|
11
|
+
it( 'should return the same object if weight is already an object', () => {
|
|
12
|
+
const fontWeight = { name: 'Thin', value: '100' };
|
|
13
|
+
expect( formatFontWeight( fontWeight ) ).toEqual( fontWeight );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'should return the formatted font weight', () => {
|
|
17
|
+
expect( formatFontWeight( '100' ) ).toEqual( {
|
|
18
|
+
name: 'Thin',
|
|
19
|
+
value: '100',
|
|
20
|
+
} );
|
|
21
|
+
expect( formatFontWeight( '200' ) ).toEqual( {
|
|
22
|
+
name: 'Extra Light',
|
|
23
|
+
value: '200',
|
|
24
|
+
} );
|
|
25
|
+
expect( formatFontWeight( '300' ) ).toEqual( {
|
|
26
|
+
name: 'Light',
|
|
27
|
+
value: '300',
|
|
28
|
+
} );
|
|
29
|
+
expect( formatFontWeight( '400' ) ).toEqual( {
|
|
30
|
+
name: 'Regular',
|
|
31
|
+
value: '400',
|
|
32
|
+
} );
|
|
33
|
+
expect( formatFontWeight( '500' ) ).toEqual( {
|
|
34
|
+
name: 'Medium',
|
|
35
|
+
value: '500',
|
|
36
|
+
} );
|
|
37
|
+
expect( formatFontWeight( '600' ) ).toEqual( {
|
|
38
|
+
name: 'Semi Bold',
|
|
39
|
+
value: '600',
|
|
40
|
+
} );
|
|
41
|
+
expect( formatFontWeight( '700' ) ).toEqual( {
|
|
42
|
+
name: 'Bold',
|
|
43
|
+
value: '700',
|
|
44
|
+
} );
|
|
45
|
+
expect( formatFontWeight( '800' ) ).toEqual( {
|
|
46
|
+
name: 'Extra Bold',
|
|
47
|
+
value: '800',
|
|
48
|
+
} );
|
|
49
|
+
expect( formatFontWeight( '900' ) ).toEqual( {
|
|
50
|
+
name: 'Black',
|
|
51
|
+
value: '900',
|
|
52
|
+
} );
|
|
53
|
+
expect( formatFontWeight( '1000' ) ).toEqual( {
|
|
54
|
+
name: 'Extra Black',
|
|
55
|
+
value: '1000',
|
|
56
|
+
} );
|
|
57
|
+
expect( formatFontWeight( 'normal' ) ).toEqual( {
|
|
58
|
+
name: 'Regular',
|
|
59
|
+
value: 'normal',
|
|
60
|
+
} );
|
|
61
|
+
expect( formatFontWeight( 'bold' ) ).toEqual( {
|
|
62
|
+
name: 'Bold',
|
|
63
|
+
value: 'bold',
|
|
64
|
+
} );
|
|
65
|
+
} );
|
|
66
|
+
} );
|