@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,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = ZoomOutPopover;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
|
+
var _blockPopover = _interopRequireDefault(require("../block-popover"));
|
|
10
|
+
var _useBlockToolbarPopoverProps = _interopRequireDefault(require("./use-block-toolbar-popover-props"));
|
|
11
|
+
var _useSelectedBlockToolProps = _interopRequireDefault(require("./use-selected-block-tool-props"));
|
|
12
|
+
var _zoomOutToolbar = _interopRequireDefault(require("./zoom-out-toolbar"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
function ZoomOutPopover({
|
|
23
|
+
clientId,
|
|
24
|
+
__unstableContentRef
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
capturingClientId,
|
|
28
|
+
isInsertionPointVisible,
|
|
29
|
+
lastClientId,
|
|
30
|
+
rootClientId
|
|
31
|
+
} = (0, _useSelectedBlockToolProps.default)(clientId);
|
|
32
|
+
const popoverProps = (0, _useBlockToolbarPopoverProps.default)({
|
|
33
|
+
contentElement: __unstableContentRef?.current,
|
|
34
|
+
clientId
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Override some of the popover props for the zoom-out toolbar.
|
|
38
|
+
const props = {
|
|
39
|
+
...popoverProps,
|
|
40
|
+
placement: 'left-start',
|
|
41
|
+
flip: false
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockPopover.default, {
|
|
44
|
+
clientId: capturingClientId || clientId,
|
|
45
|
+
bottomClientId: lastClientId,
|
|
46
|
+
className: (0, _clsx.default)('zoom-out-toolbar-popover', {
|
|
47
|
+
'is-insertion-point-visible': isInsertionPointVisible
|
|
48
|
+
}),
|
|
49
|
+
resize: false,
|
|
50
|
+
...props,
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_zoomOutToolbar.default, {
|
|
52
|
+
clientId: clientId,
|
|
53
|
+
rootClientId: rootClientId
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=zoom-out-popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockPopover","_useBlockToolbarPopoverProps","_useSelectedBlockToolProps","_zoomOutToolbar","_jsxRuntime","ZoomOutPopover","clientId","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","rootClientId","useSelectedBlockToolProps","popoverProps","useBlockToolbarPopoverProps","contentElement","current","props","placement","flip","jsx","default","bottomClientId","className","clsx","resize","children"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport ZoomOutToolbar from './zoom-out-toolbar';\n\nexport default function ZoomOutPopover( { clientId, __unstableContentRef } ) {\n\tconst {\n\t\tcapturingClientId,\n\t\tisInsertionPointVisible,\n\t\tlastClientId,\n\t\trootClientId,\n\t} = useSelectedBlockToolProps( clientId );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\t// Override some of the popover props for the zoom-out toolbar.\n\tconst props = {\n\t\t...popoverProps,\n\t\tplacement: 'left-start',\n\t\tflip: false,\n\t};\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ capturingClientId || clientId }\n\t\t\tbottomClientId={ lastClientId }\n\t\t\tclassName={ clsx( 'zoom-out-toolbar-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\tresize={ false }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ZoomOutToolbar\n\t\t\t\tclientId={ clientId }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t</BlockPopover>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,4BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAVhD;AACA;AACA;;AAEA;AACA;AACA;;AAMe,SAASM,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,EAAG;EAC5E,MAAM;IACLC,iBAAiB;IACjBC,uBAAuB;IACvBC,YAAY;IACZC;EACD,CAAC,GAAG,IAAAC,kCAAyB,EAAEN,QAAS,CAAC;EAEzC,MAAMO,YAAY,GAAG,IAAAC,oCAA2B,EAAE;IACjDC,cAAc,EAAER,oBAAoB,EAAES,OAAO;IAC7CV;EACD,CAAE,CAAC;;EAEH;EACA,MAAMW,KAAK,GAAG;IACb,GAAGJ,YAAY;IACfK,SAAS,EAAE,YAAY;IACvBC,IAAI,EAAE;EACP,CAAC;EAED,oBACC,IAAAf,WAAA,CAAAgB,GAAA,EAACpB,aAAA,CAAAqB,OAAY;IACZf,QAAQ,EAAGE,iBAAiB,IAAIF,QAAU;IAC1CgB,cAAc,EAAGZ,YAAc;IAC/Ba,SAAS,EAAG,IAAAC,aAAI,EAAE,0BAA0B,EAAE;MAC7C,4BAA4B,EAAEf;IAC/B,CAAE,CAAG;IACLgB,MAAM,EAAG,KAAO;IAAA,GACXR,KAAK;IAAAS,QAAA,eAEV,IAAAtB,WAAA,CAAAgB,GAAA,EAACjB,eAAA,CAAAkB,OAAc;MACdf,QAAQ,EAAGA,QAAU;MACrBK,YAAY,EAAGA;IAAc,CAC7B;EAAC,CACW,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = ZoomOutToolbar;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
|
+
var _icons = require("@wordpress/icons");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _data = require("@wordpress/data");
|
|
12
|
+
var _blocks = require("@wordpress/blocks");
|
|
13
|
+
var _i18n = require("@wordpress/i18n");
|
|
14
|
+
var _store = require("../../store");
|
|
15
|
+
var _blockDraggable = _interopRequireDefault(require("../block-draggable"));
|
|
16
|
+
var _blockMover = _interopRequireDefault(require("../block-mover"));
|
|
17
|
+
var _shuffle = _interopRequireDefault(require("../block-toolbar/shuffle"));
|
|
18
|
+
var _navigableToolbar = _interopRequireDefault(require("../navigable-toolbar"));
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
function ZoomOutToolbar({
|
|
33
|
+
clientId,
|
|
34
|
+
rootClientId
|
|
35
|
+
}) {
|
|
36
|
+
const selected = (0, _data.useSelect)(select => {
|
|
37
|
+
const {
|
|
38
|
+
getBlock,
|
|
39
|
+
hasBlockMovingClientId,
|
|
40
|
+
getNextBlockClientId,
|
|
41
|
+
getPreviousBlockClientId,
|
|
42
|
+
canRemoveBlock,
|
|
43
|
+
canMoveBlock
|
|
44
|
+
} = select(_store.store);
|
|
45
|
+
const {
|
|
46
|
+
getBlockType
|
|
47
|
+
} = select(_blocks.store);
|
|
48
|
+
const {
|
|
49
|
+
name
|
|
50
|
+
} = getBlock(clientId);
|
|
51
|
+
const blockType = getBlockType(name);
|
|
52
|
+
const isBlockTemplatePart = blockType?.name === 'core/template-part';
|
|
53
|
+
let isNextBlockTemplatePart = false;
|
|
54
|
+
const nextClientId = getNextBlockClientId();
|
|
55
|
+
if (nextClientId) {
|
|
56
|
+
const {
|
|
57
|
+
name: nextName
|
|
58
|
+
} = getBlock(nextClientId);
|
|
59
|
+
const nextBlockType = getBlockType(nextName);
|
|
60
|
+
isNextBlockTemplatePart = nextBlockType?.name === 'core/template-part';
|
|
61
|
+
}
|
|
62
|
+
let isPrevBlockTemplatePart = false;
|
|
63
|
+
const prevClientId = getPreviousBlockClientId();
|
|
64
|
+
if (prevClientId) {
|
|
65
|
+
const {
|
|
66
|
+
name: prevName
|
|
67
|
+
} = getBlock(prevClientId);
|
|
68
|
+
const prevBlockType = getBlockType(prevName);
|
|
69
|
+
isPrevBlockTemplatePart = prevBlockType?.name === 'core/template-part';
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
blockMovingMode: hasBlockMovingClientId(),
|
|
73
|
+
isBlockTemplatePart,
|
|
74
|
+
isNextBlockTemplatePart,
|
|
75
|
+
isPrevBlockTemplatePart,
|
|
76
|
+
canRemove: canRemoveBlock(clientId, rootClientId),
|
|
77
|
+
canMove: canMoveBlock(clientId, rootClientId)
|
|
78
|
+
};
|
|
79
|
+
}, [clientId, rootClientId]);
|
|
80
|
+
const {
|
|
81
|
+
blockMovingMode,
|
|
82
|
+
isBlockTemplatePart,
|
|
83
|
+
isNextBlockTemplatePart,
|
|
84
|
+
isPrevBlockTemplatePart,
|
|
85
|
+
canRemove,
|
|
86
|
+
canMove
|
|
87
|
+
} = selected;
|
|
88
|
+
const {
|
|
89
|
+
removeBlock
|
|
90
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
91
|
+
const classNames = (0, _clsx.default)('zoom-out-toolbar', {
|
|
92
|
+
'is-block-moving-mode': !!blockMovingMode
|
|
93
|
+
});
|
|
94
|
+
const showBlockDraggable = canMove && !isBlockTemplatePart;
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_navigableToolbar.default, {
|
|
96
|
+
className: classNames
|
|
97
|
+
/* translators: accessibility text for the block toolbar */,
|
|
98
|
+
"aria-label": (0, _i18n.__)('Block tools')
|
|
99
|
+
// The variant is applied as "toolbar" when undefined, which is the black border style of the dropdown from the toolbar popover.
|
|
100
|
+
,
|
|
101
|
+
variant: "unstyled",
|
|
102
|
+
orientation: "vertical",
|
|
103
|
+
children: [showBlockDraggable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockDraggable.default, {
|
|
104
|
+
clientIds: [clientId],
|
|
105
|
+
children: draggableProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
106
|
+
icon: _icons.dragHandle,
|
|
107
|
+
className: "block-selection-button_drag-handle zoom-out-toolbar-button",
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
label: (0, _i18n.__)('Drag'),
|
|
110
|
+
iconSize: 24,
|
|
111
|
+
size: "compact"
|
|
112
|
+
// Should not be able to tab to drag handle as this
|
|
113
|
+
// button can only be used with a pointer device.
|
|
114
|
+
,
|
|
115
|
+
tabIndex: "-1",
|
|
116
|
+
...draggableProps
|
|
117
|
+
})
|
|
118
|
+
}), !isBlockTemplatePart && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockMover.default, {
|
|
119
|
+
clientIds: [clientId],
|
|
120
|
+
hideDragHandle: true,
|
|
121
|
+
isBlockMoverUpButtonDisabled: isPrevBlockTemplatePart,
|
|
122
|
+
isBlockMoverDownButtonDisabled: isNextBlockTemplatePart,
|
|
123
|
+
iconSize: 24,
|
|
124
|
+
size: "compact"
|
|
125
|
+
}), canMove && canRemove && /*#__PURE__*/(0, _jsxRuntime.jsx)(_shuffle.default, {
|
|
126
|
+
clientId: clientId,
|
|
127
|
+
as: _components.ToolbarButton
|
|
128
|
+
}), canRemove && !isBlockTemplatePart && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
129
|
+
className: "zoom-out-toolbar-button",
|
|
130
|
+
icon: _icons.trash,
|
|
131
|
+
label: "Delete",
|
|
132
|
+
onClick: () => {
|
|
133
|
+
removeBlock(clientId);
|
|
134
|
+
}
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=zoom-out-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_components","_data","_blocks","_i18n","_store","_blockDraggable","_blockMover","_shuffle","_navigableToolbar","_jsxRuntime","ZoomOutToolbar","clientId","rootClientId","selected","useSelect","select","getBlock","hasBlockMovingClientId","getNextBlockClientId","getPreviousBlockClientId","canRemoveBlock","canMoveBlock","blockEditorStore","getBlockType","blocksStore","name","blockType","isBlockTemplatePart","isNextBlockTemplatePart","nextClientId","nextName","nextBlockType","isPrevBlockTemplatePart","prevClientId","prevName","prevBlockType","blockMovingMode","canRemove","canMove","removeBlock","useDispatch","classNames","clsx","showBlockDraggable","jsxs","default","className","__","variant","orientation","children","jsx","clientIds","draggableProps","Button","icon","dragHandle","label","iconSize","size","tabIndex","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","as","ToolbarButton","trash","onClick"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { dragHandle, trash } from '@wordpress/icons';\nimport { Button, ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport BlockMover from '../block-mover';\nimport Shuffle from '../block-toolbar/shuffle';\nimport NavigableToolbar from '../navigable-toolbar';\n\nexport default function ZoomOutToolbar( { clientId, rootClientId } ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\tconst { name } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst isBlockTemplatePart =\n\t\t\t\tblockType?.name === 'core/template-part';\n\n\t\t\tlet isNextBlockTemplatePart = false;\n\t\t\tconst nextClientId = getNextBlockClientId();\n\t\t\tif ( nextClientId ) {\n\t\t\t\tconst { name: nextName } = getBlock( nextClientId );\n\t\t\t\tconst nextBlockType = getBlockType( nextName );\n\t\t\t\tisNextBlockTemplatePart =\n\t\t\t\t\tnextBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\tlet isPrevBlockTemplatePart = false;\n\t\t\tconst prevClientId = getPreviousBlockClientId();\n\t\t\tif ( prevClientId ) {\n\t\t\t\tconst { name: prevName } = getBlock( prevClientId );\n\t\t\t\tconst prevBlockType = getBlockType( prevName );\n\t\t\t\tisPrevBlockTemplatePart =\n\t\t\t\t\tprevBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockMovingMode: hasBlockMovingClientId(),\n\t\t\t\tisBlockTemplatePart,\n\t\t\t\tisNextBlockTemplatePart,\n\t\t\t\tisPrevBlockTemplatePart,\n\t\t\t\tcanRemove: canRemoveBlock( clientId, rootClientId ),\n\t\t\t\tcanMove: canMoveBlock( clientId, rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId, rootClientId ]\n\t);\n\n\tconst {\n\t\tblockMovingMode,\n\t\tisBlockTemplatePart,\n\t\tisNextBlockTemplatePart,\n\t\tisPrevBlockTemplatePart,\n\t\tcanRemove,\n\t\tcanMove,\n\t} = selected;\n\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\n\tconst classNames = clsx( 'zoom-out-toolbar', {\n\t\t'is-block-moving-mode': !! blockMovingMode,\n\t} );\n\n\tconst showBlockDraggable = canMove && ! isBlockTemplatePart;\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName={ classNames }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant=\"unstyled\"\n\t\t\torientation=\"vertical\"\n\t\t>\n\t\t\t{ showBlockDraggable && (\n\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle zoom-out-toolbar-button\"\n\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\tlabel={ __( 'Drag' ) }\n\t\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t{ ! isBlockTemplatePart && (\n\t\t\t\t<BlockMover\n\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\thideDragHandle\n\t\t\t\t\tisBlockMoverUpButtonDisabled={ isPrevBlockTemplatePart }\n\t\t\t\t\tisBlockMoverDownButtonDisabled={ isNextBlockTemplatePart }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canMove && canRemove && (\n\t\t\t\t<Shuffle clientId={ clientId } as={ ToolbarButton } />\n\t\t\t) }\n\t\t\t{ canRemove && ! isBlockTemplatePart && (\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"zoom-out-toolbar-button\"\n\t\t\t\t\ticon={ trash }\n\t\t\t\t\tlabel=\"Delete\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -29,12 +29,14 @@ function ButtonBlockAppender({
|
|
|
29
29
|
rootClientId,
|
|
30
30
|
className,
|
|
31
31
|
onFocus,
|
|
32
|
-
tabIndex
|
|
32
|
+
tabIndex,
|
|
33
|
+
onSelect
|
|
33
34
|
}, ref) {
|
|
34
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserter.default, {
|
|
35
36
|
position: "bottom center",
|
|
36
37
|
rootClientId: rootClientId,
|
|
37
38
|
__experimentalIsQuick: true,
|
|
39
|
+
onSelectOrClose: onSelect,
|
|
38
40
|
renderToggle: ({
|
|
39
41
|
onToggle,
|
|
40
42
|
disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_element","_i18n","_icons","_deprecated","_inserter","_jsxRuntime","ButtonBlockAppender","rootClientId","className","onFocus","tabIndex","ref","jsx","default","position","__experimentalIsQuick","renderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","label","sprintf","_x","isToggleButton","inserterButton","jsxs","Button","clsx","onClick","undefined","children","VisuallyHidden","as","Icon","icon","plus","Tooltip","text","isAppender","ButtonBlockerAppender","exports","forwardRef","props","deprecated","alternative","since","_default"],"sources":["@wordpress/block-editor/src/components/button-block-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Tooltip, VisuallyHidden } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex },\n\tref\n) {\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tlet label;\n\t\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\t\tlabel = sprintf(\n\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\t\t\t\tblockTitle\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tlabel = _x(\n\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\n\t\t\t\tlet inserterButton = (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\t// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.\n\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! hasSingleBlockType && (\n\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">{ label }</VisuallyHidden>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Icon icon={ plus } />\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\n\t\t\t\tif ( isToggleButton || hasSingleBlockType ) {\n\t\t\t\t\tinserterButton = (\n\t\t\t\t\t\t<Tooltip text={ label }>{ inserterButton }</Tooltip>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn inserterButton;\n\t\t\t} }\n\t\t\tisAppender\n\t\t/>\n\t);\n}\n\n/**\n * Use `ButtonBlockAppender` instead.\n *\n * @deprecated\n */\nexport const ButtonBlockerAppender = forwardRef( ( props, ref ) => {\n\tdeprecated( `wp.blockEditor.ButtonBlockerAppender`, {\n\t\talternative: 'wp.blockEditor.ButtonBlockAppender',\n\t\tsince: '5.9',\n\t} );\n\n\treturn ButtonBlockAppender( props, ref );\n} );\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md\n */\nexport default forwardRef( ButtonBlockAppender );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AAKA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAmC,IAAAO,WAAA,GAAAP,OAAA;AAjBnC;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAGA,SAASQ,mBAAmBA,CAC3B;EAAEC,YAAY;EAAEC,SAAS;EAAEC,OAAO;EAAEC;AAAS,CAAC,
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_element","_i18n","_icons","_deprecated","_inserter","_jsxRuntime","ButtonBlockAppender","rootClientId","className","onFocus","tabIndex","onSelect","ref","jsx","default","position","__experimentalIsQuick","onSelectOrClose","renderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","label","sprintf","_x","isToggleButton","inserterButton","jsxs","Button","clsx","onClick","undefined","children","VisuallyHidden","as","Icon","icon","plus","Tooltip","text","isAppender","ButtonBlockerAppender","exports","forwardRef","props","deprecated","alternative","since","_default"],"sources":["@wordpress/block-editor/src/components/button-block-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Tooltip, VisuallyHidden } from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex, onSelect },\n\tref\n) {\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\tonSelectOrClose={ onSelect }\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tlet label;\n\t\t\t\tif ( hasSingleBlockType ) {\n\t\t\t\t\tlabel = sprintf(\n\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t_x( 'Add %s', 'directly add the only allowed block' ),\n\t\t\t\t\t\tblockTitle\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tlabel = _x(\n\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\n\t\t\t\tlet inserterButton = (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\t// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.\n\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! hasSingleBlockType && (\n\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">{ label }</VisuallyHidden>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Icon icon={ plus } />\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\n\t\t\t\tif ( isToggleButton || hasSingleBlockType ) {\n\t\t\t\t\tinserterButton = (\n\t\t\t\t\t\t<Tooltip text={ label }>{ inserterButton }</Tooltip>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn inserterButton;\n\t\t\t} }\n\t\t\tisAppender\n\t\t/>\n\t);\n}\n\n/**\n * Use `ButtonBlockAppender` instead.\n *\n * @deprecated\n */\nexport const ButtonBlockerAppender = forwardRef( ( props, ref ) => {\n\tdeprecated( `wp.blockEditor.ButtonBlockerAppender`, {\n\t\talternative: 'wp.blockEditor.ButtonBlockAppender',\n\t\tsince: '5.9',\n\t} );\n\n\treturn ButtonBlockAppender( props, ref );\n} );\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md\n */\nexport default forwardRef( ButtonBlockAppender );\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -8,11 +8,18 @@ exports.default = ChildLayoutControl;
|
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
|
+
var _data = require("@wordpress/data");
|
|
12
|
+
var _useGetNumberOfBlocksBeforeCell = require("../grid/use-get-number-of-blocks-before-cell");
|
|
13
|
+
var _store = require("../../store");
|
|
11
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
15
|
/**
|
|
13
16
|
* WordPress dependencies
|
|
14
17
|
*/
|
|
15
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
16
23
|
function helpText(selfStretch, parentLayout) {
|
|
17
24
|
const {
|
|
18
25
|
orientation = 'horizontal'
|
|
@@ -47,22 +54,46 @@ function ChildLayoutControl({
|
|
|
47
54
|
isShownByDefault,
|
|
48
55
|
panelId
|
|
49
56
|
}) {
|
|
50
|
-
const {
|
|
51
|
-
selfStretch,
|
|
52
|
-
flexSize,
|
|
53
|
-
columnStart,
|
|
54
|
-
rowStart,
|
|
55
|
-
columnSpan,
|
|
56
|
-
rowSpan
|
|
57
|
-
} = childLayout;
|
|
58
57
|
const {
|
|
59
58
|
type: parentType,
|
|
60
59
|
default: {
|
|
61
60
|
type: defaultParentType = 'default'
|
|
62
|
-
} = {}
|
|
63
|
-
orientation = 'horizontal'
|
|
61
|
+
} = {}
|
|
64
62
|
} = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {};
|
|
65
63
|
const parentLayoutType = parentType || defaultParentType;
|
|
64
|
+
if (parentLayoutType === 'flex') {
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FlexControls, {
|
|
66
|
+
childLayout: childLayout,
|
|
67
|
+
onChange: onChange,
|
|
68
|
+
parentLayout: parentLayout,
|
|
69
|
+
isShownByDefault: isShownByDefault,
|
|
70
|
+
panelId: panelId
|
|
71
|
+
});
|
|
72
|
+
} else if (parentLayoutType === 'grid') {
|
|
73
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridControls, {
|
|
74
|
+
childLayout: childLayout,
|
|
75
|
+
onChange: onChange,
|
|
76
|
+
parentLayout: parentLayout,
|
|
77
|
+
isShownByDefault: isShownByDefault,
|
|
78
|
+
panelId: panelId
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
function FlexControls({
|
|
84
|
+
childLayout,
|
|
85
|
+
onChange,
|
|
86
|
+
parentLayout,
|
|
87
|
+
isShownByDefault,
|
|
88
|
+
panelId
|
|
89
|
+
}) {
|
|
90
|
+
const {
|
|
91
|
+
selfStretch,
|
|
92
|
+
flexSize
|
|
93
|
+
} = childLayout;
|
|
94
|
+
const {
|
|
95
|
+
orientation = 'horizontal'
|
|
96
|
+
} = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {};
|
|
66
97
|
const hasFlexValue = () => !!selfStretch;
|
|
67
98
|
const flexResetLabel = orientation === 'horizontal' ? (0, _i18n.__)('Width') : (0, _i18n.__)('Height');
|
|
68
99
|
const resetFlex = () => {
|
|
@@ -71,6 +102,87 @@ function ChildLayoutControl({
|
|
|
71
102
|
flexSize: undefined
|
|
72
103
|
});
|
|
73
104
|
};
|
|
105
|
+
(0, _element.useEffect)(() => {
|
|
106
|
+
if (selfStretch === 'fixed' && !flexSize) {
|
|
107
|
+
onChange({
|
|
108
|
+
...childLayout,
|
|
109
|
+
selfStretch: 'fit'
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}, []);
|
|
113
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
114
|
+
as: _components.__experimentalToolsPanelItem,
|
|
115
|
+
spacing: 2,
|
|
116
|
+
hasValue: hasFlexValue,
|
|
117
|
+
label: flexResetLabel,
|
|
118
|
+
onDeselect: resetFlex,
|
|
119
|
+
isShownByDefault: isShownByDefault,
|
|
120
|
+
panelId: panelId,
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToggleGroupControl, {
|
|
122
|
+
__nextHasNoMarginBottom: true,
|
|
123
|
+
size: "__unstable-large",
|
|
124
|
+
label: childLayoutOrientation(parentLayout),
|
|
125
|
+
value: selfStretch || 'fit',
|
|
126
|
+
help: helpText(selfStretch, parentLayout),
|
|
127
|
+
onChange: value => {
|
|
128
|
+
const newFlexSize = value !== 'fixed' ? null : flexSize;
|
|
129
|
+
onChange({
|
|
130
|
+
selfStretch: value,
|
|
131
|
+
flexSize: newFlexSize
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
isBlock: true,
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOption, {
|
|
136
|
+
value: "fit",
|
|
137
|
+
label: (0, _i18n._x)('Fit', 'Intrinsic block width in flex layout')
|
|
138
|
+
}, "fit"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOption, {
|
|
139
|
+
value: "fill",
|
|
140
|
+
label: (0, _i18n._x)('Grow', 'Block with expanding width in flex layout')
|
|
141
|
+
}, "fill"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOption, {
|
|
142
|
+
value: "fixed",
|
|
143
|
+
label: (0, _i18n._x)('Fixed', 'Block with fixed width in flex layout')
|
|
144
|
+
}, "fixed")]
|
|
145
|
+
}), selfStretch === 'fixed' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalUnitControl, {
|
|
146
|
+
size: "__unstable-large",
|
|
147
|
+
onChange: value => {
|
|
148
|
+
onChange({
|
|
149
|
+
selfStretch,
|
|
150
|
+
flexSize: value
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
value: flexSize
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function childLayoutOrientation(parentLayout) {
|
|
158
|
+
const {
|
|
159
|
+
orientation = 'horizontal'
|
|
160
|
+
} = parentLayout;
|
|
161
|
+
return orientation === 'horizontal' ? (0, _i18n.__)('Width') : (0, _i18n.__)('Height');
|
|
162
|
+
}
|
|
163
|
+
function GridControls({
|
|
164
|
+
childLayout,
|
|
165
|
+
onChange,
|
|
166
|
+
parentLayout,
|
|
167
|
+
isShownByDefault,
|
|
168
|
+
panelId
|
|
169
|
+
}) {
|
|
170
|
+
const {
|
|
171
|
+
columnStart,
|
|
172
|
+
rowStart,
|
|
173
|
+
columnSpan,
|
|
174
|
+
rowSpan
|
|
175
|
+
} = childLayout;
|
|
176
|
+
const {
|
|
177
|
+
columnCount = 3,
|
|
178
|
+
rowCount
|
|
179
|
+
} = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {};
|
|
180
|
+
const rootClientId = (0, _data.useSelect)(select => select(_store.store).getBlockRootClientId(panelId));
|
|
181
|
+
const {
|
|
182
|
+
moveBlocksToPosition,
|
|
183
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
184
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
185
|
+
const getNumberOfBlocksBeforeCell = (0, _useGetNumberOfBlocksBeforeCell.useGetNumberOfBlocksBeforeCell)(rootClientId, columnCount);
|
|
74
186
|
const hasStartValue = () => !!columnStart || !!rowStart;
|
|
75
187
|
const hasSpanValue = () => !!columnSpan || !!rowSpan;
|
|
76
188
|
const resetGridStarts = () => {
|
|
@@ -85,155 +197,109 @@ function ChildLayoutControl({
|
|
|
85
197
|
rowSpan: undefined
|
|
86
198
|
});
|
|
87
199
|
};
|
|
88
|
-
(0, _element.useEffect)(() => {
|
|
89
|
-
if (selfStretch === 'fixed' && !flexSize) {
|
|
90
|
-
onChange({
|
|
91
|
-
...childLayout,
|
|
92
|
-
selfStretch: 'fit'
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}, []);
|
|
96
200
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
97
|
-
children: [
|
|
201
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
98
202
|
as: _components.__experimentalToolsPanelItem,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
onDeselect: resetFlex,
|
|
203
|
+
hasValue: hasSpanValue,
|
|
204
|
+
label: (0, _i18n.__)('Grid span'),
|
|
205
|
+
onDeselect: resetGridSpans,
|
|
103
206
|
isShownByDefault: isShownByDefault,
|
|
104
207
|
panelId: panelId,
|
|
105
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
106
|
-
__nextHasNoMarginBottom: true,
|
|
208
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
107
209
|
size: "__unstable-large",
|
|
108
|
-
label:
|
|
109
|
-
|
|
110
|
-
help: helpText(selfStretch, parentLayout),
|
|
210
|
+
label: (0, _i18n.__)('Column span'),
|
|
211
|
+
type: "number",
|
|
111
212
|
onChange: value => {
|
|
112
|
-
|
|
213
|
+
// Don't allow unsetting.
|
|
214
|
+
const newColumnSpan = value === '' ? 1 : parseInt(value, 10);
|
|
113
215
|
onChange({
|
|
114
|
-
|
|
115
|
-
|
|
216
|
+
columnStart,
|
|
217
|
+
rowStart,
|
|
218
|
+
rowSpan,
|
|
219
|
+
columnSpan: newColumnSpan
|
|
116
220
|
});
|
|
117
221
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
label: (0, _i18n.__)('Fit')
|
|
122
|
-
}, "fit"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOption, {
|
|
123
|
-
value: "fill",
|
|
124
|
-
label: (0, _i18n.__)('Fill')
|
|
125
|
-
}, "fill"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOption, {
|
|
126
|
-
value: "fixed",
|
|
127
|
-
label: (0, _i18n.__)('Fixed')
|
|
128
|
-
}, "fixed")]
|
|
129
|
-
}), selfStretch === 'fixed' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalUnitControl, {
|
|
222
|
+
value: columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1,
|
|
223
|
+
min: 1
|
|
224
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
130
225
|
size: "__unstable-large",
|
|
226
|
+
label: (0, _i18n.__)('Row span'),
|
|
227
|
+
type: "number",
|
|
131
228
|
onChange: value => {
|
|
229
|
+
// Don't allow unsetting.
|
|
230
|
+
const newRowSpan = value === '' ? 1 : parseInt(value, 10);
|
|
132
231
|
onChange({
|
|
133
|
-
|
|
134
|
-
|
|
232
|
+
columnStart,
|
|
233
|
+
rowStart,
|
|
234
|
+
columnSpan,
|
|
235
|
+
rowSpan: newRowSpan
|
|
135
236
|
});
|
|
136
237
|
},
|
|
137
|
-
value:
|
|
238
|
+
value: rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1,
|
|
239
|
+
min: 1
|
|
138
240
|
})]
|
|
139
|
-
}),
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
241
|
+
}), window.__experimentalEnableGridInteractivity && columnCount &&
|
|
242
|
+
/*#__PURE__*/
|
|
243
|
+
// Use Flex with an explicit width on the FlexItem instead of HStack to
|
|
244
|
+
// work around an issue in webkit where inputs with a max attribute are
|
|
245
|
+
// sized incorrectly.
|
|
246
|
+
(0, _jsxRuntime.jsxs)(_components.Flex, {
|
|
247
|
+
as: _components.__experimentalToolsPanelItem,
|
|
248
|
+
hasValue: hasStartValue,
|
|
249
|
+
label: (0, _i18n.__)('Grid placement'),
|
|
250
|
+
onDeselect: resetGridStarts,
|
|
251
|
+
isShownByDefault: false,
|
|
252
|
+
panelId: panelId,
|
|
253
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
254
|
+
style: {
|
|
255
|
+
width: '50%'
|
|
256
|
+
},
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
148
258
|
size: "__unstable-large",
|
|
149
|
-
label: (0, _i18n.__)('Column
|
|
259
|
+
label: (0, _i18n.__)('Column'),
|
|
150
260
|
type: "number",
|
|
151
261
|
onChange: value => {
|
|
262
|
+
// Don't allow unsetting.
|
|
263
|
+
const newColumnStart = value === '' ? 1 : parseInt(value, 10);
|
|
152
264
|
onChange({
|
|
153
|
-
columnStart,
|
|
265
|
+
columnStart: newColumnStart,
|
|
154
266
|
rowStart,
|
|
155
|
-
|
|
156
|
-
|
|
267
|
+
columnSpan,
|
|
268
|
+
rowSpan
|
|
157
269
|
});
|
|
270
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
271
|
+
moveBlocksToPosition([panelId], rootClientId, rootClientId, getNumberOfBlocksBeforeCell(newColumnStart, rowStart));
|
|
158
272
|
},
|
|
159
|
-
value:
|
|
160
|
-
min: 1
|
|
161
|
-
|
|
273
|
+
value: columnStart !== null && columnStart !== void 0 ? columnStart : 1,
|
|
274
|
+
min: 1,
|
|
275
|
+
max: columnCount ? columnCount - (columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1) + 1 : undefined
|
|
276
|
+
})
|
|
277
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
278
|
+
style: {
|
|
279
|
+
width: '50%'
|
|
280
|
+
},
|
|
281
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
162
282
|
size: "__unstable-large",
|
|
163
|
-
label: (0, _i18n.__)('Row
|
|
283
|
+
label: (0, _i18n.__)('Row'),
|
|
164
284
|
type: "number",
|
|
165
285
|
onChange: value => {
|
|
286
|
+
// Don't allow unsetting.
|
|
287
|
+
const newRowStart = value === '' ? 1 : parseInt(value, 10);
|
|
166
288
|
onChange({
|
|
167
289
|
columnStart,
|
|
168
|
-
rowStart,
|
|
290
|
+
rowStart: newRowStart,
|
|
169
291
|
columnSpan,
|
|
170
|
-
rowSpan
|
|
292
|
+
rowSpan
|
|
171
293
|
});
|
|
294
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
295
|
+
moveBlocksToPosition([panelId], rootClientId, rootClientId, getNumberOfBlocksBeforeCell(columnStart, newRowStart));
|
|
172
296
|
},
|
|
173
|
-
value:
|
|
174
|
-
min: 1
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
/*#__PURE__*/
|
|
178
|
-
// Use Flex with an explicit width on the FlexItem instead of HStack to
|
|
179
|
-
// work around an issue in webkit where inputs with a max attribute are
|
|
180
|
-
// sized incorrectly.
|
|
181
|
-
(0, _jsxRuntime.jsxs)(_components.Flex, {
|
|
182
|
-
as: _components.__experimentalToolsPanelItem,
|
|
183
|
-
hasValue: hasStartValue,
|
|
184
|
-
label: (0, _i18n.__)('Grid placement'),
|
|
185
|
-
onDeselect: resetGridStarts,
|
|
186
|
-
isShownByDefault: false,
|
|
187
|
-
panelId: panelId,
|
|
188
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
189
|
-
style: {
|
|
190
|
-
width: '50%'
|
|
191
|
-
},
|
|
192
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
193
|
-
size: "__unstable-large",
|
|
194
|
-
label: (0, _i18n.__)('Column'),
|
|
195
|
-
type: "number",
|
|
196
|
-
onChange: value => {
|
|
197
|
-
onChange({
|
|
198
|
-
columnStart: value,
|
|
199
|
-
rowStart,
|
|
200
|
-
columnSpan,
|
|
201
|
-
rowSpan
|
|
202
|
-
});
|
|
203
|
-
},
|
|
204
|
-
value: columnStart,
|
|
205
|
-
min: 1,
|
|
206
|
-
max: parentLayout?.columnCount ? parentLayout.columnCount - (columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1) + 1 : undefined
|
|
207
|
-
})
|
|
208
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
209
|
-
style: {
|
|
210
|
-
width: '50%'
|
|
211
|
-
},
|
|
212
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
213
|
-
size: "__unstable-large",
|
|
214
|
-
label: (0, _i18n.__)('Row'),
|
|
215
|
-
type: "number",
|
|
216
|
-
onChange: value => {
|
|
217
|
-
onChange({
|
|
218
|
-
columnStart,
|
|
219
|
-
rowStart: value,
|
|
220
|
-
columnSpan,
|
|
221
|
-
rowSpan
|
|
222
|
-
});
|
|
223
|
-
},
|
|
224
|
-
value: rowStart,
|
|
225
|
-
min: 1,
|
|
226
|
-
max: parentLayout?.rowCount ? parentLayout.rowCount - (rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1) + 1 : undefined
|
|
227
|
-
})
|
|
228
|
-
})]
|
|
297
|
+
value: rowStart !== null && rowStart !== void 0 ? rowStart : 1,
|
|
298
|
+
min: 1,
|
|
299
|
+
max: rowCount ? rowCount - (rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1) + 1 : undefined
|
|
300
|
+
})
|
|
229
301
|
})]
|
|
230
302
|
})]
|
|
231
303
|
});
|
|
232
304
|
}
|
|
233
|
-
function childLayoutOrientation(parentLayout) {
|
|
234
|
-
const {
|
|
235
|
-
orientation = 'horizontal'
|
|
236
|
-
} = parentLayout;
|
|
237
|
-
return orientation === 'horizontal' ? (0, _i18n.__)('Width') : (0, _i18n.__)('Height');
|
|
238
|
-
}
|
|
239
305
|
//# sourceMappingURL=index.js.map
|