@wordpress/block-editor 12.19.5 → 12.21.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 +4 -0
- package/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +23 -7
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/cover.js +68 -0
- package/build/components/block-popover/cover.js.map +1 -0
- package/build/components/block-popover/drop-zone.js +2 -3
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/index.js +1 -19
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +7 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +89 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -5
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +9 -26
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +60 -0
- package/build/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +7 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +15 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build/components/grid-visualizer/grid-visualizer.js +81 -0
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build/components/grid-visualizer/index.js +20 -0
- package/build/components/grid-visualizer/index.js.map +1 -0
- package/build/components/grid-visualizer/utils.js +10 -0
- package/build/components/grid-visualizer/utils.js.map +1 -0
- package/build/components/iframe/index.js +61 -16
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.native.js +7 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +9 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +2 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +1 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +3 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/dimensions.js +3 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +6 -7
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +89 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +11 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +115 -0
- package/build/hooks/spacing-visualizer.js.map +1 -0
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +111 -14
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +2 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +4 -36
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -45
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +2 -4
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -15
- package/build/store/selectors.js.map +1 -1
- package/build/utils/calculate-scale.js +17 -0
- package/build/utils/calculate-scale.js.map +1 -0
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +23 -7
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/cover.js +60 -0
- package/build-module/components/block-popover/cover.js.map +1 -0
- package/build-module/components/block-popover/drop-zone.js +2 -3
- package/build-module/components/block-popover/drop-zone.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -19
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -5
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +7 -6
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +82 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -5
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -26
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +54 -0
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +7 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +16 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build-module/components/grid-visualizer/index.js +3 -0
- package/build-module/components/grid-visualizer/index.js.map +1 -0
- package/build-module/components/grid-visualizer/utils.js +4 -0
- package/build-module/components/grid-visualizer/utils.js.map +1 -0
- package/build-module/components/iframe/index.js +61 -16
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +9 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +2 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +3 -5
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +7 -8
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +89 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +11 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +106 -0
- package/build-module/hooks/spacing-visualizer.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +113 -16
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +2 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -36
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -45
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/calculate-scale.js +11 -0
- package/build-module/utils/calculate-scale.js.map +1 -0
- package/build-style/content-rtl.css +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +55 -25
- package/build-style/style.css +55 -25
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/block-list-item.native.js +1 -1
- package/src/components/block-list/block-outline.native.js +36 -21
- package/src/components/block-list/block-selection-button.native.js +1 -3
- package/src/components/block-list/block.native.js +0 -3
- package/src/components/block-list/content.scss +5 -1
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-popover/cover.js +63 -0
- package/src/components/block-popover/drop-zone.js +3 -4
- package/src/components/block-popover/index.js +1 -28
- package/src/components/block-preview/index.js +3 -1
- package/src/components/block-removal-warning-modal/index.js +5 -19
- package/src/components/block-rename/modal.js +1 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
- package/src/components/block-toolbar/index.js +5 -11
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/empty-block-inserter.js +3 -6
- package/src/components/block-tools/index.js +13 -36
- package/src/components/block-tools/use-show-block-tools.js +73 -0
- package/src/components/caption/index.native.js +1 -1
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/color-palette/control.js +1 -1
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/contrast-checker/test/index.js +10 -10
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/border-panel.js +2 -2
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +14 -16
- package/src/components/global-styles/utils.js +2 -8
- package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
- package/src/components/grid-visualizer/grid-visualizer.js +81 -0
- package/src/components/grid-visualizer/index.js +2 -0
- package/src/components/grid-visualizer/style.scss +33 -0
- package/src/components/grid-visualizer/utils.js +5 -0
- package/src/components/iframe/index.js +78 -31
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.js +10 -4
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +2 -1
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inserter/tabs.js +2 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/index.js +1 -1
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/panel-color-settings/index.js +1 -1
- package/src/components/panel-color-settings/test/index.js +3 -3
- package/src/components/provider/index.js +1 -4
- package/src/components/resizable-box-popover/index.js +4 -6
- package/src/components/responsive-block-control/README.md +4 -4
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/responsive-block-control/test/index.js +5 -5
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +1 -2
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -5
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +1 -1
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout-child.js +91 -1
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/position.js +0 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +137 -53
- package/src/layouts/test/grid.js +16 -2
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +4 -42
- package/src/store/private-actions.js +34 -69
- package/src/store/reducer.js +2 -8
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -105
- package/src/style.scss +2 -2
- package/src/utils/calculate-scale.js +20 -0
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build/hooks/margin.js +0 -86
- package/build/hooks/margin.js.map +0 -1
- package/build/hooks/padding.js +0 -78
- package/build/hooks/padding.js.map +0 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
- package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/build-module/hooks/margin.js +0 -78
- package/build-module/hooks/margin.js.map +0 -1
- package/build-module/hooks/padding.js +0 -70
- package/build-module/hooks/padding.js.map +0 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- package/src/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
|
@@ -10,7 +10,6 @@ var _data = require("@wordpress/data");
|
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
13
|
-
var _blocks = require("@wordpress/blocks");
|
|
14
13
|
var _emptyBlockInserter = _interopRequireDefault(require("./empty-block-inserter"));
|
|
15
14
|
var _insertionPoint = _interopRequireWildcard(require("./insertion-point"));
|
|
16
15
|
var _blockToolbarPopover = _interopRequireDefault(require("./block-toolbar-popover"));
|
|
@@ -18,6 +17,7 @@ var _blockToolbarBreadcrumb = _interopRequireDefault(require("./block-toolbar-br
|
|
|
18
17
|
var _store = require("../../store");
|
|
19
18
|
var _usePopoverScroll = _interopRequireDefault(require("../block-popover/use-popover-scroll"));
|
|
20
19
|
var _zoomOutModeInserters = _interopRequireDefault(require("./zoom-out-mode-inserters"));
|
|
20
|
+
var _useShowBlockTools = require("./use-show-block-tools");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
23
|
/**
|
|
@@ -32,36 +32,17 @@ function selector(select) {
|
|
|
32
32
|
const {
|
|
33
33
|
getSelectedBlockClientId,
|
|
34
34
|
getFirstMultiSelectedBlockClientId,
|
|
35
|
-
getBlock,
|
|
36
35
|
getSettings,
|
|
37
|
-
hasMultiSelection,
|
|
38
36
|
__unstableGetEditorMode,
|
|
39
37
|
isTyping
|
|
40
38
|
} = select(_store.store);
|
|
41
39
|
const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
|
|
42
|
-
const {
|
|
43
|
-
name = '',
|
|
44
|
-
attributes = {}
|
|
45
|
-
} = getBlock(clientId) || {};
|
|
46
40
|
const editorMode = __unstableGetEditorMode();
|
|
47
|
-
const hasSelectedBlock = clientId && name;
|
|
48
|
-
const isEmptyDefaultBlock = (0, _blocks.isUnmodifiedDefaultBlock)({
|
|
49
|
-
name,
|
|
50
|
-
attributes
|
|
51
|
-
});
|
|
52
|
-
const _showEmptyBlockSideInserter = clientId && !isTyping() && editorMode === 'edit' && (0, _blocks.isUnmodifiedDefaultBlock)({
|
|
53
|
-
name,
|
|
54
|
-
attributes
|
|
55
|
-
});
|
|
56
|
-
const maybeShowBreadcrumb = hasSelectedBlock && !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out');
|
|
57
41
|
return {
|
|
58
42
|
clientId,
|
|
59
43
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
60
44
|
isTyping: isTyping(),
|
|
61
|
-
isZoomOutMode: editorMode === 'zoom-out'
|
|
62
|
-
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
63
|
-
showBreadcrumb: !_showEmptyBlockSideInserter && maybeShowBreadcrumb,
|
|
64
|
-
showBlockToolbar: !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock && !maybeShowBreadcrumb
|
|
45
|
+
isZoomOutMode: editorMode === 'zoom-out'
|
|
65
46
|
};
|
|
66
47
|
}
|
|
67
48
|
|
|
@@ -83,16 +64,18 @@ function BlockTools({
|
|
|
83
64
|
clientId,
|
|
84
65
|
hasFixedToolbar,
|
|
85
66
|
isTyping,
|
|
86
|
-
isZoomOutMode
|
|
87
|
-
showEmptyBlockSideInserter,
|
|
88
|
-
showBreadcrumb,
|
|
89
|
-
showBlockToolbar
|
|
67
|
+
isZoomOutMode
|
|
90
68
|
} = (0, _data.useSelect)(selector, []);
|
|
91
69
|
const isMatch = (0, _keyboardShortcuts.__unstableUseShortcutEventMatch)();
|
|
92
70
|
const {
|
|
93
71
|
getSelectedBlockClientIds,
|
|
94
72
|
getBlockRootClientId
|
|
95
73
|
} = (0, _data.useSelect)(_store.store);
|
|
74
|
+
const {
|
|
75
|
+
showEmptyBlockSideInserter,
|
|
76
|
+
showBreadcrumb,
|
|
77
|
+
showBlockToolbarPopover
|
|
78
|
+
} = (0, _useShowBlockTools.useShowBlockTools)();
|
|
96
79
|
const {
|
|
97
80
|
duplicateBlocks,
|
|
98
81
|
removeBlocks,
|
|
@@ -175,7 +158,7 @@ function BlockTools({
|
|
|
175
158
|
}), showEmptyBlockSideInserter && (0, _react.createElement)(_emptyBlockInserter.default, {
|
|
176
159
|
__unstableContentRef: __unstableContentRef,
|
|
177
160
|
clientId: clientId
|
|
178
|
-
}),
|
|
161
|
+
}), showBlockToolbarPopover && (0, _react.createElement)(_blockToolbarPopover.default, {
|
|
179
162
|
__unstableContentRef: __unstableContentRef,
|
|
180
163
|
clientId: clientId,
|
|
181
164
|
isTyping: isTyping
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_keyboardShortcuts","_element","_blocks","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_blockToolbarBreadcrumb","_store","_usePopoverScroll","_zoomOutModeInserters","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getSettings","hasMultiSelection","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","name","attributes","editorMode","hasSelectedBlock","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","_showEmptyBlockSideInserter","maybeShowBreadcrumb","hasFixedToolbar","isZoomOutMode","showEmptyBlockSideInserter","showBreadcrumb","showBlockToolbar","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getSelectedBlockClientIds","getBlockRootClientId","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","_react","createElement","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport BlockToolbarBreadcrumb from './block-toolbar-breadcrumb';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlock,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst { name = '', attributes = {} } = getBlock( clientId ) || {};\n\tconst editorMode = __unstableGetEditorMode();\n\tconst hasSelectedBlock = clientId && name;\n\tconst isEmptyDefaultBlock = isUnmodifiedDefaultBlock( {\n\t\tname,\n\t\tattributes,\n\t} );\n\tconst _showEmptyBlockSideInserter =\n\t\tclientId &&\n\t\t! isTyping() &&\n\t\teditorMode === 'edit' &&\n\t\tisUnmodifiedDefaultBlock( { name, attributes } );\n\tconst maybeShowBreadcrumb =\n\t\thasSelectedBlock &&\n\t\t! hasMultiSelection() &&\n\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' );\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: editorMode === 'zoom-out',\n\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\tshowBreadcrumb: ! _showEmptyBlockSideInserter && maybeShowBreadcrumb,\n\t\tshowBlockToolbar:\n\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\thasSelectedBlock &&\n\t\t\t! isEmptyDefaultBlock &&\n\t\t\t! maybeShowBreadcrumb,\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst {\n\t\tclientId,\n\t\thasFixedToolbar,\n\t\tisTyping,\n\t\tisZoomOutMode,\n\t\tshowEmptyBlockSideInserter,\n\t\tshowBreadcrumb,\n\t\tshowBlockToolbar,\n\t} = useSelect( selector, [] );\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbar && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBreadcrumb && (\n\t\t\t\t\t<BlockToolbarBreadcrumb\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,mBAAA,GAAAC,sBAA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cAAc,IACf,IAAA+B,MAAA,CAAAC,aAAA,EAAC/E,uBAAA,CAAAU,OAAsB;MACtByC,oBAAoB,EAAGA,oBAAsB;MAC7ChB,QAAQ,EAAGA;IAAU,CACrB,CACD,EAGC,CAAEU,aAAa,IAAI,CAAED,eAAe,IACrC,IAAAkC,MAAA,CAAAC,aAAA,EAACxF,WAAA,CAAA6F,OAAO,CAACC,IAAI;MACZjD,IAAI,EAAC,eAAe;MACpBkD,GAAG,EAAGX;IAAiB,CACvB,CACD,EACCzB,QAAQ,EAEV,IAAA4B,MAAA,CAAAC,aAAA,EAACxF,WAAA,CAAA6F,OAAO,CAACC,IAAI;MACZjD,IAAI,EAAC,8BAA8B;MACnCkD,GAAG,EAAGT;IAAsB,CAC5B,CAAC,EACAhC,aAAa,IACd,IAAAiC,MAAA,CAAAC,aAAA,EAAC5E,qBAAA,CAAAO,OAAoB;MACpByC,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER"}
|
|
1
|
+
{"version":3,"names":["_data","require","_components","_keyboardShortcuts","_element","_emptyBlockInserter","_interopRequireDefault","_insertionPoint","_interopRequireWildcard","_blockToolbarPopover","_blockToolbarBreadcrumb","_store","_usePopoverScroll","_zoomOutModeInserters","_useShowBlockTools","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","selector","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getSettings","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","editorMode","hasFixedToolbar","isZoomOutMode","BlockTools","children","__unstableContentRef","props","useSelect","isMatch","useShortcutEventMatch","getSelectedBlockClientIds","getBlockRootClientId","showEmptyBlockSideInserter","showBreadcrumb","showBlockToolbarPopover","useShowBlockTools","duplicateBlocks","removeBlocks","insertAfterBlock","insertBeforeBlock","selectBlock","moveBlocksUp","moveBlocksDown","useDispatch","onKeyDown","event","defaultPrevented","clientIds","length","preventDefault","rootClientId","target","closest","blockToolbarRef","usePopoverScroll","blockToolbarAfterRef","_react","createElement","InsertionPointOpenRef","Provider","value","useRef","Popover","Slot","name","ref"],"sources":["@wordpress/block-editor/src/components/block-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport BlockToolbarBreadcrumb from './block-toolbar-breadcrumb';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\t__unstableGetEditorMode,\n\t\tisTyping,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tconst editorMode = __unstableGetEditorMode();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: editorMode === 'zoom-out',\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode } = useSelect(\n\t\tselector,\n\t\t[]\n\t);\n\tconst isMatch = useShortcutEventMatch();\n\tconst { getSelectedBlockClientIds, getBlockRootClientId } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst {\n\t\tshowEmptyBlockSideInserter,\n\t\tshowBreadcrumb,\n\t\tshowBlockToolbarPopover,\n\t} = useShowBlockTools();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t} = useDispatch( blockEditorStore );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) return;\n\n\t\tif ( isMatch( 'core/block-editor/move-up', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/move-down', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t}\n\t}\n\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBreadcrumb && (\n\t\t\t\t\t<BlockToolbarBreadcrumb\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Insert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sB,CAC5B,CAAC,EACAjC,aAAa,IACd,IAAAkC,MAAA,CAAAC,aAAA,EAACrE,qBAAA,CAAAQ,OAAoB;MACpB6B,oBAAoB,EAAGA;IAAsB,CAC7C,CAE6B,CAC5B;EAAC;AAER"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useShowBlockTools = useShowBlockTools;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _blocks = require("@wordpress/blocks");
|
|
9
|
+
var _store = require("../../store");
|
|
10
|
+
var _useHasBlockToolbar = require("../block-toolbar/use-has-block-toolbar");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Source of truth for which block tools are showing in the block editor.
|
|
21
|
+
*
|
|
22
|
+
* @return {Object} Object of which block tools will be shown.
|
|
23
|
+
*/
|
|
24
|
+
function useShowBlockTools() {
|
|
25
|
+
const hasBlockToolbar = (0, _useHasBlockToolbar.useHasBlockToolbar)();
|
|
26
|
+
return (0, _data.useSelect)(select => {
|
|
27
|
+
const {
|
|
28
|
+
getSelectedBlockClientId,
|
|
29
|
+
getFirstMultiSelectedBlockClientId,
|
|
30
|
+
getBlock,
|
|
31
|
+
getSettings,
|
|
32
|
+
hasMultiSelection,
|
|
33
|
+
__unstableGetEditorMode,
|
|
34
|
+
isTyping
|
|
35
|
+
} = select(_store.store);
|
|
36
|
+
const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
|
|
37
|
+
const {
|
|
38
|
+
name = '',
|
|
39
|
+
attributes = {}
|
|
40
|
+
} = getBlock(clientId) || {};
|
|
41
|
+
const editorMode = __unstableGetEditorMode();
|
|
42
|
+
const hasSelectedBlock = clientId && name;
|
|
43
|
+
const isEmptyDefaultBlock = (0, _blocks.isUnmodifiedDefaultBlock)({
|
|
44
|
+
name,
|
|
45
|
+
attributes
|
|
46
|
+
});
|
|
47
|
+
const _showEmptyBlockSideInserter = clientId && !isTyping() && editorMode === 'edit' && (0, _blocks.isUnmodifiedDefaultBlock)({
|
|
48
|
+
name,
|
|
49
|
+
attributes
|
|
50
|
+
});
|
|
51
|
+
const maybeShowBreadcrumb = hasSelectedBlock && !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out');
|
|
52
|
+
return {
|
|
53
|
+
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
|
|
54
|
+
showBreadcrumb: !_showEmptyBlockSideInserter && maybeShowBreadcrumb,
|
|
55
|
+
showBlockToolbarPopover: hasBlockToolbar && !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock && !maybeShowBreadcrumb,
|
|
56
|
+
showFixedToolbar: editorMode !== 'zoom-out' && hasBlockToolbar && getSettings().hasFixedToolbar
|
|
57
|
+
};
|
|
58
|
+
}, [hasBlockToolbar]);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=use-show-block-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_store","_useHasBlockToolbar","useShowBlockTools","hasBlockToolbar","useHasBlockToolbar","useSelect","select","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlock","getSettings","hasMultiSelection","__unstableGetEditorMode","isTyping","blockEditorStore","clientId","name","attributes","editorMode","hasSelectedBlock","isEmptyDefaultBlock","isUnmodifiedDefaultBlock","_showEmptyBlockSideInserter","maybeShowBreadcrumb","showEmptyBlockSideInserter","showBreadcrumb","showBlockToolbarPopover","hasFixedToolbar","showFixedToolbar"],"sources":["@wordpress/block-editor/src/components/block-tools/use-show-block-tools.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useHasBlockToolbar } from '../block-toolbar/use-has-block-toolbar';\n\n/**\n * Source of truth for which block tools are showing in the block editor.\n *\n * @return {Object} Object of which block tools will be shown.\n */\nexport function useShowBlockTools() {\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetFirstMultiSelectedBlockClientId,\n\t\t\t\tgetBlock,\n\t\t\t\tgetSettings,\n\t\t\t\thasMultiSelection,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tisTyping,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst clientId =\n\t\t\t\tgetSelectedBlockClientId() ||\n\t\t\t\tgetFirstMultiSelectedBlockClientId();\n\n\t\t\tconst { name = '', attributes = {} } = getBlock( clientId ) || {};\n\t\t\tconst editorMode = __unstableGetEditorMode();\n\t\t\tconst hasSelectedBlock = clientId && name;\n\t\t\tconst isEmptyDefaultBlock = isUnmodifiedDefaultBlock( {\n\t\t\t\tname,\n\t\t\t\tattributes,\n\t\t\t} );\n\t\t\tconst _showEmptyBlockSideInserter =\n\t\t\t\tclientId &&\n\t\t\t\t! isTyping() &&\n\t\t\t\teditorMode === 'edit' &&\n\t\t\t\tisUnmodifiedDefaultBlock( { name, attributes } );\n\t\t\tconst maybeShowBreadcrumb =\n\t\t\t\thasSelectedBlock &&\n\t\t\t\t! hasMultiSelection() &&\n\t\t\t\t( editorMode === 'navigation' || editorMode === 'zoom-out' );\n\n\t\t\treturn {\n\t\t\t\tshowEmptyBlockSideInserter: _showEmptyBlockSideInserter,\n\t\t\t\tshowBreadcrumb:\n\t\t\t\t\t! _showEmptyBlockSideInserter && maybeShowBreadcrumb,\n\t\t\t\tshowBlockToolbarPopover:\n\t\t\t\t\thasBlockToolbar &&\n\t\t\t\t\t! getSettings().hasFixedToolbar &&\n\t\t\t\t\t! _showEmptyBlockSideInserter &&\n\t\t\t\t\thasSelectedBlock &&\n\t\t\t\t\t! isEmptyDefaultBlock &&\n\t\t\t\t\t! maybeShowBreadcrumb,\n\t\t\t\tshowFixedToolbar:\n\t\t\t\t\teditorMode !== 'zoom-out' &&\n\t\t\t\t\thasBlockToolbar &&\n\t\t\t\t\tgetSettings().hasFixedToolbar,\n\t\t\t};\n\t\t},\n\t\t[ hasBlockToolbar ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASI,iBAAiBA,CAAA,EAAG;EACnC,MAAMC,eAAe,GAAG,IAAAC,sCAAkB,EAAC,CAAC;EAE5C,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAM;IACb,MAAM;MACLC,wBAAwB;MACxBC,kCAAkC;MAClCC,QAAQ;MACRC,WAAW;MACXC,iBAAiB;MACjBC,uBAAuB;MACvBC;IACD,CAAC,GAAGP,MAAM,CAAEQ,YAAiB,CAAC;IAE9B,MAAMC,QAAQ,GACbR,wBAAwB,CAAC,CAAC,IAC1BC,kCAAkC,CAAC,CAAC;IAErC,MAAM;MAAEQ,IAAI,GAAG,EAAE;MAAEC,UAAU,GAAG,CAAC;IAAE,CAAC,GAAGR,QAAQ,CAAEM,QAAS,CAAC,IAAI,CAAC,CAAC;IACjE,MAAMG,UAAU,GAAGN,uBAAuB,CAAC,CAAC;IAC5C,MAAMO,gBAAgB,GAAGJ,QAAQ,IAAIC,IAAI;IACzC,MAAMI,mBAAmB,GAAG,IAAAC,gCAAwB,EAAE;MACrDL,IAAI;MACJC;IACD,CAAE,CAAC;IACH,MAAMK,2BAA2B,GAChCP,QAAQ,IACR,CAAEF,QAAQ,CAAC,CAAC,IACZK,UAAU,KAAK,MAAM,IACrB,IAAAG,gCAAwB,EAAE;MAAEL,IAAI;MAAEC;IAAW,CAAE,CAAC;IACjD,MAAMM,mBAAmB,GACxBJ,gBAAgB,IAChB,CAAER,iBAAiB,CAAC,CAAC,KACnBO,UAAU,KAAK,YAAY,IAAIA,UAAU,KAAK,UAAU,CAAE;IAE7D,OAAO;MACNM,0BAA0B,EAAEF,2BAA2B;MACvDG,cAAc,EACb,CAAEH,2BAA2B,IAAIC,mBAAmB;MACrDG,uBAAuB,EACtBvB,eAAe,IACf,CAAEO,WAAW,CAAC,CAAC,CAACiB,eAAe,IAC/B,CAAEL,2BAA2B,IAC7BH,gBAAgB,IAChB,CAAEC,mBAAmB,IACrB,CAAEG,mBAAmB;MACtBK,gBAAgB,EACfV,UAAU,KAAK,UAAU,IACzBf,eAAe,IACfO,WAAW,CAAC,CAAC,CAACiB;IAChB,CAAC;EACF,CAAC,EACD,CAAExB,eAAe,CAClB,CAAC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_blocks","_blockEditor","_i18n","Caption","accessibilityLabelCreator","accessible","inlineToolbar","isSelected","onBlur","onChange","onFocus","placeholder","__","placeholderTextColor","shouldDisplay","style","value","insertBlocksAfter","_react","createElement","View","accessibilityLabel","undefined","accessibilityRole","flex","display","RichText","__unstableMobileNoFocusOnMount","fontSize","tagName","textAlign","underlineColorAndroid","unstableOnFocus","__unstableOnSplitAtEnd","createBlock","deleteEnter","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/caption/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { RichText } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nconst Caption = ( {\n\taccessibilityLabelCreator,\n\taccessible,\n\tinlineToolbar,\n\tisSelected,\n\tonBlur,\n\tonChange,\n\tonFocus,\n\tplaceholder = __( 'Add caption' ),\n\tplaceholderTextColor,\n\tshouldDisplay = true,\n\tstyle,\n\tvalue,\n\tinsertBlocksAfter = () => {},\n} ) => (\n\t<View\n\t\taccessibilityLabel={\n\t\t\taccessibilityLabelCreator\n\t\t\t\t? accessibilityLabelCreator( value )\n\t\t\t\t: undefined\n\t\t}\n\t\taccessibilityRole=\"button\"\n\t\taccessible={ accessible }\n\t\tstyle={ { flex: 1, display: shouldDisplay ? 'flex' : 'none' } }\n\t>\n\t\t<RichText\n\t\t\t__unstableMobileNoFocusOnMount\n\t\t\tfontSize={ style && style.fontSize ? style.fontSize : 14 }\n\t\t\tinlineToolbar={ inlineToolbar }\n\t\t\tisSelected={ isSelected }\n\t\t\tonBlur={ onBlur }\n\t\t\tonChange={ onChange }\n\t\t\tplaceholder={ placeholder }\n\t\t\tplaceholderTextColor={ placeholderTextColor }\n\t\t\tstyle={ style }\n\t\t\ttagName=\"p\"\n\t\t\ttextAlign=\"center\"\n\t\t\tunderlineColorAndroid=\"transparent\"\n\t\t\tunstableOnFocus={ onFocus }\n\t\t\tvalue={ value }\n\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t}\n\t\t\tdeleteEnter
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_blocks","_blockEditor","_i18n","Caption","accessibilityLabelCreator","accessible","inlineToolbar","isSelected","onBlur","onChange","onFocus","placeholder","__","placeholderTextColor","shouldDisplay","style","value","insertBlocksAfter","_react","createElement","View","accessibilityLabel","undefined","accessibilityRole","flex","display","RichText","__unstableMobileNoFocusOnMount","fontSize","tagName","textAlign","underlineColorAndroid","unstableOnFocus","__unstableOnSplitAtEnd","createBlock","deleteEnter","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/caption/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { RichText } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nconst Caption = ( {\n\taccessibilityLabelCreator,\n\taccessible,\n\tinlineToolbar,\n\tisSelected,\n\tonBlur,\n\tonChange,\n\tonFocus,\n\tplaceholder = __( 'Add caption' ),\n\tplaceholderTextColor,\n\tshouldDisplay = true,\n\tstyle,\n\tvalue,\n\tinsertBlocksAfter = () => {},\n} ) => (\n\t<View\n\t\taccessibilityLabel={\n\t\t\taccessibilityLabelCreator\n\t\t\t\t? accessibilityLabelCreator( value )\n\t\t\t\t: undefined\n\t\t}\n\t\taccessibilityRole=\"button\"\n\t\taccessible={ accessible }\n\t\tstyle={ { flex: 1, display: shouldDisplay ? 'flex' : 'none' } }\n\t>\n\t\t<RichText\n\t\t\t__unstableMobileNoFocusOnMount\n\t\t\tfontSize={ style && style.fontSize ? style.fontSize : 14 }\n\t\t\tinlineToolbar={ inlineToolbar }\n\t\t\tisSelected={ isSelected }\n\t\t\tonBlur={ onBlur }\n\t\t\tonChange={ onChange }\n\t\t\tplaceholder={ placeholder }\n\t\t\tplaceholderTextColor={ placeholderTextColor }\n\t\t\tstyle={ style }\n\t\t\ttagName=\"p\"\n\t\t\ttextAlign=\"center\"\n\t\t\tunderlineColorAndroid=\"transparent\"\n\t\t\tunstableOnFocus={ onFocus }\n\t\t\tvalue={ value }\n\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t}\n\t\t\tdeleteEnter\n\t\t/>\n\t</View>\n);\n\nexport default Caption;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAGA;AACA;AACA;;AAKA,MAAMI,OAAO,GAAGA,CAAE;EACjBC,yBAA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|
@@ -45,8 +45,17 @@ function ChildLayoutControl({
|
|
|
45
45
|
}) {
|
|
46
46
|
const {
|
|
47
47
|
selfStretch,
|
|
48
|
-
flexSize
|
|
48
|
+
flexSize,
|
|
49
|
+
columnSpan,
|
|
50
|
+
rowSpan
|
|
49
51
|
} = childLayout;
|
|
52
|
+
const {
|
|
53
|
+
type: parentType,
|
|
54
|
+
default: {
|
|
55
|
+
type: defaultParentType = 'default'
|
|
56
|
+
} = {}
|
|
57
|
+
} = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {};
|
|
58
|
+
const parentLayoutType = parentType || defaultParentType;
|
|
50
59
|
(0, _element.useEffect)(() => {
|
|
51
60
|
if (selfStretch === 'fixed' && !flexSize) {
|
|
52
61
|
onChange({
|
|
@@ -55,7 +64,7 @@ function ChildLayoutControl({
|
|
|
55
64
|
});
|
|
56
65
|
}
|
|
57
66
|
}, []);
|
|
58
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.__experimentalToggleGroupControl, {
|
|
67
|
+
return (0, _react.createElement)(_react.Fragment, null, parentLayoutType === 'flex' && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.__experimentalToggleGroupControl, {
|
|
59
68
|
__nextHasNoMarginBottom: true,
|
|
60
69
|
size: '__unstable-large',
|
|
61
70
|
label: childLayoutOrientation(parentLayout),
|
|
@@ -64,7 +73,6 @@ function ChildLayoutControl({
|
|
|
64
73
|
onChange: value => {
|
|
65
74
|
const newFlexSize = value !== 'fixed' ? null : flexSize;
|
|
66
75
|
onChange({
|
|
67
|
-
...childLayout,
|
|
68
76
|
selfStretch: value,
|
|
69
77
|
flexSize: newFlexSize
|
|
70
78
|
});
|
|
@@ -86,12 +94,36 @@ function ChildLayoutControl({
|
|
|
86
94
|
size: '__unstable-large',
|
|
87
95
|
onChange: value => {
|
|
88
96
|
onChange({
|
|
89
|
-
|
|
97
|
+
selfStretch,
|
|
90
98
|
flexSize: value
|
|
91
99
|
});
|
|
92
100
|
},
|
|
93
101
|
value: flexSize
|
|
94
|
-
}))
|
|
102
|
+
})), parentLayoutType === 'grid' && (0, _react.createElement)(_components.__experimentalHStack, null, (0, _react.createElement)(_components.__experimentalInputControl, {
|
|
103
|
+
size: '__unstable-large',
|
|
104
|
+
label: (0, _i18n.__)('Column Span'),
|
|
105
|
+
type: "number",
|
|
106
|
+
onChange: value => {
|
|
107
|
+
onChange({
|
|
108
|
+
rowSpan,
|
|
109
|
+
columnSpan: value
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
value: columnSpan,
|
|
113
|
+
min: 1
|
|
114
|
+
}), (0, _react.createElement)(_components.__experimentalInputControl, {
|
|
115
|
+
size: '__unstable-large',
|
|
116
|
+
label: (0, _i18n.__)('Row Span'),
|
|
117
|
+
type: "number",
|
|
118
|
+
onChange: value => {
|
|
119
|
+
onChange({
|
|
120
|
+
columnSpan,
|
|
121
|
+
rowSpan: value
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
value: rowSpan,
|
|
125
|
+
min: 1
|
|
126
|
+
})));
|
|
95
127
|
}
|
|
96
128
|
function childLayoutOrientation(parentLayout) {
|
|
97
129
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","flexSize","useEffect","_react","createElement","Fragment","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","label","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","key","__experimentalUnitControl"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst { selfStretch, flexSize } = childLayout;\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<ToggleGroupControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newFlexSize
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","flexSize","columnSpan","rowSpan","type","parentType","default","defaultParentType","parentLayoutType","useEffect","_react","createElement","Fragment","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","label","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","key","__experimentalUnitControl","__experimentalHStack","__experimentalInputControl","min"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst { selfStretch, flexSize, columnSpan, rowSpan } = childLayout;\n\tconst {\n\t\ttype: parentType,\n\t\tdefault: { type: defaultParentType = 'default' } = {},\n\t} = parentLayout ?? {};\n\tconst parentLayoutType = parentType || defaultParentType;\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ parentLayoutType === 'flex' && (\n\t\t\t\t<>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tconst newFlexSize =\n\t\t\t\t\t\t\t\tvalue !== 'fixed' ? null : flexSize;\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tselfStretch: value,\n\t\t\t\t\t\t\t\tflexSize: newFlexSize,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tkey={ 'fit' }\n\t\t\t\t\t\t\tvalue={ 'fit' }\n\t\t\t\t\t\t\tlabel={ __( 'Fit' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tkey={ 'fill' }\n\t\t\t\t\t\t\tvalue={ 'fill' }\n\t\t\t\t\t\t\tlabel={ __( 'Fill' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\t\t\tvalue={ 'fixed' }\n\t\t\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t{ selfStretch === 'fixed' && (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tselfStretch,\n\t\t\t\t\t\t\t\t\tflexSize: value,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ flexSize }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ parentLayoutType === 'grid' && (\n\t\t\t\t<HStack>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ __( 'Column Span' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\tcolumnSpan: value,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ columnSpan }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t/>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ __( 'Row Span' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\trowSpan: value,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ rowSpan }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport function childLayoutOrientation( parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\treturn orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAWA,SAASG,QAAQA,CAAEC,WAAW,EAAEC,YAAY,EAAG;EAC9C,MAAM;IAAEC,WAAW,GAAG;EAAa,CAAC,GAAGD,YAAY;EAEnD,IAAKD,WAAW,KAAK,MAAM,EAAG;IAC7B,OAAO,IAAAG,QAAE,EAAE,kCAAmC,CAAC;EAChD;EACA,IAAKH,WAAW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N,IAAAd,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAAqC,0BAAY;IACZV,IAAI,EAAG,kBAAoB;IAC3BC,KAAK,EAAG,IAAApB,QAAE,EAAE,aAAc,CAAG;IAC7BQ,IAAI,EAAC,QAAQ;IACbJ,QAAQ,EAAKF,KAAK,IAAM;MACvBE,QAAQ,CAAE;QACTG,OAAO;QACPD,UAAU,EAAEJ;MACb,CAAE,CAAC;IACJ,CAAG;IACHA,KAAK,EAAGI,UAAY;IACpBwB,GAAG,EAAG;EAAG,CACT,CAAC,EACF,IAAAhB,MAAA,CAAAC,aAAA,EAACvB,WAAA,CAAAqC,0BAAY;IACZV,IAAI,EAAG,kBAAoB;IAC3BC,KAAK,EAAG,IAAApB,QAAE,EAAE,UAAW,CAAG;IAC1BQ,IAAI,EAAC,QAAQ;IACbJ,QAAQ,EAAKF,KAAK,IAAM;MACvBE,QAAQ,CAAE;QACTE,UAAU;QACVC,OAAO,EAAEL;MACV,CAAE,CAAC;IACJ,CAAG;IACHA,KAAK,EAAGK,OAAS;IACjBuB,GAAG,EAAG;EAAG,CACT,CACM,CAER,CAAC;AAEL;AAEO,SAAST,sBAAsBA,CAAEvB,YAAY,EAAG;EACtD,MAAM;IAAEC,WAAW,GAAG;EAAa,CAAC,GAAGD,YAAY;EAEnD,OAAOC,WAAW,KAAK,YAAY,GAAG,IAAAC,QAAE,EAAE,OAAQ,CAAC,GAAG,IAAAA,QAAE,EAAE,QAAS,CAAC;AACrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_control","_interopRequireDefault","require","ColorPaletteControl","onChange","value","otherProps","_react","createElement","default","onColorChange","colorValue","gradients","disableCustomGradients"],"sources":["@wordpress/block-editor/src/components/color-palette/control.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport ColorGradientControl from '../colors-gradients/control';\n\nexport default function ColorPaletteControl( {\n\tonChange,\n\tvalue,\n\t...otherProps\n} ) {\n\treturn (\n\t\t<ColorGradientControl\n\t\t\t{ ...otherProps }\n\t\t\tonColorChange={ onChange }\n\t\t\tcolorValue={ value }\n\t\t\tgradients={ [] }\n\t\t\tdisableCustomGradients
|
|
1
|
+
{"version":3,"names":["_control","_interopRequireDefault","require","ColorPaletteControl","onChange","value","otherProps","_react","createElement","default","onColorChange","colorValue","gradients","disableCustomGradients"],"sources":["@wordpress/block-editor/src/components/color-palette/control.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport ColorGradientControl from '../colors-gradients/control';\n\nexport default function ColorPaletteControl( {\n\tonChange,\n\tvalue,\n\t...otherProps\n} ) {\n\treturn (\n\t\t<ColorGradientControl\n\t\t\t{ ...otherProps }\n\t\t\tonColorChange={ onChange }\n\t\t\tcolorValue={ value }\n\t\t\tgradients={ [] }\n\t\t\tdisableCustomGradients\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,mBAAmBA,CAAE;EAC5CC,QAAQ;EACRC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACR,QAAA,CAAAS,OAAoB;IAAA,GACfH,UAAU;IACfI,aAAa,EAAGN,QAAU;IAC1BO,UAAU,EAAGN,KAAO;IACpBO,SAAS,EAAG,EAAI;IAChBC,sBAAsB;EAAA,CACtB,CAAC;AAEJ"}
|
|
@@ -97,7 +97,7 @@ function ColorGradientControlInner({
|
|
|
97
97
|
}, showTitle && (0, _react.createElement)("legend", null, (0, _react.createElement)("div", {
|
|
98
98
|
className: "block-editor-color-gradient-control__color-indicator"
|
|
99
99
|
}, (0, _react.createElement)(_components.BaseControl.VisualLabel, null, label))), canChooseAColor && canChooseAGradient && (0, _react.createElement)("div", null, (0, _react.createElement)(Tabs, {
|
|
100
|
-
|
|
100
|
+
defaultTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color
|
|
101
101
|
}, (0, _react.createElement)(Tabs.TabList, null, (0, _react.createElement)(Tabs.Tab, {
|
|
102
102
|
tabId: TAB_IDS.color
|
|
103
103
|
}, (0, _i18n.__)('Solid')), (0, _react.createElement)(Tabs.Tab, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_useSettings","_lockUnlock","colorsAndGradientKeys","TAB_IDS","color","gradient","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","headingLevel","canChooseAColor","length","canChooseAGradient","tabPanels","_react","createElement","ColorPalette","value","onChange","newColor","GradientPicker","newGradient","renderPanelType","type","Tabs","unlock","componentsPrivateApis","BaseControl","__nextHasNoMarginBottom","classnames","__experimentalVStack","spacing","VisualLabel","initialTabId","TabList","Tab","tabId","__","TabPanel","focusable","ColorGradientControlSelect","props","customColors","customGradients","useSettings","ColorGradientControl","every","key","hasOwnProperty","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tColorPalette,\n\tGradientPicker,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_IDS = { color: 'color', gradient: 'gradient' };\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n\theadingLevel,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange &&\n\t\t( ( colors && colors.length > 0 ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ( gradients && gradients.length > 0 ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst tabPanels = {\n\t\t[ TAB_IDS.color ]: (\n\t\t\t<ColorPalette\n\t\t\t\tvalue={ colorValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onColorChange\n\t\t\t\t}\n\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t\t[ TAB_IDS.gradient ]: (\n\t\t\t<GradientPicker\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onGradientChange\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\t// Unlocking `Tabs` too early causes the `unlock` method to receive an empty\n\t// object, due to circular dependencies.\n\t// See https://github.com/WordPress/gutenberg/issues/52692\n\tconst { Tabs } = unlock( componentsPrivateApis );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<Tabs\n\t\t\t\t\t\t\t\tinitialTabId={\n\t\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t\t? TAB_IDS.gradient\n\t\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_IDS.color\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.color }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Solid' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.gradient }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Gradient' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.color }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t'block-editor-color-gradient-control__panel'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.color }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.gradient }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t'block-editor-color-gradient-control__panel'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.gradient }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! canChooseAGradient && renderPanelType( TAB_IDS.color ) }\n\t\t\t\t\t{ ! canChooseAColor && renderPanelType( TAB_IDS.gradient ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst [ colors, gradients, customColors, customGradients ] = useSettings(\n\t\t'color.palette',\n\t\t'color.gradients',\n\t\t'color.custom',\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\tcolors={ colors }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! customColors }\n\t\t\tdisableCustomGradients={ ! customGradients }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAWA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA,MAAMK,qBAAqB,GAAG,CAC7B,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,wBAAwB,CACxB;AAED,MAAMC,OAAO,GAAG;EAAEC,KAAK,EAAE,OAAO;EAAEC,QAAQ,EAAE;AAAW,CAAC;AAExD,SAASC,yBAAyBA,CAAE;EACnCC,MAAM;EACNC,SAAS;EACTC,mBAAmB;EACnBC,sBAAsB;EACtBC,iCAAiC;EACjCC,SAAS;EACTC,KAAK;EACLC,aAAa;EACbC,gBAAgB;EAChBC,UAAU;EACVC,aAAa;EACbC,SAAS;EACTC,SAAS,GAAG,IAAI;EAChBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,MAAMC,eAAe,GACpBR,aAAa,KACTP,MAAM,IAAIA,MAAM,CAACgB,MAAM,GAAG,CAAC,IAAM,CAAEd,mBAAmB,CAAE;EAC7D,MAAMe,kBAAkB,GACvBT,gBAAgB,KACZP,SAAS,IAAIA,SAAS,CAACe,MAAM,GAAG,CAAC,IAAM,CAAEb,sBAAsB,CAAE;EAEtE,IAAK,CAAEY,eAAe,IAAI,CAAEE,kBAAkB,EAAG;IAChD,OAAO,IAAI;EACZ;EAEA,MAAMC,SAAS,GAAG;IACjB,CAAEtB,OAAO,CAACC,KAAK,GACd,IAAAsB,MAAA,CAAAC,aAAA,EA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OAAO,CAACE,QAAS,CAClD,CACC,CACE,CAAC;AAEhB;AAEA,SAAS+C,0BAA0BA,CAAEC,KAAK,EAAG;EAC5C,MAAM,CAAE9C,MAAM,EAAEC,SAAS,EAAE8C,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,wBAAW,EACvE,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,sBACD,CAAC;EAED,OACC,IAAA9B,MAAA,CAAAC,aAAA,EAACrB,yBAAyB;IACzBC,MAAM,EAAGA,MAAQ;IACjBC,SAAS,EAAGA,SAAW;IACvBC,mBAAmB,EAAG,CAAE6C,YAAc;IACtC5C,sBAAsB,EAAG,CAAE6C,eAAiB;IAAA,GACvCF;EAAK,CACV,CAAC;AAEJ;AAEA,SAASI,oBAAoBA,CAAEJ,KAAK,EAAG;EACtC,IACCnD,qBAAqB,CAACwD,KAAK,CAAIC,GAAG,IAAMN,KAAK,CAACO,cAAc,CAAED,GAAI,CAAE,CAAC,EACpE;IACD,OAAO,IAAAjC,MAAA,CAAAC,aAAA,EAACrB,yBAAyB;MAAA,GAAM+C;IAAK,CAAI,CAAC;EAClD;EACA,OAAO,IAAA3B,MAAA,CAAAC,aAAA,EAACyB,0BAA0B;IAAA,GAAMC;EAAK,CAAI,CAAC;AACnD;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcN,oBAAoB"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_useSettings","_lockUnlock","colorsAndGradientKeys","TAB_IDS","color","gradient","ColorGradientControlInner","colors","gradients","disableCustomColors","disableCustomGradients","__experimentalIsRenderedInSidebar","className","label","onColorChange","onGradientChange","colorValue","gradientValue","clearable","showTitle","enableAlpha","headingLevel","canChooseAColor","length","canChooseAGradient","tabPanels","_react","createElement","ColorPalette","value","onChange","newColor","GradientPicker","newGradient","renderPanelType","type","Tabs","unlock","componentsPrivateApis","BaseControl","__nextHasNoMarginBottom","classnames","__experimentalVStack","spacing","VisualLabel","defaultTabId","TabList","Tab","tabId","__","TabPanel","focusable","ColorGradientControlSelect","props","customColors","customGradients","useSettings","ColorGradientControl","every","key","hasOwnProperty","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/colors-gradients/control.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tColorPalette,\n\tGradientPicker,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../use-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_IDS = { color: 'color', gradient: 'gradient' };\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tgradientValue,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n\theadingLevel,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange &&\n\t\t( ( colors && colors.length > 0 ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ( gradients && gradients.length > 0 ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst tabPanels = {\n\t\t[ TAB_IDS.color ]: (\n\t\t\t<ColorPalette\n\t\t\t\tvalue={ colorValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAGradient\n\t\t\t\t\t\t? ( newColor ) => {\n\t\t\t\t\t\t\t\tonColorChange( newColor );\n\t\t\t\t\t\t\t\tonGradientChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onColorChange\n\t\t\t\t}\n\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t\t[ TAB_IDS.gradient ]: (\n\t\t\t<GradientPicker\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: onGradientChange\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\t// Unlocking `Tabs` too early causes the `unlock` method to receive an empty\n\t// object, due to circular dependencies.\n\t// See https://github.com/WordPress/gutenberg/issues/52692\n\tconst { Tabs } = unlock( componentsPrivateApis );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<Tabs\n\t\t\t\t\t\t\t\tdefaultTabId={\n\t\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t\t? TAB_IDS.gradient\n\t\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_IDS.color\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.color }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Solid' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.gradient }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Gradient' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.color }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t'block-editor-color-gradient-control__panel'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.color }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.gradient }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t'block-editor-color-gradient-control__panel'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.gradient }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! canChooseAGradient && renderPanelType( TAB_IDS.color ) }\n\t\t\t\t\t{ ! canChooseAColor && renderPanelType( TAB_IDS.gradient ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst [ colors, gradients, customColors, customGradients ] = useSettings(\n\t\t'color.palette',\n\t\t'color.gradients',\n\t\t'color.custom',\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\tcolors={ colors }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! customColors }\n\t\t\tdisableCustomGradients={ ! customGradients }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAWA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA,MAAMK,qBAAqB,GAAG,CAC7B,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,wBAAwB,CACxB;AAED,MAAMC,OAAO,GAAG;EAAEC,KA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C,GAAG,IAAMN,KAAK,CAACO,cAAc,CAAED,GAAI,CAAE,CAAC,EACpE;IACD,OAAO,IAAAjC,MAAA,CAAAC,aAAA,EAACrB,yBAAyB;MAAA,GAAM+C;IAAK,CAAI,CAAC;EAClD;EACA,OAAO,IAAA3B,MAAA,CAAAC,aAAA,EAACyB,0BAA0B;IAAA,GAAMC;EAAK,CAAI,CAAC;AACnD;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcN,oBAAoB"}
|
|
@@ -94,7 +94,6 @@ function NonDefaultControls({
|
|
|
94
94
|
};
|
|
95
95
|
const [isCustom, setIsCustom] = (0, _element.useState)(() => !!format && !suggestedFormats.includes(format));
|
|
96
96
|
return (0, _react.createElement)(_components.__experimentalVStack, null, (0, _react.createElement)(_components.CustomSelectControl, {
|
|
97
|
-
__nextUnconstrainedWidth: true,
|
|
98
97
|
label: (0, _i18n.__)('Choose a format'),
|
|
99
98
|
options: [...suggestedOptions, customOption],
|
|
100
99
|
value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_date","_element","_components","EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","_react","createElement","className","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","customOption","__experimentalHint","isCustom","setIsCustom","useState","includes","__experimentalVStack","CustomSelectControl","__nextUnconstrainedWidth","options","value","find","option","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\tEXAMPLE_DATE\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,MAAMI,YAAY,GAAG,IAAIC,I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AChC,CAAC,cAAAgB,qBAAA,cAAAA,qBAAA,GAAIU,YACR;IACDxB,QAAQ,EAAGA,CAAE;MAAEqC;IAAa,CAAC,KAAM;MAClC,IAAKA,YAAY,KAAKb,YAAY,EAAG;QACpCG,WAAW,CAAE,IAAK,CAAC;MACpB,CAAC,MAAM;QACNA,WAAW,CAAE,KAAM,CAAC;QACpB3B,QAAQ,CAAEqC,YAAY,CAACvC,MAAO,CAAC;MAChC;IACD;EAAG,CACH,CAAC,EACA4B,QAAQ,IACT,IAAAzB,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAA4C,WAAW;IACX9B,uBAAuB;IACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,eAAgB,CAAG;IAC/BiC,mBAAmB;IACnB7B,IAAI,EAAG,IAAA8B,iCAAwB,EAC9B,IAAAlC,QAAE,EACD,kDACD,CAAC,EACD;MACCmC,IAAI,EACH,IAAAxC,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAgD,YAAY;QACZC,IAAI,EAAG,IAAArC,QAAE,EACR,6EACD;MAAG,CACH;IAEH,CACD,CAAG;IACH4B,KAAK,EAAGpC,MAAQ;IAChBE,QAAQ,EAAKkC,KAAK,IAAMlC,QAAQ,CAAEkC,KAAM;EAAG,CAC3C,CAEK,CAAC;AAEX"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_date","_element","_components","EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","_react","createElement","className","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","customOption","__experimentalHint","isCustom","setIsCustom","useState","includes","__experimentalVStack","CustomSelectControl","options","value","find","option","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\tEXAMPLE_DATE\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,MAAMI,YAAY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AChC,CAAC,cAAAgB,qBAAA,cAAAA,qBAAA,GAAIU,YACR;IACDxB,QAAQ,EAAGA,CAAE;MAAEoC;IAAa,CAAC,KAAM;MAClC,IAAKA,YAAY,KAAKZ,YAAY,EAAG;QACpCG,WAAW,CAAE,IAAK,CAAC;MACpB,CAAC,MAAM;QACNA,WAAW,CAAE,KAAM,CAAC;QACpB3B,QAAQ,CAAEoC,YAAY,CAACtC,MAAO,CAAC;MAChC;IACD;EAAG,CACH,CAAC,EACA4B,QAAQ,IACT,IAAAzB,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAA2C,WAAW;IACX7B,uBAAuB;IACvBC,KAAK,EAAG,IAAAH,QAAE,EAAE,eAAgB,CAAG;IAC/BgC,mBAAmB;IACnB5B,IAAI,EAAG,IAAA6B,iCAAwB,EAC9B,IAAAjC,QAAE,EACD,kDACD,CAAC,EACD;MACCkC,IAAI,EACH,IAAAvC,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAA+C,YAAY;QACZC,IAAI,EAAG,IAAApC,QAAE,EACR,6EACD;MAAG,CACH;IAEH,CACD,CAAG;IACH2B,KAAK,EAAGnC,MAAQ;IAChBE,QAAQ,EAAKiC,KAAK,IAAMjC,QAAQ,CAAEiC,KAAM;EAAG,CAC3C,CAEK,CAAC;AAEX"}
|
|
@@ -199,8 +199,7 @@ function FontAppearanceControl(props) {
|
|
|
199
199
|
value: currentSelection,
|
|
200
200
|
onChange: ({
|
|
201
201
|
selectedItem
|
|
202
|
-
}) => onChange(selectedItem.style)
|
|
203
|
-
__nextUnconstrainedWidth: true
|
|
202
|
+
}) => onChange(selectedItem.style)
|
|
204
203
|
});
|
|
205
204
|
}
|
|
206
205
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","FONT_STYLES","name","_x","value","FONT_WEIGHTS","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","onChange","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","style","undefined","combineOptions","combinedOptions","forEach","styleName","styleValue","weightName","weightValue","optionName","sprintf","push","styleOptions","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","_react","createElement","CustomSelectControl","className","describedBy","selectedItem","__nextUnconstrainedWidth"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\nconst FONT_STYLES = [\n\t{\n\t\tname: _x( 'Regular', 'font style' ),\n\t\tvalue: 'normal',\n\t},\n\t{\n\t\tname: _x( 'Italic', 'font style' ),\n\t\tvalue: 'italic',\n\t},\n];\n\nconst FONT_WEIGHTS = [\n\t{\n\t\tname: _x( 'Thin', 'font weight' ),\n\t\tvalue: '100',\n\t},\n\t{\n\t\tname: _x( 'Extra Light', 'font weight' ),\n\t\tvalue: '200',\n\t},\n\t{\n\t\tname: _x( 'Light', 'font weight' ),\n\t\tvalue: '300',\n\t},\n\t{\n\t\tname: _x( 'Regular', 'font weight' ),\n\t\tvalue: '400',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'font weight' ),\n\t\tvalue: '500',\n\t},\n\t{\n\t\tname: _x( 'Semi Bold', 'font weight' ),\n\t\tvalue: '600',\n\t},\n\t{\n\t\tname: _x( 'Bold', 'font weight' ),\n\t\tvalue: '700',\n\t},\n\t{\n\t\tname: _x( 'Extra Bold', 'font weight' ),\n\t\tvalue: '800',\n\t},\n\t{\n\t\tname: _x( 'Black', 'font weight' ),\n\t\tvalue: '900',\n\t},\n];\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display unified font style and weight options.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\n\t// Combines both font style and weight options into a single dropdown.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\n\t\tFONT_STYLES.forEach( ( { name: styleName, value: styleValue } ) => {\n\t\t\tFONT_WEIGHTS.forEach(\n\t\t\t\t( { name: weightName, value: weightValue } ) => {\n\t\t\t\t\tconst optionName =\n\t\t\t\t\t\tstyleValue === 'normal'\n\t\t\t\t\t\t\t? weightName\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Font weight name. 2: Font style name. */\n\t\t\t\t\t\t\t\t\t__( '%1$s %2$s' ),\n\t\t\t\t\t\t\t\t\tweightName,\n\t\t\t\t\t\t\t\t\tstyleName\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcombinedOptions.push( {\n\t\t\t\t\t\tkey: `${ styleValue }-${ weightValue }`,\n\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tfontStyle: styleValue,\n\t\t\t\t\t\t\tfontWeight: weightValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_STYLES.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_WEIGHTS.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [ props.options ] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t\t__nextUnconstrainedWidth\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,WAAW,GAAG,CACnB;EACCC,IAAI,EAAE,IAAAC,QAAE,EAAE,SAAS,EAAE,YAAa,CAAC;EACnCC,KAAK,EAAE;AACR,CAAC,EACD;EACCF,IAAI,EAAE,IAAAC,QAAE,EAAE,QAAQ,EAAE,YAAa,CAAC;EAClCC,KAAK,EAAE;AACR,CAAC,CACD;AAED,MAAMC,YAAY,GAAG,CACpB;EACCH,IAAI,EAAE,IAAAC,QAAE,EAAE,MAAM,EAAE,aAAc,CAAC;EACjCC,KAAK,EAAE;AACR,CAAC,EACD;EACCF,IAAI,EAAE,IAAAC,QAAE,EAAE,aAAa,EAAE,aAAc,CAAC;EACxCC,KAAK,EAAE;AACR,CAAC,EACD;EACCF,IAAI,EAAE,IAAAC,QAAE,EAAE,OAAO,EAAE,aAAc,CAAC;EAClCC,KAAK,EAAE;AACR,CAAC,EACD;EACCF,IAAI,EAAE,IAAAC,QAAE,EAAE,SA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b;MACA,IAAArB,QAAE,EAAE,mCAAoC,CAAC,EACzC4B,gBAAgB,CAACnC,IAClB,CAAC;IACF;IAEA,OAAO,IAAA4B,aAAO;IACb;IACA,IAAArB,QAAE,EAAE,wCAAyC,CAAC,EAC9C4B,gBAAgB,CAACnC,IAClB,CAAC;EACF,CAAC;EAED,OACCc,kBAAkB,IACjB,IAAAyB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAA8C,mBAAmB;IAAA,GACd5B,UAAU;IACf6B,SAAS,EAAC,oCAAoC;IAC9C3B,KAAK,EAAGA,KAAO;IACf4B,WAAW,EAAGL,cAAc,CAAC,CAAG;IAChCJ,OAAO,EAAGF,aAAe;IACzB9B,KAAK,EAAGiC,gBAAkB;IAC1BzB,QAAQ,EAAGA,CAAE;MAAEkC;IAAa,CAAC,KAC5BlC,QAAQ,CAAEkC,YAAY,CAAC1B,KAAM,CAC7B;IACD2B,wBAAwB;EAAA,CACxB,CACD;AAEH"}
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","FONT_STYLES","name","_x","value","FONT_WEIGHTS","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","onChange","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","style","undefined","combineOptions","combinedOptions","forEach","styleName","styleValue","weightName","weightValue","optionName","sprintf","push","styleOptions","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","_react","createElement","CustomSelectControl","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\nconst FONT_STYLES = [\n\t{\n\t\tname: _x( 'Regular', 'font style' ),\n\t\tvalue: 'normal',\n\t},\n\t{\n\t\tname: _x( 'Italic', 'font style' ),\n\t\tvalue: 'italic',\n\t},\n];\n\nconst FONT_WEIGHTS = [\n\t{\n\t\tname: _x( 'Thin', 'font weight' ),\n\t\tvalue: '100',\n\t},\n\t{\n\t\tname: _x( 'Extra Light', 'font weight' ),\n\t\tvalue: '200',\n\t},\n\t{\n\t\tname: _x( 'Light', 'font weight' ),\n\t\tvalue: '300',\n\t},\n\t{\n\t\tname: _x( 'Regular', 'font weight' ),\n\t\tvalue: '400',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'font weight' ),\n\t\tvalue: '500',\n\t},\n\t{\n\t\tname: _x( 'Semi Bold', 'font weight' ),\n\t\tvalue: '600',\n\t},\n\t{\n\t\tname: _x( 'Bold', 'font weight' ),\n\t\tvalue: '700',\n\t},\n\t{\n\t\tname: _x( 'Extra Bold', 'font weight' ),\n\t\tvalue: '800',\n\t},\n\t{\n\t\tname: _x( 'Black', 'font weight' ),\n\t\tvalue: '900',\n\t},\n];\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display unified font style and weight options.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\n\t// Combines both font style and weight options into a single dropdown.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\n\t\tFONT_STYLES.forEach( ( { name: styleName, value: styleValue } ) => {\n\t\t\tFONT_WEIGHTS.forEach(\n\t\t\t\t( { name: weightName, value: weightValue } ) => {\n\t\t\t\t\tconst optionName =\n\t\t\t\t\t\tstyleValue === 'normal'\n\t\t\t\t\t\t\t? weightName\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Font weight name. 2: Font style name. */\n\t\t\t\t\t\t\t\t\t__( '%1$s %2$s' ),\n\t\t\t\t\t\t\t\t\tweightName,\n\t\t\t\t\t\t\t\t\tstyleName\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcombinedOptions.push( {\n\t\t\t\t\t\tkey: `${ styleValue }-${ weightValue }`,\n\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tfontStyle: styleValue,\n\t\t\t\t\t\t\tfontWeight: weightValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_STYLES.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_WEIGHTS.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [ props.options ] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;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