@wordpress/block-editor 14.3.6 → 14.5.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/README.md +6 -2
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -1
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/background-image-control/index.js +1 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-actions/index.js +1 -13
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +1 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-inspector/index.js +56 -75
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +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.map +1 -1
- package/build/components/block-list/block.js +5 -16
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +6 -8
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -8
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +14 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +5 -3
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +24 -13
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +2 -4
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-parent-selector/index.js +14 -11
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +10 -20
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +11 -13
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +45 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +2 -4
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +2 -2
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +79 -76
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -6
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-switcher/index.js +19 -15
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +1 -0
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +16 -19
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/use-has-block-toolbar.js +3 -5
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build/components/block-tools/index.js +8 -18
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -4
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +8 -7
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +1 -12
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +14 -17
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +3 -2
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +5 -32
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +3 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/border-panel.js +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 +3 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +2 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/iframe/index.js +44 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -9
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +15 -8
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +1 -10
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +24 -5
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +22 -12
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +24 -11
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +36 -14
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/media-tab/utils.js.map +1 -1
- package/build/components/inserter/menu.js +4 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +5 -5
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +5 -5
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +1 -1
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +1 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -1
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +3 -5
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +5 -15
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/list-view/appender.js +1 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -25
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.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/list-view/use-block-selection.js +2 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/utils.js +1 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +1 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -0
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +1 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +3 -3
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/responsive-block-control/label.js +1 -1
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build/components/rich-text/index.js +3 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/toolbar-button.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -0
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -0
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tool-selector/index.js +13 -8
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -0
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/unsupported-block-details/index.native.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +0 -61
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +23 -30
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/duotone.js +4 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +1 -0
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/layout-child.js +3 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -3
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-align.js.map +1 -1
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/use-zoom-out.js +24 -16
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js.map +1 -1
- package/build/store/actions.js +18 -20
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +15 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +104 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +24 -44
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +149 -71
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +4 -3
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +2 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +1 -1
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/object.js +1 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build-module/autocompleters/block.js +1 -3
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +3 -4
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +1 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +2 -3
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +1 -13
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +1 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +1 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +1 -2
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-compare/index.js +1 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +1 -3
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +2 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +1 -2
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -3
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +1 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +1 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +57 -78
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.js +1 -1
- package/build-module/components/block-list/block-crash-warning.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +1 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +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 -2
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +1 -2
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +6 -19
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +1 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +7 -10
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -3
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +1 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -8
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +14 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +5 -3
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +24 -13
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +1 -3
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -3
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +1 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +1 -2
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -3
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +1 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +3 -6
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +14 -11
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -3
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +11 -22
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -3
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +12 -15
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +45 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -7
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +3 -6
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -4
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +1 -3
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +80 -79
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +3 -9
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +1 -2
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +1 -3
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +1 -3
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +20 -18
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -2
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +1 -2
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +1 -0
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -2
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +17 -22
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +1 -3
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +3 -5
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -20
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +2 -6
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +8 -7
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +1 -12
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +14 -17
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +2 -1
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +7 -35
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +1 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +1 -2
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -4
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -3
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.native.js +1 -2
- package/build-module/components/button-block-appender/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +1 -3
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -3
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +1 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -3
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +1 -2
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -2
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +1 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +1 -3
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/dimensions-tool/width-height-tool.js +1 -3
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -1
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +1 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/floating-toolbar/index.native.js +1 -2
- package/build-module/components/floating-toolbar/index.native.js.map +1 -1
- package/build-module/components/floating-toolbar/nav-up-icon.js +1 -2
- package/build-module/components/floating-toolbar/nav-up-icon.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +2 -2
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +2 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +2 -3
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +2 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +1 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +2 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +1 -2
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +1 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +45 -12
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -3
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +1 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/form-controls.js +1 -3
- package/build-module/components/image-editor/form-controls.js.map +1 -1
- package/build-module/components/image-editor/index.js +1 -2
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +1 -3
- package/build-module/components/image-link-destinations/index.native.js.map +1 -1
- package/build-module/components/image-size-control/index.js +1 -3
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -9
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -9
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -2
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -5
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +2 -4
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +3 -13
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +27 -8
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +22 -12
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +24 -11
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -3
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -2
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +37 -17
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +1 -3
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/media-tab/utils.js.map +1 -1
- package/build-module/components/inserter/menu.js +5 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +1 -3
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +7 -8
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/no-results.js +1 -2
- package/build-module/components/inserter/no-results.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js +1 -2
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/panel.js +1 -3
- package/build-module/components/inserter/panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -7
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +1 -2
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -2
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -2
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +1 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -5
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -3
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -1
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +6 -17
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -3
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -2
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -3
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +2 -28
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +1 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +1 -2
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +1 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +2 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -4
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +1 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +1 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +1 -2
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +3 -4
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -0
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +1 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +1 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +4 -5
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/responsive-block-control/label.js +2 -4
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +2 -2
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/enter.js +2 -2
- package/build-module/components/rich-text/event-listeners/enter.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/firefox-compat.js +2 -2
- package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-events.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.native.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +1 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.js +1 -1
- package/build-module/components/rich-text/native/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +1 -3
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +1 -3
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/toolbar-button.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -0
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +1 -2
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -3
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -0
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +1 -2
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +14 -11
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -0
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/unsupported-block-details/index.native.js +1 -2
- package/build-module/components/unsupported-block-details/index.native.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -2
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +1 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +1 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -2
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +1 -2
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -62
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/video-player/index.native.js +1 -2
- package/build-module/components/video-player/index.native.js.map +1 -1
- package/build-module/components/warning/index.js +1 -2
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +1 -2
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -3
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +24 -31
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/block-bindings.js +1 -3
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +2 -3
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +1 -2
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -3
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +5 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +1 -0
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +1 -3
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +5 -4
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +1 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +5 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +1 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-align.js.map +1 -1
- package/build-module/hooks/typography.native.js +1 -2
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +1 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +24 -17
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/layouts/constrained.js +1 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -3
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +1 -3
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/store/actions.js +17 -18
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +14 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +98 -7
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -41
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +150 -70
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +2 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +1 -1
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/utils/object.js +1 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +22 -73
- package/build-style/content.css +22 -73
- package/build-style/default-editor-styles-rtl.css +10 -1
- package/build-style/default-editor-styles.css +10 -1
- package/build-style/style-rtl.css +48 -165
- package/build-style/style.css +48 -165
- package/package.json +33 -33
- package/src/autocompleters/link.js +2 -1
- package/src/components/block-actions/index.js +1 -13
- package/src/components/block-canvas/style.scss +0 -1
- package/src/components/block-draggable/style.scss +2 -2
- package/src/components/block-inspector/index.js +79 -95
- package/src/components/block-list/block.js +7 -25
- package/src/components/block-list/content.scss +4 -63
- package/src/components/block-list/index.js +21 -29
- package/src/components/block-list/use-block-props/index.js +2 -8
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +25 -4
- package/src/components/block-list/use-in-between-inserter.js +5 -2
- package/src/components/block-list/zoom-out-separator.js +32 -14
- package/src/components/block-navigation/dropdown.js +1 -2
- package/src/components/block-parent-selector/index.js +13 -10
- package/src/components/block-pattern-setup/setup-toolbar.js +5 -10
- package/src/components/block-patterns-paging/index.js +8 -7
- package/src/components/block-patterns-paging/style.scss +10 -27
- package/src/components/block-popover/index.js +64 -2
- package/src/components/block-preview/auto.js +1 -4
- package/src/components/block-quick-navigation/index.js +1 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +120 -106
- package/src/components/block-settings-menu-controls/index.js +0 -15
- package/src/components/block-switcher/index.js +37 -30
- package/src/components/block-toolbar/index.js +22 -34
- package/src/components/block-toolbar/style.scss +10 -1
- package/src/components/block-toolbar/use-has-block-toolbar.js +19 -31
- package/src/components/block-tools/index.js +7 -27
- package/src/components/block-tools/insertion-point.js +1 -4
- package/src/components/block-tools/style.scss +0 -90
- package/src/components/block-tools/use-show-block-tools.js +10 -13
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +2 -17
- package/src/components/block-tools/zoom-out-mode-inserters.js +11 -19
- package/src/components/block-tools/zoom-out-popover.js +2 -1
- package/src/components/block-tools/zoom-out-toolbar.js +4 -36
- package/src/components/font-family/README.md +5 -1
- package/src/components/global-styles/border-panel.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +1 -1
- package/src/components/iframe/content.scss +20 -24
- package/src/components/iframe/index.js +56 -12
- package/src/components/iframe/style.scss +6 -5
- package/src/components/inner-blocks/index.js +1 -16
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -10
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/src/components/inserter/block-types-tab.js +1 -1
- package/src/components/inserter/category-tabs/index.js +1 -11
- package/src/components/inserter/hooks/use-block-types-state.js +34 -14
- package/src/components/inserter/hooks/use-insertion-point.js +35 -13
- package/src/components/inserter/hooks/use-patterns-state.js +46 -9
- package/src/components/inserter/media-tab/media-preview.js +38 -12
- package/src/components/inserter/menu.js +4 -4
- package/src/components/inserter/mobile-tab-navigation.js +10 -13
- package/src/components/inserter/quick-inserter.js +6 -5
- package/src/components/inserter/style.scss +1 -69
- package/src/components/inspector-controls-tabs/style.scss +2 -6
- package/src/components/link-control/index.js +0 -1
- package/src/components/link-control/search-input.js +4 -5
- package/src/components/link-control/search-results.js +2 -13
- package/src/components/link-control/test/index.js +84 -46
- package/src/components/list-view/block-contents.js +1 -28
- package/src/components/list-view/style.scss +0 -14
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/responsive-block-control/style.scss +0 -1
- package/src/components/rich-text/style.scss +5 -0
- package/src/components/tool-selector/index.js +15 -7
- package/src/components/tool-selector/style.scss +5 -0
- package/src/components/use-block-commands/index.js +0 -58
- package/src/components/writing-flow/use-tab-nav.js +32 -40
- package/src/content.scss +0 -1
- package/src/hooks/duotone.js +4 -1
- package/src/hooks/layout-child.js +4 -1
- package/src/hooks/position.js +4 -1
- package/src/hooks/use-zoom-out.js +36 -20
- package/src/store/actions.js +17 -15
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +120 -16
- package/src/store/reducer.js +22 -45
- package/src/store/selectors.js +218 -118
- package/src/store/test/private-actions.js +15 -0
- package/src/store/test/private-selectors.js +41 -1
- package/src/store/test/reducer.js +40 -4
- package/src/store/test/selectors.js +195 -21
- package/src/store/utils.js +4 -2
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.js +2 -0
- package/build/components/block-controls/use-has-block-controls.js +0 -43
- package/build/components/block-controls/use-has-block-controls.js.map +0 -1
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js +0 -54
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js.map +0 -1
- package/build/components/block-tools/block-selection-button.js +0 -259
- package/build/components/block-tools/block-selection-button.js.map +0 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +0 -57
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +0 -1
- package/build/components/inserter/tabs.js +0 -78
- package/build/components/inserter/tabs.js.map +0 -1
- package/build-module/components/block-controls/use-has-block-controls.js +0 -34
- package/build-module/components/block-controls/use-has-block-controls.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js +0 -48
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js.map +0 -1
- package/build-module/components/block-tools/block-selection-button.js +0 -254
- package/build-module/components/block-tools/block-selection-button.js.map +0 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +0 -49
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +0 -1
- package/build-module/components/inserter/tabs.js +0 -72
- package/build-module/components/inserter/tabs.js.map +0 -1
- package/src/components/block-controls/use-has-block-controls.js +0 -35
- package/src/components/block-list/use-block-props/use-nav-mode-exit.js +0 -46
- package/src/components/block-tools/block-selection-button.js +0 -302
- package/src/components/block-tools/block-toolbar-breadcrumb.js +0 -51
- package/src/components/inner-blocks/content.scss +0 -13
- package/src/components/inserter/tabs.js +0 -78
- package/src/components/inserter/test/block-types-tab.native.js +0 -67
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = ZoomOutToolbar;
|
|
8
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
8
|
var _icons = require("@wordpress/icons");
|
|
10
9
|
var _components = require("@wordpress/components");
|
|
11
10
|
var _data = require("@wordpress/data");
|
|
@@ -16,12 +15,7 @@ var _blockDraggable = _interopRequireDefault(require("../block-draggable"));
|
|
|
16
15
|
var _blockMover = _interopRequireDefault(require("../block-mover"));
|
|
17
16
|
var _shuffle = _interopRequireDefault(require("../block-toolbar/shuffle"));
|
|
18
17
|
var _navigableToolbar = _interopRequireDefault(require("../navigable-toolbar"));
|
|
19
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
20
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
/**
|
|
22
|
-
* External dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
19
|
/**
|
|
26
20
|
* WordPress dependencies
|
|
27
21
|
*/
|
|
@@ -37,7 +31,6 @@ function ZoomOutToolbar({
|
|
|
37
31
|
const selected = (0, _data.useSelect)(select => {
|
|
38
32
|
const {
|
|
39
33
|
getBlock,
|
|
40
|
-
hasBlockMovingClientId,
|
|
41
34
|
getNextBlockClientId,
|
|
42
35
|
getPreviousBlockClientId,
|
|
43
36
|
canRemoveBlock,
|
|
@@ -74,7 +67,6 @@ function ZoomOutToolbar({
|
|
|
74
67
|
isPrevBlockTemplatePart = prevBlockType?.name === 'core/template-part';
|
|
75
68
|
}
|
|
76
69
|
return {
|
|
77
|
-
blockMovingMode: hasBlockMovingClientId(),
|
|
78
70
|
isBlockTemplatePart,
|
|
79
71
|
isNextBlockTemplatePart,
|
|
80
72
|
isPrevBlockTemplatePart,
|
|
@@ -84,25 +76,18 @@ function ZoomOutToolbar({
|
|
|
84
76
|
};
|
|
85
77
|
}, [clientId]);
|
|
86
78
|
const {
|
|
87
|
-
blockMovingMode,
|
|
88
79
|
isBlockTemplatePart,
|
|
89
80
|
isNextBlockTemplatePart,
|
|
90
81
|
isPrevBlockTemplatePart,
|
|
91
82
|
canRemove,
|
|
92
|
-
canMove
|
|
93
|
-
setIsInserterOpened
|
|
83
|
+
canMove
|
|
94
84
|
} = selected;
|
|
95
85
|
const {
|
|
96
|
-
removeBlock
|
|
97
|
-
|
|
98
|
-
resetZoomLevel
|
|
99
|
-
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
100
|
-
const classNames = (0, _clsx.default)('zoom-out-toolbar', {
|
|
101
|
-
'is-block-moving-mode': !!blockMovingMode
|
|
102
|
-
});
|
|
86
|
+
removeBlock
|
|
87
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
103
88
|
const showBlockDraggable = canMove && !isBlockTemplatePart;
|
|
104
89
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_navigableToolbar.default, {
|
|
105
|
-
className:
|
|
90
|
+
className: "zoom-out-toolbar"
|
|
106
91
|
/* translators: accessibility text for the block toolbar */,
|
|
107
92
|
"aria-label": (0, _i18n.__)('Block tools')
|
|
108
93
|
// The variant is applied as "toolbar" when undefined, which is the black border style of the dropdown from the toolbar popover.
|
|
@@ -133,25 +118,13 @@ function ZoomOutToolbar({
|
|
|
133
118
|
}), canMove && canRemove && /*#__PURE__*/(0, _jsxRuntime.jsx)(_shuffle.default, {
|
|
134
119
|
clientId: clientId,
|
|
135
120
|
as: _components.ToolbarButton
|
|
136
|
-
}), !isBlockTemplatePart && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
137
|
-
className: "zoom-out-toolbar-button",
|
|
138
|
-
icon: _icons.edit,
|
|
139
|
-
label: (0, _i18n.__)('Edit'),
|
|
140
|
-
onClick: () => {
|
|
141
|
-
// Setting may be undefined.
|
|
142
|
-
if (typeof setIsInserterOpened === 'function') {
|
|
143
|
-
setIsInserterOpened(false);
|
|
144
|
-
}
|
|
145
|
-
__unstableSetEditorMode('edit');
|
|
146
|
-
resetZoomLevel();
|
|
147
|
-
__unstableContentRef.current?.focus();
|
|
148
|
-
}
|
|
149
121
|
}), canRemove && !isBlockTemplatePart && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
|
|
150
122
|
className: "zoom-out-toolbar-button",
|
|
151
123
|
icon: _icons.trash,
|
|
152
124
|
label: (0, _i18n.__)('Delete'),
|
|
153
125
|
onClick: () => {
|
|
154
126
|
removeBlock(clientId);
|
|
127
|
+
__unstableContentRef.current?.focus();
|
|
155
128
|
}
|
|
156
129
|
})]
|
|
157
130
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_icons","_components","_data","_blocks","_i18n","_store","_blockDraggable","_blockMover","_shuffle","_navigableToolbar","_lockUnlock","_jsxRuntime","ZoomOutToolbar","clientId","__unstableContentRef","selected","useSelect","select","getBlock","hasBlockMovingClientId","getNextBlockClientId","getPreviousBlockClientId","canRemoveBlock","canMoveBlock","getSettings","blockEditorStore","__experimentalSetIsInserterOpened","setIsInserterOpened","getBlockType","blocksStore","name","blockType","isBlockTemplatePart","isNextBlockTemplatePart","nextClientId","nextName","nextBlockType","isPrevBlockTemplatePart","prevClientId","prevName","prevBlockType","blockMovingMode","canRemove","canMove","removeBlock","__unstableSetEditorMode","resetZoomLevel","unlock","useDispatch","classNames","clsx","showBlockDraggable","jsxs","default","className","__","variant","orientation","children","jsx","clientIds","draggableProps","Button","icon","dragHandle","label","iconSize","size","tabIndex","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","as","ToolbarButton","edit","onClick","current","focus","trash"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-toolbar.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { dragHandle, trash, edit } from '@wordpress/icons';\nimport { Button, ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport BlockMover from '../block-mover';\nimport Shuffle from '../block-toolbar/shuffle';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { unlock } from '../../lock-unlock';\n\nexport default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { __experimentalSetIsInserterOpened: setIsInserterOpened } =\n\t\t\t\tgetSettings();\n\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\tconst { name } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst isBlockTemplatePart =\n\t\t\t\tblockType?.name === 'core/template-part';\n\n\t\t\tlet isNextBlockTemplatePart = false;\n\t\t\tconst nextClientId = getNextBlockClientId();\n\t\t\tif ( nextClientId ) {\n\t\t\t\tconst { name: nextName } = getBlock( nextClientId );\n\t\t\t\tconst nextBlockType = getBlockType( nextName );\n\t\t\t\tisNextBlockTemplatePart =\n\t\t\t\t\tnextBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\tlet isPrevBlockTemplatePart = false;\n\t\t\tconst prevClientId = getPreviousBlockClientId();\n\t\t\tif ( prevClientId ) {\n\t\t\t\tconst { name: prevName } = getBlock( prevClientId );\n\t\t\t\tconst prevBlockType = getBlockType( prevName );\n\t\t\t\tisPrevBlockTemplatePart =\n\t\t\t\t\tprevBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockMovingMode: hasBlockMovingClientId(),\n\t\t\t\tisBlockTemplatePart,\n\t\t\t\tisNextBlockTemplatePart,\n\t\t\t\tisPrevBlockTemplatePart,\n\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\tcanMove: canMoveBlock( clientId ),\n\t\t\t\tsetIsInserterOpened,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\tblockMovingMode,\n\t\tisBlockTemplatePart,\n\t\tisNextBlockTemplatePart,\n\t\tisPrevBlockTemplatePart,\n\t\tcanRemove,\n\t\tcanMove,\n\t\tsetIsInserterOpened,\n\t} = selected;\n\n\tconst { removeBlock, __unstableSetEditorMode, resetZoomLevel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst classNames = clsx( 'zoom-out-toolbar', {\n\t\t'is-block-moving-mode': !! blockMovingMode,\n\t} );\n\n\tconst showBlockDraggable = canMove && ! isBlockTemplatePart;\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName={ classNames }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant=\"unstyled\"\n\t\t\torientation=\"vertical\"\n\t\t>\n\t\t\t{ showBlockDraggable && (\n\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle zoom-out-toolbar-button\"\n\t\t\t\t\t\t\tlabel={ __( 'Drag' ) }\n\t\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t{ ! isBlockTemplatePart && (\n\t\t\t\t<BlockMover\n\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\thideDragHandle\n\t\t\t\t\tisBlockMoverUpButtonDisabled={ isPrevBlockTemplatePart }\n\t\t\t\t\tisBlockMoverDownButtonDisabled={ isNextBlockTemplatePart }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canMove && canRemove && (\n\t\t\t\t<Shuffle clientId={ clientId } as={ ToolbarButton } />\n\t\t\t) }\n\n\t\t\t{ ! isBlockTemplatePart && (\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"zoom-out-toolbar-button\"\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t// Setting may be undefined.\n\t\t\t\t\t\tif ( typeof setIsInserterOpened === 'function' ) {\n\t\t\t\t\t\t\tsetIsInserterOpened( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstableSetEditorMode( 'edit' );\n\t\t\t\t\t\tresetZoomLevel();\n\t\t\t\t\t\t__unstableContentRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canRemove && ! isBlockTemplatePart && (\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"zoom-out-toolbar-button\"\n\t\t\t\t\ticon={ trash }\n\t\t\t\t\tlabel={ __( 'Delete' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,QAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAA2C,IAAAY,WAAA,GAAAZ,OAAA;AAtB3C;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAQe,SAASa,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAqB,CAAC,EAAG;EAC5E,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAM;IACb,MAAM;MACLC,QAAQ;MACRC,sBAAsB;MACtBC,oBAAoB;MACpBC,wBAAwB;MACxBC,cAAc;MACdC,YAAY;MACZC;IACD,CAAC,GAAGP,MAAM,CAAEQ,YAAiB,CAAC;IAE9B,MAAM;MAAEC,iCAAiC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,EAAI;MACfC,IAAI,EAAC;IAAS,CACd,CACD,EACCxB,OAAO,IAAID,SAAS,iBACrB,IAAA/B,WAAA,CAAAgD,GAAA,EAACnD,QAAA,CAAA6C,OAAO;MAACxC,QAAQ,EAAGA,QAAU;MAAC2D,EAAE,EAAGC;IAAe,CAAE,CACrD,EAEC,CAAEzC,mBAAmB,iBACtB,IAAArB,WAAA,CAAAgD,GAAA,EAAC1D,WAAA,CAAAwE,aAAa;MACbnB,SAAS,EAAC,yBAAyB;MACnCS,IAAI,EAAGW,WAAM;MACbT,KAAK,EAAG,IAAAV,QAAE,EAAE,MAAO,CAAG;MACtBoB,OAAO,EAAGA,CAAA,KAAM;QACf;QACA,IAAK,OAAOhD,mBAAmB,KAAK,UAAU,EAAG;UAChDA,mBAAmB,CAAE,KAAM,CAAC;QAC7B;QACAkB,uBAAuB,CAAE,MAAO,CAAC;QACjCC,cAAc,CAAC,CAAC;QAChBhC,oBAAoB,CAAC8D,OAAO,EAAEC,KAAK,CAAC,CAAC;MACtC;IAAG,CACH,CACD,EAECnC,SAAS,IAAI,CAAEV,mBAAmB,iBACnC,IAAArB,WAAA,CAAAgD,GAAA,EAAC1D,WAAA,CAAAwE,aAAa;MACbnB,SAAS,EAAC,yBAAyB;MACnCS,IAAI,EAAGe,YAAO;MACdb,KAAK,EAAG,IAAAV,QAAE,EAAE,QAAS,CAAG;MACxBoB,OAAO,EAAGA,CAAA,KAAM;QACf/B,WAAW,CAAE/B,QAAS,CAAC;MACxB;IAAG,CACH,CACD;EAAA,CACgB,CAAC;AAErB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_icons","require","_components","_data","_blocks","_i18n","_store","_blockDraggable","_interopRequireDefault","_blockMover","_shuffle","_navigableToolbar","_jsxRuntime","ZoomOutToolbar","clientId","__unstableContentRef","selected","useSelect","select","getBlock","getNextBlockClientId","getPreviousBlockClientId","canRemoveBlock","canMoveBlock","getSettings","blockEditorStore","__experimentalSetIsInserterOpened","setIsInserterOpened","getBlockType","blocksStore","name","blockType","isBlockTemplatePart","isNextBlockTemplatePart","nextClientId","nextName","nextBlockType","isPrevBlockTemplatePart","prevClientId","prevName","prevBlockType","canRemove","canMove","removeBlock","useDispatch","showBlockDraggable","jsxs","default","className","__","variant","orientation","children","jsx","clientIds","draggableProps","Button","icon","dragHandle","label","iconSize","size","tabIndex","hideDragHandle","isBlockMoverUpButtonDisabled","isBlockMoverDownButtonDisabled","as","ToolbarButton","trash","onClick","current","focus"],"sources":["@wordpress/block-editor/src/components/block-tools/zoom-out-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { dragHandle, trash } from '@wordpress/icons';\nimport { Button, ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockDraggable from '../block-draggable';\nimport BlockMover from '../block-mover';\nimport Shuffle from '../block-toolbar/shuffle';\nimport NavigableToolbar from '../navigable-toolbar';\n\nexport default function ZoomOutToolbar( { clientId, __unstableContentRef } ) {\n\tconst selected = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlock,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tcanMoveBlock,\n\t\t\t\tgetSettings,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { __experimentalSetIsInserterOpened: setIsInserterOpened } =\n\t\t\t\tgetSettings();\n\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\tconst { name } = getBlock( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst isBlockTemplatePart =\n\t\t\t\tblockType?.name === 'core/template-part';\n\n\t\t\tlet isNextBlockTemplatePart = false;\n\t\t\tconst nextClientId = getNextBlockClientId();\n\t\t\tif ( nextClientId ) {\n\t\t\t\tconst { name: nextName } = getBlock( nextClientId );\n\t\t\t\tconst nextBlockType = getBlockType( nextName );\n\t\t\t\tisNextBlockTemplatePart =\n\t\t\t\t\tnextBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\tlet isPrevBlockTemplatePart = false;\n\t\t\tconst prevClientId = getPreviousBlockClientId();\n\t\t\tif ( prevClientId ) {\n\t\t\t\tconst { name: prevName } = getBlock( prevClientId );\n\t\t\t\tconst prevBlockType = getBlockType( prevName );\n\t\t\t\tisPrevBlockTemplatePart =\n\t\t\t\t\tprevBlockType?.name === 'core/template-part';\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisBlockTemplatePart,\n\t\t\t\tisNextBlockTemplatePart,\n\t\t\t\tisPrevBlockTemplatePart,\n\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\tcanMove: canMoveBlock( clientId ),\n\t\t\t\tsetIsInserterOpened,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\tisBlockTemplatePart,\n\t\tisNextBlockTemplatePart,\n\t\tisPrevBlockTemplatePart,\n\t\tcanRemove,\n\t\tcanMove,\n\t} = selected;\n\n\tconst { removeBlock } = useDispatch( blockEditorStore );\n\n\tconst showBlockDraggable = canMove && ! isBlockTemplatePart;\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"zoom-out-toolbar\"\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant=\"unstyled\"\n\t\t\torientation=\"vertical\"\n\t\t>\n\t\t\t{ showBlockDraggable && (\n\t\t\t\t<BlockDraggable clientIds={ [ clientId ] }>\n\t\t\t\t\t{ ( draggableProps ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ dragHandle }\n\t\t\t\t\t\t\tclassName=\"block-selection-button_drag-handle zoom-out-toolbar-button\"\n\t\t\t\t\t\t\tlabel={ __( 'Drag' ) }\n\t\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t// Should not be able to tab to drag handle as this\n\t\t\t\t\t\t\t// button can only be used with a pointer device.\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t{ ...draggableProps }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t) }\n\t\t\t{ ! isBlockTemplatePart && (\n\t\t\t\t<BlockMover\n\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\thideDragHandle\n\t\t\t\t\tisBlockMoverUpButtonDisabled={ isPrevBlockTemplatePart }\n\t\t\t\t\tisBlockMoverDownButtonDisabled={ isNextBlockTemplatePart }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canMove && canRemove && (\n\t\t\t\t<Shuffle clientId={ clientId } as={ ToolbarButton } />\n\t\t\t) }\n\n\t\t\t{ canRemove && ! isBlockTemplatePart && (\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"zoom-out-toolbar-button\"\n\t\t\t\t\ticon={ trash }\n\t\t\t\t\tlabel={ __( 'Delete' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t\t\t__unstableContentRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAC,sBA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I;QAAA,GACRP;MAAc,CACnB;IACD,CACc,CAChB,EACC,CAAEvB,mBAAmB,iBACtB,IAAApB,WAAA,CAAAyC,GAAA,EAAC5C,WAAA,CAAAsC,OAAU;MACVO,SAAS,EAAG,CAAExC,QAAQ,CAAI;MAC1BiD,cAAc;MACdC,4BAA4B,EAAG3B,uBAAyB;MACxD4B,8BAA8B,EAAGhC,uBAAyB;MAC1D2B,QAAQ,EAAG,EAAI;MACfC,IAAI,EAAC;IAAS,CACd,CACD,EACCnB,OAAO,IAAID,SAAS,iBACrB,IAAA7B,WAAA,CAAAyC,GAAA,EAAC3C,QAAA,CAAAqC,OAAO;MAACjC,QAAQ,EAAGA,QAAU;MAACoD,EAAE,EAAGC;IAAe,CAAE,CACrD,EAEC1B,SAAS,IAAI,CAAET,mBAAmB,iBACnC,IAAApB,WAAA,CAAAyC,GAAA,EAACnD,WAAA,CAAAiE,aAAa;MACbnB,SAAS,EAAC,yBAAyB;MACnCS,IAAI,EAAGW,YAAO;MACdT,KAAK,EAAG,IAAAV,QAAE,EAAE,QAAS,CAAG;MACxBoB,OAAO,EAAGA,CAAA,KAAM;QACf1B,WAAW,CAAE7B,QAAS,CAAC;QACvBC,oBAAoB,CAACuD,OAAO,EAAEC,KAAK,CAAC,CAAC;MACtC;IAAG,CACH,CACD;EAAA,CACgB,CAAC;AAErB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_compose","_inserterListItem","_interopRequireDefault","_inserterListbox","_jsxRuntime","chunk","array","size","chunks","i","j","length","push","slice","BlockTypesList","items","onSelect","onHover","children","label","isDraggable","className","listId","useInstanceId","jsxs","InserterListboxGroup","map","row","jsx","InserterListboxRow","item","default","getBlockMenuDefaultClassName","id","isDisabled","isFirst","rowId","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-types-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockMenuDefaultClassName } from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport InserterListItem from '../inserter-list-item';\nimport { InserterListboxGroup, InserterListboxRow } from '../inserter-listbox';\n\nfunction chunk( array, size ) {\n\tconst chunks = [];\n\tfor ( let i = 0, j = array.length; i < j; i += size ) {\n\t\tchunks.push( array.slice( i, i + size ) );\n\t}\n\treturn chunks;\n}\n\nfunction BlockTypesList( {\n\titems = [],\n\tonSelect,\n\tonHover = () => {},\n\tchildren,\n\tlabel,\n\tisDraggable = true,\n} ) {\n\tconst className = 'block-editor-block-types-list';\n\tconst listId = useInstanceId( BlockTypesList, className );\n\treturn (\n\t\t<InserterListboxGroup className={ className } aria-label={ label }>\n\t\t\t{ chunk( items, 3 ).map( ( row, i ) => (\n\t\t\t\t<InserterListboxRow key={ i }>\n\t\t\t\t\t{ row.map( ( item, j ) => (\n\t\t\t\t\t\t<InserterListItem\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tclassName={ getBlockMenuDefaultClassName(\n\t\t\t\t\t\t\t\titem.id\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tisDraggable={ isDraggable && ! item.isDisabled }\n\t\t\t\t\t\t\tisFirst={ i === 0 && j === 0 }\n\t\t\t\t\t\t\trowId={ `${ listId }-${ i }` }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</InserterListboxRow>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</InserterListboxGroup>\n\t);\n}\n\nexport default BlockTypesList;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAA+E,IAAAK,WAAA,GAAAL,OAAA;AAV/E;A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AW,EAAGA,WAAW,IAAI,CAAEU,IAAI,CAACI,UAAY;QAChDC,OAAO,EAAG1B,CAAC,KAAK,CAAC,IAAIC,CAAC,KAAK,CAAG;QAC9B0B,KAAK,
|
|
1
|
+
{"version":3,"names":["_blocks","require","_compose","_inserterListItem","_interopRequireDefault","_inserterListbox","_jsxRuntime","chunk","array","size","chunks","i","j","length","push","slice","BlockTypesList","items","onSelect","onHover","children","label","isDraggable","className","listId","useInstanceId","jsxs","InserterListboxGroup","map","row","jsx","InserterListboxRow","item","default","getBlockMenuDefaultClassName","id","isDisabled","isFirst","rowId","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-types-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockMenuDefaultClassName } from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport InserterListItem from '../inserter-list-item';\nimport { InserterListboxGroup, InserterListboxRow } from '../inserter-listbox';\n\nfunction chunk( array, size ) {\n\tconst chunks = [];\n\tfor ( let i = 0, j = array.length; i < j; i += size ) {\n\t\tchunks.push( array.slice( i, i + size ) );\n\t}\n\treturn chunks;\n}\n\nfunction BlockTypesList( {\n\titems = [],\n\tonSelect,\n\tonHover = () => {},\n\tchildren,\n\tlabel,\n\tisDraggable = true,\n} ) {\n\tconst className = 'block-editor-block-types-list';\n\tconst listId = useInstanceId( BlockTypesList, className );\n\treturn (\n\t\t<InserterListboxGroup className={ className } aria-label={ label }>\n\t\t\t{ chunk( items, 3 ).map( ( row, i ) => (\n\t\t\t\t<InserterListboxRow key={ i }>\n\t\t\t\t\t{ row.map( ( item, j ) => (\n\t\t\t\t\t\t<InserterListItem\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tclassName={ getBlockMenuDefaultClassName(\n\t\t\t\t\t\t\t\titem.id\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tisDraggable={ isDraggable && ! item.isDisabled }\n\t\t\t\t\t\t\tisFirst={ i === 0 && j === 0 }\n\t\t\t\t\t\t\trowId={ `${ listId }-${ i }` }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</InserterListboxRow>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</InserterListboxGroup>\n\t);\n}\n\nexport default BlockTypesList;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAA+E,IAAAK,WAAA,GAAAL,OAAA;AAV/E;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASM,KAAKA,CAAEC,KAAK,EAAEC,IAAI,EAAG;EAC7B,MAAMC,MAAM,GAAG,EAAE;EACjB,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAGJ,KAAK,CAACK,MAAM,EAAEF,CAAC,GAAGC,CAAC,EAAED,CAAC,IAAIF,IAAI,EAAG;IACrDC,MAAM,CAACI,IAAI,CAAEN,KAAK,CAACO,KAAK,CAAEJ,CAAC,EAAEA,CAAC,GAAGF,IAAK,CAAE,CAAC;EAC1C;EACA,OAAOC,MAAM;AACd;AAEA,SAASM,cAAcA,CAAE;EACxBC,KAAK,GAAG,EAAE;EACVC,QAAQ;EACRC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClBC,QAAQ;EACRC,KAAK;EACLC,WAAW,GAAG;AACf,CAAC,EAAG;EACH,MAAMC,SAAS,GAAG,+BAA+B;EACjD,MAAMC,MAAM,GAAG,IAAAC,sBAAa,EAAET,cAAc,EAAEO,SAAU,CAAC;EACzD,oBACC,IAAAjB,WAAA,CAAAoB,IAAA,EAACrB,gBAAA,CAAAsB,oBAAoB;IAACJ,SAAS,EAAGA,SAAW;IAAC,cAAaF,KAAO;IAAAD,QAAA,GAC/Db,KAAK,CAAEU,KAAK,EAAE,CAAE,CAAC,CAACW,GAAG,CAAE,CAAEC,GAAG,EAAElB,CAAC,kBAChC,IAAAL,WAAA,CAAAwB,GAAA,EAACzB,gBAAA,CAAA0B,kBAAkB;MAAAX,QAAA,EAChBS,GAAG,CAACD,GAAG,CAAE,CAAEI,IAAI,EAAEpB,CAAC,kBACnB,IAAAN,WAAA,CAAAwB,GAAA,EAAC3B,iBAAA,CAAA8B,OAAgB;QAEhBD,IAAI,EAAGA,IAAM;QACbT,SAAS,EAAG,IAAAW,oCAA4B,EACvCF,IAAI,CAACG,EACN,CAAG;QACHjB,QAAQ,EAAGA,QAAU;QACrBC,OAAO,EAAGA,OAAS;QACnBG,WAAW,EAAGA,WAAW,IAAI,CAAEU,IAAI,CAACI,UAAY;QAChDC,OAAO,EAAG1B,CAAC,KAAK,CAAC,IAAIC,CAAC,KAAK,CAAG;QAC9B0B,KAAK,EAAG,GAAId,MAAM,IAAMb,CAAC;MAAK,GATxBqB,IAAI,CAACG,EAUX,CACA;IAAC,GAdsBxB,CAeN,CACnB,CAAC,EACDS,QAAQ;EAAA,CACW,CAAC;AAEzB;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAAP,OAAA,GAEcjB,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_element","_components","_compose","_style","_interopRequireDefault","_inserterButton","_jsxRuntime","MIN_COL_NUM","BlockTypesList","name","sections","onSelect","label","listProps","initialNumToRender","numberOfColumns","setNumberOfColumns","useState","itemWidth","setItemWidth","maxWidth","setMaxWidth","useEffect","dimensionsChangeSubscription","Dimensions","addEventListener","onLayout","remove","calculateItemWidth","paddingLeft","itemPaddingLeft","paddingRight","itemPaddingRight","InserterButton","Styles","modalItem","width","modalIconWrapper","columnStyle","styles","sumLeftRightPadding","bottomSheetWidth","BottomSheet","getWidth","containerTotalWidth","itemTotalWidth","columnsFitToWidth","Math","floor","numColumns","max","updatedItemWidth","contentContainerStyle","StyleSheet","flatten","renderSection","item","jsx","TouchableWithoutFeedback","accessible","children","FlatList","data","list","ItemSeparatorComponent","View","style","scrollEnabled","renderItem","renderListItem","default","colorScheme","usePreferredColorScheme","sectionHeaderGradientValue","sectionHeaderTitleStyles","usePreferredColorSchemeStyle","renderSectionHeader","section","metadata","icon","title","jsxs","Gradient","gradientValue","Text","SectionList","testID","accessibilityLabel","keyboardShouldPersistTaps","paddingBottom","safeAreaBottomInset"],"sources":["@wordpress/block-editor/src/components/block-types-list/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tDimensions,\n\tFlatList,\n\tSectionList,\n\tStyleSheet,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { BottomSheet, Gradient } from '@wordpress/components';\nimport {\n\tusePreferredColorScheme,\n\tusePreferredColorSchemeStyle,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport InserterButton from '../inserter-button';\n\nconst MIN_COL_NUM = 3;\n\nexport default function BlockTypesList( {\n\tname,\n\tsections,\n\tonSelect,\n\tlabel,\n\tlistProps,\n\tinitialNumToRender = 3,\n} ) {\n\tconst [ numberOfColumns, setNumberOfColumns ] = useState( MIN_COL_NUM );\n\tconst [ itemWidth, setItemWidth ] = useState();\n\tconst [ maxWidth, setMaxWidth ] = useState();\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonLayout\n\t\t);\n\t\tonLayout();\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tfunction calculateItemWidth() {\n\t\tconst { paddingLeft: itemPaddingLeft, paddingRight: itemPaddingRight } =\n\t\t\tInserterButton.Styles.modalItem;\n\t\tconst { width } = InserterButton.Styles.modalIconWrapper;\n\t\treturn width + itemPaddingLeft + itemPaddingRight;\n\t}\n\n\tfunction onLayout() {\n\t\tconst columnStyle = styles[ 'block-types-list__column' ];\n\t\tconst sumLeftRightPadding =\n\t\t\tcolumnStyle.paddingLeft + columnStyle.paddingRight;\n\n\t\tconst bottomSheetWidth = BottomSheet.getWidth();\n\t\tconst containerTotalWidth = bottomSheetWidth - sumLeftRightPadding;\n\t\tconst itemTotalWidth = calculateItemWidth();\n\n\t\tconst columnsFitToWidth = Math.floor(\n\t\t\tcontainerTotalWidth / itemTotalWidth\n\t\t);\n\n\t\tconst numColumns = Math.max( MIN_COL_NUM, columnsFitToWidth );\n\n\t\tsetNumberOfColumns( numColumns );\n\t\tsetMaxWidth( containerTotalWidth / numColumns );\n\n\t\tif ( columnsFitToWidth < MIN_COL_NUM ) {\n\t\t\tconst updatedItemWidth =\n\t\t\t\t( bottomSheetWidth - 2 * sumLeftRightPadding ) / MIN_COL_NUM;\n\t\t\tsetItemWidth( updatedItemWidth );\n\t\t}\n\t}\n\n\tconst contentContainerStyle = StyleSheet.flatten(\n\t\tlistProps.contentContainerStyle\n\t);\n\n\tconst renderSection = ( { item } ) => {\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t<FlatList\n\t\t\t\t\tdata={ item.list }\n\t\t\t\t\tkey={ `InserterUI-${ name }-${ numberOfColumns }` } // Re-render when numberOfColumns changes.\n\t\t\t\t\tnumColumns={ numberOfColumns }\n\t\t\t\t\tItemSeparatorComponent={ () => (\n\t\t\t\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tstyles[ 'block-types-list__row-separator' ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t) }\n\t\t\t\t\tscrollEnabled={ false }\n\t\t\t\t\trenderItem={ renderListItem }\n\t\t\t\t/>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t};\n\n\tconst renderListItem = ( { item } ) => {\n\t\treturn (\n\t\t\t<InserterButton\n\t\t\t\titem={ item }\n\t\t\t\titemWidth={ itemWidth }\n\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst colorScheme = usePreferredColorScheme();\n\tconst sectionHeaderGradientValue =\n\t\tcolorScheme === 'light'\n\t\t\t? 'linear-gradient(#fff 70%, rgba(255, 255, 255, 0))'\n\t\t\t: 'linear-gradient(#2e2e2e 70%, rgba(46, 46, 46, 0))';\n\tconst sectionHeaderTitleStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'block-types-list__section-header-title' ],\n\t\tstyles[ 'block-types-list__section-header-title--dark' ]\n\t);\n\n\tconst renderSectionHeader = ( { section: { metadata } } ) => {\n\t\tif ( ! metadata?.icon || ! metadata?.title ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t<Gradient\n\t\t\t\t\tgradientValue={ sectionHeaderGradientValue }\n\t\t\t\t\tstyle={ styles[ 'block-types-list__section-header' ] }\n\t\t\t\t>\n\t\t\t\t\t{ metadata?.icon }\n\t\t\t\t\t<Text style={ sectionHeaderTitleStyles }>\n\t\t\t\t\t\t{ metadata?.title }\n\t\t\t\t\t</Text>\n\t\t\t\t</Gradient>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t};\n\n\treturn (\n\t\t<SectionList\n\t\t\tonLayout={ onLayout }\n\t\t\ttestID={ `InserterUI-${ name }` }\n\t\t\taccessibilityLabel={ label }\n\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\tsections={ sections }\n\t\t\tinitialNumToRender={ initialNumToRender }\n\t\t\trenderItem={ renderSection }\n\t\t\trenderSectionHeader={ renderSectionHeader }\n\t\t\t{ ...listProps }\n\t\t\tcontentContainerStyle={ {\n\t\t\t\t...contentContainerStyle,\n\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAaA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAQA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,eAAA,GAAAD,sBAAA,CAAAL,OAAA;AAAgD,IAAAO,WAAA,GAAAP,OAAA;AA3BhD;AACA;AACA;;AAWA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAMQ,WAAW,GAAG,CAAC;AAEN,SAASC,cAAcA,CAAE;EACvCC,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,kBAAkB,GAAG;AACtB,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAEV,WAAY,CAAC;EACvE,MAAM,CAAEW,SAAS,EAAEC,YAAY,CAAE,GAAG,IAAAF,iBAAQ,EAAC,CAAC;EAC9C,MAAM,CAAEG,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAJ,iBAAQ,EAAC,CAAC;EAE5C,IAAAK,kBAAS,EAAE,MAAM;IAChB,MAAMC,4BAA4B,GAAGC,uBAAU,CAACC,gBAAgB,CAC/D,QAAQ,EACRC,QACD,CAAC;IACDA,QAAQ,CAAC,CAAC;IACV,OAAO,MAAM;MACZH,4BAA4B,CAACI,MAAM,CAAC,CAAC;IACtC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,SAASC,kBAAkBA,CAAA,EAAG;IAC7B,MAAM;MAAEC,WAAW,EAA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E,WAAA,CAAAmD,GAAA,EAAC3D,YAAA,CAAA4D,wBAAwB;MAACC,UAAU,EAAG,KAAO;MAAAC,QAAA,eAC7C,IAAAtD,WAAA,CAAA2E,IAAA,EAAChF,WAAA,CAAAiF,QAAQ;QACRC,aAAa,EAAGV,0BAA4B;QAC5CP,KAAK,EAAG3B,cAAM,CAAE,kCAAkC,CAAI;QAAAqB,QAAA,GAEpDkB,QAAQ,EAAEC,IAAI,eAChB,IAAAzE,WAAA,CAAAmD,GAAA,EAAC3D,YAAA,CAAAsF,IAAI;UAAClB,KAAK,EAAGQ,wBAA0B;UAAAd,QAAA,EACrCkB,QAAQ,EAAEE;QAAK,CACZ,CAAC;MAAA,CACE;IAAC,CACc,CAAC;EAE7B,CAAC;EAED,oBACC,IAAA1E,WAAA,CAAAmD,GAAA,EAAC3D,YAAA,CAAAuF,WAAW;IACX3D,QAAQ,EAAGA,QAAU;IACrB4D,MAAM,EAAI,cAAc7E,IAAM,EAAG;IACjC8E,kBAAkB,EAAG3E,KAAO;IAC5B4E,yBAAyB,EAAC,QAAQ;IAClC9E,QAAQ,EAAGA,QAAU;IACrBI,kBAAkB,EAAGA,kBAAoB;IACzCsD,UAAU,EAAGb,aAAe;IAC5BqB,mBAAmB,EAAGA,mBAAqB;IAAA,GACtC/D,SAAS;IACduC,qBAAqB,EAAG;MACvB,GAAGA,qBAAqB;MACxBqC,aAAa,EAAE1C,IAAI,CAACG,GAAG,CACtBrC,SAAS,CAAC6E,mBAAmB,EAC7BtC,qBAAqB,CAACqC,aACvB;IACD;EAAG,CACH,CAAC;AAEJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_element","_components","_compose","_style","_interopRequireDefault","_inserterButton","_jsxRuntime","MIN_COL_NUM","BlockTypesList","name","sections","onSelect","label","listProps","initialNumToRender","numberOfColumns","setNumberOfColumns","useState","itemWidth","setItemWidth","maxWidth","setMaxWidth","useEffect","dimensionsChangeSubscription","Dimensions","addEventListener","onLayout","remove","calculateItemWidth","paddingLeft","itemPaddingLeft","paddingRight","itemPaddingRight","InserterButton","Styles","modalItem","width","modalIconWrapper","columnStyle","styles","sumLeftRightPadding","bottomSheetWidth","BottomSheet","getWidth","containerTotalWidth","itemTotalWidth","columnsFitToWidth","Math","floor","numColumns","max","updatedItemWidth","contentContainerStyle","StyleSheet","flatten","renderSection","item","jsx","TouchableWithoutFeedback","accessible","children","FlatList","data","list","ItemSeparatorComponent","View","style","scrollEnabled","renderItem","renderListItem","default","colorScheme","usePreferredColorScheme","sectionHeaderGradientValue","sectionHeaderTitleStyles","usePreferredColorSchemeStyle","renderSectionHeader","section","metadata","icon","title","jsxs","Gradient","gradientValue","Text","SectionList","testID","accessibilityLabel","keyboardShouldPersistTaps","paddingBottom","safeAreaBottomInset"],"sources":["@wordpress/block-editor/src/components/block-types-list/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tDimensions,\n\tFlatList,\n\tSectionList,\n\tStyleSheet,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\nimport { BottomSheet, Gradient } from '@wordpress/components';\nimport {\n\tusePreferredColorScheme,\n\tusePreferredColorSchemeStyle,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport InserterButton from '../inserter-button';\n\nconst MIN_COL_NUM = 3;\n\nexport default function BlockTypesList( {\n\tname,\n\tsections,\n\tonSelect,\n\tlabel,\n\tlistProps,\n\tinitialNumToRender = 3,\n} ) {\n\tconst [ numberOfColumns, setNumberOfColumns ] = useState( MIN_COL_NUM );\n\tconst [ itemWidth, setItemWidth ] = useState();\n\tconst [ maxWidth, setMaxWidth ] = useState();\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonLayout\n\t\t);\n\t\tonLayout();\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tfunction calculateItemWidth() {\n\t\tconst { paddingLeft: itemPaddingLeft, paddingRight: itemPaddingRight } =\n\t\t\tInserterButton.Styles.modalItem;\n\t\tconst { width } = InserterButton.Styles.modalIconWrapper;\n\t\treturn width + itemPaddingLeft + itemPaddingRight;\n\t}\n\n\tfunction onLayout() {\n\t\tconst columnStyle = styles[ 'block-types-list__column' ];\n\t\tconst sumLeftRightPadding =\n\t\t\tcolumnStyle.paddingLeft + columnStyle.paddingRight;\n\n\t\tconst bottomSheetWidth = BottomSheet.getWidth();\n\t\tconst containerTotalWidth = bottomSheetWidth - sumLeftRightPadding;\n\t\tconst itemTotalWidth = calculateItemWidth();\n\n\t\tconst columnsFitToWidth = Math.floor(\n\t\t\tcontainerTotalWidth / itemTotalWidth\n\t\t);\n\n\t\tconst numColumns = Math.max( MIN_COL_NUM, columnsFitToWidth );\n\n\t\tsetNumberOfColumns( numColumns );\n\t\tsetMaxWidth( containerTotalWidth / numColumns );\n\n\t\tif ( columnsFitToWidth < MIN_COL_NUM ) {\n\t\t\tconst updatedItemWidth =\n\t\t\t\t( bottomSheetWidth - 2 * sumLeftRightPadding ) / MIN_COL_NUM;\n\t\t\tsetItemWidth( updatedItemWidth );\n\t\t}\n\t}\n\n\tconst contentContainerStyle = StyleSheet.flatten(\n\t\tlistProps.contentContainerStyle\n\t);\n\n\tconst renderSection = ( { item } ) => {\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t<FlatList\n\t\t\t\t\tdata={ item.list }\n\t\t\t\t\tkey={ `InserterUI-${ name }-${ numberOfColumns }` } // Re-render when numberOfColumns changes.\n\t\t\t\t\tnumColumns={ numberOfColumns }\n\t\t\t\t\tItemSeparatorComponent={ () => (\n\t\t\t\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tstyles[ 'block-types-list__row-separator' ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t) }\n\t\t\t\t\tscrollEnabled={ false }\n\t\t\t\t\trenderItem={ renderListItem }\n\t\t\t\t/>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t};\n\n\tconst renderListItem = ( { item } ) => {\n\t\treturn (\n\t\t\t<InserterButton\n\t\t\t\titem={ item }\n\t\t\t\titemWidth={ itemWidth }\n\t\t\t\tmaxWidth={ maxWidth }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst colorScheme = usePreferredColorScheme();\n\tconst sectionHeaderGradientValue =\n\t\tcolorScheme === 'light'\n\t\t\t? 'linear-gradient(#fff 70%, rgba(255, 255, 255, 0))'\n\t\t\t: 'linear-gradient(#2e2e2e 70%, rgba(46, 46, 46, 0))';\n\tconst sectionHeaderTitleStyles = usePreferredColorSchemeStyle(\n\t\tstyles[ 'block-types-list__section-header-title' ],\n\t\tstyles[ 'block-types-list__section-header-title--dark' ]\n\t);\n\n\tconst renderSectionHeader = ( { section: { metadata } } ) => {\n\t\tif ( ! metadata?.icon || ! metadata?.title ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback accessible={ false }>\n\t\t\t\t<Gradient\n\t\t\t\t\tgradientValue={ sectionHeaderGradientValue }\n\t\t\t\t\tstyle={ styles[ 'block-types-list__section-header' ] }\n\t\t\t\t>\n\t\t\t\t\t{ metadata?.icon }\n\t\t\t\t\t<Text style={ sectionHeaderTitleStyles }>\n\t\t\t\t\t\t{ metadata?.title }\n\t\t\t\t\t</Text>\n\t\t\t\t</Gradient>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t};\n\n\treturn (\n\t\t<SectionList\n\t\t\tonLayout={ onLayout }\n\t\t\ttestID={ `InserterUI-${ name }` }\n\t\t\taccessibilityLabel={ label }\n\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\tsections={ sections }\n\t\t\tinitialNumToRender={ initialNumToRender }\n\t\t\trenderItem={ renderSection }\n\t\t\trenderSectionHeader={ renderSectionHeader }\n\t\t\t{ ...listProps }\n\t\t\tcontentContainerStyle={ {\n\t\t\t\t...contentContainerStyle,\n\t\t\t\tpaddingBottom: Math.max(\n\t\t\t\t\tlistProps.safeAreaBottomInset,\n\t\t\t\t\tcontentContainerStyle.paddingBottom\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAaA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAQA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,eAAA,GAAAD,sBAAA,CAAAL,OAAA;AAAgD,IAAAO,WAAA,GAAAP,OAAA;AA3BhD;AACA;AACA;;AAWA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAMQ,WAAW,GAAG,CAAC;AAEN,SAASC,cAAcA,CAAE;EACvCC,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,kBAAkB,GAAG;AACtB,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAEV,WAAY,CAAC;EACvE,MAAM,CAAEW,SAAS,EAAEC,YAAY,CAAE,GAAG,IAAAF,iBAAQ,EAAC,CAAC;EAC9C,MAAM,CAAEG,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAJ,iBAAQ,EAAC,CAAC;EAE5C,IAAAK,kBAAS,EAAE,MAAM;IAChB,MAAMC,4BAA4B,GAAGC,uBAAU,CAACC,gBAAgB,CAC/D,QAAQ,EACRC,QACD,CAAC;IACDA,QAAQ,CAAC,CAAC;IACV,OAAO,MAAM;MACZH,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RequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -42,7 +43,7 @@ function VariationsButtons({
|
|
|
42
43
|
showColors: true
|
|
43
44
|
}),
|
|
44
45
|
isPressed: selectedValue === variation.name,
|
|
45
|
-
label: selectedValue === variation.name ? variation.title : (0, _i18n.sprintf)(
|
|
46
|
+
label: selectedValue === variation.name ? variation.title : (0, _i18n.sprintf)(/* translators: %s: Name of the block variation */
|
|
46
47
|
(0, _i18n.__)('Transform to %s'), variation.title),
|
|
47
48
|
onClick: () => onSelectVariation(variation.name),
|
|
48
49
|
"aria-label": variation.title,
|
|
@@ -110,7 +111,7 @@ function VariationsToggleGroupControl({
|
|
|
110
111
|
showColors: true
|
|
111
112
|
}),
|
|
112
113
|
value: variation.name,
|
|
113
|
-
label: selectedValue === variation.name ? variation.title : (0, _i18n.sprintf)(
|
|
114
|
+
label: selectedValue === variation.name ? variation.title : (0, _i18n.sprintf)(/* translators: %s: Name of the block variation */
|
|
114
115
|
(0, _i18n.__)('Transform to %s'), variation.title)
|
|
115
116
|
}, variation.name))
|
|
116
117
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_icons","_blockIcon","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","VariationsButtons","className","onSelectVariation","selectedValue","variations","jsxs","children","jsx","VisuallyHidden","as","__","map","variation","Button","__next40pxDefaultSize","size","icon","default","showColors","isPressed","name","label","title","sprintf","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","DropdownMenu","text","popoverProps","position","chevronDown","toggleProps","iconPosition","MenuGroup","MenuItemsChoice","choices","onSelect","VariationsToggleGroupControl","__experimentalToggleGroupControl","hideLabelFromVision","onChange","__nextHasNoMarginBottom","__experimentalToggleGroupControlOptionIcon","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","useDispatch","blockEditorStore","activeBlockVariation","isContentOnly","useSelect","select","getActiveBlockVariation","getBlockVariations","blocksStore","getBlockName","getBlockAttributes","getBlockEditingMode","hasContentRoleAttribute","unlock","isContentBlock","hasUniqueIcons","useMemo","variationIcons","Set","forEach","add","src","length","variationName","find","attributes","baseClass","showButtons","ButtonComponent","Component","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<div className={ `${ className }__container` }>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\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) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations, isContentOnly } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst { getBlockName, getBlockAttributes, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\tconst { hasContentRoleAttribute } = unlock( select( blocksStore ) );\n\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tif ( ! variations?.length || isContentOnly ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASW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0C,4BAA4B;EAE/B,MAAMsC,SAAS,GAAGd,cAAc,GAAGa,eAAe,GAAGrD,kBAAkB;EAEvE,oBACC,IAAA3B,WAAA,CAAAQ,GAAA,EAACyE,SAAS;IACT/E,SAAS,EAAG4E,SAAW;IACvB3E,iBAAiB,EAAGA,iBAAmB;IACvCC,aAAa,EAAGA,aAAe;IAC/BC,UAAU,EAAGA;EAAY,CACzB,CAAC;AAEJ;AAAC,IAAA6E,QAAA,GAAAC,OAAA,CAAAjE,OAAA,GAEc+B,sCAAsC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_icons","_blockIcon","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","VariationsButtons","className","onSelectVariation","selectedValue","variations","jsxs","children","jsx","VisuallyHidden","as","__","map","variation","Button","__next40pxDefaultSize","size","icon","default","showColors","isPressed","name","label","title","sprintf","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","DropdownMenu","text","popoverProps","position","chevronDown","toggleProps","iconPosition","MenuGroup","MenuItemsChoice","choices","onSelect","VariationsToggleGroupControl","__experimentalToggleGroupControl","hideLabelFromVision","onChange","__nextHasNoMarginBottom","__experimentalToggleGroupControlOptionIcon","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","useDispatch","blockEditorStore","activeBlockVariation","isContentOnly","useSelect","select","getActiveBlockVariation","getBlockVariations","blocksStore","getBlockName","getBlockAttributes","getBlockEditingMode","hasContentRoleAttribute","unlock","isContentBlock","hasUniqueIcons","useMemo","variationIcons","Set","forEach","add","src","length","variationName","find","attributes","baseClass","showButtons","ButtonComponent","Component","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<div className={ `${ className }__container` }>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\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) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations, isContentOnly } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst { getBlockName, getBlockAttributes, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\tconst { hasContentRoleAttribute } = unlock( select( blocksStore ) );\n\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tif ( ! variations?.length || isContentOnly ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASW,iBAAiBA,CAAE;EAC3BC,SAAS;EACTC,iBAAiB;EACjBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACC,IAAAL,WAAA,CAAAM,IAAA;IAAUJ,SAAS,EAAGA,SAAW;IAAAK,QAAA,gBAChC,IAAAP,WAAA,CAAAQ,GAAA,EAAChB,WAAA,CAAAiB,cAAc;MAACC,EAAE,EAAC,QAAQ;MAAAH,QAAA,EACxB,IAAAI,QAAE,EAAE,wBAAyB;IAAC,CACjB,CAAC,EACfN,UAAU,CAACO,GAAG,CAAIC,SAAS,iBAC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+1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","_allInputControl","_interopRequireDefault","_inputControls","_linkedButton","_useSettings","_utils","_jsxRuntime","DEFAULT_VALUES","topLeft","undefined","topRight","bottomLeft","bottomRight","MIN_BORDER_RADIUS_VALUE","MAX_BORDER_RADIUS_VALUES","px","em","rem","BorderRadiusControl","onChange","values","isLinked","setIsLinked","useState","hasDefinedValues","hasMixedValues","selectedUnits","setSelectedUnits","flat","parseQuantityAndUnitFromRawValue","availableUnits","useSettings","units","useCustomUnits","unit","getAllUnit","unitConfig","find","item","value","step","allValue","getAllValue","toggleLinked","handleSliderChange","next","jsxs","className","children","jsx","BaseControl","VisualLabel","as","__","Fragment","default","min","RangeControl","__next40pxDefaultSize","label","hideLabelFromVision","max","initialPosition","withInputField","__nextHasNoMarginBottom","onClick"],"sources":["@wordpress/block-editor/src/components/border-radius-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tRangeControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AllInputControl from './all-input-control';\nimport InputControls from './input-controls';\nimport LinkedButton from './linked-button';\nimport { useSettings } from '../use-settings';\nimport {\n\tgetAllValue,\n\tgetAllUnit,\n\thasDefinedValues,\n\thasMixedValues,\n} from './utils';\n\nconst DEFAULT_VALUES = {\n\ttopLeft: undefined,\n\ttopRight: undefined,\n\tbottomLeft: undefined,\n\tbottomRight: undefined,\n};\nconst MIN_BORDER_RADIUS_VALUE = 0;\nconst MAX_BORDER_RADIUS_VALUES = {\n\tpx: 100,\n\tem: 20,\n\trem: 20,\n};\n\n/**\n * Control to display border radius options.\n *\n * @param {Object} props Component props.\n * @param {Function} props.onChange Callback to handle onChange.\n * @param {Object} props.values Border radius values.\n *\n * @return {Element} Custom border radius control.\n */\nexport default function BorderRadiusControl( { onChange, values } ) {\n\tconst [ isLinked, setIsLinked ] = useState(\n\t\t! hasDefinedValues( values ) || ! hasMixedValues( values )\n\t);\n\n\t// Tracking selected units via internal state allows filtering of CSS unit\n\t// only values from being saved while maintaining preexisting unit selection\n\t// behaviour. Filtering CSS unit only values prevents invalid style values.\n\tconst [ selectedUnits, setSelectedUnits ] = useState( {\n\t\tflat:\n\t\t\ttypeof values === 'string'\n\t\t\t\t? parseQuantityAndUnitFromRawValue( values )[ 1 ]\n\t\t\t\t: undefined,\n\t\ttopLeft: parseQuantityAndUnitFromRawValue( values?.topLeft )[ 1 ],\n\t\ttopRight: parseQuantityAndUnitFromRawValue( values?.topRight )[ 1 ],\n\t\tbottomLeft: parseQuantityAndUnitFromRawValue( values?.bottomLeft )[ 1 ],\n\t\tbottomRight: parseQuantityAndUnitFromRawValue(\n\t\t\tvalues?.bottomRight\n\t\t)[ 1 ],\n\t} );\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tconst unit = getAllUnit( selectedUnits );\n\tconst unitConfig = units && units.find( ( item ) => item.value === unit );\n\tconst step = unitConfig?.step || 1;\n\n\tconst [ allValue ] = parseQuantityAndUnitFromRawValue(\n\t\tgetAllValue( values )\n\t);\n\n\tconst toggleLinked = () => setIsLinked( ! isLinked );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( next !== undefined ? `${ next }${ unit }` : undefined );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"components-border-radius-control\">\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Radius' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"components-border-radius-control__wrapper\">\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AllInputControl\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\tvalues={ values }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tselectedUnits={ selectedUnits }\n\t\t\t\t\t\t\tsetSelectedUnits={ setSelectedUnits }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Border radius' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\t\tvalue={ allValue ?? '' }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ unit ] }\n\t\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<InputControls\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tselectedUnits={ selectedUnits }\n\t\t\t\t\t\tsetSelectedUnits={ setSelectedUnits }\n\t\t\t\t\t\tvalues={ values || DEFAULT_VALUES }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,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AAU,EAAE,IAAAkB,0DAAgC,EAAET,MAAM,EAAET,UAAW,CAAC,CAAE,CAAC,CAAE;IACvEC,WAAW,EAAE,IAAAiB,0DAAgC,EAC5CT,MAAM,EAAER,WACT,CAAC,CAAE,CAAC;EACL,CAAE,CAAC;EAEH,MAAM,CAAEkB,cAAc,CAAE,GAAG,IAAAC,wBAAW,EAAE,eAAgB,CAAC;EACzD,MAAMC,KAAK,GAAG,IAAAC,wCAAc,EAAE;IAC7BH,cAAc,EAAEA,cAAc,IAAI,CAAE,IAAI,EAAE,IAAI,EAAE,KAAK;EACtD,CAAE,CAAC;EAEH,MAAMI,IAAI,GAAG,IAAAC,iBAAU,EAAET,aAAc,CAAC;EACxC,MAAMU,UAAU,GAAGJ,KAAK,IAAIA,KAAK,CAACK,IAAI,CAAIC,IAAI,IAAMA,IAAI,CAACC,KAAK,KAAKL,IAAK,CAAC;EACzE,MAAMM,IAAI,GAAGJ,UAAU,EAAEI,IAAI,IAAI,CAAC;EAElC,MAAM,CAAEC,QAAQ,CAAE,GAAG,IAAAZ,0DAAgC,EACpD,IAAAa,kBAAW,EAAEtB,MAAO,CACrB,CAAC;EAED,MAAMuB,YAAY,GAAGA,CAAA,KAAMrB,WAAW,CAAE,CAAED,QAAS,CAAC;EAEpD,MAAMuB,kBAAkB,GAAKC,IAAI,IAAM;IACtC1B,QAAQ,CAAE0B,IAAI,KAAKpC,SAAS,
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","_allInputControl","_interopRequireDefault","_inputControls","_linkedButton","_useSettings","_utils","_jsxRuntime","DEFAULT_VALUES","topLeft","undefined","topRight","bottomLeft","bottomRight","MIN_BORDER_RADIUS_VALUE","MAX_BORDER_RADIUS_VALUES","px","em","rem","BorderRadiusControl","onChange","values","isLinked","setIsLinked","useState","hasDefinedValues","hasMixedValues","selectedUnits","setSelectedUnits","flat","parseQuantityAndUnitFromRawValue","availableUnits","useSettings","units","useCustomUnits","unit","getAllUnit","unitConfig","find","item","value","step","allValue","getAllValue","toggleLinked","handleSliderChange","next","jsxs","className","children","jsx","BaseControl","VisualLabel","as","__","Fragment","default","min","RangeControl","__next40pxDefaultSize","label","hideLabelFromVision","max","initialPosition","withInputField","__nextHasNoMarginBottom","onClick"],"sources":["@wordpress/block-editor/src/components/border-radius-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tRangeControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AllInputControl from './all-input-control';\nimport InputControls from './input-controls';\nimport LinkedButton from './linked-button';\nimport { useSettings } from '../use-settings';\nimport {\n\tgetAllValue,\n\tgetAllUnit,\n\thasDefinedValues,\n\thasMixedValues,\n} from './utils';\n\nconst DEFAULT_VALUES = {\n\ttopLeft: undefined,\n\ttopRight: undefined,\n\tbottomLeft: undefined,\n\tbottomRight: undefined,\n};\nconst MIN_BORDER_RADIUS_VALUE = 0;\nconst MAX_BORDER_RADIUS_VALUES = {\n\tpx: 100,\n\tem: 20,\n\trem: 20,\n};\n\n/**\n * Control to display border radius options.\n *\n * @param {Object} props Component props.\n * @param {Function} props.onChange Callback to handle onChange.\n * @param {Object} props.values Border radius values.\n *\n * @return {Element} Custom border radius control.\n */\nexport default function BorderRadiusControl( { onChange, values } ) {\n\tconst [ isLinked, setIsLinked ] = useState(\n\t\t! hasDefinedValues( values ) || ! hasMixedValues( values )\n\t);\n\n\t// Tracking selected units via internal state allows filtering of CSS unit\n\t// only values from being saved while maintaining preexisting unit selection\n\t// behaviour. Filtering CSS unit only values prevents invalid style values.\n\tconst [ selectedUnits, setSelectedUnits ] = useState( {\n\t\tflat:\n\t\t\ttypeof values === 'string'\n\t\t\t\t? parseQuantityAndUnitFromRawValue( values )[ 1 ]\n\t\t\t\t: undefined,\n\t\ttopLeft: parseQuantityAndUnitFromRawValue( values?.topLeft )[ 1 ],\n\t\ttopRight: parseQuantityAndUnitFromRawValue( values?.topRight )[ 1 ],\n\t\tbottomLeft: parseQuantityAndUnitFromRawValue( values?.bottomLeft )[ 1 ],\n\t\tbottomRight: parseQuantityAndUnitFromRawValue(\n\t\t\tvalues?.bottomRight\n\t\t)[ 1 ],\n\t} );\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem' ],\n\t} );\n\n\tconst unit = getAllUnit( selectedUnits );\n\tconst unitConfig = units && units.find( ( item ) => item.value === unit );\n\tconst step = unitConfig?.step || 1;\n\n\tconst [ allValue ] = parseQuantityAndUnitFromRawValue(\n\t\tgetAllValue( values )\n\t);\n\n\tconst toggleLinked = () => setIsLinked( ! isLinked );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( next !== undefined ? `${ next }${ unit }` : undefined );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"components-border-radius-control\">\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Radius' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<div className=\"components-border-radius-control__wrapper\">\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<AllInputControl\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\tvalues={ values }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tselectedUnits={ selectedUnits }\n\t\t\t\t\t\t\tsetSelectedUnits={ setSelectedUnits }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Border radius' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\t\tvalue={ allValue ?? '' }\n\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ unit ] }\n\t\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<InputControls\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tselectedUnits={ selectedUnits }\n\t\t\t\t\t\tsetSelectedUnits={ setSelectedUnits }\n\t\t\t\t\t\tvalues={ values || DEFAULT_VALUES }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<LinkedButton onClick={ toggleLinked } isLinked={ isLinked } />\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,aAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKiB,IAAAS,WAAA,GAAAT,OAAA;AAxBjB;AACA;AACA;;AAUA;AACA;AACA;;AAYA,MAAMU,cAAc,GAAG;EACtBC,OAAO,EAAEC,SAAS;EAClBC,QAAQ,EAAED,SAAS;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CK,KAAK,EAAGA;QAAO,CACf,CAAC,eACF,IAAA1B,WAAA,CAAA2C,GAAA,EAACrD,WAAA,CAAA6D,YAAY;UACZC,qBAAqB;UACrBC,KAAK,EAAG,IAAAN,QAAE,EAAE,eAAgB,CAAG;UAC/BO,mBAAmB;UACnBb,SAAS,EAAC,iDAAiD;UAC3DR,KAAK,EAAGE,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,EAAI;UACxBe,GAAG,EAAG3C,uBAAyB;UAC/BgD,GAAG,EAAG/C,wBAAwB,CAAEoB,IAAI,CAAI;UACxC4B,eAAe,EAAG,CAAG;UACrBC,cAAc,EAAG,KAAO;UACxB5C,QAAQ,EAAGyB,kBAAoB;UAC/BJ,IAAI,EAAGA,IAAM;UACbwB,uBAAuB;QAAA,CACvB,CAAC;MAAA,CACD,CAAC,gBAEH,IAAA1D,WAAA,CAAA2C,GAAA,EAAC/C,cAAA,CAAAqD,OAAa;QACbC,GAAG,EAAG3C,uBAAyB;QAC/BM,QAAQ,EAAGA,QAAU;QACrBO,aAAa,EAAGA,aAAe;QAC/BC,gBAAgB,EAAGA,gBAAkB;QACrCP,MAAM,EAAGA,MAAM,IAAIb,cAAgB;QACnCyB,KAAK,EAAGA;MAAO,CACf,CACD,eACD,IAAA1B,WAAA,CAAA2C,GAAA,EAAC9C,aAAA,CAAAoD,OAAY;QAACU,OAAO,EAAGtB,YAAc;QAACtB,QAAQ,EAAGA;MAAU,CAAE,CAAC;IAAA,CAC3D,CAAC;EAAA,CACG,CAAC;AAEb","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","mode","inputArray","arr","sort","a","b","filter","v","length","shift","getAllUnit","selectedUnits","flat","cornerUnits","Object","values","Boolean","getAllValue","parsedQuantitiesAndUnits","map","value","parseQuantityAndUnitFromRawValue","allValues","_value$","allUnits","every","unit","allValue","undefined","hasMixedValues","isMixed","isNaN","parseFloat","hasDefinedValues","filteredValues"],"sources":["@wordpress/block-editor/src/components/border-radius-control/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';\n\n/**\n * Gets the (non-undefined) item with the highest occurrence within an array\n * Based in part on: https://stackoverflow.com/a/20762713\n *\n * Undefined values are always sorted to the end by `sort`, so this function\n * returns the first element, to always prioritize real values over undefined\n * values.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description\n *\n * @param {Array<any>} inputArray Array of items to check.\n * @return {any} The item with the most occurrences.\n */\nexport function mode( inputArray ) {\n\tconst arr = [ ...inputArray ];\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tinputArray.filter( ( v ) => v === b ).length -\n\t\t\t\tinputArray.filter( ( v ) => v === a ).length\n\t\t)\n\t\t.shift();\n}\n\n/**\n * Returns the most common CSS unit from the current CSS unit selections.\n *\n * - If a single flat border radius is set, its unit will be used\n * - If individual corner selections, the most common of those will be used\n * - Failing any unit selections a default of 'px' is returned.\n *\n * @param {Object} selectedUnits Unit selections for flat radius & each corner.\n * @return {string} Most common CSS unit from current selections. Default: `px`.\n */\nexport function getAllUnit( selectedUnits = {} ) {\n\tconst { flat, ...cornerUnits } = selectedUnits;\n\treturn (\n\t\tflat || mode( Object.values( cornerUnits ).filter( Boolean ) ) || 'px'\n\t);\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param {Object|string} values Radius values.\n * @return {string} A value + unit for the 'all' input.\n */\nexport function getAllValue( values = {} ) {\n\t/**\n\t * Border radius support was originally a single pixel value.\n\t *\n\t * To maintain backwards compatibility treat this case as the all value.\n\t */\n\tif ( typeof values === 'string' ) {\n\t\treturn values;\n\t}\n\n\tconst parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) =>\n\t\tparseQuantityAndUnitFromRawValue( value )\n\t);\n\n\tconst allValues = parsedQuantitiesAndUnits.map(\n\t\t( value ) => value[ 0 ] ?? ''\n\t);\n\tconst allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] );\n\n\tconst value = allValues.every( ( v ) => v === allValues[ 0 ] )\n\t\t? allValues[ 0 ]\n\t\t: '';\n\tconst unit = mode( allUnits );\n\n\tconst allValue = value === 0 || value ? `${ value }${ unit }` : undefined;\n\n\treturn allValue;\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasMixedValues( values = {} ) {\n\tconst allValue = getAllValue( values );\n\tconst isMixed =\n\t\ttypeof values === 'string' ? false : isNaN( parseFloat( allValue ) );\n\n\treturn isMixed;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasDefinedValues( values ) {\n\tif ( ! values ) {\n\t\treturn false;\n\t}\n\n\t// A string value represents a shorthand value.\n\tif ( typeof values === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// An object represents longhand border radius values, if any are set\n\t// flag values as being defined.\n\tconst filteredValues = Object.values( values ).filter( ( value ) => {\n\t\treturn !! value || value === 0;\n\t} );\n\n\treturn !! filteredValues.length;\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,IAAIA,CAAEC,UAAU,EAAG;EAClC,MAAMC,GAAG,GAAG,CAAE,GAAGD,UAAU,CAAE;EAC7B,OAAOC,GAAG,CACRC,IAAI,CACJ,CAAEC,CAAC,EAAEC,CAAC,KACLJ,UAAU,CAACK,MAAM,CAAIC,CAAC,IAAMA,CAAC,KAAKF,CAAE,CAAC,CAACG,MAAM,GAC5CP,UAAU,CAACK,MAAM,CAAIC,CAAC,IAAMA,CAAC,KAAKH,CAAE,CAAC,CAACI,MACxC,CAAC,CACAC,KAAK,C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r","sort","a","b","filter","v","length","shift","getAllUnit","selectedUnits","flat","cornerUnits","Object","values","Boolean","getAllValue","parsedQuantitiesAndUnits","map","value","parseQuantityAndUnitFromRawValue","allValues","_value$","allUnits","every","unit","allValue","undefined","hasMixedValues","isMixed","isNaN","parseFloat","hasDefinedValues","filteredValues"],"sources":["@wordpress/block-editor/src/components/border-radius-control/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';\n\n/**\n * Gets the (non-undefined) item with the highest occurrence within an array\n * Based in part on: https://stackoverflow.com/a/20762713\n *\n * Undefined values are always sorted to the end by `sort`, so this function\n * returns the first element, to always prioritize real values over undefined\n * values.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description\n *\n * @param {Array<any>} inputArray Array of items to check.\n * @return {any} The item with the most occurrences.\n */\nexport function mode( inputArray ) {\n\tconst arr = [ ...inputArray ];\n\treturn arr\n\t\t.sort(\n\t\t\t( a, b ) =>\n\t\t\t\tinputArray.filter( ( v ) => v === b ).length -\n\t\t\t\tinputArray.filter( ( v ) => v === a ).length\n\t\t)\n\t\t.shift();\n}\n\n/**\n * Returns the most common CSS unit from the current CSS unit selections.\n *\n * - If a single flat border radius is set, its unit will be used\n * - If individual corner selections, the most common of those will be used\n * - Failing any unit selections a default of 'px' is returned.\n *\n * @param {Object} selectedUnits Unit selections for flat radius & each corner.\n * @return {string} Most common CSS unit from current selections. Default: `px`.\n */\nexport function getAllUnit( selectedUnits = {} ) {\n\tconst { flat, ...cornerUnits } = selectedUnits;\n\treturn (\n\t\tflat || mode( Object.values( cornerUnits ).filter( Boolean ) ) || 'px'\n\t);\n}\n\n/**\n * Gets the 'all' input value and unit from values data.\n *\n * @param {Object|string} values Radius values.\n * @return {string} A value + unit for the 'all' input.\n */\nexport function getAllValue( values = {} ) {\n\t/**\n\t * Border radius support was originally a single pixel value.\n\t *\n\t * To maintain backwards compatibility treat this case as the all value.\n\t */\n\tif ( typeof values === 'string' ) {\n\t\treturn values;\n\t}\n\n\tconst parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) =>\n\t\tparseQuantityAndUnitFromRawValue( value )\n\t);\n\n\tconst allValues = parsedQuantitiesAndUnits.map(\n\t\t( value ) => value[ 0 ] ?? ''\n\t);\n\tconst allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] );\n\n\tconst value = allValues.every( ( v ) => v === allValues[ 0 ] )\n\t\t? allValues[ 0 ]\n\t\t: '';\n\tconst unit = mode( allUnits );\n\n\tconst allValue = value === 0 || value ? `${ value }${ unit }` : undefined;\n\n\treturn allValue;\n}\n\n/**\n * Checks to determine if values are mixed.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasMixedValues( values = {} ) {\n\tconst allValue = getAllValue( values );\n\tconst isMixed =\n\t\ttypeof values === 'string' ? false : isNaN( parseFloat( allValue ) );\n\n\treturn isMixed;\n}\n\n/**\n * Checks to determine if values are defined.\n *\n * @param {Object} values Radius values.\n * @return {boolean} Whether values are mixed.\n */\nexport function hasDefinedValues( values ) {\n\tif ( ! values ) {\n\t\treturn false;\n\t}\n\n\t// A string value represents a shorthand value.\n\tif ( typeof values === 'string' ) {\n\t\treturn true;\n\t}\n\n\t// An object represents longhand border radius values, if any are set\n\t// flag values as being defined.\n\tconst filteredValues = Object.values( values ).filter( ( value ) => {\n\t\treturn !! value || value === 0;\n\t} );\n\n\treturn !! filteredValues.length;\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,IAAIA,CAAEC,UAAU,EAAG;EAClC,MAAMC,GAAG,GAAG,CAAE,GAAGD,UAAU,CAAE;EAC7B,OAAOC,GAAG,CACRC,IAAI,CACJ,CAAEC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G,CAAC,GAC3DA,SAAS,CAAE,CAAC,CAAE,GACd,EAAE;EACL,MAAMI,IAAI,GAAG1B,IAAI,CAAEwB,QAAS,CAAC;EAE7B,MAAMG,QAAQ,GAAGP,KAAK,KAAK,CAAC,IAAIA,KAAK,GAAG,GAAIA,KAAK,GAAKM,IAAI,EAAG,GAAGE,SAAS;EAEzE,OAAOD,QAAQ;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAEd,MAAM,GAAG,CAAC,CAAC,EAAG;EAC7C,MAAMY,QAAQ,GAAGV,WAAW,CAAEF,MAAO,CAAC;EACtC,MAAMe,OAAO,GACZ,OAAOf,MAAM,KAAK,QAAQ,GAAG,KAAK,GAAGgB,KAAK,CAAEC,UAAU,CAAEL,QAAS,CAAE,CAAC;EAErE,OAAOG,OAAO;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gBAAgBA,CAAElB,MAAM,EAAG;EAC1C,IAAK,CAAEA,MAAM,EAAG;IACf,OAAO,KAAK;EACb;;EAEA;EACA,IAAK,OAAOA,MAAM,KAAK,QAAQ,EAAG;IACjC,OAAO,IAAI;EACZ;;EAEA;EACA;EACA,MAAMmB,cAAc,GAAGpB,MAAM,CAACC,MAAM,CAAEA,MAAO,CAAC,CAACT,MAAM,CAAIc,KAAK,IAAM;IACnE,OAAO,CAAC,CAAEA,KAAK,IAAIA,KAAK,KAAK,CAAC;EAC/B,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEc,cAAc,CAAC1B,MAAM;AAChC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_element","_i18n","_icons","_deprecated","_inserter","_compose","_jsxRuntime","ButtonBlockAppender","rootClientId","className","onFocus","tabIndex","onSelect","ref","inserterButtonRef","useRef","mergedInserterButtonRef","useMergeRefs","jsx","default","position","__experimentalIsQuick","onSelectOrClose","args","current","focus","renderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","isToggleButton","label","sprintf","_x","Button","__next40pxDefaultSize","clsx","onClick","undefined","showTooltip","children","Icon","icon","plus","isAppender","ButtonBlockerAppender","exports","forwardRef","props","deprecated","alternative","since","_default"],"sources":["@wordpress/block-editor/src/components/button-block-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { useMergeRefs } from '@wordpress/compose';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex, onSelect },\n\tref\n) {\n\tconst inserterButtonRef = useRef();\n\n\tconst mergedInserterButtonRef = useMergeRefs( [ inserterButtonRef, ref ] );\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\tonSelectOrClose={ ( ...args ) => {\n\t\t\t\tif ( onSelect && typeof onSelect === 'function' ) {\n\t\t\t\t\tonSelect( ...args );\n\t\t\t\t}\n\t\t\t\tinserterButtonRef.current?.focus();\n\t\t\t} }\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\t\t\t\tconst label = hasSingleBlockType\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Add %s',\n\t\t\t\t\t\t\t\t'directly add the only allowed block'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockTitle\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tref={ mergedInserterButtonRef }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\t// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.\n\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ plus } />\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t\tisAppender\n\t\t/>\n\t);\n}\n\n/**\n * Use `ButtonBlockAppender` instead.\n *\n * @deprecated\n */\nexport const ButtonBlockerAppender = forwardRef( ( props, ref ) => {\n\tdeprecated( `wp.blockEditor.ButtonBlockerAppender`, {\n\t\talternative: 'wp.blockEditor.ButtonBlockAppender',\n\t\tsince: '5.9',\n\t} );\n\n\treturn ButtonBlockAppender( props, ref );\n} );\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md\n */\nexport default forwardRef( ButtonBlockAppender );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;A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oBACC,IAAA7B,WAAA,CAAAY,GAAA,EAACnB,WAAA,CAAAqC,MAAM;QACNC,qBAAqB;QACrBxB,GAAG,EAAGG,uBAAyB;QAC/BN,OAAO,EAAGA,OAAS;QACnBC,QAAQ,EAAGA,QAAU;QACrBF,SAAS,EAAG,IAAA6B,aAAI,EACf7B,SAAS,EACT,oCACD,CAAG;QACH8B,OAAO,EAAGZ,QAAU;QACpB,iBAAgBK,cAAc,GAAG,MAAM,GAAGQ,SAAW;QACrD,iBAAgBR,cAAc,GAAGH,MAAM,GAAGW;QAC1C;QACA;QAAA;QACAZ,QAAQ,EAAGA,QAAU;QACrBK,KAAK,EAAGA,KAAO;QACfQ,WAAW;QAAAC,QAAA,eAEX,IAAApC,WAAA,CAAAY,GAAA,EAAChB,MAAA,CAAAyC,IAAI;UAACC,IAAI,EAAGC;QAAM,CAAE;MAAC,CACf,CAAC;IAEX,CAAG;IACHC,UAAU;EAAA,CACV,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAAE,mBAAU,EAAE,CAAEC,KAAK,EAAErC,GAAG,KAAM;EAClE,IAAAsC,mBAAU,
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_element","_i18n","_icons","_deprecated","_inserter","_compose","_jsxRuntime","ButtonBlockAppender","rootClientId","className","onFocus","tabIndex","onSelect","ref","inserterButtonRef","useRef","mergedInserterButtonRef","useMergeRefs","jsx","default","position","__experimentalIsQuick","onSelectOrClose","args","current","focus","renderToggle","onToggle","disabled","isOpen","blockTitle","hasSingleBlockType","isToggleButton","label","sprintf","_x","Button","__next40pxDefaultSize","clsx","onClick","undefined","showTooltip","children","Icon","icon","plus","isAppender","ButtonBlockerAppender","exports","forwardRef","props","deprecated","alternative","since","_default"],"sources":["@wordpress/block-editor/src/components/button-block-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { Icon, plus } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { useMergeRefs } from '@wordpress/compose';\n\nfunction ButtonBlockAppender(\n\t{ rootClientId, className, onFocus, tabIndex, onSelect },\n\tref\n) {\n\tconst inserterButtonRef = useRef();\n\n\tconst mergedInserterButtonRef = useMergeRefs( [ inserterButtonRef, ref ] );\n\treturn (\n\t\t<Inserter\n\t\t\tposition=\"bottom center\"\n\t\t\trootClientId={ rootClientId }\n\t\t\t__experimentalIsQuick\n\t\t\tonSelectOrClose={ ( ...args ) => {\n\t\t\t\tif ( onSelect && typeof onSelect === 'function' ) {\n\t\t\t\t\tonSelect( ...args );\n\t\t\t\t}\n\t\t\t\tinserterButtonRef.current?.focus();\n\t\t\t} }\n\t\t\trenderToggle={ ( {\n\t\t\t\tonToggle,\n\t\t\t\tdisabled,\n\t\t\t\tisOpen,\n\t\t\t\tblockTitle,\n\t\t\t\thasSingleBlockType,\n\t\t\t} ) => {\n\t\t\t\tconst isToggleButton = ! hasSingleBlockType;\n\t\t\t\tconst label = hasSingleBlockType\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: the name of the block when there is only one\n\t\t\t\t\t\t\t_x(\n\t\t\t\t\t\t\t\t'Add %s',\n\t\t\t\t\t\t\t\t'directly add the only allowed block'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockTitle\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t );\n\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tref={ mergedInserterButtonRef }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t'block-editor-button-block-appender'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\taria-haspopup={ isToggleButton ? 'true' : undefined }\n\t\t\t\t\t\taria-expanded={ isToggleButton ? isOpen : undefined }\n\t\t\t\t\t\t// Disable reason: There shouldn't be a case where this button is disabled but not visually hidden.\n\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ plus } />\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} }\n\t\t\tisAppender\n\t\t/>\n\t);\n}\n\n/**\n * Use `ButtonBlockAppender` instead.\n *\n * @deprecated\n */\nexport const ButtonBlockerAppender = forwardRef( ( props, ref ) => {\n\tdeprecated( `wp.blockEditor.ButtonBlockerAppender`, {\n\t\talternative: 'wp.blockEditor.ButtonBlockAppender',\n\t\tsince: '5.9',\n\t} );\n\n\treturn ButtonBlockAppender( props, ref );\n} );\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md\n */\nexport default forwardRef( ButtonBlockAppender );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AAKA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAAkD,IAAAQ,WAAA,G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AGZ,QAAU;QACpB,iBAAgBK,cAAc,GAAG,MAAM,GAAGQ,SAAW;QACrD,iBAAgBR,cAAc,GAAGH,MAAM,GAAGW;QAC1C;QACA;QAAA;QACAZ,QAAQ,EAAGA,QAAU;QACrBK,KAAK,EAAGA,KAAO;QACfQ,WAAW;QAAAC,QAAA,eAEX,IAAApC,WAAA,CAAAY,GAAA,EAAChB,MAAA,CAAAyC,IAAI;UAACC,IAAI,EAAGC;QAAM,CAAE;MAAC,CACf,CAAC;IAEX,CAAG;IACHC,UAAU;EAAA,CACV,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAAE,mBAAU,EAAE,CAAEC,KAAK,EAAErC,GAAG,KAAM;EAClE,IAAAsC,mBAAU,EAAE,sCAAsC,EAAE;IACnDC,WAAW,EAAE,oCAAoC;IACjDC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO9C,mBAAmB,CAAE2C,KAAK,EAAErC,GAAI,CAAC;AACzC,CAAE,CAAC;;AAEH;AACA;AACA;AAFA,IAAAyC,QAAA,GAAAN,OAAA,CAAA7B,OAAA,GAGe,IAAA8B,mBAAU,EAAE1C,mBAAoB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_keycodes","_deprecated","_interopRequireDefault","_jsxRuntime","ColorSelectorSVGIcon","jsx","SVG","xmlns","viewBox","children","Path","d","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","ToolbarGroup","ToolbarButton","label","__","onClick","onKeyDown","icon","BlockColorsStyleSelector","other","deprecated","alternative","since","version","Dropdown","popoverProps","placement","contentClassName","renderToggle","renderContent","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent =\n\t( { TextColor, BackgroundColor } ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst openOnArrowDown = ( event ) => {\n\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonToggle();\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t\t</BackgroundColor>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA+C,IAAAK,WAAA,GAAAL,OAAA;AAZ/C;AACA;AACA;;AAYA,MAAMM,oBAAoB,GAAGA,CAAA,kBAC5B,IAAAD,WAAA,CAAAE,GAAA,EAACR,WAAA,CAAAS,GAAG;EAACC,KAAK,EAAC,4BAA4B;EAACC,OAAO,EAAC,WAAW;EAAAC,QAAA,eAC1D,IAAAN,WAAA,CAAAE,GAAA,EAACR,WAAA,CAAAa,IAAI;IAACC,CAAC,EAAC;EAA6e,CAAE;AAAC,CACpf,CACL;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAU,CAAC,KAAM;EACrD,oBACC,IAAAX,WAAA,CAAAE,GAAA;IAAKS,SAAS,EAAC,+CAA+C;IAAAL,QAAA,eAC7D,IAAAN,WAAA,CAAAE,GAAA;MACCS,SAAS,
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_keycodes","_deprecated","_interopRequireDefault","_jsxRuntime","ColorSelectorSVGIcon","jsx","SVG","xmlns","viewBox","children","Path","d","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","ToolbarGroup","ToolbarButton","label","__","onClick","onKeyDown","icon","BlockColorsStyleSelector","other","deprecated","alternative","since","version","Dropdown","popoverProps","placement","contentClassName","renderToggle","renderContent","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent =\n\t( { TextColor, BackgroundColor } ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst openOnArrowDown = ( event ) => {\n\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonToggle();\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t\t</BackgroundColor>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA+C,IAAAK,WAAA,GAAAL,OAAA;AAZ/C;AACA;AACA;;AAYA,MAAMM,oBAAoB,GAAGA,CAAA,kBAC5B,IAAAD,WAAA,CAAAE,GAAA,EAACR,WAAA,CAAAS,GAAG;EAACC,KAAK,EAAC,4BAA4B;EAACC,OAAO,EAAC,WAAW;EAAAC,QAAA,eAC1D,IAAAN,WAAA,CAAAE,GAAA,EAACR,WAAA,CAAAa,IAAI;IAACC,CAAC,EAAC;EAA6e,CAAE;AAAC,CACpf,CACL;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAU,CAAC,KAAM;EACrD,oBACC,IAAAX,WAAA,CAAAE,GAAA;IAAKS,SAAS,EAAC,+CAA+C;IAAAL,QAAA,eAC7D,IAAAN,WAAA,CAAAE,GAAA;MACCS,SAA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;EACV,CAAE,CAAC;EAEH,oBACC,IAAAlC,WAAA,CAAAE,GAAA,EAACR,WAAA,CAAAyC,QAAQ;IACRC,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9C1B,SAAS,EAAC,+BAA+B;IACzC2B,gBAAgB,EAAC,wCAAwC;IACzDC,YAAY,EAAG3B,qBAAqB,CAAEkB,KAAM,CAAG;IAC/CU,aAAa,EAAGA,CAAA,KAAMlC;EAAU,CAChC,CAAC;AAEJ,CAAC;AAAC,IAAAmC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,wBAAwB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_colord","require","_names","_interopRequireDefault","_a11y","_components","_lockUnlock","extend","namesPlugin","a11yPlugin","kebabCase","unlock","componentsPrivateApis","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","find","color","slug","exports","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","colordColor","colord","getColorContrast","contrast","maxContrast","Math","max","map"],"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nconst { kebabCase } = unlock( componentsPrivateApis );\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults,\n * and the values of the defined color or custom color returns a color object describing the color.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} definedColor A string containing the color slug.\n * @param {?string} customColor A string containing the customColor value.\n *\n * @return {?Object} If definedColor is passed and the name is found in colors,\n * the color object exactly as set by the theme or editor defaults is returned.\n * Otherwise, an object that just sets the color is defined.\n */\nexport const getColorObjectByAttributeValues = (\n\tcolors,\n\tdefinedColor,\n\tcustomColor\n) => {\n\tif ( definedColor ) {\n\t\tconst colorObj = colors?.find(\n\t\t\t( color ) => color.slug === definedColor\n\t\t);\n\n\t\tif ( colorObj ) {\n\t\t\treturn colorObj;\n\t\t}\n\t}\n\treturn {\n\t\tcolor: customColor,\n\t};\n};\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {?Object} Color object included in the colors array whose color property equals colorValue.\n * Returns undefined if no color object matches this requirement.\n */\nexport const getColorObjectByColorValue = ( colors, colorValue ) => {\n\treturn colors?.find( ( color ) => color.color === colorValue );\n};\n\n/**\n * Returns a class based on the context a color is being used and its slug.\n *\n * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...\n * @param {string} colorSlug Slug of the color.\n *\n * @return {?string} String with the class corresponding to the color in the provided context.\n * Returns undefined if either colorContextName or colorSlug are not provided.\n */\nexport function getColorClassName( colorContextName, colorSlug ) {\n\tif ( ! colorContextName || ! colorSlug ) {\n\t\treturn undefined;\n\t}\n\n\treturn `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;\n}\n\n/**\n * Given an array of color objects and a color value returns the color value of the most readable color in the array.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {string} String with the color value of the most readable color.\n */\nexport function getMostReadableColor( colors, colorValue ) {\n\tconst colordColor = colord( colorValue );\n\tconst getColorContrast = ( { color } ) => colordColor.contrast( color );\n\n\tconst maxContrast = Math.max( ...colors.map( getColorContrast ) );\n\treturn colors.find( ( color ) => getColorContrast( color ) === maxContrast )\n\t\t.color;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,IAAAM,cAAM,EAAE,CAAEC,cAAW,EAAEC,aAAU,CAAG,CAAC;AAErC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,+BAA+B,GAAGA,CAC9CC,MAAM,EACNC,YAAY,EACZC,WAAW,KACP;EACJ,IAAKD,YAAY,EAAG;IACnB,MAAME,QAAQ,GAAGH,MAAM,EAAEI,IAAI,CAC1BC,KAAK,IAAMA,KAAK,CAACC,IAAI,KAAKL,YAC7B,CAAC;IAED,IAAKE,QAAQ,EAAG;MACf,OAAOA,QAAQ;IAChB;EACD;EACA,OAAO;IACNE,KAAK,EAAEH;EACR,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAK,OAAA,CAAAR,+BAAA,GAAAA,+BAAA;AASO,MAAMS,0BAA0B,GAAGA,CAAER,MAAM,EAAES,UAAU,KAAM;EACnE,OAAOT,MAAM,EAAEI,IAAI,CAAIC,KAAK,IAAMA,KAAK,CAACA,KAAK,KAAKI,UAAW,CAAC;AAC/D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAF,OAAA,CAAAC,0BAAA,GAAAA,0BAAA;AASO,SAASE,iBAAiBA,CAAEC,gBAAgB,EAAEC,SAAS,EAAG;EAChE,IAAK,CAAED,gBAAgB,IAAI,CAAEC,SAAS,EAAG;IACxC,OAAOC,SAAS;EACjB;EAEA,
|
|
1
|
+
{"version":3,"names":["_colord","require","_names","_interopRequireDefault","_a11y","_components","_lockUnlock","extend","namesPlugin","a11yPlugin","kebabCase","unlock","componentsPrivateApis","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","find","color","slug","exports","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","colordColor","colord","getColorContrast","contrast","maxContrast","Math","max","map"],"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nconst { kebabCase } = unlock( componentsPrivateApis );\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults,\n * and the values of the defined color or custom color returns a color object describing the color.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} definedColor A string containing the color slug.\n * @param {?string} customColor A string containing the customColor value.\n *\n * @return {?Object} If definedColor is passed and the name is found in colors,\n * the color object exactly as set by the theme or editor defaults is returned.\n * Otherwise, an object that just sets the color is defined.\n */\nexport const getColorObjectByAttributeValues = (\n\tcolors,\n\tdefinedColor,\n\tcustomColor\n) => {\n\tif ( definedColor ) {\n\t\tconst colorObj = colors?.find(\n\t\t\t( color ) => color.slug === definedColor\n\t\t);\n\n\t\tif ( colorObj ) {\n\t\t\treturn colorObj;\n\t\t}\n\t}\n\treturn {\n\t\tcolor: customColor,\n\t};\n};\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {?Object} Color object included in the colors array whose color property equals colorValue.\n * Returns undefined if no color object matches this requirement.\n */\nexport const getColorObjectByColorValue = ( colors, colorValue ) => {\n\treturn colors?.find( ( color ) => color.color === colorValue );\n};\n\n/**\n * Returns a class based on the context a color is being used and its slug.\n *\n * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...\n * @param {string} colorSlug Slug of the color.\n *\n * @return {?string} String with the class corresponding to the color in the provided context.\n * Returns undefined if either colorContextName or colorSlug are not provided.\n */\nexport function getColorClassName( colorContextName, colorSlug ) {\n\tif ( ! colorContextName || ! colorSlug ) {\n\t\treturn undefined;\n\t}\n\n\treturn `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;\n}\n\n/**\n * Given an array of color objects and a color value returns the color value of the most readable color in the array.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {string} String with the color value of the most readable color.\n */\nexport function getMostReadableColor( colors, colorValue ) {\n\tconst colordColor = colord( colorValue );\n\tconst getColorContrast = ( { color } ) => colordColor.contrast( color );\n\n\tconst maxContrast = Math.max( ...colors.map( getColorContrast ) );\n\treturn colors.find( ( color ) => getColorContrast( color ) === maxContrast )\n\t\t.color;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,IAAAM,cAAM,EAAE,CAAEC,cAAW,EAAEC,aAAU,CAAG,CAAC;AAErC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,+BAA+B,GAAGA,CAC9CC,MAAM,EACNC,YAAY,EACZC,WAAW,KACP;EACJ,IAAKD,YAAY,EAAG;IACnB,MAAME,QAAQ,GAAGH,MAAM,EAAEI,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|
1
|
-
{"version":3,"names":["_element","require","_compose","_components","_utils","_useSettings","_lockUnlock","_jsxRuntime","kebabCase","unlock","componentsPrivateApis","upperFirst","firstLetter","rest","toUpperCase","join","withCustomColorPalette","colorsArray","createHigherOrderComponent","WrappedComponent","props","jsx","colors","withEditorColorPalette","userPalette","themePalette","defaultPalette","useSettings","allColors","useMemo","createColorHOC","colorTypes","withColorPalette","colorMap","reduce","colorObject","colorType","compose","Component","constructor","setters","createSetters","colorUtils","getMostReadableColor","bind","state","colorValue","Object","keys","settersAccumulator","colorAttributeName","upperFirstColorAttributeName","customColorAttributeName","createSetColor","getColorObjectByColorValue","setAttributes","slug","undefined","getDerivedStateFromProps","attributes","previousState","entries","newState","colorContext","getColorObjectByAttributeValues","previousColorObject","previousColor","color","class","getColorClassName","render","createCustomColorsHOC","withColors"],"sources":["@wordpress/block-editor/src/components/colors/with-colors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, Component } from '@wordpress/element';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetMostReadableColor,\n} from './utils';\nimport { useSettings } from '../use-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { kebabCase } = unlock( componentsPrivateApis );\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher order component factory for injecting the `colorsArray` argument as\n * the colors prop in the `withCustomColors` HOC.\n *\n * @param {Array} colorsArray An array of color objects.\n *\n * @return {Function} The higher order component.\n */\nconst withCustomColorPalette = ( colorsArray ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => (\n\t\t\t<WrappedComponent { ...props } colors={ colorsArray } />\n\t\t),\n\t\t'withCustomColorPalette'\n\t);\n\n/**\n * Higher order component factory for injecting the editor colors as the\n * `colors` prop in the `withColors` HOC.\n *\n * @return {Function} The higher order component.\n */\nconst withEditorColorPalette = () =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => {\n\t\t\tconst [ userPalette, themePalette, defaultPalette ] = useSettings(\n\t\t\t\t'color.palette.custom',\n\t\t\t\t'color.palette.theme',\n\t\t\t\t'color.palette.default'\n\t\t\t);\n\t\t\tconst allColors = useMemo(\n\t\t\t\t() => [\n\t\t\t\t\t...( userPalette || [] ),\n\t\t\t\t\t...( themePalette || [] ),\n\t\t\t\t\t...( defaultPalette || [] ),\n\t\t\t\t],\n\t\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t\t);\n\t\t\treturn <WrappedComponent { ...props } colors={ allColors } />;\n\t\t},\n\t\t'withEditorColorPalette'\n\t);\n\n/**\n * Helper function used with `createHigherOrderComponent` to create\n * higher order components for managing color logic.\n *\n * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).\n * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.\n *\n * @return {Component} The component that can be used as a HOC.\n */\nfunction createColorHOC( colorTypes, withColorPalette ) {\n\tconst colorMap = colorTypes.reduce( ( colorObject, colorType ) => {\n\t\treturn {\n\t\t\t...colorObject,\n\t\t\t...( typeof colorType === 'string'\n\t\t\t\t? { [ colorType ]: kebabCase( colorType ) }\n\t\t\t\t: colorType ),\n\t\t};\n\t}, {} );\n\n\treturn compose( [\n\t\twithColorPalette,\n\t\t( WrappedComponent ) => {\n\t\t\treturn class extends Component {\n\t\t\t\tconstructor( props ) {\n\t\t\t\t\tsuper( props );\n\n\t\t\t\t\tthis.setters = this.createSetters();\n\t\t\t\t\tthis.colorUtils = {\n\t\t\t\t\t\tgetMostReadableColor:\n\t\t\t\t\t\t\tthis.getMostReadableColor.bind( this ),\n\t\t\t\t\t};\n\n\t\t\t\t\tthis.state = {};\n\t\t\t\t}\n\n\t\t\t\tgetMostReadableColor( colorValue ) {\n\t\t\t\t\tconst { colors } = this.props;\n\t\t\t\t\treturn getMostReadableColor( colors, colorValue );\n\t\t\t\t}\n\n\t\t\t\tcreateSetters() {\n\t\t\t\t\treturn Object.keys( colorMap ).reduce(\n\t\t\t\t\t\t( settersAccumulator, colorAttributeName ) => {\n\t\t\t\t\t\t\tconst upperFirstColorAttributeName =\n\t\t\t\t\t\t\t\tupperFirst( colorAttributeName );\n\t\t\t\t\t\t\tconst customColorAttributeName = `custom${ upperFirstColorAttributeName }`;\n\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t`set${ upperFirstColorAttributeName }`\n\t\t\t\t\t\t\t] = this.createSetColor(\n\t\t\t\t\t\t\t\tcolorAttributeName,\n\t\t\t\t\t\t\t\tcustomColorAttributeName\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcreateSetColor( colorAttributeName, customColorAttributeName ) {\n\t\t\t\t\treturn ( colorValue ) => {\n\t\t\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\t\t\tthis.props.colors,\n\t\t\t\t\t\t\tcolorValue\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t[ colorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? colorObject.slug\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t[ customColorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: colorValue,\n\t\t\t\t\t\t} );\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t{ attributes, colors },\n\t\t\t\t\tpreviousState\n\t\t\t\t) {\n\t\t\t\t\treturn Object.entries( colorMap ).reduce(\n\t\t\t\t\t\t( newState, [ colorAttributeName, colorContext ] ) => {\n\t\t\t\t\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\t\tattributes[ colorAttributeName ],\n\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t`custom${ upperFirst(\n\t\t\t\t\t\t\t\t\t\tcolorAttributeName\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\n\t\t\t\t\t\t\tconst previousColorObject =\n\t\t\t\t\t\t\t\tpreviousState[ colorAttributeName ];\n\t\t\t\t\t\t\tconst previousColor = previousColorObject?.color;\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The \"and previousColorObject\" condition checks that a previous color object was already computed.\n\t\t\t\t\t\t\t * At the start previousColorObject and colorValue are both equal to undefined\n\t\t\t\t\t\t\t * bus as previousColorObject does not exist we should compute the object.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpreviousColor === colorObject.color &&\n\t\t\t\t\t\t\t\tpreviousColorObject\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] =\n\t\t\t\t\t\t\t\t\tpreviousColorObject;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] = {\n\t\t\t\t\t\t\t\t\t...colorObject,\n\t\t\t\t\t\t\t\t\tclass: getColorClassName(\n\t\t\t\t\t\t\t\t\t\tcolorContext,\n\t\t\t\t\t\t\t\t\t\tcolorObject.slug\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\treturn newState;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\trender() {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\tcolors: undefined,\n\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\tcolorUtils: this.colorUtils,\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}\n\t\t\t};\n\t\t},\n\t] );\n}\n\n/**\n * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic\n * for class generation color value, retrieval and color attribute setting.\n *\n * Use this higher-order component to work with a custom set of colors.\n *\n * @example\n *\n * ```jsx\n * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];\n * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );\n * // ...\n * export default compose(\n * withCustomColors( 'backgroundColor', 'borderColor' ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).\n *\n * @return {Function} Higher-order component.\n */\nexport function createCustomColorsHOC( colorsArray ) {\n\treturn ( ...colorTypes ) => {\n\t\tconst withColorPalette = withCustomColorPalette( colorsArray );\n\t\treturn createHigherOrderComponent(\n\t\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t\t'withCustomColors'\n\t\t);\n\t};\n}\n\n/**\n * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.\n *\n * For use with the default editor/theme color palette.\n *\n * @example\n *\n * ```jsx\n * export default compose(\n * withColors( 'backgroundColor', { textColor: 'color' } ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,\n * it should contain the color attribute name as key and the color context as value.\n * If the argument is a string the value should be the color attribute name,\n * the color context is computed by applying a kebab case transform to the value.\n * Color context represents the context/place where the color is going to be used.\n * The class name of the color is generated using 'has' followed by the color name\n * and ending with the color context all in kebab case e.g: has-green-background-color.\n *\n * @return {Function} Higher-order component.\n */\nexport default function withColors( ...colorTypes ) {\n\tconst withColorPalette = withEditorColorPalette();\n\treturn createHigherOrderComponent(\n\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t'withColors'\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAjB3C;AACA;AACA;;AAKA;AACA;AACA;;AAUA,MAAM;EAAEO;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAGA,CAAE,CAAEC,WAAW,EAAE,GAAGC,IAAI,CAAE,KAC5CD,WAAW,CAACE,WAAW,CAAC,CAAC,GAAGD,IAAI,CAACE,IAAI,CAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAKC,WAAW,IAC3C,IAAAC,mCAA0B,EACvBC,gBAAgB,IAAQC,KAAK,iBAC9B,IAAAb,WAAA,CAAAc,GAAA,EAACF,gBAAgB;EAAA,GAAMC,KAAK;EAAGE,MAAM,EAAGL;AAAa,CAAE,CACvD,EACD,wBACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,sBAAsB,GAAGA,CAAA,KAC9B,IAAAL,mCAA0B,EACvBC,gBAAgB,IAAQC,KAAK,IAAM;EACpC,MAAM,C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U,EAAEC,gBAAiB,CAAC,EAC9C,kBACD,CAAC;EACF,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASwC,UAAUA,CAAE,GAAGzC,UAAU,EAAG;EACnD,MAAMC,gBAAgB,GAAGT,sBAAsB,CAAC,CAAC;EACjD,OAAO,IAAAL,mCAA0B,EAChCY,cAAc,CAAEC,UAAU,EAAEC,gBAAiB,CAAC,EAC9C,YACD,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_element","require","_compose","_components","_utils","_useSettings","_lockUnlock","_jsxRuntime","kebabCase","unlock","componentsPrivateApis","upperFirst","firstLetter","rest","toUpperCase","join","withCustomColorPalette","colorsArray","createHigherOrderComponent","WrappedComponent","props","jsx","colors","withEditorColorPalette","userPalette","themePalette","defaultPalette","useSettings","allColors","useMemo","createColorHOC","colorTypes","withColorPalette","colorMap","reduce","colorObject","colorType","compose","Component","constructor","setters","createSetters","colorUtils","getMostReadableColor","bind","state","colorValue","Object","keys","settersAccumulator","colorAttributeName","upperFirstColorAttributeName","customColorAttributeName","createSetColor","getColorObjectByColorValue","setAttributes","slug","undefined","getDerivedStateFromProps","attributes","previousState","entries","newState","colorContext","getColorObjectByAttributeValues","previousColorObject","previousColor","color","class","getColorClassName","render","createCustomColorsHOC","withColors"],"sources":["@wordpress/block-editor/src/components/colors/with-colors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, Component } from '@wordpress/element';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetMostReadableColor,\n} from './utils';\nimport { useSettings } from '../use-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { kebabCase } = unlock( componentsPrivateApis );\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher order component factory for injecting the `colorsArray` argument as\n * the colors prop in the `withCustomColors` HOC.\n *\n * @param {Array} colorsArray An array of color objects.\n *\n * @return {Function} The higher order component.\n */\nconst withCustomColorPalette = ( colorsArray ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => (\n\t\t\t<WrappedComponent { ...props } colors={ colorsArray } />\n\t\t),\n\t\t'withCustomColorPalette'\n\t);\n\n/**\n * Higher order component factory for injecting the editor colors as the\n * `colors` prop in the `withColors` HOC.\n *\n * @return {Function} The higher order component.\n */\nconst withEditorColorPalette = () =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) => ( props ) => {\n\t\t\tconst [ userPalette, themePalette, defaultPalette ] = useSettings(\n\t\t\t\t'color.palette.custom',\n\t\t\t\t'color.palette.theme',\n\t\t\t\t'color.palette.default'\n\t\t\t);\n\t\t\tconst allColors = useMemo(\n\t\t\t\t() => [\n\t\t\t\t\t...( userPalette || [] ),\n\t\t\t\t\t...( themePalette || [] ),\n\t\t\t\t\t...( defaultPalette || [] ),\n\t\t\t\t],\n\t\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t\t);\n\t\t\treturn <WrappedComponent { ...props } colors={ allColors } />;\n\t\t},\n\t\t'withEditorColorPalette'\n\t);\n\n/**\n * Helper function used with `createHigherOrderComponent` to create\n * higher order components for managing color logic.\n *\n * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).\n * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.\n *\n * @return {Component} The component that can be used as a HOC.\n */\nfunction createColorHOC( colorTypes, withColorPalette ) {\n\tconst colorMap = colorTypes.reduce( ( colorObject, colorType ) => {\n\t\treturn {\n\t\t\t...colorObject,\n\t\t\t...( typeof colorType === 'string'\n\t\t\t\t? { [ colorType ]: kebabCase( colorType ) }\n\t\t\t\t: colorType ),\n\t\t};\n\t}, {} );\n\n\treturn compose( [\n\t\twithColorPalette,\n\t\t( WrappedComponent ) => {\n\t\t\treturn class extends Component {\n\t\t\t\tconstructor( props ) {\n\t\t\t\t\tsuper( props );\n\n\t\t\t\t\tthis.setters = this.createSetters();\n\t\t\t\t\tthis.colorUtils = {\n\t\t\t\t\t\tgetMostReadableColor:\n\t\t\t\t\t\t\tthis.getMostReadableColor.bind( this ),\n\t\t\t\t\t};\n\n\t\t\t\t\tthis.state = {};\n\t\t\t\t}\n\n\t\t\t\tgetMostReadableColor( colorValue ) {\n\t\t\t\t\tconst { colors } = this.props;\n\t\t\t\t\treturn getMostReadableColor( colors, colorValue );\n\t\t\t\t}\n\n\t\t\t\tcreateSetters() {\n\t\t\t\t\treturn Object.keys( colorMap ).reduce(\n\t\t\t\t\t\t( settersAccumulator, colorAttributeName ) => {\n\t\t\t\t\t\t\tconst upperFirstColorAttributeName =\n\t\t\t\t\t\t\t\tupperFirst( colorAttributeName );\n\t\t\t\t\t\t\tconst customColorAttributeName = `custom${ upperFirstColorAttributeName }`;\n\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t`set${ upperFirstColorAttributeName }`\n\t\t\t\t\t\t\t] = this.createSetColor(\n\t\t\t\t\t\t\t\tcolorAttributeName,\n\t\t\t\t\t\t\t\tcustomColorAttributeName\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tcreateSetColor( colorAttributeName, customColorAttributeName ) {\n\t\t\t\t\treturn ( colorValue ) => {\n\t\t\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\t\t\tthis.props.colors,\n\t\t\t\t\t\t\tcolorValue\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t[ colorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? colorObject.slug\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t[ customColorAttributeName ]:\n\t\t\t\t\t\t\t\tcolorObject && colorObject.slug\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: colorValue,\n\t\t\t\t\t\t} );\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t{ attributes, colors },\n\t\t\t\t\tpreviousState\n\t\t\t\t) {\n\t\t\t\t\treturn Object.entries( colorMap ).reduce(\n\t\t\t\t\t\t( newState, [ colorAttributeName, colorContext ] ) => {\n\t\t\t\t\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\t\tattributes[ colorAttributeName ],\n\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t`custom${ upperFirst(\n\t\t\t\t\t\t\t\t\t\tcolorAttributeName\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\n\t\t\t\t\t\t\tconst previousColorObject =\n\t\t\t\t\t\t\t\tpreviousState[ colorAttributeName ];\n\t\t\t\t\t\t\tconst previousColor = previousColorObject?.color;\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The \"and previousColorObject\" condition checks that a previous color object was already computed.\n\t\t\t\t\t\t\t * At the start previousColorObject and colorValue are both equal to undefined\n\t\t\t\t\t\t\t * bus as previousColorObject does not exist we should compute the object.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpreviousColor === colorObject.color &&\n\t\t\t\t\t\t\t\tpreviousColorObject\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] =\n\t\t\t\t\t\t\t\t\tpreviousColorObject;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tnewState[ colorAttributeName ] = {\n\t\t\t\t\t\t\t\t\t...colorObject,\n\t\t\t\t\t\t\t\t\tclass: getColorClassName(\n\t\t\t\t\t\t\t\t\t\tcolorContext,\n\t\t\t\t\t\t\t\t\t\tcolorObject.slug\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\treturn newState;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{}\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\trender() {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\tcolors: undefined,\n\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\tcolorUtils: this.colorUtils,\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}\n\t\t\t};\n\t\t},\n\t] );\n}\n\n/**\n * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic\n * for class generation color value, retrieval and color attribute setting.\n *\n * Use this higher-order component to work with a custom set of colors.\n *\n * @example\n *\n * ```jsx\n * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];\n * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );\n * // ...\n * export default compose(\n * withCustomColors( 'backgroundColor', 'borderColor' ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).\n *\n * @return {Function} Higher-order component.\n */\nexport function createCustomColorsHOC( colorsArray ) {\n\treturn ( ...colorTypes ) => {\n\t\tconst withColorPalette = withCustomColorPalette( colorsArray );\n\t\treturn createHigherOrderComponent(\n\t\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t\t'withCustomColors'\n\t\t);\n\t};\n}\n\n/**\n * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.\n *\n * For use with the default editor/theme color palette.\n *\n * @example\n *\n * ```jsx\n * export default compose(\n * withColors( 'backgroundColor', { textColor: 'color' } ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,\n * it should contain the color attribute name as key and the color context as value.\n * If the argument is a string the value should be the color attribute name,\n * the color context is computed by applying a kebab case transform to the value.\n * Color context represents the context/place where the color is going to be used.\n * The class name of the color is generated using 'has' followed by the color name\n * and ending with the color context all in kebab case e.g: has-green-background-color.\n *\n * @return {Function} Higher-order component.\n */\nexport default function withColors( ...colorTypes ) {\n\tconst withColorPalette = withEditorColorPalette();\n\treturn createHigherOrderComponent(\n\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t'withColors'\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAjB3C;AACA;AACA;;AAKA;AACA;AACA;;AAUA,MAAM;EAAEO;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAGA,CAAE,CAAEC,WAAW,EAAE,GAAGC,IAAI,CAAE,KAC5CD,WAAW,CAACE,WAAW,CAAC,CAAC,GAAGD,IAAI,CAACE,IAAI,CAAE,EAAG,CAAC;;A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